#include <SPI.h> client.
println("<body style = 'background-
#include <Ethernet.h> image:url(http://image.shutterstock.com/z/stock-
vector-cartoon-power-lines-delivering-energy-
// Enter a MAC address and IP address for your standing-in-a-row-sketch-high-voltage-electric-
controller below. power-289622807.jpg)'>");
// The IP address will be dependent on your local //client.println("<div ");
network: //client.println("<img src
byte mac[] = { = http://image.shutterstock.com/z/stock-vector-
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED cartoon-power-lines-delivering-energy-standing-
}; in-a-row-sketch-high-voltage-electric-power-
IPAddress ip(192, 168, 1, 177); 289622807.jpg>");
// client.println("<body
// Initialize the Ethernet server library bgcolor=lightblue>");
// with the IP address and port you want to use client.println("<head>");
// (port 80 is default for HTTP): client.println("<font color=black>");
EthernetServer server(80); client.println("<center>");
String readString; client.println("<h1>Electrical Grids Based
void setup() { SCADA System</h1>");
pinMode(6,OUTPUT); //Relay client.println("</center>");
pinMode(7,OUTPUT); client.println("</head>");
// Open serial communications and wait for port client.println("<title>");
to open: client.println("Electrical Grids");
Serial.begin(9600); client.println("</title>");
// start the Ethernet connection and the server: client.println("<center>");
Ethernet.begin(mac, ip); // we can see if there is Motion or not.
server.begin(); client.println("<p>");
Serial.print("server is at "); client.println("<table border=1 width=600>");
Serial.println(Ethernet.localIP());
} client.println("<tr>");
client.println("<td align=center>");
client.println("<font color=blue>");
void loop() { client.println("<h3>Current in Grid 1:</h3>");
// listen for incoming clients client.println("</td>");
EthernetClient client = server.available(); client.println("<td align=center>");
if (client) { client.println("<font color=blue>");
Serial.println("new client"); client.println("<h3>Current in Grid 2:</h3>");
// an http request ends with a blank line client.println("</td>");
boolean currentLineIsBlank = true;
while (client.connected()) { client.println("<td align=center>");
if (client.available()) { client.println("<font color=blue>");
char c = client.read(); client.println("<h3>Temperature:</h3>");
if (readString.length() < 100) { client.println("</td>");
readString += c;
} client.println("</tr>");
Serial.write(c); client.println("<tr>");
// if you've gotten to the end of the line client.println("<td align=center>");
(received a newline client.println("<font color = red size=10>");
// character) and the line is blank, the http float Grid1 = analogRead(0);
request has ended, Grid1=(Grid1*4.83);
// so you can send a reply Grid1=(Grid1/10); //10E Resistor
if (c == '\n' && currentLineIsBlank) { Grid1=(Grid1/1000); //conversion to Amp
// send a standard http response header client.println(Grid1);
client.println("HTTP/1.1 200 OK"); client.println(" Amp");
client.println("Content-Type: text/html"); client.println("</td>");
client.println("Connection: close"); // the
connection will be closed after completion of the client.println("<td>");
response client.println("<center>");
client.println("Refresh: 5"); // refresh the client.println("<font color = red size=10>");
page automatically every 5 sec float Grid2 = analogRead(1);
client.println(); Grid2=Grid2*4.83;
client.println("<!DOCTYPE HTML>"); Grid2=(Grid2/10); //10E Resistor
//client.println("<html>"); Grid2=(Grid2/1000);
client.println(Grid2); digitalWrite(6, LOW);
client.println(" Amp"); }
client.println("</center>");
client.println("</td>"); else{
if(readString.indexOf("?Grid2on") >0) //
client.println("<td align=center>"); these are the snippets the Arduino is watching
client.println("<font color = red size=10>"); for.
float temp = analogRead(5); {
temp=(temp*4.83)/10; digitalWrite(7, HIGH);
client.println(temp); }
client.println(" *C"); else{
client.println("</td>"); if(readString.indexOf("?Grid2off") >0)
{
client.println("</tr>"); digitalWrite(7, LOW);
client.println("</table>"); }}}}
client.println("<p>"); // close the connection:
client.println("<FORM>"); readString="";
client.println("<INPUT type=button value=Grid1- client.stop();
ON onClick=window.location='/?Grid1on1\'>"); Serial.println("client disconnected");
client.println("<INPUT type=button value=Grid1- }
OFF onClick=window.location='/?Grid1off1\'>"); }
client.println("</FORM>");
client.println("<FORM>");
client.println("<INPUT type=button value=Grid2-
ON onClick=window.location='/?Grid2on1\'>");
client.println("<INPUT type=button value=Grid2-
OFF onClick=window.location='/?Grid2off1\'>");
client.println("</FORM>");
client.println("<font color=blue>");
client.println("<center>");
client.println("<h1>By Prince, Renuka Chauhan,
Shreya Arun</h1>");
client.println("</center>");
client.println("</body>");
client.println("</html>");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
} else if (c != '\r') {
// you've gotten a character on the current
line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the
data
delay(1);
if(readString.indexOf("?Grid1on") >0) //
these are the snippets the Arduino is watching
for.
{
digitalWrite(6, HIGH);
}
else{
if(readString.indexOf("?Grid1off") >0)
{