'Time to Get Out of Your Chair' Alarm

1,299

21

1

Introduction: '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!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: BoM

* Photosensor

* 10kΩ Resistor

* Jumper Cables

* Arduino

Tools:

* Soldering Iron

Step 2: 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

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

/**
 * '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

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!

Enjoy your lengthened and healthier lifestyle!

Live long and Prosper!

Makerspace Contest 2017

Participated in the
Makerspace Contest 2017

MacGyver Challenge

Participated in the
MacGyver Challenge

Fix It Contest

Participated in the
Fix It Contest

Be the First to Share

    Recommendations

    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Finish It Already Speed Challenge

      Finish It Already Speed Challenge

    Discussions

    0
    aymanah
    aymanah

    Question 9 months ago

    Hi I tried to do this but it didn't work. I changed the code a tiny bit by making a pin a different pin which is small. I then went to verify it and the code didn't work. I go try to fix it and find a couple of mistakes. Here is my 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 = 11;
    const int LED1 = 8;
    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
    int minute9;
    int hour1;
    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 = minute9;
    digitalWrite(LED1, HIGH);
    } else // otherwise it's bright
    {
    hour1 = -1;
    minute1 = -1;
    digitalWrite(LED1, LOW);
    }
    unsigned long minute = minute9;
    if (abs(60 - minute9 + minute1 )>20){
    // time to stand up
    while (lightVal < bright) { // still sitting
    tone (buzzPin, 1000, 100);
    delay (100);
    noTone(buzzPin); }
    }
    }

    The digitalWrite for LED1 was to check if it worked. It may even work and I don't know yet. I used a breadboard and I have my sensor connected to the 3.3V as told, I have the resistor and a wire coming out of the other side of the sensor, the wire goes to the A0 and the resistor to the GND. My buzzer is on the 11pin and GND.

    I hope you don't mind helping me.