I have a string of 20 LED's in parallel, normally powered by 2 AA batteries. The Arduino board outputs 5V through the pins. How do I power the LED's, which are supposed to use 3V, with 5V?
Did you mean parallel?
I did, yes. Edited my post. Thanks
The GPIO pins on the Arduino are not power supplies, You can't connect that many LEDs to a GPIO.
Exactly what are you trying to do?
I'm trying to modify a string of 20 christmas LED's to turn on and off at a certain time in the day using the arduino
It is best to use a timer and a power source for the LEDs.
Measure how much current the LEDs draw from 2xAA batteries.
Will give it a try, thank you.
You can turn them off/on, blink them, even fade if you use PWM
Is a transistor needed? I don't have one on hand and I have no way of getting one quickly.
Do you have any relays or MOSFETs
Nothing, no ![]()
Sorry
Ok, thanks. Out of curiosity then, why couldn't I simply connect the wires of the string of light directly to the Arduino pins? Don't the pins output 5 volts? I'm speaking as a novice of electronics.
Don't the pins output 5 volts?
Assuming you have an UNO or similar, the answer is yes but they have a current limit of 20mA.
I'm sure that your LED string will require more than 20mA and you will damage the Arduino if you try to connect it to one of the digital pins.
I see. I appreciate your help with this. You have taught me a lot. Thank you.
You could also use a relay module like this.
You won't need a breadboard or have to do any soldering.
The relay option gives you on-off, but if you'd like to be able to dim the LEDs( for example, think full brightness during the day, but a softer glow at night with the house lights off), you need to look at fast on-off cycles, which means a transistor or better, a mosfet switch is your better option.
Search Amazon for "logic level mosfet switch" and look for something like this:

You will need a series resistor to limit the current. Ideally one resistor per LED, but if the LEDs are all the same colour and the same batch you may get away with a single resistor for the string.
This resistor is missing from the schematic in #8.
There may be such resistors present in your LED string already, that's not clear.
By the way, 2xAA is not enough for running an LED string, really. Most LEDs (white, or those using a phosphor) need 2.8-3V to switch on. AA batteries are nominally 1.5V each but quickly drop to about 1.2-1.3V. You'll be much better off with 3xAA or a USB power bank.
You can run your Arduino off the same 3xAA batteries (use the 5V pin, not the Vin pin - the voltage of those batteries should be high enough for 16 MHz operation), or of course the USB if you use a powerbank.
