74HC595 troubles

I just started messing with shift registers and started off with shiftOut() - Arduino Reference 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:

//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).

Shpaget:
Could all this come from the lacking cap?

Yes.

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.

Boffin1:
with prefrably a 10 mFD electrolytic across that.

I'm not sure I understand this part. What is "that" you are referring to?

Boffin1:
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.

Got it to work. The problem was... well, let's call it user error XD.

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

I buy from here
Cheaper, and quicker delivery.
http://www.dipmicro.com/store/C5K10-50
or

e-bay often not the best choice, I rarely buy there.

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.

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

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

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.

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.

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.