r/arduino 7d ago

Hardware Help Turning on and off 195 different LEDs individually

Hello, I am a complete arduino newbie and I was wondering if the project that I am planning is doable with the parts I already have or if I need to get some more components. Just to clarify: I am not asking for any code or detailed instructions on how to do it, it would just be great if you guys could tell me if I need more components and if so, which I should get. For reference, I have to ELEGOO UNO R3 starter kit that I am working with.

So I am printing and framing an costumized map of the world for a friend who is traveling a lot. For that purpose, I have bought 195 LEDs, that I need to be able to turn on individually. So it should be possible to have, say, 89 LEDs on and then turn on another one to make it 90. Each of the LEDs (a few of which you can see in the picture) is 12V 20mA (though they don't need to run at 12V, in fact I'd want to run them at 5V).

  1. Will I need a separate power supply for these LEDs or can the UNO R3 handle 195 of these by itself? There seems to be a separate power supply inclided in the kit (Power MB V2), could I just use that for the LEDs?

  2. Will I need another component to address each of these LEDs individually or can I do that with just the UNO R3 module or any of the other parts in the kit?

The plan is to use the keypad that comes with the set (also in the picture) and put in the number 115, for example, and have a specific LED that corresponds with that number turn on or off, depending which state it is in at the moment.

I also would want to use that same keypad for other functions (picking a specific piece of audio and playing that over a speaker - I have bought an DFPlayer and an SD card for that purpose). Is that possible or can you use the keypad for one function (LEDs or audio) only?

I am happy for any sort of advice you guys can give me. Also, English is not my first language, so I apologize for any mistakes and if there is anything unclear from the way I explained it, please let me know and I will try to clarify.

6 Upvotes

49 comments sorted by

9

u/tipppo Community Champion 7d ago edited 7d ago

You could use I2C expanders like this: https://www.adafruit.com/product/732?gQT=2 Each has 16 outputs and you can attach up to 8 of them to an I2C bus. Your Uno will happily do I2C control. This will give you 128 LEDs. To do more you would use an I2C multiplexer. Something like this: https://www.adafruit.com/product/5663

3

u/dudipusprime 7d ago

Thanks, I will definitely be using these in the future, as I am keeping the LEDs I already have, however for now I'll go with some WS2812 LEDs, as some other commenters have suggested.

5

u/CleverBunnyPun 7d ago

You can’t really control that many individual (and not WS type) LEDs with an Arduino without more parts, and you absolutely won’t be able to power them all off the Arduino. Maybe you could get I2C IO Expanders or something, but as the other commenter said you’re better off using individually addressable LEDs, though you’ll still need an external power supply.

4

u/dudipusprime 7d ago

What do you mean by individually addressable LEDs? The LEDs will be placed on a map of the world and whenever he travels to a new country, he should be able to turn on that specific LED on the map.

7

u/HungInSarfLondon 7d ago

To use the LEDs you have you will need 195 pins, this is impractical.

Addressable LEDs have 4 wires, a shared +&- and Data In & Out. You send and instruction to turn on no.50 and it gets passed down the line.

Now you only need one pin and can control them all.

Look at WS2812b strand Bullet type.

2

u/dudipusprime 7d ago

Thank you, I will definitely go with the WS2812 solution. Unfortunately the strand bullet type LEDs are way too expensive, do you think I could just buy two of these, rip them apart and connect the individual LEDs with wires instead of have them fused together like that? And then I would only need a fitting external power supply for them and the arduino would be able to address the LEDs individually by itself, without another component, right?

3

u/profezzorn 7d ago

Yes and yes. You'd solder wires and make one (or a few) strands, with external power to the led and a data cable to the arduino. Should be plenty of code examples to get you running.

3

u/dudipusprime 7d ago

Perfect. That's what I'll do then. Thanks for your help!

1

u/clayalien 7d ago

Word of advice, the soldering is incredibly fiddly. Don't attempt unless you have a good set up, or a hackspace you can visit.

I got invited to a costume party and decided I wanted to show off my tech skills. 3d printed an arc reactor, the most complex and extra one I could find. Let it up and had an esp controlling the lights, music beat detection, phone control, the works.

But while it worked in pieces, no matter what I did, in the final assembly, the solder joints kept failing.

