Skip to main content
38 events
when toggle format what by license comment
Jan 7 at 16:00 history bumped CommunityBot This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Sep 5, 2023 at 1:01 history bumped CommunityBot This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
May 5, 2023 at 16:05 history bumped CommunityBot This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Feb 22, 2022 at 9:53 comment added Thijs @DeanArnold I agree with Andyaka that in a normal situation a led should not be glowing due to the leaking of a transistor switch. In 2N4401 datasheets I'm reading something like 100nA of leakage when the BJT is forced off. So 0V between base and emitter should really result in no light (bulb or led). When you set the ESP pin to 'off', can you check the B-E voltage with a multimeter? Perhaps a miswiring, bad parts or something similar? If you share a picture we can check your wiring.
Feb 21, 2022 at 17:25 history edited Dean Arnold CC BY-SA 4.0
added 1 character in body
Feb 21, 2022 at 17:19 comment added Dean Arnold winny: thanks for the email. I saw your previous comment about including decoupling capacitors...thanks for that...I had completely forgot to include them on the diagram. Regarding the LEDs, here is link to the ones I would like to provide as an alternative: [link]amazon.com/dp/…
Feb 21, 2022 at 17:08 answer added winny timeline score: 1
Feb 21, 2022 at 16:12 comment added winny If the "3 V" LED bulb is actually supposed to be driven with 3 V CV and does internal current limiting, you don't need to do anything. Just use a MOSFET as a low side switch and feed 3 V regardless of what's installed. If it's a bare LED marketed by the Chinese as "3 V LED", where do you need to apply current limiting, you need to do something more elaborate. Please clarify what you have.
Feb 21, 2022 at 16:05 answer added jayben timeline score: 0
Feb 21, 2022 at 15:44 answer added D.A.S. timeline score: 0
Feb 21, 2022 at 15:33 comment added Andy aka However, when you then place a 3V 1mA LED bulb into the same E10 socket...it glows even when the GPIO pin is driven low. @DeanArnold - this sounds problematic. I wouldn't expect any BJT to produce more than 1 uA collector current when the base is being driven to 0 volts. It looks like the 2N4401 is the bad choice here. Or maybe you have it wired incorrectly.
Feb 21, 2022 at 15:29 comment added Dean Arnold DKNguyen: Yes agreed. In doing some calculations with the high hFe of the Darlington's in theory it looks like it would switch on and off both. However, I might still get a small amount of current flow when the LED is installed. I may order a couple and see what happens in practice.
Feb 21, 2022 at 15:25 comment added DKNguyen @DeanArnold Darlingtons just let you have less base current for more collector current while MOSFETs just let voltage do the control rather than current. It is still a wash since you're stuck needing a way to swap two base resistors.
Feb 21, 2022 at 15:23 comment added Dean Arnold DKNguyen: thanks, that was what I was afraid might be the case and why I came to the forum to see if I was missing something. I recognize that the transistor is acting more like an amplifier then a switch (when I switch between bulbs) so was hoping maybe a Darlington or MOSFET might work.
Feb 21, 2022 at 15:23 comment added DKNguyen @DeanArnold You are going to need two transistors that each use the correct circuit for each lamp, and a way for the MCU to know which to use. You need to abandon this variable base resistor to modify the collector-emitter current approach that uses the BJT as an amplifier. Any method requires more pins. Probably not possible to do with your constraints.
Feb 21, 2022 at 15:17 comment added Dean Arnold Andy aka: the 2N4401 with a 1kΩ resistor connected to its base which is being controlled by a GPIO works fine with the 3V 120mA bulb. However, when you then place a 3V 1mA LED bulb into the same E10 socket...it glows even when the GPIO pin is driven low. When it is driven high, the LED glows brighter.
Feb 21, 2022 at 15:13 comment added Dean Arnold HandyHowie: yes 0v and 3.3v on GPIOs (e.g., pinMode(LED1, OUTPUT); digitalWrite(LED1,1); etc.. The sketch works fine if I just use the bulb LEDs directly to the GPIOs, or if I use the incandescent bulbs with a transistor thru the GPIOs. The question I have is how can I use both...or is it possible to use either in the lamp socket.
Feb 21, 2022 at 15:07 comment added Andy aka The base resistor should be chosen so that it can properly turn on the transistor (I would also recommend using a MOSFET and not a BJT then you don't need a series resistor at all). If the transistor can then turn on the bulb, it will equally turn on the LED. Ditto for turning off.
Feb 21, 2022 at 15:07 comment added HandyHowie Are you getting solid 0v and 3.3v on your GPIO outputs? You haven't got anything crazy set up like open collector outputs have you?
Feb 21, 2022 at 15:06 comment added Dean Arnold Thijs: you hit the nail on the head...this is exactly the type of LEDs I want the user to be able to install in the lamp sockets (as a substitute for the incandescent bulbs). However, the draw a very different level of current then the incandescent bulbs. So, when you install them in the lamp sockets with base resistor at 1KΩ they glow even when the pin is driven low on the ESP8266--i.e., they do not fully switch off.
Feb 21, 2022 at 15:02 comment added Dean Arnold user1850479: thanks for the comment. I thought about this but I don't have enough available pins on the ESP8266.
Feb 21, 2022 at 15:01 comment added winny OT but your ESP32 is missing decoupling capacitor(s).
Feb 21, 2022 at 14:59 comment added DKNguyen @DeanArnold You think you're using it as a switch, but you're not. See electronics.stackexchange.com/questions/402210/… That series resistor is what limits the lamp current so then the BJT base can be driven so it can be completely conducting without throttle. Then it's a switch.
Feb 21, 2022 at 14:58 comment added Thijs Currently you are trying to feed the base of the BJT with just enough current to switch the thing you want to switch. You are free to supply the BJT with more base current than it strictly needs to let the collector-emitter current flow more freely. This avoids unnecessarily limitations. Just let the BJT switch fully and limit the current with an additional series resistor in case of the led. PS: they sell leds with built-in resistors to make it easier for the user that needs to swap these things out!
Feb 21, 2022 at 14:57 comment added Dean Arnold Just to clarify. I am not trying to use the transistor as an amplifier...in fact quite the opposite. I want to use it as a switch. The use case for this project requires that a user can substitute the 3V incandescent bulb with a 3V LED bulb into the lamp socket. This may not be possible but that's why I am asking.
Feb 21, 2022 at 14:55 comment added user1850479 You are already including an entire microcontroller, why not use it? Sense the resistance of the load and then switch out between the incandescent and LED drivers.
Feb 21, 2022 at 14:54 comment added DKNguyen You are not using the BJT as a switch. You are using it as an amplifier attempting to throttle the current. This will fry it.
Feb 21, 2022 at 14:53 comment added Andy aka If both lamps use 3 volts then apply 3 volts to the socket.
Feb 21, 2022 at 14:53 history edited Dean Arnold CC BY-SA 4.0
added 89 characters in body
Feb 21, 2022 at 14:50 history edited winny CC BY-SA 4.0
added 38 characters in body
Feb 21, 2022 at 14:49 comment added Unimportant What I'm getting from this is that you're trying to limit current by playing with the transistor's base current. That's not how it's done, transistor Hfe differs greatly between parts, temperature, etc...
Feb 21, 2022 at 14:45 comment added winny Overly complex but possible would be to feed it 1 mA and check what voltage you get. Too low = switch to incandescent mode and bypass the current limiter. High enough = LED installed and everything is good.
Feb 21, 2022 at 14:45 comment added DKNguyen I don't think you're going to be able to do this with a dumb circuit that does not know what type of bulb is connected, Base resistor value should be non-critical unless your schematic, which you have not provided, is unusual. You are using the BJT as a switch, right?
Feb 21, 2022 at 14:45 history edited JRE CC BY-SA 4.0
deleted 57 characters in body; edited title
Feb 21, 2022 at 14:45 comment added HandyHowie Can you add a schematic of you setup?
Feb 21, 2022 at 14:44 history edited winny CC BY-SA 4.0
Kelvin -> kilo
S Feb 21, 2022 at 14:41 review First questions
Feb 21, 2022 at 15:36
S Feb 21, 2022 at 14:41 history asked Dean Arnold CC BY-SA 4.0