Group 8 – Lab 3

Group 8: The Backend Cleaning Inspectors

Dylan Bowman – dbowman

Peter Yu – keunwooy

Green Choi – ghchoi

Tae Jun Ham – tae

 

Description:

We built a miniature toy that moves around using two Servo motors, which act as legs for the toy.  The toy is controlled using a light sensor and potentiometer.  The potentiometer controls the direction of the toy (either left, right, or straight), and the light sensor tells the toy when to move.  When the light sensor is covered up (dark), the toy will move in whatever direction the potentiometer has set it, and when it’s uncovered (light) it stops moving.  We built this, because it’s a fun little toy that takes advantage of Servo motors as well as sensors that we’ve learned to implement.  The toy was a success in that we could control its movements and make it turn directions, but the Servo motors were not the most reliable source of propulsion in that they occasionally fell off, or the movement was not exactly ideal.

List of Brainstorming Ideas:

  1. RC Boat with DC motor propellor and Servo motor for steering
  2. Two servo motors, one on each side, in replication of Walker from Star Wars, or little bug toy
  3. Two wheel based mini cars (rubber around DC motors)
  4. Moving sprinkler – tied to a DC motor which pulls it forward, while Servo motor allows the sprinkler to spread water around
  5. Balloon powered car – Servo motor acts as rudder to steer air coming out of balloon on back of car
  6. Blimp with oscillating Servo motor powered wings that keep it afloat and steer it
  7. 4 DC wheel robot with an oscillating Servo motor arm that regularly pushes against a flex sensor which initiates the DC wheels to move
  8. Helicopter with a DC motor helicopter blade on top
  9. Sailboat with flex sensors that read where the wind is blowing from and turns the sail to best catch the wind
  10. Line tracer, car that traces a line on the floor to target point
  11. Wave generator, put a DC motor with a blade attached under the water which initiates waves which will push an object on the surface towards a point
  12. Paper airplane that can stay in the air forever (or a long time) by using force sensors to adjust flaps on the plane to stay in the air

Photos of Design Sketches:

Video of Our Final System:

List of Parts:

– Two servo motors

– photo cell

– potentiometer

– Capacitor (optional)

– Resistor

Instructions:

Connect the light sensor with the resistor and complete the circuit into an analog pin (0 in our case). Connect the potentiometer to an analog pin (1 in our case). Connect the servo motors to two different digital pins (5 and 9 in our case). Here you can use a capacitor (see http://learn.adafruit.com/downloads/pdf/adafruit-arduino-lesson-14-servo-motors.pdf) to power the servos more reliably. We did use a capacitor, but it’s not strictly necessary. Use the attached code.

Source Code:

#include 

int lightPin = 0;
int knobPin = 1;
int servoPinL = 5;
int servoPinR = 9;
Servo servoL;
Servo servoR;
int l;
int r;
void setup()
{
 servoL.attach(servoPinL);
 servoR.attach(servoPinR);
 Serial.begin(9600);
}

void loop()
{
 int reading = analogRead(lightPin);     // 0 to 1023
 int leftOrRight = analogRead(knobPin);
 if (leftOrRight  200) {
     servoL.write(0);
     servoR.write(90);
   }
   else {
     servoL.write(0);
     servoR.write(0);
   }
 } else if (leftOrRight  200) {
     servoL.write(0);
     servoR.write(90);
   }
   else {
     servoL.write(90);
     servoR.write(0);
   }
 } else {
   // go right
   if (reading > 200) {
     servoL.write(0);
     servoR.write(0);
   }
   else {
     servoL.write(90);
     servoR.write(0);
   }
 }

}