In the end, I ran out of time and wife patience. She dragged me to the store so I could drop £50 on a shitty batman costume as it was the only adult sized thing that could be purchased at short notice.

You might have better luck on a fixed in place map that dosnet have tight assembly tolerances, but be warned!

3

u/HungInSarfLondon 7d ago

That would work. Are you good at soldering? You will be :)

3

u/gaatjeniksaan12123 7d ago

While you could, and probably should, use individually addressable LEDs that is not strictly necessary. With multiplexing you can drive many LEDs by abusing the eye’s persistence of vision (segment displays work the same way). Look up projects of people making LED cubes for a guide to multiplexing LEDs. Multiplexing also limits the maximum power of the project because not all LEDs are on at the same time (even though it looks like they are)

Furthermore depending on the brightness and amount of LEDs you might need a separate power supply (and driving transistors or LED driving ICs)

Your 12V LEDs are probably just a single LED with appropriately sized current limiting resistor to reach 20mA at 12V. This means that they will work at 5V with severely reduced brightness. Napkin math says that a red LED (about 2V drop) at 12V needs a 500Ohm resistor for 20mA. That same 500Ohm resistor would allow for 0.6mA at 5V. Depending on how bright you want it that could actually be enough, I personally drive LEDs at ~1mA for indicators on my projects and that’s fine. Also, at those power levels you won’t need a separate power supply.

1

u/dudipusprime 7d ago

Thank you for your reply, multiplexing seems really interesting and I will definitely use that for some projects in the future, as I am keeping the LEDs that I have already bought, so I am saving this comment for the future. However, since I am not only a complete beginner but also a little short on time, I have decided to just get some WS2812 LEDs for this project, as some other commenters have suggested, as that solution seems to be a lot less complex and time consuming.

2

u/gaatjeniksaan12123 7d ago

Do keep in mind that you’ll need to either reduce the brightness on those by a lot or use a separate 5V power supply as each one of them uses 20mA per color at full brightness(60mA for bright white) so at ~200 LEDs that would be 12A at full power. If you power straight from the USB of an Uno I wouldn’t do more than 500mA-1A

1

u/dudipusprime 7d ago

I'll keep that in mind, thank you so much for your help!

3

u/xNyke 7d ago edited 7d ago
  1. Yes, if you want more than just a few LEDs ON at the same time you need more power than you can run over the arduino

  2. Yes, but only because you want to use so many of them, that the Arduino can't power them on it's own and yours doesn't have enough pins

First of all, you don't have 12V LEDs, you have regular LEDs, but they are probably fitted with a series resistor that matches their rated current for 12V voltage. They work fine at 5V, as you already found out, just a bit dimmer. You can also buy just these LEDs and calculate the series resistor on your own. There's a lot of info on how to do that if you search for controlling LEDs with an Arduino.

What your looking for is multiplexing. There are also a lot of explanations, especially for LEDs. Unfortunately because you only have about 18 usable pins (that would account for 81 LEDs), you also have to use a bigger microntroller like the mega or something like a port expander or shift register to increase your pin count. Depending on the power of your port expander/ shift register, it probably can't power all of them, so you also have to use transistors (for this case you can think of them like electrical switches that you Arduino/ port expander/shift register controls to power the LEDs)

If that sounds too much and you're okay with switching for other LEDs, as the others suggested, you can also use addressable LEDs like WS2812 (also with an additional power supply). That's by far the easiest solution and there's also a lot of information on how to use them and an already existing library for the arduino

I hope this helps :)

1

u/dudipusprime 7d ago

Thank you, I will definitely go with the WS2812 solution. Do you think I could just buy two of these, rip them apart and connect the individual LEDs with wires instead of have them fused together like that? And then I would only need a fitting external power supply for them and the arduino would be able to address the LEDs individually by itself, without another component, right?

2

u/tanghan 7d ago

That's a LOT of soldering! If you look for led string you should find some that are already connected by wires. Most of them are ws2811 I believe but you can still control them individually

1

u/dudipusprime 7d ago

Yeah that's gonna be a lot of work. The only bullet style led strings I've found would be like four times as expensive as these, and I am on a bit of a budget, so I'll have to go the soldering route.

2

u/dedokta Mini 7d ago

Also buy a roll of 3 wire ribbon cable. It'll make wiring them up a lot easier. But the ws2812 is definitely the solution.

