Rotating Pinwheel

For this lab, I built a pinwheel powered by the dc motor. While making the pinwheel wasn’t very hard, a lot of thought and effort went into controlling its stability and speed on the motor’s spindle. After a very few spins, the spindle makes the hole in the pinwheel bigger causing the pinwheel paper to lose contact with the motor which further results in loss of control over the motion of the pinwheel and the speed.

To circumvent the problem, I used a twist tie to harness the motion of the spindle and transfer it onto the pinwheel. The arrangement is depicted in the photo attached. I then hosted the pinwheel and motor on a candy holder to allow for the pinwheel to get enough space to spin. I also placed a sticker on the top of the spindle hole to prevent the paper pinwheel from flying away.

img_20161009_230825https://drive.google.com/a/berkeley.edu/file/d/0ByHw8c_nutT2LU9EcGRNMWR2b28/view?usp=sharing

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 = 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() {
pinMode(motorPin, OUTPUT);
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
}

Leave a Reply