DC motor - spinning snowflake

Posted by melissa

melissa's picture

Description:
Used a DC motor to experiment with motion as output. It was difficult to find something that would attach to the spinning part of the motor without flying off. I finally found a mini clothespin that could pretty much only hold a piece of paper. I took an old paper snowflake from our winter decorations and decided to give it motion and make it spin! video: http://www.youtube.com/watch?v=uRoU5RxBTEc

Materials Used:

  • DC Motor
  • Transistor
  • Diode
  • Potentiometer
  • Battery pack
  • Paper snowflake

Code: 

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
}
 
IMG_1271.JPG
IMG_1270.JPG
0
Your rating: None
Tags: