Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: ze3one on Nov 24, 2011, 01:15 am

Title: 16 bit shift register parallel out...?
Post by: ze3one on Nov 24, 2011, 01:15 am
Hello, I'm having problem understanding how to plug a shift register to arduino, I would like 16 output with 0/1 state with the fewest pin possible.

Is this one correct for the use I want to do?

http://eshop.engineering.uiowa.edu/NI/pdfs/00/95/DS009585.pdf (http://eshop.engineering.uiowa.edu/NI/pdfs/00/95/DS009585.pdf)

If yes, how do I plug in to my arduino ( I have a atmega 1280 )

thank you guys
Title: Re: 16 bit shift register parallel out...?
Post by: runaway_pancake on Nov 24, 2011, 01:42 am
http://www.arduino.cc/en/Tutorial/ShiftOut

Title: Re: 16 bit shift register parallel out...?
Post by: ze3one on Nov 24, 2011, 01:50 am
Using the second diagram with 16 led and that codehttp://arduino.cc/en/Tutorial/ShftOut22 (http://arduino.cc/en/Tutorial/ShftOut22) it will use only 3 pin two control 16 output with 0/1 state. Is that right?
Title: Re: 16 bit shift register parallel out...?
Post by: milamber on Nov 24, 2011, 02:18 am
Yes. If you set it up as per example 2 you will have 16 outputs using 3 control pins. Be aware that there is an error in the tutorial. The Capacitor that is shown SHOULD NOT be included. There should be NO capacitor on the latch pin.

The example should give you the basics of how to "Shift" data into the registers and how to format that data.

Once you understand the basics you should be able to modify this code, or write new code, to achieve the effect you are after.

On an advanced note, if you need to shift the information faster there is a method to do this using SPI. But for simple lighting effects the ShiftOut function should be fine.
Title: Re: 16 bit shift register parallel out...?
Post by: ze3one on Nov 24, 2011, 05:57 am
Thanks for the information, For my project, I will do a 8*8*8 LEDs cube with 8 layer of 8 by 8 LEDs (anode in \\, cathode in \\), then I'll mutiplex two layer of transistors 8*8, one npn and one pnp, so like that I would be able to light each LED one by one by powering one npn and one pnp. So two 74hc595 for the npn, same thing for pnp. Does shift out gonna be enough fast so we can see all LEDs light at the same time? I know it seem complex, I can post a draft schematic.
Title: Re: 16 bit shift register parallel out...?
Post by: milamber on Nov 24, 2011, 07:20 am
I haven't done anything with LED Cubes but 8x8x8 means 512 LEDs. All of which have to be multiplexed and updated constantly. It may be that ShiftOut won't be fast enough for that purpose.

There are people on here who have made cubes, maybe one of them could chime in.
Title: Re: 16 bit shift register parallel out...?
Post by: CrossRoads on Nov 24, 2011, 08:32 am
I would use SPI.transfer to send data to a cube, way faster than software based shiftout.
Use SCK and MOSI pins, with SS for the shift register latch pin.

digitalWrite (SS, LOW);
SPI.transfer (byte1);
SPI.transfer (byte2);
digitalWrite (SS, HIGH);