Go Down

Topic: Bootloader without turning pins on/off when booting up (Read 2 times) previous topic - next topic

Graynomad

Yes, at the time it wasn't known (by me anyway :)) what was driving these relays.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

retrolefty


Quote
[floating pins] could then do anything and you relay board will follow suite.

I would think that the usual bipolar-transistor driven relay board actually requires substantial current (mA rather than uA) to turn on.  An IC-driven relay board could be much more sensitive...



Actually the majority of those asian 'relay boards' that actual post a simple schematic (often showing only a single channel) use the same type of input logic. On the 2 channel relay board I have I can 'activate' an input channel by just having two wires to the arduino, one to an arduino's output pin and one to the arduino 5V shield pin. The current flow (I measured 2ma to activate an opto's input) from 5V pin through a 1k ohm resistor, in and out of the opto's input led, then in and out of a series on board indicator led (red) and then on to the relays channel input pin on to the arduino's output pin, and when set LOW allows 2ma to flow and activate the optoisolator channel. Note that no arduino ground connection is required to just activate a channel's optoisolator on or off.

A arduino ground connect is required if you wish the arduino to provide the +5vdc to power the opto's output transistor, the current switching npn transistor and of course the relay coil, however in that case you are defeating the benefit of having complete opto isolation between the arduino and the relay card. In this case the current to power the relay is being pulled from the arduino's 5V pin, not each digital output pin. I didn't measure the 5vdc current draw to activate a relay coil ( I just measured that the arduino output pin sinks 2 ma to activate the opto's input) but it would be whatever the DC coil resistance is for the relay(s).

However to take full advantage of the ability to have complete galvanic isolation from the arduino to the relay card there is a Vcc jumper on the relay board that allows one to use an external +5vdc power source to provide the relay power and then again one would not have a ground wire from that arduino wired to the relay board or the external 5 vdc power source.

So it can be a little confusing in that relays themselves offer galvanic isolation between the circuit they are controlling via their contacts and the rest of the relay boards circuity, but there is available on these boards the ability to offer an additional level of isolation between the arduino and the relays coil driving circuitry, by pulling a jumper and providing an external 5vdc source.

So in closing I can state that these asian relay boards are fairly cleaver and flexible in there design options and are certainly inexpensive. Features like the opto isolated inputs, the on-board led indicators are nice to have. However their typical documentation is either totally missing or very sketchy at best. The fact that one needs to output a low to activate a channel is probably the first thing that confuses beginners using these boards. Add to that the ability to have two different methods of powering the relay coil circuity and you have a lot of room for confusion for beginners.

Lefty

westfw

If your relays are "active-low", you can avoid momentary ON glitches by setting the output state BEFORE you set the pin to an output:
Code: [Select]
digitalWrite(pin, HIGH);
pinMode(pin, OUTPUT);

StealthRT


If your relays are "active-low", you can avoid momentary ON glitches by setting the output state BEFORE you set the pin to an output:
Code: [Select]
digitalWrite(pin, HIGH);
pinMode(pin, OUTPUT);



Should that not be:
Code: [Select]

digitalWrite(pin, LOW);
pinMode(pin, OUTPUT);

Notice the "low" part instead of "high"? High would turn it on?

StealthRT

I stand corrected.. it was only pin 13 that was coming on/off on reset/power.

Resoldered it to another pin so this is now solved. BUT! with a lot of helpful tips and input for when i do just need to run code and not the stock bootloader.

Thanks for your help everyone!

Go Up