Assignment: DC Motor: Actuation Assignment 1
Collaborators:
Description
A new twist on an old favorite -- the thaumatrope! I used the eraser on a pencil (and after that broke, glued a cardboard sandwich together with wires), as the anchor for the drive shaft of the dc motor to twist the image. I then used a notecard folded in half and attached to the pencil shaft to rotate the images and produce an "animation". Two animated images are shown below.
Components Used
- DC Motor, wires, battery pack, breadboard, 1 potentiometer, resistors
- Cardboard
- One #2 pencil, broken in half
- pen cap
- paper clips
- markers
- notecards, blank
- adjustable wrench and a bag of rice, as an base to anchor the DC motor
Arduino Code
I used the code for dc motor with controlled by a potentiometer.
/*
* 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 = 0; // select the input pin for the potentiometer
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(potPin); // read the value from the sensor, between 0 - 1024
Serial.println(val);
analogWrite(motorPin, val/4); // analogWrite can be between 0-255
}