First of all you will need the following; an Arduino, Arduino Relay Module, Wires and a 240v electrical appliance you wish to control the power to. ( You may notice the Ethernet Module of my Arduino) This is for the next guide which will show you how to control the relay using ethernet but whether you have this module or not this guide will still apply.
Okay no that we have our kit, the first thing we will need to do is connect the relay to the Arduino as shown below
You will need 3 cables.
Cable 1 Goes from GND on the Arduino to GND on the relay
Cable 2 Goes from Pin 7 to IN1 on the relay
Cable 3 Goes from 5V on the Arduino to VCC on the relay
Once that is done you will need to upload the following code to your Ardwino Uno (Don’t forget to select the COM port if you get an error with the upload)
#define RELAY1 7
digitalWrite(RELAY1,0); // Turns ON Relay
delay(3000); // Wait 3 seconds
digitalWrite(RELAY1,1); // Turns Relay Off
This is the main part completed now and will now require us to wire up our AC appliance.