For this lab I decided to use the vibrating practicality of a motor by attaching a cork slice off center. I then attached the vibrating motor to a cup where if left by itself for too long it would start to vibrate to remind you (see attached video).
The motivation for this is a reminder to drink a beverage. Some uses of this could be making sure you drink the cup of water you poured yourself to get your 8 glasses per day or to finish your coffee/tea before it gets cold. By picking up the cup the user exposes the photosensor to the ambient light and this resets the counter. I utilized a photosensor for this prototype instead of an FSR because the force would change as you drink your beverage. Future work would include an FSR to turn off the alarm when the cup is empty. Another added functionality would be to increase the vibration the more alarm periods that are missed.
https://docs.google.com/file/d/0BzquLLPdhTEkdFlxUm4yQjAxQzA/edit?usp=sha...
Materials used
1- Arduino Uno Microcontroller
1- Breadboard
1- 1KΩ Resistor
1- 10KΩ Resistor
1- USB Cable
1- Laptop Computer
1 - DC Motor
1 - 1N4004 Diode
1 - TIP120 Transistor
1 - Battery pack with 2 AA batteries
1 - Photosensor
1 - Cup
1 - Tape
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 senPin = 0; // select the input pin for the sensor
int motorPin = 9; // select the pin for the Motor
int motorval = 0; // variable to store the value coming from the sensor
int senval = 0;
int count = 0; //counts how many times senval is below limit
int timelim = 5; //count the amount of time cup is down in seconds
int limit = 150; //sensor value to determine if cup is up or down
int vib = 2; //how many vibrations per warning
void setup() {
Serial.begin(9600);
pinMode(senPin, OUTPUT);
}
void loop() {
delay(1000); //read values every second
senval = analogRead(senPin); //read in sensor value
Serial.println(senval); //debugging
if(senval<limit)
{
count++;
}
if(senval>limit)
{
count=0;
}
if(count>=timelim)
{
for(int i=0; i <= vib; i++){
analogWrite(motorPin, 100);
delay(200);
analogWrite(motorPin, 0);
delay(200);
}
count = 0;
}
}
- Login to post comments