Author Options:

Random flashing LEDs when using shift registers and turning on the system: how to fix? Answered

I have a setup using 5 shift registers (74HC595s) hooked up to an arduino micro. Everything works great! So much so, that I didn't pay too much attention to the start up issue.

When I start up the system (either by hooking up a battery or plugging it into a USB socket) the LED's hooked up to the 595's will either turn on according to the last pattern they had, or turn on randomly. I was following the Arduino tutorial for this, and it does state that "The one flaw of this set up is that you end up with the lights turning on to their last state or something arbitrary every time you first power up the circuit before the program starts to run." It also states "You can get around this by controlling the MR and OE pins from your Arduino board too, but this way will work and leave you with more open pins." However, I'm either missing it or it is not outlined how to hook up the MR and OE pins to the setup to correct this.

Any help is greatly appreciated! 


Tie all the MR pins on your 595s together. Tie all your OE lines together. When the arduino starts, all its pin are pulled high IIRC. Connect the MR to a convenient pin, connect OE to a convenient pin. Drop MR when your program starts, then raise it again, and drop OE. If you ever want to turn all the lights off fast, drop MR

Just to clearify a few things:

If the Arduino starts and pulls all the pins high, wont that still cause the lights on the 595 to blink on? Or will the fact that the OE being high as well keep them off?

Would I want to pull MR low in the setup loop then? Stupid, I know, but I have a shiftout setting all the 595s outputs off, and this still causes the odd blink.


This is why I suggested you invert MR and OE from the arduino. Then they START LOW.

I'm not sure how...but it appears it was a faulty chip. I swapped out the trouble one for a new one, and it's working now, no problems! Thanks again!

I tried that as well. It's the weirdest thing...if I do invert the MR, I still get all the strings to stay off but that last on. Then, once the code loads, I get all the lights doing the right thing, but the last leg, which will turn off an not come back on unless I then toggle the MR pin of it.

I'm not sure WHAT the default is, for shame...Check. If they go HIGH on reset, you'll need an inverter to make sure MR is asserted LOW on boot.

With some of that lingo, I was actually able to find a post on the arduino forums for this. Looks like the OE pin should be pulled low, then high when I go to display things. Could I stick a pin high in the startup?

Just gave it a shot with a toggle switch to manually pull the OE pin low/high...and go figure, that did it! However..I'm a tad fuzzy on what the best way to do this would be now...you said to tie all the OE pins together: but how would that look? Is this the correct way to do that?

Notch that: I just set it up, and it's working! Totally forgot I have enough 595 to start a small shop...anyways, it works like it should, shy of the fact that the last 595 in the chain still does the random light issue. Any ideas on whats causing that issue? thanks!

your solution i mean't. sorry

Thanks steveastrouk. You solution worked.


3 years ago

I would use a separate LED supply switched with a MOSFET and make it normally OFF. Then preload your SR registers and only then apply the LED Power using a Arduino signal pin...!!

Just to make sure I'm on the right page here: your suggesting sticking a MOSFET on the main power leg of the 595, and setting it on once the arduino boots? And what MOSFET would you suggest for this? I [sadly] have yet to play with them too much...thanks!!