Introduction: 'Time to Get Out of Your Chair' Alarm

Picture of '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!

Step 1: BoM

Picture of BoM

* Photosensor

* 10kΩ Resistor

* Jumper Cables

* Arduino

Tools:

* Soldering Iron

Step 2: Solder

Picture of 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.

Step 3: Connections

Picture of Connections

Follow the table below for the connections between the I/Os and the

I/OI/O pinArduino Pin
Photosensor1A0
Photosensor2GND**
Buzzer*19
Buzzer*2GND**

* Order of pins do not matter for the buzzer

** The Arduino board has at least 3 GND pins

Step 4: Code

Picture of 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);  }
  }
    
}

Step 5: Setup

Picture of 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.

Step 6: Enjoy!

Picture of Enjoy!

Enjoy your lengthened and healthier lifestyle!

Live long and Prosper!

Comments

About This Instructable

479views

12favorites

License:

Bio: Aerospace Engineer working in Software Development with a passion for Hardware.
Add instructable to: