
This project is an example of Ethernet shield. User can manage his house easily by using Arduino platform through Web. This project would be included in Remote control category of WIZnet Museum.
Internet controlled Destroyer is essential in all civil and military cars. Military can use this technology to decrease the loose of soldiers by sending machines to fight while they are safe in the control room.
Controlling over internet opens a whole new window for everything not just only cars you can control your home machines, control garage which ease our life
The Arduino UNO will work as a microcontroller
The car should be fully controlled by the internet over 3G, wifi, or any other internet provider.
Programming the Arduino
connect the board to the pc and upload the code to have access to the internet
#include <EEPROM.h> #include <Servo.h> #include <Wire.h> #include <SERVER328.h> #include <SPI.h> #include <Ethernet.h> // User configurable variables byte useDhcp = true; byte useDns = true; byte mac[] = { 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX }; char serverName[] = "us01.proxy.SERVER.org"; // Only if useDns is true unsigned int serverPort = 5353; // Can be set to either 53 or 5353 byte statusLedPin = 8; // User configurable key, this is used to authenticate with the proxy server // This is checked against the EEPROM on boot and written if necessary // The proxy server retreives the key from the EEPROM byte key[] = { 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX }; // Other required variables byte data[257]; byte dataLength; byte hexStage; unsigned long lastInstruction = 0; unsigned long lastRefresh = 0; byte stage = 0; // Declare client object EthernetClient Client; void setup() { // Load presets SERVER.loadPresets(); // Set status LED pin SERVER.setStatusLedPin(statusLedPin); SERVER.setStatusLed(1); // Initialisation // Check the EEPROM header and check to see if the key is correct // This is to ensure the key is not cleared from the EEPROM if(EEPROM.read(0) != '#') { EEPROM.write(0, '#'); } if(EEPROM.read(1) != 0) { EEPROM.write(1, 0); } if(EEPROM.read(2) != '#') { EEPROM.write(2, '#'); } if(EEPROM.read(160) != '#') { EEPROM.write(160, '#'); } for(byte i = 0; i < 16; i++) { if(EEPROM.read(161 + i) != key[i]) { EEPROM.write(161 + i, key[i]); } } if(EEPROM.read(177) != '#') { EEPROM.write(177, '#'); } // Start network and attempt to connect to proxy server SERVER.setStatusLed(2); // Network configuration if(useDhcp) { if(!Ethernet.begin(mac)) { SERVER.setStatusLed(2, false, 10000); SERVER.reset(); } } delay(1000); SERVER.setStatusLed(3); // Connect to server if(useDns && !Client.connect(serverName, serverPort)) { SERVER.setStatusLed(3, false, 10000); SERVER.reset(); } lastInstruction = millis(); } void loop() { if(Client.connected()) { // What we need to do depends on which 'stage' we are at switch(stage) { case 0: // Wait for start byte if(Client.available()) { char c = Client.read(); if(c == '?') { stage++; } } break; case 1: // Reset variables dataLength = 0; hexStage = 0; stage++; break; case 2: // Instruction byte if(Client.available()) { char c = Client.read(); if(c == '?') { stage = 1; break; } else if(c == '\r' || c == '\n' || c == '.') { stage = 0; break; } if(!hexStage) { data[0] = SERVER.hexDecode(c) * 16; } else { data[0] += SERVER.hexDecode(c); } hexStage = !hexStage; if(!hexStage) { stage++; } } break; case 3: // Data length byte if(Client.available()) { char c = Client.read(); if(c == '?') { stage = 1; break; } else if(c == '\r' || c == '\n' || c == '.') { stage = 0; break; } if(!hexStage) { data[1] = SERVER.hexDecode(c) * 16; } else { data[1] += SERVER.hexDecode(c); } hexStage = !hexStage; if(!hexStage) { stage++; } } break; case 4: // Data if(Client.available()) { char c = Client.read(); if(c == '?') { stage = 1; break; } else if(c == '\r' || c == '\n' || c == '.') { if(dataLength == data[1]) { stage++; break; } else { stage = 0; break; } } if(!hexStage) { data[2 + dataLength] = SERVER.hexDecode(c) * 16; } else { data[2 + dataLength] += SERVER.hexDecode(c); } hexStage = !hexStage; if(!hexStage) { dataLength++; } } break; case 5: // Execute instruction and return result SERVER.instruction(data); Client.write('!'); for(int i = 0; i < data[1] + 2; i++) { Client.write(SERVER.hexEncode(data[i] / 16)); Client.write(SERVER.hexEncode(data[i] % 16)); } Client.write('\n'); lastInstruction = millis(); stage = 0; break; } } else { SERVER.setStatusLed(10); SERVER.reset(); } // Has the instruction timeout been reached? if(millis() - lastInstruction > 30000) { Client.flush(); Client.stop(); SERVER.setStatusLed(9); SERVER.reset(); } // Process refreshes every 50ms if(millis() - lastRefresh >= 50) { SERVER.pinTimers(); SERVER.shiftRegisterTimers(); SERVER.shiftRegisters(); lastRefresh = millis(); } // Check to see if reset has been requested SERVER.checkReset(); }
Voltage Regulator
I have used the 7806 which have the attached pic specs.
But I couldn’t use it alone since it can handle up to 1A at the output while I need 3A and I don’t want to use 3 regulators to get to that result therefore i implemented the following way which allow you to have what you need and even more if you requested
The main idea is that am collecting the Ampere from the 2N0355 power transistor and the voltage from the regulator which gives the perfect match for my component
Motor Controller
There are many ways to control a motor but my problem was that I needed Tristate way which allow me to control the motor on standby mode, forward and backward and with high power therefore I used a handmade circuit done by myself which gave me the privilege to have full control of my motor.
The Motor need
Voltage = 6V
Iload(max) = 1.25A
In general, we use both PNP or NPN transistors as switches. However,
First we need to make sure that the transistor can safely handle the worst current we might draw. The parameter we are looking for is the maximum collector current, Ic(max).
Next we have to verify that the transistor can safely handle the supply voltage we plan to use. The parameter we are looking for is the maximum collector emitter voltage, Vceo(max).
Now we need to calculate whether we can provide sufficient base current to keep the transistor in saturation. First we need to find what the base current will be when the transistor is carrying the worst-case current of 1.25 A. Arduino, can deliver (safely) at most 40 mA.
Therefore the TIP120 is used after looking to its specifications.
First, we see that Ic(max) = 5 A, and that Vceo(max) is 60, 80, or 100 V, so we are fine so far.
Next we check the base current. Ic=250 * Ib or our collector current of 1.25 A requires a base current of 5 mA (5 * 250 = 1250), which is well below the maximum of 40 mA the Arduino can put out.
Finally we need to select a base resistor which will be low enough to ensure that the TIP120 remains saturated, but high enough to prevent the Arduino from trying to deliver more current than it should. We want a current between 5 mA and 40 mA, so let’s pick a midway point of 20 mA.
When the collector current is 1 A, Vbe(sat) is about 1.5 V. Now if the Arduino is putting out 5 V, and Vbe is 1.5 V, that means that the resistor has a voltage drop of (5 – 1.5) or 3.5 V across it. Using Ohm’s law, R = V/I = 3.5/(20 mA)= 175 Ohms
Webpage
The webpage code is:
<html> <body> <p align="center">title</p> <table> <tr> <td> <html> <head> <link rel="stylesheet" rev="stylesheet" href="dlink.css?cidx=1.022011-11-07" type="text/css"> <title>Camera</title> <META content="text/html; charset=windows-1252" http-equiv=Content-Type> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Expires" CONTENT="-1"> <script language="Javascript" SRC="function.js?cidx=1.022011-11-07"></script> <script language="Javascript"> function Init() { cvcs.RemoteHost = "192.168.10.30" cvcs.RemoteWeb = 800 cvcs.Timeout = 5 cvcs.AuthType = 1 cvcs.PreviewFrameRate = 1 cvcs.PreviewWidth = 640 cvcs.PreviewHeight = 480 cvcs.DeviceSerialNo = "YWRtaW46" window.setInterval("ShowFrameRate()", 1000) if (1) { audioon.disabled = false; audiooff.disabled = false; } else { audioon.disabled = true; audiooff.disabled = true; } if (0 == 1) { nightmodeon.disabled = false; nightmodeoff.disabled = false; } else { nightmodeon.disabled = true; nightmodeoff.disabled = true; } } function ShowFrameRate() { if (1) { var fFrameRate = cvcs.FrameRate window.status = "Frame:" + fFrameRate.toString() + " fps" if (0) CurrentFrame.innerHTML = "Frame:" + fFrameRate.toString() + " fps" } cvcs.Play() CurrentTime.innerHTML = cvcs.TimeString } function SubmitAudioOn() { cvcs.Mute(0); javascript:document.forms[0].submit(); } function SubmitAudioOff() { cvcs.Mute(1); javascript:document.forms[1].submit(); } function SubmitNightModeOn() { javascript:document.forms[2].submit(); } function SubmitNightModeOff() { javascript:document.forms[3].submit(); } </script> </head> <body topmargin="1" leftmargin="0" rightmargin="0" onload="Init()" onunload="cvcs.Stop()"> <table border="0" cellpadding="0" cellspacing="0" width="838" align="center" bgcolor="#FFFFFF" bordercolordark="#FFFFFF"> <tr><td> <table border="0" cellpadding="0" cellspacing="0" width="838" align="center" bgcolor="#FFFFFF" bordercolordark="#FFFFFF"> <tr> <td valign="top" id="maincontent_container" height="420"> <table height="420" width=100% border="0" cellpadding="0" cellspacing="0" bgcolor="white"> <tr><td> <div id="maincontent"> <!-- === BEGIN MAINCONTENT === --> <div class="box"> <table cellpadding="2" cellspacing="1" border="0" width="534" bgcolor="white" bordercolor="#FFFFFF"> <tr><td align="center"> <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0> <tr> <td bgcolor=black><font color=white><BR></font></td> <td bgcolor=black align=right valign=top> <font color=white><SPAN id="CurrentTime"></SPAN></font></td> </tr> <tr> <td colspan=2 align=center bgcolor="white"> <OBJECT ID="cvcs" WIDTH=640 HEIGHT=480 CLASSID="CLSID:7191F0AC-D686-46A8-BFCC-EA61778C74DD" CODEBASE="aplugLiteDL.cab#version=2,3,2,22"> </OBJECT> </td> </tr> </TABLE> </td></tr> </table> </div> <!-- === END MAINCONTENT === --> </div> </td></tr> <tr height=100%><td></td></tr> </table> </td> </tr> </table> </td></tr></table> </body> <form action="/audiocontrol.cgi" method="POST"> <INPUT type="hidden" name="AudioMute" value="0"> </form> <form action="/audiocontrol.cgi" method="POST"> <INPUT type="hidden" name="AudioMute" value="1"> </form> <form action="/nightmodecontrol.cgi" method="POST"> <INPUT type="hidden" name="IRLed" value="1"> </form> <form action="/nightmodecontrol.cgi" method="POST"> <INPUT type="hidden" name="IRLed" value="0"> </form> </html> </td> <td> <table width="300"> <tr> <td colspan="2" align="center"><a href="http://us01.proxy.SERVER.org/api/1.0/328.php?k={9AA615BA7DA56B88DD093F23F6E0F56E}&r=setDigitalOutput&pin=5&output=2" target="frame"><img src="forward.jpg" border="0"/></a></td> </tr> <tr> <td width="50%" align="center"><a href="http://us01.proxy.SERVER.org/api/1.0/328.php?k={9AA615BA7DA56B88DD093F23F6E0F56E}&r=setDigitalOutput&pin=9&output=2" target="frame"><img src="left.jpg" border="0"/></a></td> <td align="center"><a href="http://us01.proxy.SERVER.org/api/1.0/328.php?k={9AA615BA7DA56B88DD093F23F6E0F56E}&r=setDigitalOutput&pin=10&output=2" target="frame"><img src="right.jpg" border="0"/></a></td> </tr> <tr> <td colspan="2" align="center"><a href="http://us01.proxy.SERVER.org/api/1.0/328.php?k={9AA615BA7DA56B88DD093F23F6E0F56E}&r=setDigitalOutput&pin=6&output=2" target="frame"><img src="backward.jpg" border="0"/></a></td> </tr> </table> <br/><br/> <table width="400" height="300" border="0"> <tr> <td align="center" valign="center" height="50%"><a href="http://us01.proxy.SERVER.org/api/1.0/328.php?k={9AA615BA7DA56B88DD093F23F6E0F56E}&r=setServo&servo=0&position=45" target="frame"><font color="red" size="5"><b>45</b></font></a></td> <td align="center" valign="top"><a href="http://us01.proxy.SERVER.org/api/1.0/328.php?k={9AA615BA7DA56B88DD093F23F6E0F56E}&r=setServo&servo=0&position=90" target="frame"><font color="red" size="5"><b>90</b></font></a><br/><br/><br/><br/><br/> <a href="http://us01.proxy.SERVER.org/api/1.0/328.php?k={9AA615BA7DA56B88DD093F23F6E0F56E}&r=setDigitalOutput&pin=12&output=2" target="frame"><font color="blue" size="4"><b>FIRE</b></font></a></td> <td align="center" valign="center"><a href="http://us01.proxy.SERVER.org/api/1.0/328.php?k={9AA615BA7DA56B88DD093F23F6E0F56E}&r=setServo&servo=0&position=135" target="frame"><font color="red" size="5"><b>135</b></font></a></td> </tr> <tr> <td align="left" valign="top"><a href="http://us01.proxy.SERVER.org/api/1.0/328.php?k={9AA615BA7DA56B88DD093F23F6E0F56E}&r=setServo&servo=0&position=10" target="frame"><font color="red" size="5"><b>10</b></font></a></td> <td></td> <td align="right" valign="top"><a href="http://us01.proxy.SERVER.org/api/1.0/328.php?k={9AA615BA7DA56B88DD093F23F6E0F56E}&r=setServo&servo=0&position=170" target="frame"><font color="red" size="5"><b>170</b></font></a></td> </tr> </table> </td> </tr> </table> <iframe width="0" height="0" framborder="0" name="frame"></iframe> </body> </html>
If you want to know more in detail, refer to
Source : http://www.instructables.com/id/Internet-Controlled-Car/
COMMENTS