Shy Car

Submitted by bmcrae on Tue, 03/12/2013 - 20:05
bmcrae's picture

Description

In this lab, a car that runs away when you try to touch it was created it. When you reach out your hand to try and catch the car from behind, it will zoom off until it reaches a safe distance away from you.

This was achieved using a DC motor with a rubber band to rotate the two wheels of the car, as well as a photocell that senses the change in light when one approach the vehicle. Other components such as the transistor and the diode were used to create the overall circuit. This "shy" car could be a fun toy for young children to interact and play with!

During the development of this project, several difficulties came from attaching a rubber band conveyor belt to the DC motor's shaft. It was difficult to mount things directly on the shaft without a coupler. Through the use of makeshift parts and much trial and error, I was finally able to get the wheels to turn on the car; however, by no means was the implementation very robust. Depending on the how the rubber band rubs against the shaft of the DC motor, the car may accelerate at different speeds. In the future, I would like to find better parts that allow me to make a more robust design. As a proof of concept and a prototype, this design and implementation are decent.

 

Components

1 - Arduino Uno

1 - 10K ohm resistor

1 - 1K ohm resistor

1 - photocell

1 - DC motor

1 - diode 1N4004

1 - transistor TIP120

1 - battery holder

2 - AA batteries

1 - breadboard

 

Code

 

/* Shy Car
 * Brian McRae
 * 3/10/13
 *
 * one pot fades one motor
 * modified version of AnalogInput
 * by DojoDave <http://www.0j0.org>
 * http://www.arduino.cc/en/Tutorial/AnalogInput 
 * Modified again by dave
 */
 
int photo_Pin = 0;   // select the input pin for the photocell
int motorPin = 9; // select the pin for the Motor
int val = 0;      // variable to store the value coming from the sensor
 
void setup() {
  Serial.begin(9600);
}
 
void loop() {
  val = analogRead(photo_Pin);    // read the value from the sensor, between 0 - 1024
  Serial.println(val);
  
  if (val < 500) {    // when a user reachs over to touch the back end of the car, the light level from the photocell will decrease.
    analogWrite(motorPin, 255); // Motor will turn to move car away from person.
  }
  
  else {
    analogWrite(motorPin, 0); // Otherwise, car is stationary.
  }
  
}

 

photo2.JPG
photo3.JPG
photo4.JPG
photo5.JPG
photo6.JPG
0
Your rating: None
Drupal theme by Kiwi Themes.