Go Down

Topic: Help needed with shift registers (Read 1 time) previous topic - next topic



After finishing my 3x3x3 LED cube I decided to go a little bigger (5x5x5). Now the arduino doesn't have enough pins to control the LEDs, so I decided to use (5)shift registers to expand my number of outputs. So I was searching on the internet and found this tutorial(http://arduino.cc/en/Tutorial/ShiftOut). So I ordered a few LEDs and the 74hc595N shift register (datasheet:http://www.nxp.com/documents/data_sheet/74HC_HCT595.pdf). After wired everything (only 2 LEDs hooked up) up as the tutorial shows, everything worked perfectly fine :). Because i'm gonna use 5 transistors to control the LED's  layers, I pulled out the ground (pin 8 on the shift register). I expected to see the LEDs go off though they didn't. So now I pulled out the 5v aswell and still the LEDs are on (less bright though).

Now I think the shift register is provided by current through the I/O pins 8, 11, 12. Now I don't why this happening so if someone can explain it to me (why and how??) it would be very helpful!

this code i'm using:
Code: [Select]
//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;

void setup() {
 //set pins to output so you can control the shift register
 pinMode(latchPin, OUTPUT);
 pinMode(clockPin, OUTPUT);
 pinMode(dataPin, OUTPUT);

void loop() {
 // count from 0 to 4 and display the number
 // on the LEDs
 for (int numberToDisplay = 0; numberToDisplay < 4; numberToDisplay++) {
   // take the latchPin low so
   // the LEDs don't change while you're sending in bits:
   digitalWrite(latchPin, LOW);
   // shift out the bits:
   shiftOut(dataPin, clockPin, MSBFIRST, numberToDisplay);  
   //take the latch pin high so the LEDs will light up:
   digitalWrite(latchPin, HIGH);
   // pause before next value:

this is what is happening:

Nick Gammon

ICs can power themselves parasitically by drawing current from the data lines. However that is not the recommended way to use them and may damage them. They aren't designed for it.


Don't do that!  You risk frying the chip!

CMOS logic (these days that's everything pretty-much) is extremely sensitive to static electricity and
ESD (electro-static discharge) - so almost every chip has input-protection diodes on all the inputs (and
outputs usually), whose purpose is to reduce the risk of stray electrostatics destroying the FETs on the chip.

The gate of a FET is a few atoms thick layer of silicon dioxide and a static discharge if even a few dozen volts
can easily blow holes through it and destroy the FET.

The protection diodes connect the input and output pins to Vdd and GND such that the gate voltage is prevented
from exceeding safe limits (for small discharges, upto a few thousand volts from a human finger...).  But of course they allow the power
rails to be directly powered by any input, which is the behaviour you see.

However the continuous current carrying ability of these diodes is usually quite small - think mA or less - so this
is usually a bad state of affairs - the input diodes overheat and degrade and perhaps melt.

Furthermore if you pass large currents through these diodes even for very short times this can trigger "CMOS
latch-up" - wikipedia will explain this.

So in short never disconnect GND or Vdd from the chips

What you want to do is use a group of transistors to handle the layers of the LED cube, and power the bases of
these transistors from the shift register outputs via resistors - disconnect the LEDs anodes from GND, don't
disconnect the shift register from GND!!
[ I won't respond to messages, use the forum please ]


Feb 06, 2013, 12:45 am Last Edit: Feb 06, 2013, 12:50 am by WonderTiger Reason: 1
Yes I discovered I made a bad mistake what mark mentioned. Instead of pulling out the ground from the arduino I should have pulled out the ground from the LED(so stupid). Mark, thanks for the info by the way now I know even more about shift register(I am still very new with electronics so it is a kind of learning experience for me), thanks :)!


Well, there is also the mindset that says... "You learn more from failure than success"   So while your experimentation is somewhat beneficial, (you now know more than you did before) you also need to be prepared to replace damaged parts.

Go Up