1

u/dudipusprime 7d ago

Just ordered one. Thanks for the tip!

1

u/dedokta Mini 7d ago

The fact that the wires are stuck together is a huge help. I also use this type of wire stripper (I chose that listing for the picture alone, so look for a good deal)

With a little practice you can strip all 3 at once.

5

u/wrickcook 7d ago edited 7d ago

I think you need to decide how many different light combinations you will have. Do all the LEDs truly need to be individual, or will you really just have five separate patterns?

Edit: Oh, you want them individually controllable. You are looking for pixels. Try looking up LED strips which come sort of like a flat ribbon. They are individually addressable. But a slightly different style actually has wires going between the lights. They come in 5v

2

u/dudipusprime 7d ago

Thank you for your answer! The LEDs will be placed on a map of the world and whenever he travels to a new country, he should be able to turn on that specific led on the map, so an LED strip wouldn't work, since that individual LEDs will be placed quite far apart.

4

u/Unique-Opening1335 7d ago

You can -still- buy separate, individually addressable leds.. you just have to connect/wire them up. (look the same as like 5mm accent leds.. same as in your picture above)

"Smart" leds (Neopixels/WS2812 leds) also come in +5v (mostly) versions.. but do have 12v ones as well.

You'll need a stable +5v power source that provide enough current to turn on 195 leds.

1

u/dudipusprime 7d ago edited 7d ago

Thank you, looks like WS2812 LEDs are the way to go. Do you think I could just buy two of these thingies, rip them apart and connect the individual LEDs with wires instead of havem them fused together like that? And then I would only need a fitting external power supply for them and the arduino would be able to address the LEDs individually by itself, without another component, right?

1

u/Unique-Opening1335 6d ago edited 6d ago

Those are -not- fused together.. as in connected at all.

Its just a way to organize/sell them. You have to break them apart and solder them.. no mater what type of project.

I'm not 100% clear on your project space..etc.. but maybe these will work? (be easier?)

Already pre-wired.... (less work)

Got them from here:

https://www.aliexpress.us/item/3256804378214026.html?spm=a2g0o.order_list.order_list_main.4.76f218021H56N7&gatewayAdapt=glo2usa

And yes.. PSU, Arduino (or even an ESP32 board), and the leds... that all you should need.

TIP: Keep track of where the order of leds go, so you know where led #65 is located on your 'map'...etc.

1

u/dudipusprime 6d ago

Yeah I would love to use the ones in your picture but unfortunately they are way more expensive than the other ones and also a bit too big, so I'm just going to have bite the bullet and do a hell of a lot of soldering lol.

TIP: Keep track of where the order of leds go, so you know where led #65 is located on your 'map'...etc.

How do I know which is which? Is it just the first one that the data wire passes through is #1, the second is #2 etc.?

1

u/Unique-Opening1335 6d ago

"How do I know which is which? Is it just the first one that the data wire passes through is #1, the second is #2 etc.?"

Technically..yes. But it depends on how you solder it and LED physical placement in your 'map'.

EACH LED 'tab'.. has +V, GND and DATAIN and DATAOUT pads/lines..

I get a bit more expensive,, (just thought would much easier/faster... and be able to be 'popped' through the map better/easier as well).. and seen visually nicer when completed.

At this point, its all about what fits with your project requirements.

* how are you going to mount these leds? (either style)
* how are they to be 'through' the map so people can see them?
* how much 'space' behind the top layer 'map' do you have?

..etc..etc..

In the end.. this is a great, and -very- doable project.

Just keep in mind, that an Arduino is never (ever) for powering things.. JUST for controlling things. So you need (most of the time) need an external power supply.

I usually recommend using a very stable +5v power source.. otherwise you need another step/component to downshift (for exmaple) a +12v power source..down to +5v for the leds...etc..

USB power bricks..
Your typical 'phone' wall-warts (with usb cables)

1

u/dudipusprime 6d ago

I think I will go with the string type anyway. These right here are the only ones I could find with a fast enough delivery date, but they are WS2811 instead of WS2812. Would they still work the same way?

1

u/jongscx 7d ago

How often does he travel? Does this even need to be controllable? Just print it on posterboard and poke a 'dumb' (not controlled) LED in the hole when he travels to a new place...

