I have an small problem, I'm using 2 595 shift registers to control my 16 relays board.
The problem is that when I power the Arduino, the shift registers are powered (by the 5V pin of the Arduino) before the Arduino program starts, I suppose this is the cause of the shift registers having a random state (which turns ON few of my relays, and I don't want that) until the program run normally.
What can I do about it? Thanks!
You can apply a pull down resistor on the enable output pin and only drive this pin high once you have loaded the shift registers for the first time.
Ok, thank you Mike I will try that, this require using an additional Arduino pin but no problem I have a Arduino Mega.
I have found another solution on Nick Gammon's website, but have a little problem with it.
The 10K pull-down resistor on the SS (Slave Select) is designed to keep the registers from clocking in bits while the main processor is booting, and the SS line might be "floating" and in an indeterminate state.
Problem with this, is that when power is applied, all the outputs of the shift registers are HIGH.
But in reality this is not a problem for me because my relay board is Active LOW :). But just to know, is there a solution to this problem?
So I tried with your solution, it worked as should (all outputs are LOW on powerup), but the OE pin is Active LOW so I needed a pull UP resistor (is this correct?).
Anyway, I will use the previous solution since as said my relay board is active low so I need the shift registers outputs to be HIGH at powerup
but the OE pin is Active LOW so I needed a pull UP resistor (is this correct?).
Yes or you could use an inverter.
The other thing is that you could attach the master reset pin 10 to the arduino reset pin and have all the bits set to zero each time you reset the processor.
He needs output bits at 1 tho.
So pull OE/ high and control it from an arduino pin, and add pullup resistors to the outputs if needed.
CrossRoads, your solution worked best, I had some problem with the other one(I first tried with USB power, it worked well but with external power (9V) sometimes fail).
Thanks both I now understand much better how to use pull up/down R
Just one more question: how to determine a good value for pull up/down resistor?
Actually my relay board isn't connected to the breadboard, instead I use LEDs (with 220ohm resistors). With your solution CrossRoad, I tried pull ups of 3Kohm, 4.7Kohm, 10Kohm. Everytime, the LEDs are ON at powerup, but with 3Kohm they are a little brighter than with 10K (as expected).
Am I correct assuming that even if the LEDs are very dim (with the 10Komh for example), then it is still a logical HIGH level, and so that it will not turn ON my relay?
Ok thank you
Here is my current breadboard (.svg), maybe useful for someone else
I'm happy to tell that this method (pull up on outputs + OE pin controlled by Arduino) is working perfect!
I added my HC-07 Bluetooth module to the thing, I can now control the relays wirelessly! I love it