The Arduino Relay Shield is an add-on board for any Arduino Uno microcontroller. This board is designed to make connecting a relay to your Arduino as easy as possible. The board features two 10A / 250VAC relays and all the support circuitry required to control them. The Relay Shield is manufactured in Canada with North American sourced relays and electronic components. With headers installed, the Arduino Relay Shield and Arduino form a compact and reliable control package.
The board is constructed around two sealed relays. Each of these relays is rated to a minimum of 10A on each contact at 16VDC or 250VAC. As relays cannot be directly controlled by an Arduino, each relay has transistor-based control circuit, complete with flyback diode and an indicator LED. The indicator LED is illuminated when the relay is energized. Each relay is used in a dry contact configuration, and both relay contact sets are completely independent from the other.
Large, high quality screw terminals are used to connect all the high voltage / high current contacts on each relay. Each terminal is rated at 300V / 13.5A per contact and will accept wires from 16AWG down to 30AWG. All connections to the Arduino are made via the stacking headers. On this board we use the Uno R3 Version of the Arduino Stacking Header configuration. Standard breakaway headers or stacking headers can be installed on this board depending on the application.
Because devices are not always operating in a pristine environment, air gap isolation is routed into the board. This is done to reduce any leakage current between the higher voltage / current portion of the board and the low voltage Arduino. As time goes on, dirt and moisture may accumulate on a PCB, this can allow a small amount of current to flow in undesirable ways. Increasing the creepage distance with these air gaps reduces this.
A large prototyping area is also made available in the extra space on the circuit board. The roughly 5 x 14 grouping of plated through-holes are not interconnected and allow for the permanent installation of additional connectors or components to complete your device. These feature a standard perfboard / breadboard pitch of 2.54mm ( 0.100” ).
Compatible with all Arduino and Arduino compatible boards with 5V available using the Arduino R3 pin standard.
The board was intended be used for basic automation scenarios such as switching something on or off at a specific time or based on a sensor input. Some examples:
All Arduino pins are brought up through the header. While this board does not make use of most of them, we have doubled them up next to the headers to give easy access to all pins just incase you need to configure the relays to use alternate control pins, or they are needed for extra circuitry in the prototyping area.
In the Arduino R3 configuration the 8 pin “Power” header provides access to all power and the reset pin of the Arduino. The Arduino Relay shield brings all 8 pins onboard and provides an additional access point for each pin. The shield uses the 5V pin and GND pins to power the relays and indicator LEDs.
The 6 pin Analog Input Header is unused by the shield, but we do provide an additional access point to each pin on the shield.
The 2×3 pin ICSP header is unused by the shield, but the pins are located in the correct location and can be used as a pass through if needed. If not needed, these pins are not connected on this board and can be included as part of the prototyping area.
The shield uses digital pin #7 as control for Relay #1, this is contained within the 8 pin Digital Header. All other pins are unused, but access is provided to them by way of an additional access point.
The second relay is controlled by digital pin #8 within the 10 pin Digital Header. All other pins are unused in this header, but access is provided to them by way of an additional access point.
Each relay features a large 3-pin screw terminal for connection to each of the high voltage / high current contacts of the Relay. The screw terminal is rated at 300V and 13.5A per contact.
Both relays are used in a dry contact configuration and the contact sets are completely independent from the other. Each screw terminal provides access to the adjacent relay’s COM (Common) pin, NO (Normally Open) pin, and NC (Normally Closed) pin. The COM pin connects to the common pin on the relay, while the NO and NC pins connect to the NO and NC pins on the Relay.
If there is a conflict between the pin requirements of the 2 Channel Arduino Relay Shield and another board, we have set the relay shield up to be able to use alternate pins. Each relay has a solder jumper that allows for the control line to be diverted to a through hole pin rather than the Arduino pin. From this through hole pin, wire can be routed to an alternate Arduino pin on the board.
To use these solder jumpers, a trace will need to be cut between the two pads. A hobby knife or even a small flat blade screwdriver with a sharp corner will easily break the connection. Cut / scribe at the arrow in the below photo.
If you have a multimeter handy, check there is no continuity between the two pads. Now that the connection is broken, use a soldering iron and a blob of solder to bridge the middle pad and the opposite pad instead.
If this modification ever needs to be reverted back to the “Normal” pin, just remove the solder blob, and create a new one that replaces the trace that was cut before.
Based on Arduino R3 Standard. Clone boards may vary.
Provisions for modifying control pins available. Soldering required.
The only assembly required with the 2 Channel Arduino Relay Shield is the addition of breakaway headers or stacking headers. Both options can be used, and it will be up to your application whether stacking headers are needed or not.
For the simple stacking of this board on top of an Arduino Uno R3 we recommend our Breakaway Male Header – Long. These tall headers give a little extra clearance over the larger USB input on the Arduino.
For boards such as the Arduino Uno R4, Arduino Leonardo, SparkFun Redboard, or Adafruit Metro, where clearance is not an issue, Breakaway Male Header – Standard can be used to create a more compact assembly.
If you wish to stack on top of this board, using our Arduino Stacking Headers will work. It should be noted that with stacking headers, the height required to clear the relays is significant. Our Breakaway Male Header – Long will be required for the board above it.
The 2 Channel Arduino Relay Shield uses non-latching conventional relays to switch high voltage / high current devices. These relays are well suited for many applications and effectively act as a SPDT (Single Pole, Dual Throw) switch that is controlled by an Arduino.
The operational logic of this board is very simple; when Digital Pin 7 or 8 are set to the “HIGH” state with your Arduino, the respective relay coil is energized, triggering the relays to change contact positions. As long as the digital pin remains “HIGH”, the coil will remain energized in the “ON” state. If the Arduino pin is set “LOW” or power is lost, the relay will immediately return to its original “OFF” contact position.
The mechanical relays used on this board are not designed for high speed switching. While they can typically engage within 10ms and release within 5ms, the switching frequency should be kept to a minimum. For high speed switching, we suggest looking into Solid State Relays or Power MOSFETS.
Normal use would see a power source run through the COM pin of the relay. The output would be then run to the device from the NO (Normally Open) or NC (Normally Closed) contact. Which contact would be determined how you want the system to react.
Please be aware: Due to the relays and terminal blocks used on this board being through hole components, any high voltages used will be exposed on the bottom of the board where these components are soldered to the circuit board. As with all high voltage applications, if you are not familiar with best practices and proficient in working with high voltage devices, we recommend consulting a professional.
Source power should be appropriately protected with a fuse or circuit breaker designed for your application. High current or high voltage devices need appropriately rated wire, fusing, and protection.
Very basic Arduino code to supply power to a small pump when water reaches a certain height. Pump connected through Relay #1
const int waterSensorPin = 3; // Water level sensor connected to digital pin 3
const int relayPin = 7; // Digital pin 7 for Relay #1
void setup() {
pinMode(waterSensorPin, INPUT);
pinMode(relayPin, OUTPUT);
}
void loop() {
int waterLevel = digitalRead(waterSensorPin);
if (waterLevel == HIGH) {
digitalWrite(relayPin, HIGH); // Set relayPin HIGH
} else {
digitalWrite(relayPin, LOW); // Set relayPin LOW
}
delay(1000); // Optional delay to avoid rapid switching, adjust as needed
}
Very basic Arduino code to control a fan connected to Relay #1 . The fan is switched on for 5 minutes, and then off for 1 Hour.
const int fanPin = 7; // Digital pin 7 to control Relay #1
unsigned long fanStartTime = 0;
const unsigned long fanDuration = 5 * 60 * 1000; // 5 minutes in milliseconds
const unsigned long fanInterval = 60 * 60 * 1000; // 1 hour in milliseconds
void setup() {
pinMode(fanPin, OUTPUT);
}
void loop() {
unsigned long currentTime = millis();
// Check if it's time to turn on the fan
if (currentTime - fanStartTime >= fanInterval) {
fanStartTime = currentTime; // Reset the start time
digitalWrite(fanPin, HIGH); // Turn on the fan
}
// Check if the fan has been on for the specified duration
if (currentTime - fanStartTime >= fanDuration) {
digitalWrite(fanPin, LOW); // Turn off the fan
}
// Your other non-blocking code can go here
}
Very basic Arduino code to read a DHT11 Temperature Sensor. When the temperature drops below 0.0°C , switch on a heating pad connected to Relay #2 until the temperature rises above 0.0°C again. A 10 second delay is used to prevent rapid switching.
#include
#define DHTPIN 2 // Pin where DHT11 is connected
#define DHTTYPE DHT11 // DHT sensor type
const int heatingPadPin = 8; // Digital pin to control Relay #2
DHT dht(DHTPIN, DHTTYPE);
void setup() {
pinMode(heatingPadPin, OUTPUT);
Serial.begin(9600);
dht.begin();
}
void loop() {
float temperature = dht.readTemperature();
// Check if temperature is below freezing
if (temperature < 0.0) {
// Turn on heating pad
digitalWrite(heatingPadPin, HIGH);
Serial.println("Heating pad ON");
} else {
// Turn off heating pad
digitalWrite(heatingPadPin, LOW);
Serial.println("Heating pad OFF");
}
delay(10000); // Adjust the delay as needed to control the update rate.
}
For more information on how to use this product please check out the resources below:
July 2020 – Version 2.0 Released