Weitere ähnliche Inhalte
Ähnlich wie ELESeniorDesignFinalReport
Ähnlich wie ELESeniorDesignFinalReport (20)
ELESeniorDesignFinalReport
- 2. 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
- 5. wireless card was connected to the Galileo using a halfheight to fullheight 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 N6205 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 N6205 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
- 9.
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
- 10. 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
- 15. }
}
}
// 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
- 16. 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
- 18. 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 everysooften 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 resoldering the loose connection, several unknown bugs within the Galileo
prevented the car from properly working.
Page | 17
- 23. 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
- 27. }
// 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
- 28. }
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