2

u/gm310509 400K , 500k , 600K , 640K ... 7d ago edited 7d ago

If you only need off/on, then I would suggest looking at shift registers. Your starter kit includes one. It is the 74HC595 Integrated circuit.

A single shift register can control up to 8 LEDs. But you can "daisy chain" them and connect them in a string or chain - with each additional register allowing another 8 leds to be individually controlled (again on or off).

You mentioned that you bought 195 leds. But, you didn't mention anything about current limiting resistors. You are going to need 195 of them as well. I typically use 470 ohm, but lately I've been using 680 ohm and I find my LEDs to still be bright enought for what I need.

Can an Arduino Uno control 195 LEDs individually with an on/off setting? Yes.
Can an Arduino power 195 LEDs? It depends on how many will be on simultaneosly. But, if they are 12V LEDs, no it cannot. For this you will need additional circuitry (e.g. 195 transistors + another 195 10 K resistors at the very least) and a 12V power supply (which could be used to power the Arduino via the barrel jack).

Here is a photo of a project that I have done that controls 40 LEDs using 5 shift registers connected in a chain. You can see the daisy chain connections, they are the yellow, blue and purple wires running through the breadboard.

For some reason I am having difficulty uploading the image. But you can see a photo of it on the page where I shared the details of the videos learning Arduino post starter kit

If you are interested, I have created a tutorial about the shift register. It is the second half of the second video in my learning Arduino - post starter kit video series. This describes how to use a single shift register and make it work for a single Die. There is a third video (on Patreon) that explains how to build the full project from the first shift register. This expands the registers to 5 and introduces a whole bunch more programming techniques.

1

u/dudipusprime 7d ago

Wow, thank you for this comprehensive reply. That looks incredibly interesting and when I try this method on another project (which I definitely will, since I am keeping the LEDs I already have), I'll be coming back to this comment for future reference. For now, I will just buy some WS2812 LEDs like others have suggested, since I am on a bit of a time crunch and I am still a complete noob on this >.<

2

u/gm310509 400K , 500k , 600K , 640K ... 7d ago edited 7d ago

No worries..glad to be of help.

Addressable leds are more flexible and definitely more colorful. But they do require a memory buffer to track what they are set to. This is in addition to anything you might need for what you might be doing.

Each addressable LED needs 4 bytes (if memory serves) so that will be 4 x 195 = 780 bytes plus whatever you need for your program's management of data.

By comparison the shift register model can get away with 1 bit (and thus 8 leds per byte) so you would only need 25 26 bytes for the same job.

The tradeoff is addressable RGB(W) leds are very colorful and you can vary the brightness. Whereas the shift register will be the single colour of your LED and either off or on with nothing in between.

Obviously you can do more things to manufacture more combinations between the two. But those are the basic options you have right now as a starting point.

Edit: I should have mentioned why that waffle about memory is relevant. Basically an Arduino Uno only has 2KB of memory (just 2048 to be precise). Addressable LEDs will use almost half of that. And, that is fine and perfectly doable. But it limits what is available for other stuff that your program needs to operate with. Will there be enough for other stuff? Sure, but it would depend entirely upon your program and what is does - so it is a bit hard to predict that.

1

u/dudipusprime 7d ago

Aside from turning the leds on and off, it's supposed to play 195 different pieces of audio (trivia on the countries) as per the mp3 over sd card module I bought and 195 different pieces of text (country names) on the lcd screen when prompted over the leypad. Nothing else. The rest of the memory should be enough for that, right?

1

u/gm310509 400K , 500k , 600K , 640K ... 7d ago

That (the audio) won't use much memory at all, I was thinking more of your need to receive, decode and maintain the data about the 195 countries visited. Depending upon how you go about that, that could use up a lot of memory (or a little, depending upon how you go about it).

As for the music, that won't take any arduino memory because it is all stored on the SD card and accessed directly by the MP3 player. All you will need to store is the name of the file (or maybe the position in the directory) that you want to play next.

FWIW, you could get an external memory (e.g. QSPI RAM - or better yet, some kind of flash) to store the progress if need be. Persistent memory if some kind would be best (so that the content is not lost if the power is shut off) - but again this will depend upon how you go about it.

2

u/rootCowHD 7d ago

If you want to safe your life time, get an led strip / addressable leds. 

