Pages: [1]   Go Down
Author Topic: 74HC595 troubles  (Read 1658 times)
0 Members and 1 Guest are viewing this topic.
Croatia
Offline Offline
God Member
*****
Karma: 13
Posts: 511
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I just started messing with shift registers and started off with http://arduino.cc/en/Reference/shiftOut http://arduino.cc/en/Tutorial/ShiftOut and few other web pages google came up with.

Currently I have single 74HC595 hooked up to an Uno, just the way it is connected here, with one difference. I don't have a 0.1"f capacitor (I suppose that is 0.1μF?) at hand so I tried without it.

The problem manifests in the way that although all the LEDs function at some time, they don't always light up. For example, in my attempt to pinpoint the problem I dumbed down the code to count to 9, took out all the ifs and loops and fancy variables. It now looks like this:

Code:
//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() {
      digitalWrite(latchPin, LOW); 
    delay(1); 
    shiftOut(dataPin, clockPin, MSBFIRST, 0);
    delay(1);
    digitalWrite(latchPin, HIGH);   
    delay(1000);
   
      digitalWrite(latchPin, LOW);
   delay(1);   
    shiftOut(dataPin, clockPin, MSBFIRST, 1);
    delay(1);
    digitalWrite(latchPin, HIGH);   
    delay(1000);
   
      digitalWrite(latchPin, LOW);
   delay(1);   
    shiftOut(dataPin, clockPin, MSBFIRST, 2);
    digitalWrite(latchPin, HIGH);
 delay(1);   
    delay(1000);
   
      digitalWrite(latchPin, LOW);
   delay(1);   
    shiftOut(dataPin, clockPin, MSBFIRST, 3);
    digitalWrite(latchPin, HIGH);
  delay(1); 
    delay(1000);
   
      digitalWrite(latchPin, LOW); 
    delay(1); 
    shiftOut(dataPin, clockPin, MSBFIRST, 4);
    digitalWrite(latchPin, HIGH);   
    delay(1);
    delay(1000);
   
      digitalWrite(latchPin, LOW);   
      delay(1);
    shiftOut(dataPin, clockPin, MSBFIRST, 5);
    delay(1);
    digitalWrite(latchPin, HIGH);   
    delay(1000);
   
      digitalWrite(latchPin, LOW);   
      delay(1);
    shiftOut(dataPin, clockPin, MSBFIRST, 6);
    delay(1);
    digitalWrite(latchPin, HIGH);   
    delay(1000);
 
  digitalWrite(latchPin, LOW);   
      delay(1);
    shiftOut(dataPin, clockPin, MSBFIRST, 7);
    delay(1);
    digitalWrite(latchPin, HIGH);   
    delay(1000);
   
    digitalWrite(latchPin, LOW);   
      delay(1);
    shiftOut(dataPin, clockPin, MSBFIRST, 8);
    delay(1);
    digitalWrite(latchPin, HIGH);   
    delay(1000);
   
    digitalWrite(latchPin, LOW);   
      delay(1);
    shiftOut(dataPin, clockPin, MSBFIRST, 9);
    delay(1);
    digitalWrite(latchPin, HIGH);   
    delay(1000);
}

See? Can't be much dumber than this.
The code is supposed to light up the LEDs and represent the numbers in binary. However, it skips some numbers entirely. For example, after the number three which is represented with LEDs one and two, all LEDs turn off until it is time for number five (LEDs three and one). Six also doesn't work at all, but seven (first three diodes) happily glows correctly like nothing happened.

Working and non working numbers are randomly interchanging so every number eventually lights up at exactly the right time, showing that everything is hooked up correctly, that arduino is sending the numbers at the right time.

Could all this come from the lacking cap? I tried 10μF (the only one I had around) but the problem just changes slightly (half works for a bit just like before, then completely freezes until the cap is removed).
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5635
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Could all this come from the lacking cap?

