Offline
Full Member
Karma: 2
Posts: 212
|
 |
« on: January 16, 2013, 01:57:36 pm » |
Ok i have need to control hundred or more digital outputs in a timed sense. (Art project)
I am not sure what kind of micro controller could do that, or if it should be a combination of multiple micro-controllers. What i do know that each output would need to be controlled individual with some delay, but this delay will also rapidly change and be different for each output. Overall it needs to work pretty fast too, like a blink of an eye
I am thinking of setting it all maybe let an arduino output some binary bits, but the arduino doesnt have enough pins. Any ideas would be welcome on how to do this.
|
|
|
|
« Last Edit: January 16, 2013, 02:00:12 pm by PGTBOOS »
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15316
Measurement changes behavior
|
 |
« Reply #1 on: January 16, 2013, 02:07:22 pm » |
Ok i have need to control hundred or more digital outputs in a timed sense. (Art project)
I am not sure what kind of micro controller could do that, or if it should be a combination of multiple micro-controllers. What i do know that each output would need to be controlled individual with some delay, but this delay will also rapidly change and be different for each output. Overall it needs to work pretty fast too, like a blink of an eye
I am thinking of setting it all maybe let an arduino output some binary bits, but the arduino doesnt have enough pins. Any ideas would be welcome on how to do this.
No micro-controller is going to have 255 independent output pins avalible. A popular method one could use is a series of serial in parallel output shift registers wired in series to gain the total number of output pins you require. Then in your arduino software you shift out the serial bit stream and clock pulses for the register array and when all bits are transferred out you pulse a latch pin wired to all the shift registers that transfer all the bits to their output pins at the same time. There is plenty of time to perform all that magic as a blink of the eye is a long time for a arduino running at 16 Mhz. Lefty
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 9
Posts: 775
|
 |
« Reply #2 on: January 16, 2013, 02:08:37 pm » |
You probably want a serial-in, parallel-out shift register. The 74595 seems to be very popular. I assume it (and the Arduino) will be fast-enough for you. Serial data transmission does tend to be slower, because you'll have to "write" 100-255 times before you can update the parallel data. However, Ethernet is serial, and and digital audio/video transmision is serial, SATA disc drives are serial... So in the real world serial can be very-fast! You feed-in the data serially one bit at a time, synchronized with a clock signal. When all of the data has been shifted-into position, you send another signal to transfer & latch the data at the parallel outputs. These devices can be chained together for many outputs. (I'm using an LED driver that uses the same concept to drive 48 independently addressable LEDs from a 3-wire serial output.)
|
|
|
|
« Last Edit: January 16, 2013, 02:17:40 pm by DVDdoug »
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 2
Posts: 212
|
 |
« Reply #3 on: January 16, 2013, 02:10:30 pm » |
Interesting do you know what kind of shift registors (i never used them).. can be used, or know of a some sample with an arduino ?
|
|
|
|
|
Logged
|
|
|
|
|
Copenhagen / Denmark
Offline
Edison Member
Karma: 5
Posts: 2338
Do it !
|
 |
« Reply #4 on: January 16, 2013, 02:19:54 pm » |
74hc595 for instance.
They are rather cheap.
Depending on what you are goint to control you might need other tuff as well. Like the Arduino pins you can't draw much current from the shift register pins. Shift registers with high current draw capability are available but they are much more expencieve. You should alo conider your power upply needs.
If you tell a little about what you are going to control we could probably give better advice :-)
|
|
|
|
|
Logged
|
|
|
|
|
Netherlands
Offline
Tesla Member
Karma: 90
Posts: 9401
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #5 on: January 16, 2013, 02:49:42 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15316
Measurement changes behavior
|
 |
« Reply #6 on: January 16, 2013, 03:00:31 pm » |
Two are good for 128 bits, so enough for his low end estimate but short of his 255 estimate. If very long headers are used to allow two Centipede Shields to be stacked, then by changing the ADDRESS jumper it is possible to address 128 I/O pins.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 248
Posts: 16535
Available for Design & Build services
|
 |
« Reply #7 on: January 16, 2013, 03:25:25 pm » |
Or parallel strings of shift registers in series. Than one doesn't need to shift out 32 bytes of data every time. Use 4 strings perhaps, and only shift out 8 bits to update one string. Use SPI.transfer( ) and 4 chip selects, 1 per string.
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15316
Measurement changes behavior
|
 |
« Reply #8 on: January 16, 2013, 03:34:54 pm » |
Or parallel strings of shift registers in series. Than one doesn't need to shift out 32 bytes of data every time. Use 4 strings perhaps, and only shift out 8 bits to update one string. Use SPI.transfer( ) and 4 chip selects, 1 per string.
But doesn't it take the same amount of time to shit shift out all X bits no matter if one long string or multiple strings. Especially if you want to transfer the latch all at the same time? Lefty
|
|
|
|
« Last Edit: January 18, 2013, 01:39:19 pm by retrolefty »
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 248
Posts: 16535
Available for Design & Build services
|
 |
« Reply #9 on: January 16, 2013, 03:48:35 pm » |
The requirement was for "each output would need to be controlled individual with some delay, but this delay will also rapidly change and be different for each output. Overall it needs to work pretty fast too, like a blink of an eye" Breaking up the grouping supports that. Even better - 8 strings of 4. Use 1 more part to control the 8 chip selects for the other strings. digitalWrite(controlSS, LOW); SPI.transfer(stringSelectData); // 1 of 8 outputs low digitalWrite(controlSS, HIGH); // 1 of 8 strings now has it latch pin low, ready for data SPI.transfer( stringX[byte0]); SPI.transfer( stringX[byte1]); // do this part a little smarter - make the string called an array, and select it based on SPI.transfer( stringX[byte2]); // the timing criteria going on SPI.transfer( stringX[byte3]); // maybe even repeat this entire example 8 unique times, each with its own unique time check to kick it off digitalWrite(controlSS, LOW); SPI.transfer(0xff); // all outputs high digitalWrite(controlSS, HIGH); // data is latched into 4 registers
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 2
Posts: 212
|
 |
« Reply #10 on: January 16, 2013, 05:16:47 pm » |
I think the code to control it would be something like sending the delay time to one of the 100 ~ 255 pins in ms Then based on the signal a mosfet will control a larger current.
How does it go with SPI, i've read a bit about it but its a bit unclear, i understand from it that its slightly different then the shift register method. If i am right, then SPI is a kind of cable on which multiple (arduino?) devices can connect and each get a number. So then to send a signal the signal should address the number of the connected arduino, and then send an instruction to it ?. Does one need to invent a protocol or handshake for that to define how much data in which direction you need to send?
Also since i need many outputs here, to save cost, could it be like having a normal duemilanove as a Master, with lots of cheaper Tiny arduino models like SPI slaves ?.
hmm or perhaps.. (thinking) 1 arduino master controling 15 arduino boards through SPI, and then have 10 boards with each 14 pins minus the one used for SPI ~ i guess 3? makes 15 * 11 = 165 pins..
.. i am not sure about my budget, i assume i would be able to program the arduino dough thats a big plus .. however these other two solutions might be cheaper (that extension board and using 2 arduino's) gives 128 pins.. maybe using an usb hub i can add 3 arduino's to a PC The shift register solution.. i dont know i think it is the cheapest ? , but also require more electronics knowledge perhaps.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 2
Posts: 212
|
 |
« Reply #11 on: January 16, 2013, 05:48:53 pm » |
just reading an Arduino Mega has 54 pins.. so 3 or 4 of them might do the trick too.
I wonder if i would use SPI and send data to control this all what would be the shortest time to send such control information ?.
|
|
|
|
|
Logged
|
|
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 248
Posts: 16535
Available for Design & Build services
|
 |
« Reply #13 on: January 16, 2013, 07:12:27 pm » |
I wonder if i would use SPI and send data to control this all what would be the shortest time to send such control information ?. Yes it would. No other interface is faster. If i am right, then SPI is a kind of cable on which multiple (arduino?) devices can connect and each get a number. No, that is describing I2C. SPI, each device (or string of devices) gets its own chip select (aka slave select). SPI is the fastest interface, with default clock rate speed of 4 MHz - fastest I2C speed is 400KHz, and requires the devices to acknowledge the transmission. Here's what I was discussing earlier. This is drawn with open-drain TPIC6B595, replace with 74HC595 if don't need the higher current sink capability. The board pictured can hold 12 TPIC6B595s, I have daisy chained 2 of them with 20 shift registers total to control a 5x20 display (used 5 of 8 outputs on each). Apparently I can't count all the time - 256/8 = 32 chips, so 4 strings of 8, could that with 4 of these boards. Only 1 needs the uC setup, the others can be just shift registers, caps, and connectors.
|
|
|
|
« Last Edit: January 16, 2013, 07:34:59 pm by CrossRoads »
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 2
Posts: 212
|
 |
« Reply #14 on: January 17, 2013, 02:15:55 pm » |
I am completely new to chip connections how many devices can be connected using ISP and a arduino as a Master ? Hmm I might favour Arduino slaves, since i have some experience with programming them, and it would require less soldering for me. Or hmm i make it a soldering project.. 
|
|
|
|
|
Logged
|
|
|
|
|
|