Automatic Screwdriver

Description
For this assignment, I crafted an automatic screwdriver using the DC motor to spin a chop stick and an FSR sensor to control the drilling speed.
Components
- Arduino Uno
- Breadboard
- FSR sensor
- DC motor
- Transistor
- Resistor (10 ohm)
- Battery case
- 2 x AA batteries
- Paper
- Cardboard
- Chop stick
- Wadding
- Tape
Code
int fsrPin = A0; // select the input pin for the FSR sensor
int motorPin = 9; // select the pin for the DC Motor
int fsrVal = 0; // variable to store the value coming from the FSR sensor
void setup() {
Serial.begin(9600);
}
void loop() {
fsrVal = analogRead(fsrPin); // read the value from the sensor, between 0 - 1023
Serial.println(fsrVal); // print value
fsrVal = map(fsrVal, 0, 1023, 0, 255); // even out FSR value range (0-1023) and DC motor value range (0-255)
analogWrite(motorPin, fsrVal); //
//Serial.println(fsrVal);
delay(250);
}
- Login to post comments
Drupal theme by Kiwi Themes.