'Time to Get Out of Your Chair' Alarm
by TechMartian in Circuits > Assistive Tech
3760 Views, 26 Favorites, 0 Comments
'Time to Get Out of Your Chair' Alarm
This is a device that warns and sets off an alarm when you've been sitting on your chair for too long, reminding you to get off of your @$$ and get some exercise! It's the Pomodoro Clock of Chairs, one chair to rule them all!
Working as a software developer as a day job means I am almost always glued to a chair. Many older people suffer from back problems due to the nature of the job. I have created a mechanism that may circumvent this problem by detecting how long you've been sitting on a chair and sounding an alarm if you have been there for too long!
BoM
* Photosensor
* 10kΩ Resistor
* Jumper Cables
* Arduino
Tools:
* Soldering Iron
Solder
Since I wanted to go breadboard-less we'd need to solder the resistor onto one of the pins of the photosensor (call this pin 1) since the photosensor will use a voltage divider to relay input signals to the Arduino.
Connections
Follow the table below for the connections between the I/Os and the
I/O | I/O pin | Arduino Pin |
---|---|---|
Photosensor | 1 | A0 |
Photosensor | 2 | GND** |
Buzzer* | 1 | 9 |
Buzzer* | 2 | GND** |
* Order of pins do not matter for the buzzer
** The Arduino board has at least 3 GND pins
Code
/**
* 'Get out of your chair alarm!' * By TechMartian *
/cosntants for the pins where sensors are plugged into. const int sensorPin = 0; const int buzzPin = 9;
unsigned long minute1; float time1;
//Set up some global variables for the light level an initial value. int bright; // initial value int lightVal; // light reading
void setup() { // We'll set up the LED pin to be an output. bright = 900; //we will take a single reading from the light sensor and store it in the lightCal //variable. This will give us a prelinary value to compare against in the loop }
void loop() {
lightVal = analogRead(sensorPin); // read the current light levels
//if lightVal is less than our initial reading withing a threshold then it is dark. if(lightVal < bright) { // reset the timer, person began to sit down minute1 = minute(); } else // otherwise it's bright { hour1 = -1; minute1 = -1; } unsigned long minute = minute(); if (abs(60 - minute + minute1 )>20){ // time to stand up while (lightVal < bright) { // still sitting tone (buzzPin, 1000, 100); delay (100); noTone(buzzPin); } }
}
Setup
Place the photosensor at the back of the char where you won't sit on it, but will be blocked off of the light when you sit down.
Enjoy!
Enjoy your lengthened and healthier lifestyle!
Live long and Prosper!