Stabilzing output pins on reset - how?

Hi all,

sorry for being such a noob, but i’ve got a relay module with optocouplers that are being activated by pulling the pin LOW (sink-in) connected to an an Arduino Uno.

The circuit on the relay-board is like:

     VCC ------------+
                     :
                     #
                     # 1K
                     #
                     :
                     V  Optocoupler
                    '''
                     :
                     :
     D0  -----:<-----+
              LED

Problem is: When the ATMega resets the relay is activated which is very unfortunate.

I tried to add a 10K pull-up betweem D0 and Vcc but this did not change anything (since the 1K on the board is lower, i guess).
However i don’t understand why the relay is switching because if D0 is input and high-impedance on reset how can current flow at all?

I guess i’m missing something obvious here, sorry. Is it possible to “silence” the ports during reset at all?

An relay module with opto-coupler is good, but you should have bought a normal one :grin:

The Arduino Uno uses pin 0 and pin 1 for the serial port, which is used to upload a new sketch. The bootloader uses them. Pin 13 is for the system led and is also activated by the bootloader.

Try pin 2 and see what happens.

Did you try another digital port other than 0 and 1? you need to change your code and maybe wiring, because sinking INT port cause relay to switch. You need to decide how your relay be Normally Closed or normally Open, then change your code according to it.

omersiar, Peter_n, you're both right...

Peter_n:
An relay module with opto-coupler is good, but you should have bought a normal one :grin:

Why? :frowning:

Peter_n:
The Arduino Uno uses pin 0 and pin 1 for the serial port, which is used to upload a new sketch. The bootloader uses them. Pin 13 is for the system led and is also activated by the bootloader.

facepalm

That was it. Using another pin as D0/D1 does work as expected .... :blush: Oh my...

Those modules are cheap and sold by less good sellers.

Use good things from www.adafruit.com or www.sparkfun.com
Or buy cheap modules from Ebay, many of those are more compatible and cheaper than the modules sold by some "less good" sellers. Where did you buy it ?

sonderstorch:
omersiar, Peter_n, you're both right...

Peter_n:
An relay module with opto-coupler is good, but you should have bought a normal one :grin:

Why? :frowning:

Yes, why? An optoisolator is always better.

I ment it like this: step 1: an optocoupler is always good, step 2: get one with normal polarity with the optocoupler to ground.

Peter_n:
I ment it like this: step 1: an optocoupler is always good, step 2: get one with normal polarity with the optocoupler to ground.

Poppy cock. A relay input optoisolator requires several milliamps of current flow to operate and that doesn't happen by accident or reset or power up. Using active high or active low polarity makes no difference and either kind will work well if wired correctly and avoid pin conflicts.

True, I still mean something else.
A normal polarity for the input of the relay module requires less work for my brains.
Those are typical the kind of modules that are sold by dx.com and alike.

In my opinion there are two options:
1 ) Buy from the official Arduino store or Sparkfun and Adafruit and other good sellers. The give all the schematics and information.
2 ) When buying something cheap or unknow, don't pay extra for something that is not compatible, buy the cheapest or the cheapest compatible. In most cases, that means bying the cheapest on Ebay. As long as shipping from China costs almost nothing, lets use it.