I have 5 such relays attached to an ESP-12E module with a 600ma Power Supply. The LED (LED4) glows but the relay doesn't switch. Is there anything wrong with my schematic?
Using MMBT3904 instead of a BC848B and using a 5V sugar cube relay.
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It only takes a minute to sign up.
Sign up to join this communityI have 5 such relays attached to an ESP-12E module with a 600ma Power Supply. The LED (LED4) glows but the relay doesn't switch. Is there anything wrong with my schematic?
Using MMBT3904 instead of a BC848B and using a 5V sugar cube relay.
For comparison, as you have a drive of 3.3V max, see the difference of the relay current.
Circuit 1 (left) is not really "the good choice".
Here for a drive of 5V.
Here's what your schematic is (left) and what I would use (right):
simulate this circuit – Schematic created using CircuitLab
The left schematic will act like a (sort of) current source, where the transistor will determine the current. Here, that current is too low for the relay to engage.
In the right circuit, the transistor will act as a switch. The current will be determined by the relay. The LED (D3) and resistor (R4) are optional, leave them out if you do not need them.
Because the title is "controlling relay using ESP8266" rather that "what's wrong with the way I'm driving this relay" I'm going to suggest the use of prefab relay modules with driver circuitry based around optocouplers.
Here's an example on ebay for about ten bucks. https://www.ebay.com.au/itm/164378054696
I have no affiliation with the seller other than having bought some relay modules.
The design is an excellent solution which is why it's super common and cheap as chips pre-fab. The input impedances are very high and the trigger current can be as low as microamps although the unit shown needs 5mA.
These babies switch up to 30A at 5 to 24V. I used to make this sort of module myself but it's cheaper to buy them complete.
Another thing you might look at depending on how much current you need to switch, is MOSFETs instead of relays. High input impedance, low trigger current and very fast switching with no bounce. You do get a bit of forward leakage. You can drive em straight off the ESP IO pins.