Look, your relay board is quite surely low side trigger one.
If you want to verify it, connect it like on your original post #1 and arduino 5V pin to one IN- pin of the relay. If it doesn't trigger, you have confirmation for low side.
Which connector. The DC socket.
With these relay boards you should only power the relay board, not the Arduino.
The Arduino gets it's power from the relay board.
One relay board needs a 5volt/1.5A(minimum) regulated supply.
If you only power the Arduino, then the relay board will draw power from the Arduino,
and that could potentially go wrong.
Leo..
yes that is why I started this topic ![]()
With these boards you would first enable internal pull up on the pin,
before setting the pin to output.
That stops brief relay activation during bootup.
A pin array could reduce the number of lines.
Leo..
const byte relayPin[] {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, A0, A1, A2, A3};
void setup() {
for (byte i = 0; i < 16; i++) {
pinMode(relayPin[i], INPUT_PULLUP); // first enable internal pull up
pinMode(relayPIN[i], OUTPUT); // then set to output
}
}
These boards work with reverse logic.
Writing a LOW to the pin will turn a relay ON.
A HIGH will turn the relay OFF.
If you only power the Arduino, then the relay board will draw power from the Arduino,
and that could potentially go wrong.
Not so, if relay logic header is wired correctly (5V - IN).
Of course.
No ground, no current path.
OP should have used 8-channel boards.
Projects like this often end in strange restarts and lockups of the Arduino, because of no user selectable opto isolation (the opto couplers on a 16-ch board are useless ornaments).
If you search this site then you might find several examples.
Leo..
For the 8 channel relay board I am reading that the vcc should be redirected to the arduino.
Yes, VCC must be used. Same for the 16-ch board.
Ground is optional, VCC is not.
Leo..
pinMode(relayPin[i], INPUT_PULLUP); // first enable internal pull up pinMode(relayPIN[i], OUTPUT); // then set to output
It's the same and a bit less confusing to write
digitalWrite(relayPin[i], HIGH);
pinMode(relayPIN[i], OUTPUT);
a7
digitalWrite(relayPin[i], HIGH);
This is the old way.
I remember there was a notification that not all platforms support this.
Leo.
This is the old way.
I remember there was a notification that not all platforms support this.
THX
File that under learning something every day.
I would have expected that writing to the port output bit, then to the data direction register to have a glitch-less startup, and be a more universal and plain way to do.
Whereas exploiting a curiosity of the AVR (UNO, Mega &c.) i/o pin circuitry (that the pull-up resistor is controlled by the output bit of the port) would be less portable.
a7
No relays are per default off
They are off because as you menioned you are not supplying any power to the boards. The relays are Active LOW
I am supplying power at the moment via the arduino.
Perhaps I am not understanding your definition of off.
In a working situation the Relays are default off. The signal from the arduino triggers the relay to go on/active (led turns on).
I am supplying power at the moment via the arduino.
That is why it is overheating. Both boards should have an external supply can be just on supply for both.
The signal from the arduino triggers the relay to go on/active (led turns on).
but you defined Active as being HIGH and that would turn the relays off.
I understand the overheating part. Again that is why I started this thread because I am working on external power for the relay boards.
My question in post 1 started with how to wire it correctly.
I have to say I am now completely confused on low vs high and active as inactive.
I am going to connect 2 relay boards in an opposite way and see what the difference is.
I have to say I am now completely confused on low vs high and active as inactive.
The confusion might come from mixing two different ideas: voltage level (high or low) and logic meaning (active or inactive).
“High” and “low” describe the electrical voltage on the control pin, where high means a high voltage and low means a voltage near zero.
“Active” and “inactive” describe what that signal does. “Active” means the relay coil is energized and the contacts switch; “inactive” means the coil is not energized and the contacts stay in their default position.
If a relay is “active low”, it energizes when the control pin is low and releases when the pin is high. If it is “active high”, it energizes when the control pin is high and releases when it is low.
What can be confusing too is that some relay boards provide both NO (normally open) and NC (normally closed) contacts. When the relay coil is inactive, COM is connected to NC and disconnected from NO. When the relay becomes active, COM switches to NO and disconnects from NC.
Other relay boards have only one output contact, meaning you can switch a circuit on or off in one direction only, typically through a single terminal marked “COM” and another marked “NO”. In this case, the relay simply connects COM to NO when it is active.
So honestly I am not sure if LOW or HIGH is used.
You need to determine if the load can be On with the power off to the Arduino. If it matters and must be off then you must use the NO and adjust your logic appropriately. If it doesn’t matter use either. The NO/NC on the relay indicates that its coil is not powered.
“High” and “low” describe the electrical voltage on the control pin, where high means a high voltage and low means a voltage near zero.
“Active” and “inactive” describe what that signal does. “Active” means the relay coil is energized and the contacts switch; “inactive” means the coil is not energized and the contacts stay in their default position.
If a relay is “active low”, it energizes when the control pin is low and releases when the pin is high. If it is “active high”, it energizes when the control pin is high and releases when it is low.
Based on your thorough explanation I would say the relay is “active high”.
As in the inactive position there is (almost) no voltage measurable on the control pin.
Will do some testing tomorrow on it.
I guess you need to add what "normal" means.
Normally, a relay is not energized, and the CO common contact is switched to the NC contact.
And with pushbuttons, normal is when no one is pushing the button.
Mostly you can compensate in software, unless the relay must be open when the system is powered off.Or when you don't want to have the relay energized 99 percent of the time - the natural deployment might want to have the relay not energized most of the time.
a7
Will do some testing tomorrow on it.
Finally..
I have to say I am now completely confused on low vs high and active as inactive.
Does it matter if you need to flick the lever of the light switch on the wall up or down to turn the light on. Same for an Arduino pin. It doesn't matter for the program to set the pin LOW or HIGH to energize the relays. YOU just have to get used to it, like drawing the curtains sideways to close them, now that's weird.
These relay boards are activated when the Arduino pin is LOW.
That's why you set the pins HIGH in setup(), to de-activate the relays on bootup (see post#24).
Leo..