Help regarding a simple circuit - Page 1
Forum section: electronics / beginners

author: Gurbovey
author_rank: Newbie
timestamp: November 20, 2021, 08:14:04 pm
content: Hello!I'm trying to "design" a simple circuit that would add a transistor beside an already-existing push button on a board, with the transistor being controlled by a microcontroller. The board is an interface board (as in, having LED's, buttons and potentiometers) for a gas water heater. However, I am an almost-complete newbie when it comes to electronics. My experience is summed up by a very distant uni class about electronics and replacing a power socket every now and then. I do, however, have some experience with soldering, so at least that's one worry out. I will try my best to not sound too lost, thoughI have a gas water heater in my home that very often loses its guard flame, usually when you really need it (eg butt-naked in the shower). Once the guard flame is blown out, hot water is no longer available, and I have to manually go to the heater and press a RESET button on it to reignite the flame. I've been told by several maintenance personnel that the flame goes out in very drafty rooms, which mine definitely is. So, I had the (in my opinion) marvellous idea to bodge together athingthat will allow me to reset the flame remotely, on demand. For this, I thought to use a WiFi-enabled microcontroller that would toggle a transistor that is placed in parallel to the switch. Simple enough, I thought...Unfortunately, the board has only 12v rails "lying" around, and I'd rather not touch anything else on it. After searching and reading around, I've come to the conclusion that I need a linear voltage regulator that would reduce the voltage from 12 to 3.3 volts, and a NPN transistor. I've sketched a simple diagram for my proposed contraption:. All in all, I would need some wire and one of each: ESP8266, 2N222A, L78L33ABZ. The regulator and the transistor were chosen simply because they fit the description (or so I hope), and they seem terribly cheap and available.So, my questions would be:Do I need any other components for this task? I saw some diagrams using capacitors with a voltage regulator, but I'm not sure if I need them. Also, I have not taken thought about resistors anywhere, mainly because I don't know if anything needs themWill the 3.3v be enough to "drive" the transistor? The datasheet specifies voltages that seem to allow the 12v through (collector-emmiter 40v), but nothing about the "on" voltage.Will the voltage regulator need a heatsink? I've read in many places that you do need one, but such a low power draw must certainly allow for its absence, right?Sorry if I butchered any terms, or trashed any basic knowledge, but it has really been quite a while since I used them.

author: cortex_m0
author_rank: Regular Contributor
timestamp: November 21, 2021, 04:47:49 pm
content: So first, I assume you are talking about a 2N2222, not a 2N222 which as far as I know is not a valid part number.1. The 2N2222 is fairly robust, but I would generally advise a couple of resistors. Place one between the base of the 2N2222 and the emitter, value ~4.7K. And place one between the ESP32 and the base of the 2N2222, value ~1.0K. This will help prevent damage to the 2N2222 over time, and prevent the circuit from activating if the ESP32 fails or has leakage currents2. A BJT is a current-driven device. The 2N2222 needs only a few nanoamps at the base terminal to turn on. Too much voltage or current will damage the transistor, thus the 1.0K resistor I suggested above. Note that I do not think the ESP32 can source enough current to damage the BJT, but I did not look at its specs.3. No heat sink should be required. The power dissipated in the 78L33 is given by (Vin-Vout)*Iout. In your case, I(out) is probably less than 10mA. Let's assume 10mA. 12-3.3*0.01 = 87mW, which might be expected to cause a temperature rise of a approx. 15C in the chip based on the thermal specs given in the data sheet.Now, from a practical aspect... wouldn't it be more effective to fix the draft?

author: cortex_m0
author_rank: Regular Contributor
timestamp: November 21, 2021, 04:55:27 pm
content: One other thing I did not notice the first time:Your transistor emitter is not shown as connected to the circuit GND. If that is actually the case, this circuit may not work at all. If there is no base-emitter voltage, then there can be no base-emitter current, and so no activation of the transistor.

author: Manul
author_rank: Super Contributor
timestamp: November 21, 2021, 05:38:02 pm
content: L78L33 is not a low dropout, so it might be stable without input output capacitors, but still I would recommend to add them. Resistors as cortex_m0 wrote.You need to check if RESET_OUT is actually BOARD_GND. If yes, the all good. If no, then your transistor will not work as expected.

author: Gurbovey
author_rank: Newbie
timestamp: November 21, 2021, 08:38:05 pm
content: Quote from: cortex_m0 on November 21, 2021, 04:47:49 pmThank you very very much!1 & 2. Yes, indeed, I was looking at a 2N2222, but was a bit hungry and ate a 2. Thank you very much for the resistor advice, I really did now know whether to add any!3. That's reassuring, even moreso as at least a little bit of wind will most likely blow near it.As for fixing the draft, unfortunately there's not much I can do besides big physical changes (replacing the heater, or swapping it for a more "sealed" one, if such characteristic exists). Its exhaust is inside averywindy, very wide vertical vent that the building used to have as a communal chimney many years ago. As I was told many times, it's quite normal for the flame to go out, and safe to just reignite it every time it dies.Quote from: Manul on November 21, 2021, 05:38:02 pmI will wholeheartedly heed your recommendation then. The datasheet specifies an input capacitor of 0.33uF, and output one of 0.1uF. I'll slap some in to be sure!As for the button "pins", I didn't even think that I could face problems. In my mind, transistor == relay but without moving parts; silly me.Here is a crude diagram of how I see the traces (I'll try to snap a proper picture of the board if needed, but it's quite well tucked inside). There are multiple other components on the board, but I've listed only the ones that directly interact with either rail of the button. Resistor values are... approximate, as colors are a bit hard to see. Also I am not sure if VCC and GND should be swapped, but I don't think it matters. The potentiometer is completely irrelevant to the function of the button, but I included it just to be complete. So BOARD_GND is actually connected to RESET_OUT, through a couple of resistors. Will that affect the function of the transistor?EDIT:Reuploaded the diagram

author: Manul
author_rank: Super Contributor
timestamp: November 21, 2021, 10:07:46 pm
content: Quote from: Gurbovey on November 21, 2021, 08:38:05 pmWell, it is VERY important if the GND you marked is a ground of the board, same ground as you use for your ESP8266 board. Because if it is VCC, then it changes the situation up side down. It the means the button is "high side", and you need different approach. Transistor is not a relay.