Lab 6:DC Motor(Blossoming Buds)
Description:
We use DC Motors in this lab. This assignment exposes us to building more complex circuits. We use transistors and diodes to control a DC Motor using an input sensor(Pot). For HW, I use the DC Motor to produce a visual pattern resembling the blossoming of flower buds by using strips of paper.
Components Used:
- Arduino Micro-controller
- 1 Resistor (1K Ohms)
- Wires/Bread Board
- Potentiometer
- Transistor
- Diode
- DC Motor
Blossoming Buds(HW):
For HW, I attached colorful strips of paper to the DC Motor to give a visual effect of blossoming flowers. In order to produce the layered effect, I had to use strips of varying size and weight. Hence, they spread out at different levels. Controlling the output voltage using an input sensor, I could make the 'flower' either 'blossom' or become a 'bud'.
Just to give it a greater context, I tried out the photocells as input also. Hence, when it was dark, the flower became a bud, and in light, it blossomed.
Click here to see the video. (Don't miss the background screen-saver! Perfect harmony of colors)
Ardruino Code:
/**
* --Blossoming Buds --
* This code runs a DC Motor with the input coming in from an input sensor,
* in this case a Pot or a Photocell. Using strips of paper of different sizes and
* weights, the motor spreads these stips out differently, hence giving a layered effect.
*/
int inPin = 0; // select the input pin for the sensor(Pot, or Photocell)
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
}