Assignment: DC Motor: Actuation Assignment 1
Collaborators:
Description
I created an electric, force-sensing toothbrush for this assignment, using a DC motor and a force sensor. The force sensor is located where people usually rest their thumb on a toothbrush, and signals the DC motor to start spinning. I attached a piece of cork off center to allow more powerful spinning and vibrating. I sized the cork so that it wouldn't hit a diligent toothbrusher in the tooth, but it is still a risk and could be improved.
Components
One regular toothbrush
One FSR
One DC motor
One battery pack
One diode
One transistor
One 1-kohm resistor
One 10-kohm resistor
Several wires
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() {
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
}
Pictures
Video