Help with troubleshooting a circuit error

Hello,

I have a problem with a circuit I just built (cf. attached schematic). In works perfectly well on the breadboard. The perfboard version, with everything soldered on, has a small issue which I don't understand.

The Arduino sketch mainly lights up different LEDs with the HC595s according to button presses shifted in through the HC165s (it's a complicated menu system for a device). This functionality is preserved entirely in the perfboard version, i.e. I can select buttons and LEDs display like they should.

The one notable exception is the top right button: when it's pressed, the button pressed is registered by the sketch but all the board LEDs start blinking quickly at a very dim level. If, say, a LED somewhere in the middle is set to be ON (normally getting 1.8V), then the LEDs to the left of it are dimmer than the ones to the right of it, and the LED itself is now getting only 1.2V (i.e. the HC595 seems to be sending it, and it only, 0.6V less than it should). This behavior only lasts as long as the button is held.

I've checked the sketch several times, outputting variables to the Serial Monitor, and it's not a software issue. I've also replugged everything back to the breadboard version and the problems disappeared. I've examined several times the perfboard version but I can't figure out what could be causing the problem.

Is there any way someone could help me figure this out?

Thank you.

Have you added 0.1uF (100nF) decoupling capacitors on all of your IC's (between power and ground pins)?

Not yet, since the whole thing isn't connected to the servos it's supposed to operate (and that's the reason I was told to add those capacitors). But anyway, the breadboard circuit work without them, so I'm thinking it must be something else.

Pins 11, 12 on second HC595 not connected anywhere?

Sorry, that was left out of the schematic. Pins 11 & 12 are of course connected to the Uno, 10 to 5V and 13 to GND (just like the first 595). The only pin not connected to anything is the serial out pin of the second 595 (pin #9).

and that's the reason I was told to add those capacitors

No, you should ALWAYS include power supply decoupling capacitors.

ALWAYS include power supply decoupling capacitors

I will, thank you. However, the problem I had is my candidate for the Stupid Oversight of the Day contest: Arduino's ground and the circuit's ground should eventually meet somewhere, of course...

Thanks a lot for all your suggestions, you made me look yet again at what I thought was properly wired :slight_smile:

Any logic circuit switching LEDs at logic rates will need good decoupling because typical CMOS logic signals are very fast (change at 1000000000 volts/second) and LEDs cause significant currents to be switched (currents changing at 4000000 amps/second/LED). I put the zeroes in full to labour the point.

Its these high rates of change (together with stray capacitance and inductance) that can cause the supply voltage to "flap about like crazy" if not strongly decoupled. For an LED switching circuit suggest using 0.1uF or 0.22uF ceramic per IC, and say a 22uF capacitor as well per board or circuit. For higher currents you keep increasing the decoupling.

(Actually they don't really "flap about like crazy", but significant spikes are induced that can cause any part of the digital circuitry to malfunction - you don't want to be chasing phantoms, so always decouple logic circuits) Decoupling capacitors for each chip must be mounted close to the chip. That's within 1/2 inch if possible.