Yes.
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Cape Town South Africa
Offline Offline
Edison Member
*
Karma: 19
Posts: 1217
A newbie with loads of posts, and still so much to learn !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The only caps that should be on the board, are a 0.1mFd  ( 100nF ) across the vcc and ground pins of the chip, with prefrably a 10 mFD electrolytic across that.

There should be no cap on the latch pin ( we have been trying to get that removed in the tutorial )

Make sure your grounds are connected propertly between the 595 and the Arduino ground.
Logged

With my mobile phone I can call people and talk to them -  how smart can you get ?

Croatia
Offline Offline
God Member
*****
Karma: 13
Posts: 511
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

with prefrably a 10 mFD electrolytic across that.
I'm not sure I understand this part. What is "that" you are referring to?


Make sure your grounds are connected propertly between the 595 and the Arduino ground.
I suppose they are, considering all the LEDs light up eventually.
Logged

Croatia
Offline Offline
God Member
*****
Karma: 13
Posts: 511
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Got it to work. The problem was... well, let's call it user error smiley-lol.
Logged

Rhode Island - USA
Offline Offline
Full Member
***
Karma: 0
Posts: 156
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i'm about to start the same exact thing... i just got my 0.1uF 50V's in the mail today..

100 of them for $3.00 on ebay.... seller:thaishine
« Last Edit: February 11, 2013, 06:45:35 pm by Ruffsta » Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27352
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I buy from here
Cheaper, and quicker delivery.
http://www.dipmicro.com/store/C5K10-50
or
http://www.taydaelectronics.com/capacitors/ceramic-disc-capacitors/10-x-0-1uf-50v-ceramic-disc-capacitor-pkg-of-10.html

e-bay often not the best choice, I rarely buy there.
« Last Edit: February 11, 2013, 06:57:52 pm by CrossRoads » Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Rhode Island - USA
Offline Offline
Full Member
***
Karma: 0
Posts: 156
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i normally would have ordered from dipmacro.. but i didn't see any uF's... i didn't know you could use nF's.. so i was looking for the specific ones..

i have also ordered from tayda... both are excellent and highly recommended sources!


for the most part, they are cheaper - but not in all instances..
ie:
100 Bright RGB LED 5mm Common Anode Clear Lense 4-pin Bulb Tri-Color's - dipmacro price: $19.94 + shipping - ebay price: $12.94 free shipping

that's just 1 example - overall yes, i would stick with dipmacro or tayda -but since i am not that much in a rush, waiting on delivery is ok at the moment with me.
« Last Edit: February 11, 2013, 07:37:34 pm by Ruffsta » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

100nF is 0.1uF and its represented by a 104 on the side of most disk caps.
Logged

Rhode Island - USA
Offline Offline
Full Member
***
Karma: 0
Posts: 156
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

not everybody knows that (especially new people to arduino).. uF and nF were 2 different things to me.. so i looked specifically for uF
Logged

Eugene, Oregon
Offline Offline
Sr. Member
****
Karma: 9
Posts: 388
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I often refer to them as 104 caps, that is often what is printed on the cap (even tiny smt ones)

Just be glad that you dont have to read color dots.
Logged


Cumming, GA
Offline Offline
Edison Member
*
Karma: 20
Posts: 1657
Ultimate DIY: Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

An interesting electronics hobby anomaly I've noticed over the years.    Tinkerers in the USA tend to avoid the nano-farad nomenclature entirely.  Commonly skipping from micro-farad ranges like  0.47uF .047uF and then slip right into pico-farad ranges like 4700pF, 470pF and 47pF....   while the rest of the world seems quit at home with using the "mid-range" nano-farad which really does help with keeping the numbers manageable.

http://www.justradios.com/uFnFpF.html
Logged

Leeds, England, (dis)UK
Offline Offline
God Member
*****
Karma: 16
Posts: 704
Quick, chuck it in the bin before the boss finds out...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I find the use of centimetres odd. I can't immediately think of anything else where we use 'centi' in everyday measurement. Everything else is in powers of 103.
Logged

Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

Pages: [1]   Go Up
Jump to: