Arduino Wireless Racer


 This project was completed by David Damour, George Loeper, and Andrew Rauh.



The Car:

Features and characteristics of the Arduino Wireless Racer:
    -Control forward speed and turning with the use of a remote.
    -Is powered by 3 double-A batteries and one 9v battery.
    -Direction of the wheels and functions of Remote buttons can be reprogrammed and changed. 
    -Car is powered by two DV motors originally belonging to a Lego kit. 

The body of the car came from an Lego kit. We had to completely remove the previous circuit board connected to the two motors, and create our own board upon which our Arduino is mounted. 

Board Model:
(higher quality image can be found at <http://imgur.com/yXwo3.png>)


Code:

int motor1a = 7;           //motor pin 
int motor1b = 2;           //motor pin
int motor1pmw = 5;     // this is the pmw that will set how much battery power the motor is getting (speed)
int motor2a = 10;   //motor pin
int motor2b = 1;    //motor pin
int motor2pmw = 6;  // this is the pmw that will set how much battery power the motor is getting (speed)
int buttond = 17;  //analog pin number used for button d
int button1 = 18;  //analog pin number used for button c
int button2 = 19;  //analog pin number used for button b
void setup()
{
  pinMode(14,OUTPUT);  //these all refer to the analog pins you are using for the radio reciever. 
  digitalWrite(14,HIGH); //positive power
  pinMode(15,OUTPUT);
  digitalWrite(15,HIGH);   //postive power
  pinMode(16,OUTPUT);
  digitalWrite(16,LOW);  //negative power

pinMode(motor1a, OUTPUT);           //
pinMode(motor1b, OUTPUT);           // these simply are declaring them as outputs
pinMode(motor1pmw, OUTPUT);     //
pinMode(motor2a, OUTPUT);
pinMode(motor2b, OUTPUT);
pinMode(motor2pmw, OUTPUT);
analogWrite(motor1pmw, 255);      // this is the analog speed value for the arduino (0-255)
analogWrite(motor2pmw, 255);
pinMode(buttond, INPUT);
pinMode(button1, INPUT);
pinMode(button2, INPUT);
}
 
void loop()
{
 
if(digitalRead(buttond)==HIGH) //if you press d, this happens
{
digitalWrite(motor1a, HIGH);         
digitalWrite(motor1b, HIGH);          //turns the motors on - forwards
digitalWrite(motor2a, LOW);
digitalWrite(motor2b, LOW);
}
else
{
digitalWrite(motor1a, LOW);         
digitalWrite(motor1b, LOW);          //turns the motors on - backwards(in our case nothing happens)
digitalWrite(motor2a, HIGH);
digitalWrite(motor2b, HIGH);
} 

if(digitalRead(button1)==HIGH) //if button c is pressed then, it turns.
{
digitalWrite(motor1a, HIGH);         
digitalWrite(motor1b, LOW);          //turns the motors on - forwards
digitalWrite(motor2a, HIGH);
digitalWrite(motor2b, LOW);
}
if(digitalRead(button2)==HIGH) //if button b is pressed, it goes forward but at a slower pace. 
{
  digitalWrite(motor1a, HIGH);
  digitalWrite(motor1b, HIGH);
  digitalWrite(motor2a, HIGH);
  digitalWrite(motor2b, HIGH);
}
}

Most of the problems we encountered involved our shoddy soldering and wiring. 
The coding was not difficult, but we made many mistakes in wiring the h-bridge. 
We overcame this problems by taking the time to work out a diagram of the wiring on paper 
first. 
Also, we discovered that the motors we used seem to unable to go backwards. This may be due to an unknown diode in the motors, or a gear issue. 

We would add.:
The first thing we would do is interface the remote control with the computer, so that keys pressed on the keyboard would control the car wirelessly. 
Once the remote is interfaced with the computer, we could add other things such as connectivity to twitter. 
For example, we could have written a program on the computer that tweets a message when the keyboard command for driving forward is given. 
We could also add a stronger motor so things could be carried on the car.
Finally, if we had more time, we would have added more push buttons and direction control to the car. 

Video:



Pictures:











Comments