Now-a-days, microcontrollers are potent integrated circuit is used as parts of most home and office appliances. Wireless grid control is a monitoring and controlling system is used to collect and transfer the data from power generating stations to remote control unit. In this paper, a method using Ethernet and Arduino ATMEGA328 microcontroller based control unit. This is based on remote data transfer through Ethernet on internet. The system is compatible to access, monitoring of equipment parameters through the network and web browser in real-time.
Link For Library
etherShield.h
1. https://github.com/thiseldo/EtherShield
ETHER_28J60.h
2. https://github.com/muanis/arduino-projects/tree/master/libraries/ETHER_28J60
Output Pin LED1 Arduino= 4
Output Pin LED1 Arduino= 7
Servo Connect Pin= 9
ip Address (can be changed) : 172.16.2.155
#include <etherShield.h>
#include <ETHER_28J60.h>
#include <Servo.h>
#include <SoftwareSerial.h>
#define ON1 HIGH
#define OFF1 LOW
#define ON1 HIGH
#define OFF2 LOW
#define ON2 HIGH
#define OFF3 LOW
#define ON3 HIGH
int RELAY1=4;
int RELAY2=7;
int RELAY3=8;
Servo Rishi;
static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24};
static uint8_t ip[4] = {172, 16, 2, 155};
static uint16_t port = 80;
ETHER_28J60 client;
void setup() {
Serial.begin(9600); // Set up Serial library at 9600 bps
Rishi.attach(9); // Servo motor is attached to pin 9
client.setup(mac, ip, port);
pinMode(RELAY1, OUTPUT);
pinMode(RELAY2, OUTPUT);
pinMode(RELAY3, OUTPUT);
}
void loop() {
char* params;
if (params = client.serviceRequest()) {
// custom buttons
client.print("<h2>MAHARISHI UNIVERSITY OF INFORMATION TECHNOLOGY </h2></br>");
client.print("<h3>Project by: RISHIKESH KUMAR </h3></br>");
client.print("<h4>Ethernet Based 'LED & Servo Control'</h4></br>");
client.print("<input type=submit value='LED1 ON1' style=width:100px;height:35px onClick=location.href='/?LED1=ON1'>   ");
client.print("<input type=submit value='LED1 OFF1' style=width:100px;height:35px onClick=location.href='/?LED1=OFF1'><br/>");
client.print("<input type=submit value='LED2 ON2' style=width:100px;height:35px onClick=location.href='/?LED2=ON2'>   ");
client.print("<input type=submit value='LED2 OFF2' style=width:100px;height:35px onClick=location.href='/?LED2=OFF2'><br/>");
client.print("<input type=submit value='SERVO 30' style=width:100px;height:35px onClick=location.href='/?SERVO=30'><br/>");
client.print("<input type=submit value='SERVO 60' style=width:100px;height:35px onClick=location.href='/?SERVO=60'><br/>");
If (strcmp(params, "?LED1=ON1") == 0)
{
digitalWrite(RELAY1, ON1);
}
if (strcmp(params, "?LED1=OFF1") == 0)
{
digitalWrite(RELAY1, OFF1);
}
if (strcmp(params, "?LED2=ON2") == 0)
{
digitalWrite(RELAY2, ON2);
}
if (strcmp(params, "?LED2=OFF2") == 0)
{
digitalWrite(RELAY2, OFF2);
}
if (strcmp(params, "?SERVO=30") == 0)
{
Rishi.write(30);
}
if (strcmp(params, "?SERVO=60") == 0)
{
Rishi.write(60);
}
client.respond();
}
}