User login

Powered by Drupal, an open source content management system

Theory and Practice of Tangible User Interfaces

Lab 6: DC Motors

Submitted by katalene on Wed, 12/31/2008 - 23:56

Assignment: DC Motor: Actuation Assignment 1
Collaborators:
Assignment: DC Motor: Actuation Assignment 1 Collaborators: sohyeong
Assignment: DC Motor: Actuation Assignment 1 Collaborators: sohyeong
Description: we were inspired by the old-fashioned optical illusions, and wanted to duplicate that using the DC motor. To that end, we cut out a piece of cardboard and drew a bird on one side and an empty cage on the other. Using the potentiometer to control the speed of the DC motor, the cardboard rotated quickly enough to provide an optical illusion of placing the bird in the cage.
Ingredients:
arduino/breadboard/wires/resistor
1 DC motor
1 potentiometer
1 diode
1 transistor
1 3V battery
cardboard (bird on one side, cage on the other)
photo:

 
video link:
http://video.google.com/videoplay?docid=-6774711699928308325&hl=en
 
code:
/* * 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 potPin = 5;   // select the input pin for the potentiometerint motorPin = 9; // select the pin for the Motorint val = 0;      // variable to store the value coming from the sensorvoid setup() { Serial.begin(9600);}void loop() { val = analogRead(potPin);    // read the value from the sensor, between 0 - 1024 Serial.println(val); analogWrite(motorPin, val/4); // analogWrite can be between 0-255}