0

I got my Arduino kit a few days ago and I've been going through some of the tutorials.

I got to the 8 LEDs with a shift register tutorial, where I got stuck. Nothing would light up after I plugged everything in and uploaded the sketch.

arduino

This is the circuit I've attempted to recreate using Fritzing, and the following is the code I used, from the tutorial :

int tDelay = 100;
int latchPin = 11;      // (11) ST_CP [RCK] on 74HC595
int clockPin = 9;      // (9) SH_CP [SCK] on 74HC595
int dataPin = 12;     // (12) DS [S1] on 74HC595

byte leds = 0;

void updateShiftRegister()
{
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, LSBFIRST, leds);
  digitalWrite(latchPin, HIGH);
}

void setup()
{
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
}

void loop()
{
  leds = 0;
  updateShiftRegister();
  delay(tDelay);
  for (int i = 0; i < 8; i++)
  {
    bitSet(leds, i);
    updateShiftRegister();
    delay(tDelay);
  }
}

I have also attempted to use an 8-segment digit display using the same shift register, also failing.

Is there something wrong that I am doing or could it be that the little chip is broken?

I accidentally discovered that when I swap the ground from pin 8 on the 595 to 5V, all the LEDs will light up.

Update : I got the same circuit in Tinkercad, some kind of Arduino simulator. After dropping in the code and running the simulation, after it lights up the 5th LED, I get this warning :

warning

However, when I change the 220 ohm resistors to something like 500 ohm resistors, that pop-up is gone. Could this be another reason of why my chip could be possible broken at the moment?

  • LEDs light up because of protection diodes on the inputs/outputs. You've got negative voltage on the outputs, so current flows. I'd worry about OE input, as it's hardwired to the ground. Protection diodes are for the small currents only so i'd expect burning protection diode and after that /OE might get destroyed. – KIIV Jan 5 at 14:33
  • BTW: code + schematics is working. – KIIV Jan 5 at 15:06
  • Okay... thanks for confirming that. Guess I'll have to buy a new shift register... the issue is I have no idea where in the town I can get electronics like that. Thank you, anyway! – hiimsoba Jan 5 at 15:09
  • 1
    I tried the config in different places on the breadboard and with different wires... same result. – hiimsoba Jan 5 at 15:11
  • 1
    the power and ground rails on breadboards are sometimes interrupted int the middle of the breadboard – Juraj Jan 6 at 12:00
0

One omission I see is that you don't have a bypass capacitor across Vcc and Gnd of the 74HC595. Without it you would have inconsistent operation.

But if you had the power reversed on the chip then that will be the major problem and I'm sure the chip is damaged.

What I would do is put leds on the clock, data, and latch lines. And then make your delay very long, 1 second, so that you can see what the lines are doing. Just to confirm that you are getting the output that you expect. But first put a bypass cap across the chip.

Also double check that your leds are in the right way.

  • I'm quite a newb in the electronics field, may I ask what am I supposed to do, in a step-by-step fashion? I followed the guide I got with the kit and it didn't have any capacitors involved. The LEDs are the right way, I tried each one of them out before and they all light up. – hiimsoba Jan 5 at 14:14
0

The only way i found to make this circuit to work is by putting 8 pullup resistors (1k) from vcc to each of the output pins of the 74hc595 whithout them no leds light up ever.

-2

well a few thoughts

connecting 5v to pin 8 (=gnd) is the like stupid most idea one can have. it may not cause any damage if pin 16(=vcc) is also connected to 5v but i would not rely on that. generally reverse voltage is the dead of all electronics if not protected against it.

for the leds i would use 1k to 10k this is giving still enough current to see them light up. i dont know why seemingly everyone goes for 330ohms this just takes more current and makes the leds extremely bright (3mA are enough)

for testing if something simple like a shiftregister or a flipflop or logic gate is working i would not use a microcontroller at all. just use a couple of switches. this eliminates one point where stuff can go wrong.

whether or not you put in a bypass cap makes hardly a difference if your supply is sufficiently capable and stable. i for instance use the charger of my broken laptop that can deliver 5v at up to 2.5amps. i dont need any bypassing although its a best practise.

adding leds to the serial in latch shift clock and serial outputs may also help nail down the problem.

also make sure you dont have any dodgy cables used. if any of the wires is broken or has microscopic internal breaks this can lead to misbehaviour and is basically impossible to find.

one thing i did when i tried if my chips worked was using a known good chip from a collegue first to confirm the circuit being ok.

depending on where you take your power from adding a power led is usually a good idea as well. if you power everything from a powerbank you may find that some of them just shutoff the outputs if there is less than a certain threshold current flowing out. which leads to effects like "the circuit worked for 30 seconds and then died. after disconnecting waiting a couple of seconds and repluging the power it works again..." i literally include a power led in just about every project of mine.

  • Your answer seems to be getting some down votes. Perhaps if you took the trouble to properly construct English sentences that would help? Sentences start with a capital letter, and the word "I" is capitalized. This isn't a mobile phone message. – Nick Gammon Mar 11 at 6:16
  • Really? That seems unduly harsh to down vote an answer because it is not punctuated and does not start sentences with capitals correctly. I also could not see that as a reason in the help center arduino.stackexchange.com/help/privileges/vote-down . Now if it were the English literature SO community, I would tend to agree. It is a shame that people are not required to give a reason for the down vote... I to have received several on the arduino site and often have no clue why. – GMc Jul 19 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.