Issues "Lesson 11 Eight LED with 74HC595"

Helpppp! I have no idea what went wrong, but it seems like my computer cannot detect my board somehow.
Here's the code, exactly the same as provided:

//www.elegoo.com
//2016.12.9 

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);
  }
}


and the wiring:

The L led and ON on the board will slowly vanish after I connect the board to the computer, but if I remove the GND or 5V wire it goes back to normal again. Also none of the LED light up.

Really really confused rn, would be really grateful for some help

It's impossible to tell if you haven't just got a wiring error.

Post the schematic you are working from.

Check your wiring.

a7

Welcome to the forum

The fact that your computer cannot detect your board has nothing to do with the sketch that you are trying to compile

  • Which board do you have ?
  • When you plug your board into USB does the PC create a new COM port ?
  • Which Operating System are you using ?
  • Have you ever been able to upload a sketch ?
  • Are you sure that the USB cable that you are using is a data cable and not just a charging cable ?

Hi! Welcome to the Forum. It sounds like you have a short circuit somewhere. Are your LEDs all connected correctly?

Keep in mind that in these longer breadbords there’s no connection between (+) and (-) rails from one half to the other. Try moving your black GND wire to the side above the LEDs.

1 Like

@owowow7
The following diagram (Fig-1) may help OP to check the wiring correctness of his project.


Figure-1:

Instructions:
1. Take out all connections between UNOR3 and Breadboard.
2. Verify that the blue cable is a data and power cable by uploading the following Blink sketch. Check that the onboard LED (L) of UNO Board is blinking at 1-sec interval.

void setup()
{
     pinMode(13, OUTPUT);
}

void loop()
{
      digitalWrite(13, HIGH);
      delay(500);
      digitalWrite(13, LOW);
      delay(500);
}

3. Disconnect UNO from PC.
4. Check the wiring between HC595 and the current limiting resistors.
5. Check that the cathode terminals of all the LEDs are shorted together and are then connected with GND pin of UNO3 using only one jumper.

6. Short Pin-8 and Pin-13 of HC595 and then connect tem with GND pin of UNO.
7. Short Pin-16 and Pin-10 of HC595 together and then connect them with 5V of UNO.

8. Connect Pin-12 of HC595 with DPin-11 of UNO.
9. Connect Pin-11 of HC595 with DPin-9 of UNO.
10. Connect Pin-14 of C595 with DPin-12 of UNO.
11. Upload your sketch of post #1 and check that your desired LEDs have turned On.

1 Like

Correct!

1 Like

actually it depends if the blue and red line are discontinued, then they are not connected

but if the blue and red line go through, then it's all connected

OP's one seems to be the continuous type

4 Likes

Forgive me: I just got an image of a noob carefully drawing lines on his breadboard with blue and red fine-tipped pens.

a7

I doubt anyone will be able to spot a wiring error from that photo.

  1. The photo is too blurred
  2. Even if the photo was sharp, the wiring is like spaghetti because you used Dupont wires to connect everything.
  3. You used Uno with a breadboard, so you have to use at least some Dupont wires.
  4. Classic Nano would be a better choice when building a breadboard circuit. It can plug into the breadboard, unlike Uno, so you can avoid using Dupont wires (which are notoriously unreliable, by the way)
  5. Use solid-core hookup wire. Cut pieces to length and lay them flat to the breadboard. Use several different colours, but use them consistently. Use red for 5V and black for ground.
2 Likes

This non-colored breadboard has perfect electrical isolation between the two halves.

  • Do some reading on decoupling capacitors.

  • It appears you are not using any.
    With digital circuits they must be added.

1 Like

When wired correctly, your sketch works just fine with an Uno R3, as you can see. I suspect you have either a wiring error, you have something other than a 74HC595 in your circuit, or it is inserted incorrectly.

Unfortunately, as others have already noted, it is not possible to ascertain what the problem is from your photo as what's wired where is impossible to see.

I would strongly advise ditching the Dupont wires and going with 22/24AWG solid hookup wire. When used properly, it makes wiring much easier to see.

2 Likes
  • OP, Confirm your I.C. is orientated correctly.

1 Like

If one makes the image a bit brighter one can see the notch is at the top so pin 1 would be top left, VCC top right and GND bottom left.

The wiring does appear to be consistent with that. What I don't see are any markings on the chip. Could be that the markings are difficult to see at certain angles, but the top of this IC seems to be completely blank?

OP, could you confirm whether there are any markings on the top of the IC, and if so, what do they say?

1 Like

sorry my bad, here's the diagram:

I have UNO R3 (elegoo) and I'm using Windows. Usually the PC would create a new COM port if I plug the board in, but in this project it just wouldn't. I've checked if my cable or board were broken but they're all alright. And yeah all other sketches were working.

ahhhh wait... problem solved. I just figured I've used the wrong chip....I'm sorry that's so lameee haha

thanks for all the replies, I just figured I've used the wrong chip XDDD. lame as hell, sorry haha..

1 Like
  • Note to self
    ”Always Blame Youself”.

:wink:

2 Likes

No one here ever made a mistake like that. :expressionless:

a7