Ethernet Based Home Automation using Arduino: I hope you already visited my series of home automation projects. I have used various ways like Serial communication with a computer, IR remote and receiver, Bluetooth, Voice Control and GSM based home automation system using Arduino. Now I am using Ethernet shield to control devices from a distance. Arduino is the brain of this project. Ethernet shield is used to connect Arduino to the internet to get instruction to switch appliances on and off from a webpage. So in this ethernet based home automation project, we will be able to control home devices through web server which can be accessed from anywhere around the world.
- 1 Block Diagram of Ethernet based home automation project
- 2 Components required for Ethernet based home automation system
- 3 Circuit Diagram of Ethernet based home automation project using Arduino
- 4 Working of Ethernet based home automation project using Arduino
- 5 Implementation:
- 6 Code for Ethernet based home automation system
Components required for Ethernet based home automation system
- Arduino Uno: We use Arduino Uno due to its compatibility with Ethernet shield we can also use Arduino Mega but Uno works great. It is very useful when prototyping a project.
- 4 Channel Relay Modules: The relay module we use in this project is HL-54S. It switches on and off using a 5-volt logical signal from Arduino. It can handle up to 250V alternate current and holds up to 10A. These modules have 4 relays so we can control 4 AC appliances at a time.
- Ethernet Shield: The Ethernet Shield connects your Arduino to the internet in less than a minute. Just plug this module onto your Arduino board, connect it to your network with an RJ45 cable. This module is open source, it’s all documents schematics are available on Arduino website.
The shield contains a number of informational LEDs:
- PWR: indicates that the board and shield are powered
- LINK: indicates the presence of a network link and flashes when the shield transmits or receives data
- FULLD: indicates that the network connection is full duplex
- 100M: indicates the presence of a 100 Mb/s network connection (as opposed to 10 Mb/s)
- RX: flashes when the shield receives data
- TX: flashes when the shield sends data
- COLL: flashes when network collisions are detected
- AC bulbs with holders: AC bulbs are used to represent appliances. Because it is easy to handle and very useful when you are prototyping any AC project. In final product just replace with AC socket to control.
- AC wire with plug: Always use good quality wire when to work with higher voltages. And protect and cover the connections using tape or heat shrink tubing.
- External 5 Volt supply: External 5 volt dc supply is used to switches the relay on and off.Otherwise it did not work.
As we use few components so the connection is very easy.First of all, mount the Ethernet shield on the Arduino Uno; this shield is also Arduino Mega compatible so you can also use Arduino Mega in this project if you want to control more devices. Now we make a connection on the Ethernet shield.
- Ini1 of relay module to Digital pin 3.
- Ini2 of relay module to Digital pin 4.
- Ini3 of relay module to Digital pin 5.
- Vcc of relay module to 5v of Arduino.
- Gnd to a ground of Arduino.
- JDVcc to external 5v supply and ground to ground.
- Connect Wifi to Ethernet shield using Ethernet cable.
- Connect the appliances as shown in the diagram.
Working of Ethernet based home automation project using Arduino
First of all Ethernet shield connects to the internet and display an IP address on Serial monitor. This IP address is the URL to open the web page to control appliances. When we press the button on a web page the corresponding relay is switch on and off.The following code is used to display text on a web page and make a button on it. You can change the text and the labels on the button by modifying following code.
client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println(); client.print("<center><br><h1>Ethernet based Home Automation</h1><br><br><br><FORM>"); client.print("<P> <INPUT type=\"submit\" name=\"status\" value=\"S1 ON\">"); client.print("<P> <INPUT type=\"submit\" name=\"status\" value=\"S1 OFF\">"); client.print("<P> <INPUT type=\"submit\" name=\"status\" value=\"S2 ON\">"); client.print("<P> <INPUT type=\"submit\" name=\"status\" value=\"S2 OFF\">"); client.print("<P> <INPUT type=\"submit\" name=\"status\" value=\"S3 ON\">"); client.print("<P> <INPUT type=\"submit\" name=\"status\" value=\"S3 OFF\">"); client.print("</FORM></center>");