Electronics > Beginners

Want to control 12 LEDs but there is not enough pins on Arduino?

<< < (3/5) > >>

Nusa:

--- Quote from: BU508A on July 21, 2019, 10:32:17 pm ---I suggest to use a shift register as a serial to parallel decoder.

Example:



Source:
https://prometec.org/actuators-and-sensors/arduino-and-shift-registers/

--- End quote ---
If only the person making that diagram paid more attention to being correct than using all the pretty colors. I'm sure he knew better, but that's not what he drew. Look at the yellow data line.

rstofer:
As long as an LED gets lit within 1/60th of a second of an event, you won't know whether is was coincident or not.  The only requirement is that when the dance stops, the proper lights are lit (within 1/60th second).  Actually, 1/30th may be ok as well.  It's an eye versus flicker thing.

You can EASILY use an IO Expander like the 16bit MCP23S17 running at as high as 10 MHz!  No problem shifting out the bits at some reasonable clock rate and meeting the 1/60th second thing.  Extra points if you use the hardware SPI gadget rather than bit-banging and doing it with an interrupt on each transfer means it will work by magic.  Just stick the LED values in a known location (an unsigned 16 bit int) and every time there is an interrupt, the latest value gets sent.  The SPI gadget can only handle 8 bit transfers but what you do is lower CS', send the high 8 bits, send the low 8 bits and then raise CS'.

Did I mention FAST!

mariush:

--- Quote from: BU508A on July 21, 2019, 10:32:17 pm ---I suggest to use a shift register as a serial to parallel decoder.

--- End quote ---

Or just use an actual led driver IC like I suggested a few posts above, and you save pcb space by not having to use one resistor for each led, and you have finer control over the current.

james_s:
With only 12 LEDs I'd be tempted to just multiplex or charlieplex them directly. If you wanted to drive a larger number of LEDs the MAX7219 can handle 64 of them from just a few IO pins.

Kjelt:

--- Quote from: Nusa on July 21, 2019, 09:34:40 pm ---A decoder doesn't work so well if you want more than one LED lit at a time, although you can likely cycle it so several appear lit. All of them at once is probably out of the question.

--- End quote ---
The hef4000 were sturdy, IIRC  25mA per output max total 250mA or so, with modern he leds @4 to 6mA it is more then enough, so wouldn't be a problem at all.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod