1
\$\begingroup\$

I'm trying to create programmable Christmas lights - a very simple circuit controlled via Arduino or NodeMCU. My problem isn't on the microcontroller side, but the basic electronics.

Now... I have 2 sets of 50 LED lights that use 3 V and draw 0.23 W meaning about 77 mA, which is significantly more than Arduino or NodeMCU can handle from a single pin. This doesn't really come as a surprise, so I need some kind of a transistor, relay or optoisolator to drive it.

I have a bunch of 2N2222A transistors that I tried to use, but running 3 V from the lights' original battery pack to the collector and connecting the lights to the emitter and running 3 V to the base (or less using a resistor - didn't check for the ohms of the resistor as the results didn't change from the direct 3 V current) I did get lights on, but due to the voltage drop involved in the transistor, they were markedly dimmed. I didn't measure the exact drop at this stage yet.

I had a 4-channel optoisolator on hand as well (HW-3999) that I decided to try as well, but it had the same results. This time I measured the voltage drop and it was around 0.6 V. Not surprising really, since the optoisolator (as I understand them) is basically a light-controlled MOSFET.

So I would like to know what are my options here? Either use a relay as a switch or should I use 5 V as the base voltage and calculate the voltage drop involved in the optoisolator and/or transistor and then calculate a fitting resistor to use in order to drop the total voltage to around 3 V that the lights can handle, or should I just use a relay?

Thanks!

\$\endgroup\$
5
  • 1
    \$\begingroup\$ First you need to understand that LEDs are current mode devices requiring either a current limit resistor or controlled current source for each LED or series string in a parallel array. Once you settle that you can use a transistor or FET as a low side switch if your current source does not have an enable. But first you must document how the multiple LEDs are to be wired together. \$\endgroup\$ Commented Nov 17, 2020 at 21:22
  • 1
    \$\begingroup\$ If you post a schematic of your setup we may be able to help you out more. \$\endgroup\$
    – MadHatter
    Commented Nov 17, 2020 at 21:29
  • \$\begingroup\$ Many xmas LED lights use SCRs. Why did you not consider them? \$\endgroup\$ Commented Nov 17, 2020 at 21:29
  • \$\begingroup\$ @SredniVashtar SCR's are not workable with a DC source, since there is no way to turn them off. They only work with AC or pulsed DC sources where they turn off by themselves at the null current part of each cycle. \$\endgroup\$ Commented Nov 17, 2020 at 23:46
  • \$\begingroup\$ You are right, I was thinking about incandescent bulbs, like the string whose scr controller burned to death while I was pushing its buttons, last year. \$\endgroup\$ Commented Nov 18, 2020 at 0:52

3 Answers 3

1
\$\begingroup\$

Well, I managed to solve this by using a higher voltage, apparently 3 V wasn't enough to open the 2n2222 all the way, but 6V seemed to work, then a 47 ohm resistor to drive down the voltage (at 77 mA current I calculated that the resistance of the LEDs was about 40 ohm) to a level the lights could handle. This seemed to work.

Note that I have not hooked up a microcontroller at this point yet and basically this is more or less what I was trying to accomplish... probably I'll use a 9 V or somesuch DC source to drive the Arduino and use the same source to drive the LED's as well.

\$\endgroup\$
0
\$\begingroup\$

You need either to use a 3V relay, or better - go with mosfet. Problem (as You observed) is that it creates voltage drop. Why? 3V is not enough to turn it fully on. You have to look for oiwer mosfets compatible with 3V3 systems. Or build simple charge pump circuit (eg. on 555 timer) to create higher voltage for mosfet gate (and use open collector to drive it). Optoisolator probably is just not intended for such use - too small drain current? (couldnt find datasheet). Other option is to just use higher voltage supply and step it down for everything else.

Example of suitable mosfet: PSMN2R7-30PL

\$\endgroup\$
1
  • 1
    \$\begingroup\$ No, this is not the issue. Lack of understanding how to drive LEDs and apply transistors is. \$\endgroup\$ Commented Nov 17, 2020 at 21:19
0
\$\begingroup\$

Any BJT based device is going to have a Collector to Emitter voltage drop. Specifically for the 2N2222, it is not to bad, looking at the plots it should be less then 100mV, assuming you have a base current that is reasonable, try something along the lines of 1mA (a 1k Resistor from your Arduino pin to the base should work)

If it is still dim even with the setup above, you may have your circuit miss-wired etc.

Best way to minimize power (voltage) loss would be to use a Logic Level MOSFET. There is going to basically be no voltage drop assuming you select an appropriate part, that is also compatible with a 3.3V Gate drive. But what you have should also give acceptable results.

Also - Your not trying to use the 3.3V from the Arduino are you? It might not have enough power available to drive the lights depending on the exact model etc. Try with an external power supply.

\$\endgroup\$
2
  • \$\begingroup\$ As with the other answer making this mistake, this is not the issue. The issue is that the asker doesn't understand that LEDs require current mode drive, and that they have explicitly described a miswiring of the transistor in their attempt - no "may have" about it. \$\endgroup\$ Commented Nov 17, 2020 at 23:42
  • \$\begingroup\$ @ChrisStratton Good point about them wiring to the emitter. Atleast my comment about a schematic is useful haha. \$\endgroup\$
    – MadHatter
    Commented Nov 17, 2020 at 23:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.