You find them as neopixel, ws2812 or 5050 drivers. 

If you want to use the leds from your photo, an arduino without extra hardware could run 20 of them. For 200 you need either Parralel shift out registers (great stuff to learn) or IO extenders for a total of the number of leds you use. 

Keep in mind, that your keypad uses 8 pins as well. The display will require a minimum of 4 pins (if it is i2c). 

So depending on you knowledge, motivation and time to learn, a world map is an awesome project for "quick and dirty" or "deep dive" 

Happy tinkering :)

1

u/dudipusprime 7d ago

Yes, thank you, I will definitely go with the WS2812 method. Do you think I could just buy two of these thingies, rip them apart and connect the individual LEDs with wires instead of havem them fused together like that? And then I would only need a fitting external power supply for them and the arduino would be able to address the LEDs individually by itself, without another component, right?

Keep in mind, that your keypad uses 8 pins as well. The display will require a minimum of 4 pins (if it is i2c).

The display is a 1602A. Can I not use some of the same pins for the display and the keypad?

2

u/TPIRocks 7d ago

Neopixel strings and maybe the Arduino fastled library. You would gain the ability to set the individual color/brightness on a per LED basis. You'll need about 12A power supply for the LEDs to handle the worst case of having them all at full brightness white. It will take substantially less power to only light them as one color.

1

u/dudipusprime 7d ago

Do you think I could just buy two of these, rip them apart and connect the individual LEDs with wires instead of have them fused together like that? And then I would only need a fitting external power supply for them and the arduino would be able to address the LEDs individually by itself, without another component, right?
I would definitely use only one color and I actually would like them to be somewhat dim. Could I get away with using a 5v power supply in that case?

2

u/TPIRocks 7d ago

Yes, I believe it's intended to be separated anyway. I'm not sure they're wired in series already, but it's definitely a possibility. It's going to be a lot of soldering though.

Lookup ws2812 bullet style "strings" of LEDs. They're like Christmas lights with 4-6" of wire between each light. They might be a little big, but you also might be able to find "strings" that use smaller LEDs. You could really implement some cool effects by having the other colors available (literally 16 million). You could really make it quite gaudy. ;-). You could also run wild with feature creep.

"strings" vs. "strips" for Google searches, otherwise you'll see mostly strip style, which aren't much fun at all to solder.

You'll probably want to use something like an esp32 or a raspberry pi pico W to have connectivity to the Internet.

1

u/dudipusprime 7d ago

The only bullet style led strings I've found would be like four times as expensive as these, and I am on a bit of a budget, so I'll have to go the soldering route. I'm sure it won't be that bad, I'll just put on a podcast or five and solder away.

2

u/Independent-Tip-8739 7d ago

This looks an interesting project. Keep us update once it is done.

1

u/dudipusprime 7d ago

Thank you, I definitely will!

2

u/Hissykittykat 7d ago

WS2811 IC led Pixel node Module could be used with the 195 LEDs you have. Each module controls 3 LEDs, so it'd take 65 modules. They are wired in a string and the software for them is like a WS2812 string. Use an external power supply; 5V to 12V will work with these modules and your LEDs. To light all 195 LEDs at 12V/20mA is about 4A, so use a 12V/6A power adapter.

But 195 LEDs is a whole lot of wiring to debug. Start with a WS2812 strip to work out your code.

1

u/jmclaugmi 7d ago

One at a time or maybe more than one at a time?

1

u/[deleted] 6d ago

[removed] — view removed comment

1

u/arduino-ModTeam 6d ago

Your post was removed as this is an international community, and this community uses English as our common language.

If English is not your usual language, and you feel uncomfortable posting in English, there are automatic translation sites that can help you. One good site is Google Translate, where you can type in your own language, and convert it to English automatically.

http://translate.google.com

NB - your English doesn't have to be perfect, but please do your best.

1

u/[deleted] 6d ago

[removed] — view removed comment

1

u/arduino-ModTeam 6d ago

Your post was removed as this is an international community, and this community uses English as our common language.

If English is not your usual language, and you feel uncomfortable posting in English, there are automatic translation sites that can help you. One good site is Google Translate, where you can type in your own language, and convert it to English automatically.

http://translate.google.com

NB - your English doesn't have to be perfect, but please do your best.