Introduction: SitSat - My Personal Office Chair Sitting Pattern Monitor
This project is intended to change the behavior of office employees with smart monitoring of sitting pattern.
The story to start this project is not new, in fact everyone know the harmful consequences of sitting for long hours on office chair. Obesity and Computer Vision Syndrome (CVS) are the primarily caused by longer hours of working on computer and it is unavoidable in today's working culture. It is worth questioning that we are leading a path of evolution or devolution.
Being a health freak, I used to try different methods. There is very famous rule of 20/20/20 for eyes which I tried to implement using Arduino with simple blink program and three LEDs (RGY). I put the arrangement on my office table and it was quite helpful reminder to follow 20/20/20 rule. In this project, I tried to hack into my sitting pattern and make the table area smarter itself.
Step 1: Prototyping
In order to detect my presence at desk area, I have used HC-SR04 sensor which has a range of 5meters. As shown in the figure #1, I started with testing single sensor. While taking the values, I figured out that taking decision on the value of one sensor erratic. In order to improve the performance of whole system and take smarter trigger, I have implemented two sensors as shown in figure #3.
Step 2: Assembly
I needed extended wire to reach expansion board for which some hand dextering is required. :)
Be careful with HC-SR04 as it has temperature sensitive ICs which could burn or damage if comes in contact with hot glue. In order to avoid this problem I cut out solder PCB board in exact shape of sensor as shown in figure. I also fixed one rubber band around the PCB while fixing it.
Fully assembled setup shows a permanent setup for sensors.
Step 3: Final Placement and Schematic
Final assembly is shown in figure #2 and figure #3. I have used GPIO extender as shown in figure #2 in order to ease the wiring and flexible sensor placement.
Two sensors are permanently fixed beneath my work table as shown in figure below. The values generated from these two sensors are logically "and" operated to activate the trigger pin. Code structure is as following:
Step 4: Coding and Data Analysis
Below figure shows the distance measurement from each sensor. The threshold value is constant value of 24cm (2 feet) as per my sitting arrangement and chair height. As the figure clearly shows, as soon as both sensor value crosses 24cm, the message is generated and mail is sent through Cayenne setup.
Full code is available at my github link:
Step 5: Cayenne Setup and Automation
It is quite easy to setup triggers along with mail and SMS integration. Before Cayenne, I used to work with Python API for SMTP which keep giving me trouble due to advanced security features of gmail. Further SMS integration was a nightmare for me.
Just after creating a device name, just need to setup trigger condition as shown below. As soon as RPi pin 21 gets triggered, an email is sent as shown in figure #9.
The whole setup generates a lot of mail on daily basis and it doesn't make sense to get disturbed on checking mail every hour. I created an event at the beginning of each day to remind me to check mail. It'll send an email (dummy mail ID shown) reminder and pi will shut down. So after checking the mail and pattern, I have start pi again to make sure I checked the pattern.
The whole event setup looks useful and all in one place. These features are very much useful to make RPi take smart decisions itself.
Step 6: Gmail Analysis
The mail received are quite gmail friendly and just a look at it gives overall picture of my activity. Opening mail shows standard message in mail body.
In office hour of 8 hours, my goal is to take break from office chair for at least 20-30 times. Below figure shows all the mail is generated from last 5 days, it means I am much above goal.
We have a be nice policy.
Please be positive and constructive.