After completing the activity using the DC motor and potentiometer, I got the idea of making massage machine with the DC motor and the force sensor. The massage machine vibrates when I put pressure on the vibrating surface. The extent of vibration depends on how strongly I push the machine to body.
I started to extending the wires connected to a force sensor installed on the massage machine. I installed he DC motor inside the massage equipment. Although I wanted to use the Piezo Buzzer and enable it to play musice notes whenever massaging activity is going on, my Piezo Buzzer was broken (one wire came off). Then, I coded a program which takes input value from the force sensor and provide output through vibration of the DC motor.
Components used:
1- Arduino Uno
1- Breadboard
2- 10Kohms resistor
1-Force sensor
1-diode
1-transistor
1-DC motor
Connecting wires
Arduino 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 = A0; // 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);
pinMode(9,OUTPUT);
pinMode(A0,INPUT);
}
void loop() {
val = analogRead(potPin);
Serial.println(val);
analogWrite(motorPin, val/4);
}
- Login to post comments