Project tutorial

An Ethernet Powered Server for Home Automation © GPL3+

An WIZnet powered Arduino Server used for Home automation. The receiving end would be node MCU devices.

  • 2,097 views
  • 4 comments
  • 9 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
The main server component, the Data transmitter
×1
Nodemcu
NodeMCU ESP8266 Breakout Board
one of the data receiver
×1
12002 04
Breadboard (generic)
×1
Adafruit industries ada592 image 75px
USB-A to Micro-USB Cable
powering the photon and node mcu
×1

Apps and online services

WIZnet software
To setup the wiznet Ethernet connection for transmission of data commands
Ide web
Arduino IDE

About this project

What if you don't have a Pi or beagle borne board and you still want to setup a server that can be used for Home automation projects, then this is the project for you.

In this project, we will be setting up an arduino server that is powered by the WIZ750SR serial to Ethernet module. Then we will be sending the data commands which are received from arduino(serially) to the node mcu powered home automation device via internet. We will be using a Tenda router for this project, but feel free to use any router you like.

So lets start! First of all this is the list of all the components required :

1. Components Required

  • Arduino Uno
  • WIZ750SR serial to Ethernet module
  • NodeMCU
  • Tenda Router for connection setup
  • Breadboard
  • Jumper wires
  • Cables to power the Arduino and NodeMCU.

The images of these components are shown below:

So we can now move on to setup our WIZ750SR module.

2. Configuration of Module

Now, We need WIZ S2E configuration tool in our laptop or pc to setup our module. Here is the download link for the same:

https://github.com/Wiznet/WIZnet-S2E-Tool-GUI

This is the git link. You can also download the software from WIZnet's official website. Once you have downloaded and installed it, open the tool and set it up following the image below:

We can get our IP by simply going to our command prompt window and typing "ipconfig".

This completes the setup of our module, and hence our server. Now it will be ready for transmission once we have run our code into the arduino.

Now, lets configure our receiving end, i.e. the node MCU.

3. Node MCU Configuration

For configuring this, there is a really easy way available to us now. That is using the arduino IDE. Download the additional esp8266 package using the additional package download in arduino ide.

Now, its easy to code for both arduino and node MCU. The codes are attached below. Now we will see how our System will work using a block diagram shown below.

We have used this tenda router as an access point for this project as mentioned above.

So, now you can build your own Ethernet powered Arduino Server for home automation. The code I have given is for simple LED control using this method.

You can utilize this for home automation by using relays with the node mcu. The schematic of the following is shown below,

So, the project is over here, feel free to comment or message me privately if you have any doubt with the project, Thank You!

Code

Node mcu codeC/C++
#include <ESP8266WiFi.h>
 
const char* ssid = "Dhairya";
const char* password = "paddword";
 
int ledPin = 13; // GPIO13
WiFiServer server(80);
 
void setup() {
  Serial.begin(115200);
  delay(10);
 
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);
 
  // Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
 
  WiFi.begin(ssid, password);
 
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
 
  // Start the server
  server.begin();
  Serial.println("Server started");
 
  // Print the IP address
  Serial.print("Use this URL to connect: ");
  Serial.print("http://");
  Serial.print(WiFi.localIP());
  Serial.println("/");
 
}
 
void loop() {
  // Check if a client has connected
  WiFiClient client = server.available();
  if (!client) {
    return;
  }
 
  // Wait until the client sends some data
  Serial.println("new client");
  while(!client.available()){
    delay(1);
  }
 
  // Read the first line of the request
  String request = client.readStringUntil('\r');
  Serial.println(request);
  client.flush();
 
  // Match the request
 
  int value = LOW;
  if (request.indexOf("/LED=ON") != -1)  {
    digitalWrite(ledPin, HIGH);
    value = HIGH;
  }
  if (request.indexOf("/LED=OFF") != -1)  {
    digitalWrite(ledPin, LOW);
    value = LOW;
  }
 
// Set ledPin according to the request
//digitalWrite(ledPin, value);
 
  // Return the response
  client.println("HTTP/1.1 200 OK");
  client.println("Content-Type: text/html");
  client.println(""); //  do not forget this one
  client.println("<!DOCTYPE HTML>");
  client.println("<html>");
 
  client.print("Led pin is now: ");
 
  if(value == HIGH) {
    client.print("On");
  } else {
    client.print("Off");
  }
  client.println("<br><br>");
  client.println("<a href=\"/LED=ON\"\"><button>Turn On </button></a>");
  client.println("<a href=\"/LED=OFF\"\"><button>Turn Off </button></a><br />");  
  client.println("</html>");
 
  delay(1);
  Serial.println("Client disonnected");
  Serial.println("");
 
}
 
Arduino codeC/C++
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11);  //RX,TX

int LEDPIN = 13;
 
void setup() 
{
    pinMode(LEDPIN, OUTPUT);
 
    Serial.begin(9600);     // communication with the host computer
    //while (!Serial)   { ; }
 
    // Start the software serial for communication with the ESP8266
    mySerial.begin(115200);  
 
    Serial.println("");
    Serial.println("Remember to to set Both NL & CR in the serial monitor.");
    Serial.println("Ready");
    Serial.println("");    
}
 
void loop() 
{
    // listen for communication from the ESP8266 and then write it to the serial monitor
    if ( mySerial.available() )   {  Serial.write( mySerial.read() );  }
 
    // listen for user input and send it to the ESP8266
    if ( Serial.available() )       {  mySerial.write( Serial.read() );  }
}

Schematics

Server schematic
Wiznet ah1qrykx3m
LED control nodeMCU
Led rfxhhhfinn
Home appliance control NodeMCU
Electrical control bb tcuhpm58tv

Comments

Similar projects you might like

Home Automation Using Raspberry Pi 2 And Windows 10 IoT

Project tutorial by Anurag S. Vasanwala

  • 283,870 views
  • 95 comments
  • 667 respects

Android App-Based Home Automation System Using IOT

Project tutorial by Team Autoshack

  • 19,699 views
  • 12 comments
  • 58 respects

Bluetooth Based Home Automation

Project tutorial by Team Brink.IO

  • 7,439 views
  • 6 comments
  • 32 respects

When IoT Meets AI: Home Automation With Alexa and NodeMCU

Project tutorial by MJRoBot

  • 4,637 views
  • 3 comments
  • 14 respects

Smart Home Automation

by Team Kamakshi's Smart Team

  • 4,403 views
  • 1 comment
  • 13 respects

Firebase Home Automation System Using NodeMCU

Project tutorial by sarful

  • 1,195 views
  • 1 comment
  • 6 respects
Add projectSign up / Login