Description
In this assignment, I use a FSR to contorl the DC motor, and attach a fan to it. The code actually is really simple, but the result looks fun.
Component
1.Arduino board
2.White breadboard
3.DC motor (connects to pin9)
4.1K Resistor
5.Diode
6.Transistor
7.Wires connect DC motor to Arduino board
8.FSR (Force Sensitive Resistor)
9.10K Resistor (labeled using brown, black orange and gold bands)
10.Wires connect FSR to Arduino board
11.2 rubber bands
12.USB cable
13.Arduino environment
Code
int senPin = 1; // select the input pin for FSR
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(senPin); // read the value from the sensor, between 0 - 1023
Serial.println(val);
analogWrite(motorPin, val/4); // analogWrite can be between 0-255
delay(250);
}
Picture

Video
Comments
Comments from TAs
Moving things seem to always be fun! Creating a spinning fan is a good way to start working with motors. It would also be interesting to consider different shapes of fans to create some that are prettier, more efficient, etc... Or, you could experiment with different inputs. For example, what about a fan that turns on automatically when it gets hot, or that reacts to other elements of the environment?