Description: Optical Vehicle
Since I only have one DC motor, a set of gears is adopted to apply one DC motor into two directions. The original setup for this optical vehicle is only two wheels; however, it’s hard to be balanced when putting something on it. Thus, two small extra wheels are added in the front part of the model. The motion of the Optical Vehicle is controlled by a FSR. The major wheels emit green and blue light separately, controlled by the other FSR and photocell sensor.
Components: Two force pressure resistors, one photocell sensor, Arduino board, breadboard, wires, Blue and Green LEDs, one silicon translucent ball, a set of gears.
Arduino Code:
/*
* DC motors Input
* Resistive Sensor Input
* Takes the input from a resistive sensor, e.g., FSR or photocell
* by Hsin-Hsien Chiu, 2007
*/
int sensor1Pin = 0; // select the input pin for the sensor
int sensor2Pin = 1;
int moterPin = 2;
int BluePin = 11; // select the output pin for the LED
int GreenPin = 10;
int morterPin = 9;
int sensor1val = 0; // variable to store the value coming from the sensor
int sensor2val = 0;
int moterval = 0;
void setup() {
Serial.begin(9600);
beginSerial(9600);
}
void loop() {
sensor1val = analogRead(sensor1Pin); // read the value from the sensor, 0-1023
sensor2val = analogRead(sensor2Pin);
moterval = analogRead(moterPin);
analogWrite(BluePin, sensor1val/4); // analogWrite (dimming the LED) can be between 0-255
analogWrite(GreenPin, sensor2val/4);
analogWrite(morterPin, moterval/4);
Serial.println(sensor1val/4); // writing the value to the PC via serial connection
Serial.println(sensor2val/4);
Serial.println(moterval/4);
delay(50); // rest a little...
}
Movies:
http://www.youtube.com/watch?v=AM7mj65djFM
Images:
http://photo.xuite.net/berkeleychiu/2052399/1.jpg
http://photo.xuite.net/berkeleychiu/2052399/2.jpg
http://photo.xuite.net/berkeleychiu/2052399/3.jpg
http://photo.xuite.net/berkeleychiu/2052399/4.jpg
http://photo.xuite.net/berkeleychiu/2052399/5.jpg
Comments
Comments from TAs
Very nice work! Connecting your motor to gears and getting the vehicle to be steerable must have been a lot of work. As other students start working with mechanical systems in later labs or in their final projects, it would be great if you'd be willing to give advice on building similar sets of gears. I like the video!