Arduino Relay module

Arduino Add comments

Ever wanted to control the lights from your home computer?
Or perhaps some other appliance in the house?

This post is a copy of this Arduino Relay on Ebay. I am replicating it here because ended items on Ebay are not indexed by Google, the author’s page is written in Chinese and doesn’t contains the Source code. If you are the author and you are obset with this, please get in touch.

Appliances with high voltage and current can’t be controlled by the Arduino digital IO ports directly, we need a relay to solve this problem. The Arduino Relay module allows Arduino Sensor Shield with digital outputs to control larger loads and devices like AC or DC Motors, electromagnets, solenoids, and incandescent light bulbs.

-Featuring Omron G5LE relay-Switching capacity of 250 Vac / 5 Vdc -LED indicator display the output status of the Relay Module-Compatible with our Arduino Sensor Shield



-Connect to external appliance

-Connect to digital IO port of Sensor Shield

-Not neccessary when using Sensor Shield, only for use directly with Arduino or other MCU

WARNING: When working with this device, you will be dealing with ~120V / ~220 AC. This is considered HIGH VOLTAGE, which as many know, can be lethal. Be careful when working with high voltage; NEVER work on this when it is plugged in. Make sure all connections are how they should be, and verify that they are fully insulated and won’t short each other out, or you could cause a fire. Also, be aware of what is going on around you, be alert, and never work on with high voltage if you feel you can’t devote enough concentration towards what you are doing. And lastly, if you ever have to service the connections inside this device, ALWAYS unplug it before doing so.

In this experiment, we will need the Arduino Duemilanove, Sensor Shield, Relay module, LED module, Button Switch module and a 220V or 110V desk lamp. A relay is an electrically controlled mechanical switch. Inside the little plastic box is an electromagnet that, when energized, causes a switch to trip.


Example of using Relay module to switch a household desk lamp

1. Stack the Sensor Shield onto the Arduino Duemilanove, and connect the modules with our specialized cables at the buckled end.

2. On the other end of the cables, connect the Relay module to digital pin 8, LED module to digital pin 13 and Button Switch module to digital pin 2.

3. Now, let’s test the arduino connection before connecting the appliance. Copy the code below and upload to the arduino.

int switchPin = 2;
int relayPin = 8;
int ledPin = 13;
int value = 0;

void setup() {
 pinMode(switchPin, INPUT);
 pinMode(relayPin, OUTPUT);
 pinMode(ledPin, OUTPUT);
}

void loop() {
 value = digitalRead(switchPin);
 if (HIGH == value) {
  digitalWrite(relayPin, HIGH);
  digitalWrite(ledPin, HIGH);
 } else {
  digitalWrite(relayPin, LOW);
  digitalWrite(ledPin, LOW);
 }
}

When you click the push button, the relay will give out a very satisfying clicking sound, which means it is switching the appliance.

4. My desk lamp is in UK wiring system without earth (ground), so you only see two wires in the cord. Cut the hot (live) or neutral wire in half and expose metal in 5mm. Here is a table to show the color of each wire:


5. In the relay module, we will only use the wire contacts on the left (the one above the “Relay” logo) when we connect it with the Sensor Shield. There are 3 wire contacts. We can use either set A or set B as shown in the picture, just make sure the middle one is used.



6. Screw the two wires into the contacts. Make sure no metal wire is exposed outside of the plastic for safety.

7. This last step is easy, plug the socket of the appliance and you can control the on/off by the arduino now.

Wires Color in US Colour in UK
hot/live Black Brown
neutral White Blue
earth/ground Green Yellow/Green
Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists

One Response to “Arduino Relay module”

  1. Efstathios Xatzikiriakidis Says:

    I see there are two brown wires.. Why?

    The cable has a small brown and a big blue..

    Where the blue is going??

    What is the biggest brown wire?

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in