Relay boards: two and four channels
The green boards with a row of blue relays, one screw terminal per relay and a control header at the end.
Each channel is the single relay module, and the boards add one thing everybody trips over: they are active low.
Pins
| Pin | What it does |
|---|---|
GND |
Ground. |
IN1 to IN4 |
One input per channel. LOW switches the channel on. |
VCC |
5 V for the coils and the optocouplers. |
NO1, COM1, NC1 and so on |
Each channel's changeover contact. |
Properties
trigger: low (the default, as on nearly every board sold) or high.
pull_ms and release_ms: 10 and 5 ms, the SRD-05VDC's times.
Active low, and the click at power-up
Each input goes to an optocoupler's LED, whose other end is on VCC. Pulling IN
low lights it, which switches the relay's transistor, which pulls the coil in. So
digitalWrite(pin, LOW) switches a channel on and HIGH switches it off, and an
unwired input is off.
A sketch that calls pinMode(pin, OUTPUT) before writing the pin HIGH leaves it
low for that instant, and every channel clicks on at power-up. Write the pin HIGH
first, then make it an output.
What the model gets right
Everything the single module gets right, per channel: the 10 ms pull-in and 5 ms
release, the arm touching neither contact while it travels, and no coil pulling in
under 4 V of VCC. Each channel's red LED lights while its coil is energized.
What it does not model
The optocoupler as a circuit: the input is a logic level against half of VCC,
where a real one is an LED that a 3.3 V high on a 5 V board may still half light.
The JD-VCC jumper that lets the coils run from their own supply is not brought
out: VCC powers everything. Coil current (about 70 mA a channel, 280 mA for four,
more than a USB-powered board likes), contact bounce, and the 10 A contact rating.
See it in action
Relay board runs a chase round four lamps on a four-channel board, and Relays reverse a motor uses a two-channel board as an H bridge. Open them at /templates.
Arduino relay module: active LOW and startup clicks walks through why LOW turns a channel on, the click at power-up and a module that will not switch, on the Relay board circuit.