SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
__________________________________________________________________________ 
Intel Galileo Project: Remote Controlled Car 
__________________________________________________________________________ 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
May 8, 2015 
 
Contents 
 
1. Abstract         2 
2. Introduction         3 
3. Configuring the Hardware and Software         3 
4. Physical Model         5 
5. Circuit and Programming of the Galileo RC Car         6 
6. Results       17 
7. Conclusions       18 
8. References       19 
9. Appendix       20 
 
 
 
 
 
 
 
 
 
 
 
Page | 1
Abstract 
An Intel Galileo was to be used as the controller and antenna for an RC car base 
kit, consisting of 4 DC motors and two levels of plastic making up the body of the car. 
Using the Galileo’s microprocessor combined with its 32­bit Intel processor running a 
lite version of the Linux OS Yocto off of a microSD card, a web server was hosted on 
the Galileo and used to control the car.  The web code, which implemented C as the 
programming language, was made accessible from an external WiFi enabled device 
through an Intel N­6205 wireless card using two 3 Dbi antennas to broadcast its signal. 
The WiFi network was tethered using the built­in connman library of the Yocto 
distribution. 
 
 
 
 
 
 
 
 
 
 
 
 
Page | 2
Introduction 
The purpose of Senior Design II was to have the students provide ideas for a 
suitable project for the Spring Semester.  In the beginning, several ideas were toyed 
around with: a mechanical system to litz braid audio wires; an automatic record player 
head; controlling a remote controlled car by using an Intel Galileo.  Although the wire 
braiding machine was pursued for a few weeks at the start of the semester, the students 
realized that it was not quite feasible to produce this within the constraint of one 
semester.  Similarly, the idea for the record player was tossed rather quickly. 
Ultimately, it was decided that the project for the semester would be the RC car.  This 
report describes the processes undertaken to find a base RC car kit to be used; 
purchasing all parts necessary for the Galileo to be able to work for the project; as well 
as all hardware and software coding that would make up the final product. 
 
Configuring the Hardware & Software 
Using the Intel IoT (Internet of Things) kit, a version of Linux Yocto was installed 
to an 8Gb microSD card.  The file was downloaded from the Intel Galileo support 
website, where all software required for software is available.  The image was extracted 
to the card using 7zip FileManager, a compressed folder extracting software. 
 
To be able to use the Galileo as the controller for the remote controlled car, it 
was necessary to give the Galileo wireless capabilities.  Using the full sized mini­PCI 
Express slot on the bottom of the Galileo, the Intel Centrino N­6205 single band 
Page | 3
wireless card was connected to the Galileo using a half­height to full­height extender, 
and a pair of 9Dbi antennas were used to broadcast and receive signals.  While 
functional, the 9Dbi antennas were much too large in comparison to the car, and so a 
pair of 3Dbi antennas were ordered and replaced the original ones. To allow the Galileo 
to see the wireless card, the Galileo was first updated to the most current firmware 
version 1.0.4.  This was important, because the 0.7.3.2 firmware version that was 
installed as default on the Galileo contained a bug which prevented the Galileo from 
booting straight from the microSD card, as it is supposed to do automatically whenever 
a microSD card is detected.  Then, the Intel Galileo N­6205 specific driver was 
downloaded as a .tar file.  To install this driver to the Galileo, the serial communications 
software Putty was used.  In the Putty terminal, the .tar file was unzipped and the driver 
itself was copied to the firmware directory on the Galileo.  At first, the Galileo would not 
recognize the wireless card, due to a fault in installing the Yocto image to the microSD 
card.  When connecting through serial to the Galileo, rather than prompting to log in to 
Yocto as expected, the Galileo booted up from the board.  It was discovered that this 
happened because the Yocto image had not been installed correctly through the 
extraction process.  To properly install Yocto, Win32diskimager was downloaded and 
used to completely format the microSD card and install the Yocto image. The Galileo 
was restarted and properly booted to Yocto.  Using the login account “root” to gain total 
access and full administrative privileges, the wireless library method connman was used 
to verify that the N­6205 was recognized.  Once inside connmanctl, the following bit of 
code was entered to enable the wireless card and to tether a network from the Galileo: 
Page | 4
//​connman> enable wifi 
//​connman> tether wifi on Galileo electricals 
 
The first line was used to enable the wireless card, and the second line created an SSID 
broadcasted as “Galileo” and created a password “electricals” to enable connection 
through WiFi to the Galileo.  Now that the tethering had been enabled, the next step 
was to ensure that the tethering would start automatically every time the Galileo was 
started.  To do this, the file main.conf inside the directory on the microSD card 
/etc/connman/ was modified.  This file is provided with the Yocto distribution, and inside 
the file the following line of code is present: 
//#PersistentTetheringMode = false 
Changing “false” to “true” ensured that the previously set up wireless network would 
always start whenever the Galileo is started. 
 
Physical Model 
Once the RC car kit had been assembled, the Galileo was attached to the top 
level using two screws in pre­drilled holes.  To mount the antennas, two new holes were 
drilled on one end of the car.  Using the 3D­modeling software SolidWorks, two pieces 
were designed and 3D­printed to be bolted on top of the car and used to hold the 
battery in place.  In the final circuit, the battery was soldered to the circuit board along 
with a switch to keep the DC motors from constantly drawing power from the battery. 
The motor controller and associated circuit were also soldered to the circuit board, using 
Page | 5
header pins to provide connections from the Galileo to the circuit.  The header pins 
were arranged to fix precisely on top of the Galileo, much like an Arduino shield would.   
 
