Virtual Reality R/C Car Part 1

Introduction:

Over at the Boca Bearings Workshop we recently were able to obtain a handful of abandoned arcade games. Once all of them arrived at the shop, Brian and I were pretty eager to find out to what degree all of these games were still functional. I mean who doesn't love some classic arcade games? Once we started looking into some of these machines we realized that there were a lot of wires without any places to be plugged in. After Brian did a little further research it turns out that it was pretty common practice to take the motherboard out of those machines when they were abandoned. This meant that we basically have everything we need except for the software to play a game. One thing we did notice however was that the arcade motorcycles that originally were used for MANX TT Superbike contained three primary input devices, 3 geared potentiometers. With the help of an Arduino we figured we could turn that bike into a controller that would make you feel a little more immersed while driving your R/C car.

Testing the Potentiometers:




So on this machine there is a potentiometer to read the tilt of the bike, how far the break is pulled in, and how far the throttle has been turned. In order to test these devices I powered them with the 5 volt output from the Arduino, connected the ground pin on each of the potentiometer to the ground on the Arduino, and connected each of the signal pins to one of the analog input pins on the Arduino Uno. All three of the potentiometers can share the same 5v input and ground but each one must be connected to a separate analog input pin.




Code:

//Declare variables
int bikeTilt;
int throttle;
int handBreak;

void setup() {
 Serial.begin(9600); //Select Baud Rate
}

void loop() {
  //Read Pots
  bikeTilt = analogRead(A0);
  throttle = analogRead(A1);
  handBreak = analogRead(A2);

  //Print and format values
  Serial.print("Bike Tilt=");
  Serial.print(bikeTilt);
  Serial.print("  Throttle=");
  Serial.print(throttle);
  Serial.print("   HandBreak=")
  Serial.println(handBreak);  // the println moves to the next line in the serial monitor
 

}

Interpreting the Results:
Arduino reads analog signals in 10-bit. This means that each variables read in the code above can range in value from 0-1023, which corresponds to the signal of the potentiometer outputting between 0 and 5 Volts. However because of the way they are set up on the bike they could not actually reach their absolute maximum and minimum. So what I did was run the code above to find out the actual maximum and minimum values for each potentiometer on the bike.

Bike Tilt
313-737

Throttle
75-976

Break
0-305

These values will be important later because these are the range of values that I will use to control the R/C car.


No comments:

Post a Comment