I have a Uno and am happy to get a Mega (to get the 54 pins) but I want to run a question past the forum for feasibility.
I want to blink 200 LEDs. Yes, I know there are only 54 pins BUT what I want to do is use 4 banks of 50 LEDs giving 200 LEDs.
So pins 0 to 49 will have 4 LEDs connected to EACH pin(or plug or whatever they are called)
The first LED from each pin will be connected to pin 50. The second LED from each pin will be connected to pin 51. Third to pin 52 and fourth to pin 53.
One of pins 50 to 53 will be switched on at random. This will activate one bank. Within that bank I will randomly blink one LED.
So 200 blinking LEDs but will this work? Pins 0 to 49 will have to be input, right? And pins 50 to 53 output? If I put the 220 ohm resistor on pins 50 to 53, can I do it all with FOUR resistors. I will vary the delay (and interval) for each blink but only ONE LED will be firing so current drain is not a consideration
I have been programming computers for more years than I can remember so the logic will be child's play to me.
My question is - Will this concept work?
I suppose I could try 4 banks of 10 on my Uno but I thought I would just ask you bright sparks on the forum before I go and buy a Mega
The economical option is of course using shift registers - but requires a lot of wiring. I was achieving refresh rates of 75 Hz for 20 LED strips each a meter long with 60 LED's on each strip.
The costly way is to daisy chain individually addressable LED strips (NeoPixels?) the down side of this approach is cost and speed.
I researched "charlie" and other suggestions but will stick to my "banks" idea. As I said - retired programmer not electrician
I'm puzzled by my recollection of "P = IR" from school days 55 years ago, which suggest to me that the 220 ohms has to carry 4.4 watts??????? 20MA X 220ohms = 4.4 watts???? I must have it wrong somewhere????
My gut tells me that the power would be negligible????
Or you can use a MAX7219 to handle 64 LEDs if you wire them in a matrix:
Personally I would look at a few 74HC595 chips. After all, you are going to have to run wires one way or the other to 200 LEDs. May as well delegate the job. In any case trying to run them all from the main processor, you are likely to hit output pin limits. In other words, it probably won't be able to provide enough current to light 200 LEDs without transistors.
You can get LED strips fairly cheaply, and they run hundreds of LEDs from only 4 wires (power, ground, data, clock).
I believe the guy might need some hints on what is a 595.
They are serial to parallel converters: you send in an information 8 bits long using three wires (plus power lines) and they convert those 8 bits in 8 output lines.
So, without even trying to describe how you send those 8 bits to the 595 chip, if you send the binary sequence 01001000 it will turn on pins 3 and 6 and it will turn off all the remaining pins (out of a 0 to 7 numbering).
That means you have already added 5 pins to your pinout: using 3 pins you are able to drive 8. Those chips can be also daisy chained, meaning they provide an additional output pin which can be connected to the input pin of another one so that any data "overflowing" the chip is going to be "pushed" in the subsequent.
In other words, if you have two 595s daisy chained you can send them 16bits rather than 8: the first 8 bits will end up in the second chip (the one at the end of the chain) and the second 8 bits into the first one (that's why we call it overflowing).
With two daisy chained 595s you can drive 16 pins by using 3 pins on your arduino (not counting the Vcc and GND power lines).
There's a limit on how many 595s can be effectively daisy chained, but you can ramp this up a quite a lot before hitting those limits: I know guys driving 10 of those chips from an arduino with no troubles at all.
Now go read the 595 datasheet and get a better understanding if you think this might solve your problem, but do not forget 595s are not meant to provide a lot of current: the normal DIP package has a quite low limit on the amount of current you can provide from a chip, which is LOWER than the amount of current it can provide from each single pin if all the pins are turned on...
I wish someone had given me an explanation as the above one when I was trying to understand how these chips work.
It would have saved me a lot of time and troubles.
MKII1200:
I wish someone had given me an explanation as the above one when I was trying to understand how these chips work.
It would have saved me a lot of time and troubles.
Me too!
That's why I tried to put it the simple way, even if I know it does contain some imprecision, but at least he should now have an understanding what we are pointing him at.
I took a scrolling LED sign, worked out how it was wired up, and drove it from an Arduino.
It had 10 x 595 chips, plus 7 transistors. Between them they drive 504 LEDs. There is some multiplexing involved as clearly 10 x 595 chips can't directly drive 504 LEDs.
So, 9 of them drive the columns (9 x 8 = 72) multiplexed with 7 rows (7 * 72 = 504) giving 504 LEDs for a cost of only 10 chips.
You can buy 10 x 595 chips on eBay for around $1.50 so you can see the cost is not that high.
I'd go with 4 MAX7219s. I have this little breakout board for it, you can wire add LEDs with a pair of wires each and space the LEDs out however you'd like. Designed to be daisy chained together.
Using the MAX7219 is easy, write to a register directly with SPI.transfer, or with the LEDcontrol library. http://www.crossroadsfencing.com/BobuinoRev17/
Thanks to everyone for all the informative responses
Have to wait for my cables/wires/ties(?) to arrive from eBay. First lot are a week overdue so ordered 2 more lots from different sellers (hopefully one lot will arrive soon)
Finding out lots about my Uno, like on-board 3.3V and analog pins can be used as digital
Quick question - can I switch the on-board 3.3V with the pins? Or will this cause some sort of short circuit?
I played with the Blink example to make it blink four times then wait 2 seconds just to get my hands dirty
The onboard 3.3V is just the output of a regulator. You can use it as a power source to other things, or add p-channel MOSFETs and switch the MOSFET on & off to let 3.3V current flow.
Can I use the digital (or analog) pins to switch the 3.3V output? I am worried that the digital pins go HIGH to 5V and how will that interact with the 3.3V? And can the pins switch the 3.3V?