Circuit and Programming of the Galileo RC Car  
For this remote control car project the Intel Galileo board was used, which is 
arduino compatible. This means all the programming was done using the arduino 
software and using the C programming language. Prior to programming the Galileo 
board, some research was done on how to program and how to use the Galileo.  
 
The following link shows the first program used to test the motors: 
https://learn.sparkfun.com/tutorials/galileo­experiment­guide/sik­galileo­­­part­12­driving
­a­motor​. Using that code (shown in the appendix as code 1) as an example, the main 
program that was used to move the wheel motors was coded. The circuit shown in the 
link and on figures 1 and 2 below was originally used to power the motors, although this 
circuit was not used in the final design.  
Page | 6
 
Figure 1: Intel Galileo Motor controller circuit diagram (obtained from 
sparkfun.com)  
 
 
Figure 2: Intel Galileo Motor controller circuit (obtained from sparkfun.com)  
 
Page | 7
 
After having the code for driving the motors, more research was done to figure 
out how to set up a Web server using the Intel galileo board. A YouTube video of an 
Intel Galileo Web server was found 
(​https://www.youtube.com/watch?v=ROSwWpIdgkQ​) and the YouTube user was 
contacted to see if he could provide the code he used, to give us an idea on how to set 
up the web server. When the response from the YouTube user was received, the code 
(shown as code 2 on the appendix) he sent was studied. Once the code had been 
studied and understood, it gave a good idea on how a web server could be set up, 
however the Web server he used was set up via ethernet cable while the one that was 
needed was a wifi web server. After trying some ideas and searching for some example 
codes that used a wifi web server, the final program was coded.  
First when the sparkfun code was used to test the motors, the code was used as 
an example and a code to move the four wheels was started. The code for the four 
wheels consisted on a GoForward command, a Reverse command, a Stop command, 
and a TurnLeft and TurnRight command as shown below. 
 
//Moving 4 motors code 
 
const int In1 = 3;        
const int In2 = 5;       
const int In3 = 6;        
const int In4 = 11;     
   
void setup()  
{    
// initialize the pins as output:    
pinMode(In1, OUTPUT);    
pinMode(In2, OUTPUT);    
Page | 8
pinMode(In3, OUTPUT);    
pinMode(In4, OUTPUT);   
}   
 
void loop() 
{   
int speed1;   
int speed2;   
// speed1 and speed2 are two variables  
// You can change these values from 0 to 255  / 
/ We will use 150 for now      
speed1 = 150;    
speed2 = 150;     
 
while(1==1)   
{      
//Go Forward      
analogWrite(In4, 0);       
analogWrite(In3, speed1);       
analogWrite(In2, 0);       
analogWrite(In1, speed2);       
delay(2000);     
 
//Reverse      
analogWrite(In4, speed1);       
analogWrite(In3, 0);       
analogWrite(In2, speed2);       
analogWrite(In1, 0);      
delay(1000);    
 
//STOP       
analogWrite(In4, 0);      
analogWrite(In3, 0);       
analogWrite(In2, 0);       
analogWrite(In1, 0);     
delay(1000);     
 
//TurnLeft 
analogWrite(In4, 0);    
analogWrite(In3, speed1);  
analogWrite(In2, speed2);  
analogWrite(In1, 0);  
Page | 9
 
//TurnRight 
analogWrite(In4, speed1);    
analogWrite(In3, 0);  
analogWrite(In2, 0);  
analogWrite(In1, speed2); 
} 
} 
 
The code was not able to be tested till the circuit had been properly connected. 
Four circuits were put together based on the circuit shown in figures 1 and 2, then each 
of the motors was connected to each of the circuits. When the circuit was done and 
everything was connected, the program was tested. The motors and the Intel Galileo 
didn't work as expected; with each of the motors connected to each circuit it would only 
allow the voltage to go only on one direction (forward) and not in both forward and 
backwards.  
Since the circuit was not working as it was supposed to, the circuit had to be 
changed or another method had to be applied. So the circuit was modified by changing 
how the connections from the circuit components connected to the motors, while the 
rest of the circuit was left exactly the same just as shown on figure 3 below. 
Page | 10
 
Figure 3: Modified Circuit 
 
Once the circuit was connected like that, the circuit worked for a couple of 
second and the the wheels wouldn't move at all. When the motors were turned off, the 
magnetic field inside it collapsed, and generated a voltage spike that damaged the 
transistors and burned them.  Since the time was running out, instead of trying to figure 
out how to fix the circuit, a motor controller was used.   
 
Figure 4: Pololu DRV8833 Dual Motor Controller  
Page | 11
The motor controller used for this project was the Pololu DRV8833 Dual Motor 
Controller as shown in figure 4 above. The code remained the same even though the 
circuit had changed. This time the circuit and the motor both worked as expected. At 
this point the 4 motor driving code was combined with the web server code, and after 
some minor coding problems the final code was achieved. The final code as shown 
below has the Forward function, the Backwards function, the Stop function, and the Left 
and Right options.  
//Final Code 
//4 Motor Driving Web Server 
#include <WiFi.h> 
int status = WL_IDLE_STATUS; 
WiFiServer server(80); 
 
int T = 0; 
const int speed1 = 150; 
const int speed2 = 150; 
 
const int In1 = 3;  //use the PWM­cable pins     
const int In2 = 5;  //use the PWM­cable pins     
const int In3 = 6;  //use the PWM­cable pins    
const int In4 = 11; //use the PWM­cable pins  
 
void setup() { 
 Serial.begin(9600); 
 pinMode(In1, OUTPUT); 
 pinMode(In2, OUTPUT); 
 pinMode(In3, OUTPUT); 
 pinMode(In4, OUTPUT);  
 
 server.begin();  
} 
 
void loop() 
 { 
WiFiClient client = server.available();   // listen for incoming clients 
Page | 12
         
 if (client) {                             // if you get a client, 
   String currentLine = "";      // make a String to hold incoming data from the client 
   while (client.connected()) {            // loop while the client's connected 
     if (client.available()) {                  // if there's bytes to read from the client, 
       char c = client.read();               // read a byte, then 
       if (c == 'n') {                            // if the byte is a newline character 
         if (currentLine.length() == 0) {   
           client.println("HTTP/1.1 200 OK"); 
           client.println("Content­type:text/html"); 
           client.println(); 
           client.print("<a href="/F">Forward</a> <br>"); 
           client.print("<a href="/B">Backwards</a> <br>"); 
           client.print("<a href="/S">Stop</a> <br>"); 
           client.print("<a href="/R">Right</a> <br>"); 
           client.print("<a href="/L">Left</a> <br>"); 
           client.println(); 
           break;          
         }  
         else { 
           currentLine = ""; 
         } 
       }      
       else if (c != 'r') {    // if you got anything else but a carriage return character, 
         currentLine += c;      // add it to the end of the currentLine 
       } 
 // Check to see if the client request was "GET /F" or "GET /B" or "GET /S" or 
"GET /R" or "GET /L": 
       if (currentLine.endsWith("GET /F")) { 
         T=1; 
         GoForward(speed1,speed2);               // GET /F  Go Forward  
       } 
       if (currentLine.endsWith("GET /B")) { 
         Reverse(speed1,speed2);                 // GET /B Go Backwards 
         T=2;  
       } 
       if (currentLine.endsWith("GET /S")) { 
         T=3; 
         StopMotors();                           // GET /S Stop  
       } 
       if (currentLine.endsWith("GET /R")) { 
         TurnRight(speed1,speed2);               // GET /R turns Car to the Right  
       } 
       if (currentLine.endsWith("GET /L")) { 
         TurnLeft(speed1,speed2);                // GET /L turns Car to the Left 
Page | 13
       } 
     } 
   } 
   // close the connection: 
   client.stop(); 
 } 
} 
 
 void StopMotors() 
 { 
   Serial.println("Stop Motors"); 
   analogWrite(In4, 0);  
   analogWrite(In3, 0);  
   analogWrite(In2, 0);  
   analogWrite(In1, 0); 
   return; 
 } 
  
 void GoForward(int speed1, int speed2) 
 { 
   Serial.println("Forward"); 
   analogWrite(In4, 0);  
   analogWrite(In3, speed1);  
   analogWrite(In2, 0);  
   analogWrite(In1, speed2); 
   return; 
 }  
 
 void Reverse (int speed1, int speed2)  
 { 
   Serial.println("Reverse"); 
   analogWrite(In4, speed1);  
   analogWrite(In3, 0);  
   analogWrite(In2, speed2);      
   analogWrite(In1, 0); 
   return; 
 }   
  
 void TurnLeft (int speed1, int speed2) 
 {  
   Serial.println("Turn Left");  
   analogWrite(In4, 0);    
   analogWrite(In3, speed1);  
   analogWrite(In2, speed2);  
Page | 14
   analogWrite(In1, 0);  
       if (T==1){ 
             GoForward(speed1,speed2);               
       } 
       if (T==2){ 
             Reverse(speed1,speed2);                
       } 
       if (T==3){ 
             StopMotors();                 
       } 
   return; 
  }  
 
 void TurnRight (int speed1, int speed2) 
 {  
   Serial.println("Turn Right");  
   analogWrite(In4, speed1);    
   analogWrite(In3, 0);  
   analogWrite(In2, 0);  
   analogWrite(In1, speed2);  
       if (T==1){ 
             GoForward(speed1,speed2);               
       } 
       if (T==2){ 
             Reverse(speed1,speed2);                
       } 
       if (T==3){ 
             StopMotors();                 
       } 
   return; 
  }  
 
This code allowed the user to connect to the Galileo via Wifi. Once connected to 
the Galileo Wifi Network the user could go into the web site, which was just the ip 
address 198.168.0.1 and in this site the user would be able to see and use the 
commands to move the RC Car (shown in figure 5).  
Page | 15
 
Figure 5: Remote Control Car Website 
After the site was working the final code was improved (shown in appendix as 
code 3) to add an increase speed and a decrease speed functions, however these 
functions did not work and the code could be modified to make this work. The web site 
with these additional functions is shown in figure 6 below. If more time had been 
available then these functions could have been working just as well as the rest of the 
rest of the code. 
 
Figure 6: “Improved” Remote Control Car Website 
Page | 16
Results 
Throughout the course of this project, there were a lot of software issues as well 
as errors in our original design that caused difficulties. At the end the project worked, 
however there were a lot of issues when trying to send code to the Galileo through the 
arduino software. Several times, both the serial connection through Putty and the 
connection through arduino were unable to “see” the Galileo. The microSD card had to 
be reformatted several times because of corruptions. The drivers on the computer side 
had to be reinstalled several times as well because every­so­often they would fail. 
When checking in the Windows Device Manager, the serial driver would sometimes 
show up as “CDC serial,” requiring the driver to be reinstalled.  Other times, the Galileo, 
connected through the microUSB port, would show up as “unknown USB,” requiring the 
port driver to be reinstalled. Finally, one of the connections was loose on the circuit, and 
thus the car was unable to move forwards, although all other commands were working. 
After re­soldering the loose connection, several unknown bugs within the Galileo 
prevented the car from properly working.  
 
 
 
 
 
 
 
Page | 17
 
Conclusions 
At the end the project was successful and worked as intended. With some help of 
Dr. Goggans fixing several unknown bugs occurring within the Galileo that were 
preventing the car from functioning properly. To conclude the students do not 
recommend the use of an Intel Galileo Gen 1 since this has several software issues that 
create a lot of problems for those working with it. Perhaps using an Intel Galileo Gen 2 
or an Arduino may provide better results and less problems with this project or similar 
projects. 
 
 
 
 
 
 
 
 
 
 
 
 
 
Page | 18
References 
[1] "Arduino ­ IntelGalileo." ​Arduino ­ IntelGalileo​. Available FTP: 
http://www.hofrock.com/setting­up­wi­fi/ 
[2] "Galileo Experiment Guide." ​Galileo Experiment Guide​. Available FTP: 
http://www.arduino.cc/en/ArduinoCertified/IntelGalileo 
[3] "Galileo Getting Started Guide." ​Galileo Getting Started Guide​. Web. Available 
FTP: 
https://learn.sparkfun.com/tutorials/galileo­getting­started­guide?_ga=1.7097550
4.1281909668.1425498561 
[4] "Setting up Wi­Fi." ​Clay and Galileo​. Available FTP: 
https://learn.sparkfun.com/tutorials/galileo­experiment­guide/sik­galileo­­­part­12­
driving­a­motor 
 
 
 
 
 
 
 
 
Page | 19
Appendix 
 
Code 1: Obtained from sparkfun.com 
 
// We'll be controlling the motor from pin 9. 
// This must be one of the PWM­capable pin 
const​ ​int​ motorPin ​=​ ​9​; 
void​ setup() 
{ 
 ​// Set up the motor pin to be an output: 
 pinMode(motorPin, OUTPUT); 
 ​// Set up the serial port: 
 Serial.begin(​9600​); 
} 
void​ loop() 
{ 
 ​// Here we've used comments to disable some of the examples. 
 ​// To try different things, uncomment one of the following lines 
 ​// and comment the other ones. See the functions below to learn 
 ​// what they do and how they work. 
 ​// motorOnThenOff(); 
 ​// motorOnThenOffWithSpeed(); 
 ​// motorAcceleration(); 
    serialSpeed(); 
} 
// This function turns the motor on and off like the blinking LED. 
// Try different values to affect the timing. 
void​ motorOnThenOff() 
{ 
 ​int​ onTime ​=​ ​3000​;  ​// milliseconds to turn the motor on 
 ​int​ offTime ​=​ ​3000​; ​// milliseconds to turn the motor off 
 
 digitalWrite(motorPin, HIGH); ​// turn the motor on (full speed) 
 delay(onTime);                ​// delay for onTime milliseconds 
 digitalWrite(motorPin, LOW);  ​// turn the motor off 
 delay(offTime);               ​// delay for offTime milliseconds 
} 
// This function alternates between two speeds. 
// Try different values to affect the timing and speed. 
void​ motorOnThenOffWithSpeed() 
{ 
 ​int​ Speed1 ​=​ ​200​;  ​// between 0 (stopped) and 255 (full speed) 
 ​int​ Time1 ​=​ ​3000​;  ​// milliseconds for speed 1 
 ​int​ Speed2 ​=​ ​50​;   ​// between 0 (stopped) and 255 (full speed) 
 ​int​ Time2 ​=​ ​3000​;  ​// milliseconds to turn the motor off 
Page | 20
 analogWrite(motorPin, Speed1);  ​// turns the motor On 
 delay(Time1);                   ​// delay for onTime milliseconds 
 analogWrite(motorPin, Speed2);  ​// turns the motor Off 
 delay(Time2);                   ​// delay for offTime milliseconds 
} 
// This function slowly accelerates the motor to full speed, 
// then back down to zero. 
void​ motorAcceleration() 
{ 
 ​int​ speed; 
 ​int​ delayTime ​=​ ​20​; ​// milliseconds between each speed step 
 ​// accelerate the motor 
 ​for​(speed ​=​ ​0​; speed ​<=​ ​255​; speed​++​) 
 { 
   analogWrite(motorPin,speed);    ​// set the new speed 
   delay(delayTime);               ​// delay between speed steps 
 } 
 ​// decelerate the motor 
 ​for​(speed ​=​ ​255​; speed ​>=​ ​0​; speed​­­​) 
 { 
   analogWrite(motorPin,speed);    ​// set the new speed 
   delay(delayTime);               ​// delay between speed steps 
 } 
} 
// This function will let you type a speed into the serial 
// monitor window. Open the serial monitor using the magnifying­ 
// glass icon at the top right of the Arduino window. Then 
// type your desired speed into the small text entry bar at the 
// top of the window and click "Send" or press return. The motor 
// will then operate at that speed. The valid range is 0 to 255. 
 
void​ serialSpeed() 
{ 
 ​int​ speed; 
 Serial.println(​"Type a speed (0­255) into the box above,"​); 
 Serial.println(​"then click [send] or press [return]"​); 
 Serial.println();  ​// Print a blank line 
 ​// In order to type out the above message only once, 
 ​// we'll run the rest of this function in an infinite loop: 
 ​while​(true)  ​// "true" is always true, so this will loop forever. 
 { 
   ​// First we check to see if incoming data is available: 
   ​while​ (Serial.available() ​>​ ​0​) 
   { 
     ​// If it is, we'll use parseInt() to pull out any numbers: 
Page | 21
     speed ​=​ Serial.parseInt(); 
     ​// Because analogWrite() only works with numbers from 
     ​// 0 to 255, we'll be sure the input is in that range: 
     speed ​=​ constrain(speed, ​0​, ​255​); 
     ​// We'll print out a message to let you know that the 
     ​// number was received: 
     Serial.​print​(​"Setting speed to "​); 
     Serial.println(speed); 
     ​// And finally, we'll set the speed of the motor! 
     analogWrite(motorPin, speed); 
   } 
 } 
} 
Code 2: YouTube user Web Server code 
 
/* 
Web Server 
A simple web server that shows the value of the analog input pins. 
using an Arduino Wiznet Ethernet shield. 
Circuit: 
* Ethernet shield attached to pins 10, 11, 12, 13 
* Analog inputs attached to pins A0 through A5 (optional) 
created 18 Dec 2009 
by David A. Mellis 
modified 9 Apr 2012 
by Tom Igoe 
*/ 
#include <SPI.h> 
#include <Ethernet.h> 
int led = 7; 
String POST = ""; 
String SET = ""; 
// Enter a MAC address and IP address for your controller below. 
// The IP address will be dependent on your local network: 
byte mac[] = { 
0x31, 0x2D, 0xDS, 0x45, 0x3D, 0xG1 };       //you will find ur Mac address on the intel 
board u need to change this 1 <­­­­­­­ 
IPAddress ip(192,168,0,177); 
// Initialize the Ethernet server library 
// with the IP address and port you want to use 
// (port 80 is default for HTTP): 
EthernetServer server(80); 
void setup() { 
// Open serial communications and wait for port to open: 
Page | 22
Serial.begin(9600); 
 while (!Serial) { 
  ; // wait for serial port to connect. Needed for Leonardo only 
} 
// start the Ethernet connection and the server: 
Ethernet.begin(mac, ip); 
server.begin(); 
Serial.print("server is at "); 
Serial.println(Ethernet.localIP()); 
pinMode(led, OUTPUT); 
} 
void loop() { 
// listen for incoming clients 
EthernetClient client = server.available(); 
digitalWrite(led, HIGH); 
if (client) { 
  Serial.println("new client"); 
  // an http request ends with a blank line 
  boolean currentLineIsBlank = true; 
  while (client.connected()) { 
    if (client.available()) { 
      char c = client.read(); 
      Serial.write(c); 
      // if you've gotten to the end of the line (received a newline 
      // character) and the line is blank, the http request has ended, 
      // so you can send a reply 
      if (c == 'n' && currentLineIsBlank) { 
        // it is after the double cr­lf that the variables are 
        // read another line! 
        String POST = ""; 
        while(client.available()) 
        { 
          c = client.read(); 
          // save the variables somewhere 
          POST += c; 
        } 
        if(POST != "") 
        { 
          if(POST == "led=1"){ 
            SET = "on"; 
            Serial.println("on"); 
          }else{ 
            SET = "off"; 
            Serial.println("off"); 
          } 
Page | 23
        } 
 
Code 3: Non­working “Improved” Final Code 
 
#include <WiFi.h> 
//char ssid[] = "SSID";      //  your network SSID (name)  
//char pass[] = "password";  // your network password 
//int keyIndex = 0;          // your network key Index number (needed only for WEP)  
int status = WL_IDLE_STATUS; 
WiFiServer server(80); 
int T = 0; 
int speed1 = 150; 
int speed2 = 150; 
const int In1 = 3;  //use the PWM­cable pins     
const int In2 = 5;  //use the PWM­cable pins     
const int In3 = 6;  //use the PWM­cable pins    
const int In4 = 11; //use the PWM­cable pins  
void setup() { 
 Serial.begin(9600); 
 pinMode(In1, OUTPUT); 
 pinMode(In2, OUTPUT); 
 pinMode(In3, OUTPUT); 
 pinMode(In4, OUTPUT);  
//if (WiFi.status() == WL_NO_SHIELD) { 
//    while(true);        // don't continue 
//  }  
//  
//  while ( status != WL_CONNECTED) {  
//    status = WiFi.begin(ssid, pass); 
//    delay(10000); 
//  } 
 server.begin();  
} 
void loop() { 
WiFiClient client = server.available();   // listen for incoming clients         
 if (client) {                             // if you get a client, 
   String currentLine = "";                // make a String to hold incoming data from the client 
   while (client.connected()) {            // loop while the client's connected 
     if (client.available()) {             // if there's bytes to read from the client, 
       char c = client.read();             // read a byte, then 
       if (c == 'n') {                    // if the byte is a newline character 
         if (currentLine.length() == 0) {   
           client.println("HTTP/1.1 200 OK"); 
           client.println("Content­type:text/html"); 
Page | 24
           client.println(); 
           client.print("<a href="/F">Forward</a> <br>"); 
           client.print("<a href="/B">Backwards</a> <br>"); 
           client.print("<a href="/S">Stop</a> <br>"); 
           client.print("<a href="/R">Right</a> <br>"); 
           client.print("<a href="/L">Left</a> <br>"); 
           client.print("<a href="/I">IncreaseSpeed</a> <br>"); 
           client.print("<a href="/D">DecreaseSpeed</a> <br>"); 
           client.println(); 
           break;          
         }  
         else { 
           currentLine = ""; 
         } 
       }      
       else if (c != 'r') {    // if you got anything else but a carriage return character, 
         currentLine += c;      // add it to the end of the currentLine 
       } 
       // Check to see if the client request was "GET /F" or "GET /B" or "GET /S" or "GET 
/R" or "GET /L": 
       if (currentLine.endsWith("GET /F")) { 
         T=1; 
         GoForward(speed1,speed2);               // GET /F  Go Forward  
       } 
       if (currentLine.endsWith("GET /B")) { 
         Reverse(speed1,speed2);                 // GET /B Go Backwards 
         T=2;  
       } 
       if (currentLine.endsWith("GET /S")) { 
         T=3; 
         StopMotors();                           // GET /S Stop  
       } 
       if (currentLine.endsWith("GET /R")) { 
         TurnRight(speed1,speed2);               // GET /R turns Car to the Right  
       } 
       if (currentLine.endsWith("GET /L")) { 
         TurnLeft(speed1,speed2);                // GET /L turns Car to the Left 
       } 
       if (currentLine.endsWith("GET /I")) { 
         IncreaseSpeed;                          // Increase Speed by 5 
       } 
       if (currentLine.endsWith("GET /D")) { 
         DecreaseSpeed;                          // Decrease Speed by 5 
       } 
     } 
Page | 25
   } 
   // close the connection: 
   client.stop(); 
 } 
} 
 void StopMotors() 
 { 
   Serial.println("Stop Motors"); 
   analogWrite(In4, 0);  
   analogWrite(In3, 0);  
   analogWrite(In2, 0);  
   analogWrite(In1, 0); 
   return; 
 }  
 void GoForward(int speed1, int speed2) 
 { 
   Serial.println("Forward"); 
   analogWrite(In4, 0);  
   analogWrite(In3, speed1);  
   analogWrite(In2, 0);  
   analogWrite(In1, speed2); 
   return; 
 }  
 void Reverse (int speed1, int speed2)  
 { 
   Serial.println("Reverse"); 
   analogWrite(In4, speed1);  
   analogWrite(In3, 0);  
   analogWrite(In2, speed2);      
   analogWrite(In1, 0); 
   return; 
 }     
 void TurnLeft (int speed1, int speed2) 
 {  
   Serial.println("Turn Left");  
   analogWrite(In4, 0);    
   analogWrite(In3, speed1);  
   analogWrite(In2, speed2);  
   analogWrite(In1, 0);  
   delay (4000); 
       if (T==1){ 
             GoForward(speed1,speed2);               
       } 
       if (T==2){ 
             Reverse(speed1,speed2);                
Page | 26
       } 
       if (T==3){ 
             StopMotors();                 
       } 
   return; 
  }  
 void TurnRight (int speed1, int speed2) 
 {  
   Serial.println("Turn Right");  
   analogWrite(In4, speed1);    
   analogWrite(In3, 0);  
   analogWrite(In2, 0);  
   analogWrite(In1, speed2);  
   delay (4000); 
       if (T==1){ 
             GoForward(speed1,speed2);               
       } 
       if (T==2){ 
             Reverse(speed1,speed2);                
       } 
       if (T==3){ 
             StopMotors();                 
       } 
   return; 
  } 
  void IncreaseSpeed (int speed1, int speed2) 
 {  
   Serial.println("Increase Speed");  
    speed1 = (speed2 + 50);  
    speed2 = speed1;  
       if (T==1){ 
             GoForward(speed1,speed2);               
       } 
       if (T==2){ 
             Reverse(speed1,speed2);                
       } 
       if (T==3){ 
             StopMotors();                 
       } 
   return; 
  }  
  void DecreaseSpeed (int speed1, int speed2) 
 {  
   Serial.println("Decrease Speed");  
    speed1 = (speed2 ­ 50);  
Page | 27
    speed2 = speed1;  
       if (T==1){ 
             GoForward(speed1,speed2);               
       } 
       if (T==2){ 
             Reverse(speed1,speed2);                
       } 
       if (T==3){ 
             StopMotors();                 
       } 
   return; 
  }  
 
Page | 28

Weitere ähnliche Inhalte

Ähnlich wie ELESeniorDesignFinalReport

IRJET- An Analysis and Implementation of Vehicle Black-Box System
IRJET- An Analysis and Implementation of Vehicle Black-Box SystemIRJET- An Analysis and Implementation of Vehicle Black-Box System
IRJET- An Analysis and Implementation of Vehicle Black-Box SystemIRJET Journal
 
IRJET- Implementation of Ideal Stop and Go Deactivation Logic for Passeng...
IRJET-  	  Implementation of Ideal Stop and Go Deactivation Logic for Passeng...IRJET-  	  Implementation of Ideal Stop and Go Deactivation Logic for Passeng...
IRJET- Implementation of Ideal Stop and Go Deactivation Logic for Passeng...IRJET Journal
 
TFG_Oriol_Torta.pdf
TFG_Oriol_Torta.pdfTFG_Oriol_Torta.pdf
TFG_Oriol_Torta.pdfhoussemouni2
 
A portable hardware in-the-loop device for automotive diagnostic control systems
A portable hardware in-the-loop device for automotive diagnostic control systemsA portable hardware in-the-loop device for automotive diagnostic control systems
A portable hardware in-the-loop device for automotive diagnostic control systemsISA Interchange
 
D1.3 public report
D1.3 public reportD1.3 public report
D1.3 public reportxpuig
 
IRJET- Review on Iot Solar Power Monitoring System
IRJET-  	  Review on Iot Solar Power Monitoring SystemIRJET-  	  Review on Iot Solar Power Monitoring System
IRJET- Review on Iot Solar Power Monitoring SystemIRJET Journal
 
IRJET- Artificial Intelligence Based Iot Automation: Controlling Devices with...
IRJET- Artificial Intelligence Based Iot Automation: Controlling Devices with...IRJET- Artificial Intelligence Based Iot Automation: Controlling Devices with...
IRJET- Artificial Intelligence Based Iot Automation: Controlling Devices with...IRJET Journal
 
IRJET - Advanced Charging Station for Electric Vehicles
 IRJET - Advanced Charging Station for Electric Vehicles IRJET - Advanced Charging Station for Electric Vehicles
IRJET - Advanced Charging Station for Electric VehiclesIRJET Journal
 
Software control systems for smart antenna
Software control systems for smart antennaSoftware control systems for smart antenna
Software control systems for smart antennaeSAT Journals
 
Simulation and Modelling of 3-Floor Elevator System using PLC
Simulation and Modelling of 3-Floor Elevator System using PLCSimulation and Modelling of 3-Floor Elevator System using PLC
Simulation and Modelling of 3-Floor Elevator System using PLCIRJET Journal
 
IRJET- Design and Fabrication of a Self Balancing Mono Wheel Vehicle
IRJET- Design and Fabrication of a Self Balancing Mono Wheel VehicleIRJET- Design and Fabrication of a Self Balancing Mono Wheel Vehicle
IRJET- Design and Fabrication of a Self Balancing Mono Wheel VehicleIRJET Journal
 
IRJET- Real Time Fuel Estimation using Micro Controller and Android App
IRJET- Real Time Fuel Estimation using Micro Controller and Android AppIRJET- Real Time Fuel Estimation using Micro Controller and Android App
IRJET- Real Time Fuel Estimation using Micro Controller and Android AppIRJET Journal
 
EE323 Mini-Project - Line tracing robot
EE323 Mini-Project - Line tracing robotEE323 Mini-Project - Line tracing robot
EE323 Mini-Project - Line tracing robotPraneel Chand
 
IRJET- Road Safety with a Smart Helmet for Two Wheeler Vehicle with Autom...
IRJET-  	  Road Safety with a Smart Helmet for Two Wheeler Vehicle with Autom...IRJET-  	  Road Safety with a Smart Helmet for Two Wheeler Vehicle with Autom...
IRJET- Road Safety with a Smart Helmet for Two Wheeler Vehicle with Autom...IRJET Journal
 
High Efficiency Motor Systems
High Efficiency Motor SystemsHigh Efficiency Motor Systems
High Efficiency Motor SystemsLeonardo ENERGY
 
Fuzzy System Model for Management of Driver Distractions in Motor Vehicles
Fuzzy System Model for Management of Driver Distractions in Motor VehiclesFuzzy System Model for Management of Driver Distractions in Motor Vehicles
Fuzzy System Model for Management of Driver Distractions in Motor VehiclesEswar Publications
 
Autonomous Vehicle by using 3D LIDAR and 2D Camera
Autonomous Vehicle by using 3D LIDAR and 2D CameraAutonomous Vehicle by using 3D LIDAR and 2D Camera
Autonomous Vehicle by using 3D LIDAR and 2D CameraIRJET Journal
 
Implementation of Automatic Upper Dipper in Car Dashboard using CANoe
Implementation of Automatic Upper Dipper in Car Dashboard using CANoeImplementation of Automatic Upper Dipper in Car Dashboard using CANoe
Implementation of Automatic Upper Dipper in Car Dashboard using CANoeIRJET Journal
 
IRJET- Modelling and Control of Variable Frequency Drive using PLC and Ma...
IRJET-  	  Modelling and Control of Variable Frequency Drive using PLC and Ma...IRJET-  	  Modelling and Control of Variable Frequency Drive using PLC and Ma...
IRJET- Modelling and Control of Variable Frequency Drive using PLC and Ma...IRJET Journal
 

Ähnlich wie ELESeniorDesignFinalReport (20)

IRJET- An Analysis and Implementation of Vehicle Black-Box System
IRJET- An Analysis and Implementation of Vehicle Black-Box SystemIRJET- An Analysis and Implementation of Vehicle Black-Box System
IRJET- An Analysis and Implementation of Vehicle Black-Box System
 
OCC FOR EASY RIDE
OCC FOR EASY RIDEOCC FOR EASY RIDE
OCC FOR EASY RIDE
 
IRJET- Implementation of Ideal Stop and Go Deactivation Logic for Passeng...
IRJET-  	  Implementation of Ideal Stop and Go Deactivation Logic for Passeng...IRJET-  	  Implementation of Ideal Stop and Go Deactivation Logic for Passeng...
IRJET- Implementation of Ideal Stop and Go Deactivation Logic for Passeng...
 
TFG_Oriol_Torta.pdf
TFG_Oriol_Torta.pdfTFG_Oriol_Torta.pdf
TFG_Oriol_Torta.pdf
 
A portable hardware in-the-loop device for automotive diagnostic control systems
A portable hardware in-the-loop device for automotive diagnostic control systemsA portable hardware in-the-loop device for automotive diagnostic control systems
A portable hardware in-the-loop device for automotive diagnostic control systems
 
D1.3 public report
D1.3 public reportD1.3 public report
D1.3 public report
 
IRJET- Review on Iot Solar Power Monitoring System
IRJET-  	  Review on Iot Solar Power Monitoring SystemIRJET-  	  Review on Iot Solar Power Monitoring System
IRJET- Review on Iot Solar Power Monitoring System
 
IRJET- Artificial Intelligence Based Iot Automation: Controlling Devices with...
IRJET- Artificial Intelligence Based Iot Automation: Controlling Devices with...IRJET- Artificial Intelligence Based Iot Automation: Controlling Devices with...
IRJET- Artificial Intelligence Based Iot Automation: Controlling Devices with...
 
IRJET - Advanced Charging Station for Electric Vehicles
 IRJET - Advanced Charging Station for Electric Vehicles IRJET - Advanced Charging Station for Electric Vehicles
IRJET - Advanced Charging Station for Electric Vehicles
 
Software control systems for smart antenna
Software control systems for smart antennaSoftware control systems for smart antenna
Software control systems for smart antenna
 
Simulation and Modelling of 3-Floor Elevator System using PLC
Simulation and Modelling of 3-Floor Elevator System using PLCSimulation and Modelling of 3-Floor Elevator System using PLC
Simulation and Modelling of 3-Floor Elevator System using PLC
 
IRJET- Design and Fabrication of a Self Balancing Mono Wheel Vehicle
IRJET- Design and Fabrication of a Self Balancing Mono Wheel VehicleIRJET- Design and Fabrication of a Self Balancing Mono Wheel Vehicle
IRJET- Design and Fabrication of a Self Balancing Mono Wheel Vehicle
 
IRJET- Real Time Fuel Estimation using Micro Controller and Android App
IRJET- Real Time Fuel Estimation using Micro Controller and Android AppIRJET- Real Time Fuel Estimation using Micro Controller and Android App
IRJET- Real Time Fuel Estimation using Micro Controller and Android App
 
EE323 Mini-Project - Line tracing robot
EE323 Mini-Project - Line tracing robotEE323 Mini-Project - Line tracing robot
EE323 Mini-Project - Line tracing robot
 
IRJET- Road Safety with a Smart Helmet for Two Wheeler Vehicle with Autom...
IRJET-  	  Road Safety with a Smart Helmet for Two Wheeler Vehicle with Autom...IRJET-  	  Road Safety with a Smart Helmet for Two Wheeler Vehicle with Autom...
IRJET- Road Safety with a Smart Helmet for Two Wheeler Vehicle with Autom...
 
High Efficiency Motor Systems
High Efficiency Motor SystemsHigh Efficiency Motor Systems
High Efficiency Motor Systems
 
Fuzzy System Model for Management of Driver Distractions in Motor Vehicles
Fuzzy System Model for Management of Driver Distractions in Motor VehiclesFuzzy System Model for Management of Driver Distractions in Motor Vehicles
Fuzzy System Model for Management of Driver Distractions in Motor Vehicles
 
Autonomous Vehicle by using 3D LIDAR and 2D Camera
Autonomous Vehicle by using 3D LIDAR and 2D CameraAutonomous Vehicle by using 3D LIDAR and 2D Camera
Autonomous Vehicle by using 3D LIDAR and 2D Camera
 
Implementation of Automatic Upper Dipper in Car Dashboard using CANoe
Implementation of Automatic Upper Dipper in Car Dashboard using CANoeImplementation of Automatic Upper Dipper in Car Dashboard using CANoe
Implementation of Automatic Upper Dipper in Car Dashboard using CANoe
 
IRJET- Modelling and Control of Variable Frequency Drive using PLC and Ma...
IRJET-  	  Modelling and Control of Variable Frequency Drive using PLC and Ma...IRJET-  	  Modelling and Control of Variable Frequency Drive using PLC and Ma...
IRJET- Modelling and Control of Variable Frequency Drive using PLC and Ma...
 

ELESeniorDesignFinalReport