Reset switches relay

I have an arduino controlling a relay board, when I send a digital high the relay in switches. All good so far, problem is when the arduino reboots, the digital output goes high for a fraction of a second and causes the relay to switch. I thought of using an RC circuit that would slowly charge the voltage but as the relay boards input is a transistor I'm not sure this would work or be the ideal solution. Is there a way to stop digital outputs going high during a reset?

Try adding pull-down resistors to the output pins.

johnwasser:
Try adding pull-down resistors to the output pins.

So if I connect a 10k resistor between the pin and ground?
So in between the pin and the input to the relay I have a resistor connected to gnd?

the digital output goes high for a fraction of a second and causes the relay to switch

What pin are you using as the output?

So in between the pin and the input to the relay I have a resistor connected to gnd

Yes

Even with a pull down it will still briefly go high on a reset as the pin used goes high on reboot.

The easiest fix i guess, have the output fill a capacitor (so that the resistor slowly charges the cap pulling in the transistor to give a high out on the relay.

The capacitor/resistor value could give you a delay of a second or more before the relay activates, i’d use a 10 ~ 100k to bleed the cap when the signal is low…

Or.

Modify the boot loader or change (if possible) to an unused pin.

Which digital output pin are you using? One or two pins go high when the bootloader is running (pin 13 on a Uno AFAIR), but most don't, they just start up in the input state. Most relay boards and relay driver circuits I have seen will not turn the relay on when the pin is defined as an input. So you may just need to use a different output pin.

I am using pins 7 and 8 to trigger the 2 inputs of the relay board. Thing is, the ppins don't clonnect straight tot he relay,they go visa transistor. I thought about the R-C circuit but would that work with the transistor? Surely it will start conducting at anything over 0.7 volts?
What pins would you folks suggest I use? I have an led connected to the outputs and can see them faintly glow when the circuit is resetting or the PC is connecting.

Are you sure it isn't the LEDs that are causing the relays to come on? Try disconnecting them.

OK, will give that a try but I also have another change issue. I seem to only be able to switch on and off the relay a few times before the arduino hangs and I have to disconnect and reconnect again. Its not a straight relay I am connecting to but a relay boardnfor an arduino so I assume it has diode protection etc, any idea what this problem could be caused by?

craigja:
Its not a straight relay I am connecting to but a relay board for an Arduino so I assume it has diode protection etc, any idea what this problem could be caused by?

Nevertheless, the relay board is not being supplied with power from a connection on the Arduino board is it?

It is being supplied with power from the arduino - is this a no no?

if you’re powering a relay directly (eg, not an expansion board which requires a 5v input), yes it’s a no no.

Its a little expansion board that takes a 5 v input. Is that OK to be powered from the arduino, which in turn is connected bua USB to the laptop?

I would most certainly not be comfortable with powering the relay from the USB supply, even with the back-EMF diode. All the more so with a laptop.

I would punt that if you power the relay (module) from a separate supply, the problem disappears!