ARDUINO A000110 4 Relays Shield User Manual
- June 15, 2024
- ARDUINO
Table of Contents
ARDUINO A000110 4 Relays Shield User Manual
4 Leds Example:
This example shows you how to pilot the switch on of 4 Leds by 4 Relays
Shield.
Note:
In this example are used 4 Leds to demonstrate the operation of the 4 Relays
Shield but you can connect to relays other types of loads and create your
personalized sketch.
Hardware:
- Arduino board
- Arduino 4 Relays Shield
- 4 Leds
- 4 Resistor 220Ω
- Wires
Circuit:
Mount your 4 Relays Shield on an Arduino board, connect the “Common” contacts
(C) of the Relays to power pin “5V” of the Shield.
Connect all anodes of the Leds (usually the longer pin) in series to a
resistor of 220Ω and connect them to “Normally Open” contact (NO) of the
Relays.
Also connect the cathodes of the Leds to Ground (GND) of the Shield.
Finally connect the board to PC with a USB cable and upload the sketch.
Now you can pilot each single Led by the relay that it has been connected.
Code:
This sketch pilots 4 Leds.
First it switches on the led1 connected to relay1, after one second it turn on
the led2 connected to relay2, exceeded another second it turns on the led3
connected to relay3 and finally, passed one second, it switches on the led4
that it is connected to relay4.
When all Leds have been turned on it waits one second and it turns off a led
each second, starting from led4 untill to led1.
The relay1 is piloted from pin 4, the relay2 from pin7, the relay3 from 8 and
the relay4 from pin 12.
The commutation is commanded by “digitalWrite()” function.
When the relays are set as LOW, the “Common” (C) contact is connected to
“Normally Closed” (NC) contact.
Instead when the relays are set as HIGH, the “Common” (C) contact switches and
connects to “Normally Open” (NO) contact.
Here you can download the Schematic of 4-Relays Shield.
The complete code and its detailed description are shown down.
/4-Relays Shield Example/
//define variable
int RELAY1 = 4;
int RELAY2 = 7;
int RELAY3 = 8;
int RELAY4 = 12;
void setup()
{
//set Relays as Output
pinMode(RELAY1, OUTPUT);
pinMode(RELAY2, OUTPUT);
pinMode(RELAY3, OUTPUT);
pinMode(RELAY4, OUTPUT);
void setup()
{
//set Relays as Output
pinMode(RELAY1, OUTPUT);
pinMode(RELAY2, OUTPUT);
pinMode(RELAY3, OUTPUT);
pinMode(RELAY4, OUTPUT);
}
void loop()
{
digitalWrite(RELAY1,HIGH); // Turns ON Led1
delay(1000); // Wait 1 seconds
digitalWrite(RELAY2,HIGH); // Turns ON Led2
delay(1000); // Wait 1 seconds
digitalWrite(RELAY3,HIGH); // Turns ON Led3
delay(1000); // Wait 1 seconds
digitalWrite(RELAY4,HIGH); // Turns ON Led4
delay(1000); // Wait 1 seconds
digitalWrite(RELAY4,LOW); // Turns OFF Led4
delay(1000); // Wait 1 seconds
digitalWrite(RELAY3,LOW); // Turns OFF Led3
delay(1000); // Wait 1 seconds
digitalWrite(RELAY2,LOW); // Turns OFF Led2
delay(1000); // Wait 1 seconds
digitalWrite(RELAY1,LOW); // Turns OFF Led1
delay(1000); // Wait 1 seconds
}
Reference Designs ARE PROVIDED “AS IS” AND “WITH ALL FAULTS”. Arduino
DISCLAIMS ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, Arduino may make changes
to specifications and product descriptions at any time, without notice. The
Customer must not
REGARDING PRODUCTS, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE rely on the absence or
characteristics of any features or instructions marked “reserved” or
“undefined.” Arduino reserves these for future definition and shall have no
responsibility whatsoever for conflicts or incompatibilities arising from
future changes to them.
The product information on the Web Site or Materials is subject to change
without notice. Do not finalize a design with this information.
“Arduino” name and logo are trademarks registered by Arduino S.r.l. in Italy,
in the European Union and in other countries of the world.
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>