We've all read it. "Sitting is the new smoking", "Sitting is killing you", etc. Regardless of what the studies and headlines show you I think it is pretty easy to agree that sitting on your butt all day isn't healthy. Many of us with desk jobs do exactly that for 8+ hours a day though. I work in front of a computer most of my day and I know that my back starts to get sore, my posture sucks, etc after getting into "the zone" and working away for 2-3 hour stretches. I'm always looking for an excuse to make something and thought a simple reminder to get up and walk around or stand and work (at a modular sit/stand work station) would be a pretty good thing.
Furthermore, I have Type 1 Diabetes which is an autoimmune disease in which my body decided to attack my pancreas and kill off my insulin producing beta cells. So I take insulin 24/7/365 just to stay alive and keep my blood sugar in range. This is not the same as the diabetes your overweight grandpa developed. I am pretty darn good at managing my blood sugar but one thing that definitely helps is getting up and moving! It helps increase your insulin sensitivity and is overall just a good thing for you. The same can also be said for the Type 2 Diabetics out there (the more common and generally tied to poor diet and exercise). If you want to better understand the difference between the two main type of diabetes check out this link and be ignorant no more!
I set about designing the box to include an indicator for when I should get up and walk around and another to tell me when I should stand up and work. It has an "acknowledge" button you press after you walk around which resets a one hour timer. There is also a reset button which you press at the beginning of each day to reset all of the timers. The goal was to make it simple, pleasing to the eye and cheap! Follow along and see the build.
If you like the project please vote for me in the Microcontroller Contest! Just click the orange Vote button in the upper right corner of this page.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials
I used the following materials and tools:
- (2) Normally Open Buttons
- (2) Clear/white LEDs
- ATtiny 45 Microcontroller
- 8 pin DIP socket
- 0.200" Plywood
- Double sided perf board
- (2) bottle caps
- Wood glue
- Frosted window film
- (2) 10kOhm Resistors
- (2) 200 Ohm Resistors
- Old USB cable (USB A connector on one end, doesn't matter on the other end)
- Scrap wire
- Scrap cardboard
- Hot glue gun
- Soldering iron
- Arduino Uno (to program the ATtiny)
Step 2: Design
Designing the box:
I used Inkscape along with Maker Case to design the box. The person walking symbol was a simple trace from an image of a "pedestrian crosswalk" signs and the arrow was a simple sketch. I went with a small 4" x 3" x 2" box that wouldn't take up much desk space but would make it easy to work inside of with electronic installation, etc. I went with 0.200" thick plywood from my local HomeDepot. I chose this because they had some with a nice finish as wells as it being thin enough to cut on the laser cutter.
Cutting the box:
I belong to my local FabLab and love it. They have an Epilog laser cutter there that makes quick work of the plywood. The SVG and PDF files are uploaded here should you want to cut my design or edit it to your application.
Step 3: Design the Circuit
The idea here is to keep it super simple. I will touch on a few of the highlights below.
Microcontroller (MCU): I went with an ATtiny 45. This is a small (size of your fingernail) 8 pin DIP package microcontroller with 4kb of flash, up to 5 digital I/Os and up to 3 analog inputs. If you are familiar with the ATtiny 85 it is the roughly the same thing, just half the flash. It is programmable via the Arduino IDE so it is super simple to understand.
LEDs: These hook up to pins 6 & 7 (digital pins 1 & 2 respectively) via a current limiting resistor. I used 200 ohm resistors which are perfect for this LED and the application.
Buttons: Any normally open switch will work. I used simple breadboard compatible tactile switches for prototyping and panel mount switches for the finished product. These switches will be pulled high by our 10K resistors and when pressed will then be read as low by the microcontroller. One switch is connected to pin 1 which is the reset pin. When this is high the MCU keeps on chugging along. When low the MCU resets and the programs starts over. The other switch is connected to pin 2 (digital pin 3). We will touch on that in the coding section.
Power: To be powered via USB. So V++ = 5v and GND = 0v.
I started out just placing everything on a breadboard as a prototype. Best to get the bugs worked out before you put any solder in place. This should only take 5 minutes to set up and be ready to test once we upload the code.
Step 4: Write the Code
The code here is pretty simple. The code is heavily commented and should be self explanatory as you read through it. The basics are below.
Start up, flash each light back and forth to confirm start of program (handy to confirm pressing the reset button actually did what it was supposed to).
Timer [millis()] begins counting milliseconds since last reset.
First bit of code once we enter the loop. Check if the button is being pressed, if so set "mark" equal to current value of millis().
Second bit evaluates to see if it has been more than one hour since the "activity" button has been pressed. If it has been more than one hour illuminate the "walk" light. If not, turn/leave the walk light lit.
Third bit evaluates to see if the "stand" light should be lit. It evaluates this by comparing the current value of millis() to a pre-defined schedule. The schedule essentially has you stand from hours 1-2, 4-5, 7-8, 10-11, 13-14 and 16-17.
End loop, start again!
Step 5: Upload Sketch to ATtiny
Ok, here is where I will gladly point you to other sources. This is really quite simple but does not warrant me rephrasing everything. I first messed around with the ATTiny series after reading danasf's post "Use a $1 ATTiny to drive addressable RGB LEDs". It gives you a pretty good guide of how to program your ATTiny for this purpose. It is based on work done by High/Low Tech in which they use your Arduino to program the ATTiny. There are also other solutions, but I liked this one the best.
Find more at High/Low Tech's pages:
Big thing here is to be sure to load the bootloader after selecting the 8 MHz INTERNAL clock. If you burn the fuses wrong it won't work. After you load the bootloader you just then upload the code I supplied and then your ATTiny is programmed and ready for your project! Move on to testing it on the breadboard.
Step 6: Test Your ATtiny on Your Breadboard
Test the ATtiny 45 on your breadboard by popping it in, supplying 5v and GND and watching the code run. For this step I ususally just pull my 5v and GND from the pins of a plugged in Arduino Uno. You could use any power supply with 5v though.
In the above picture I just used whatever LEDs were closest to me (red/green) instead of digging through my drawer.
Step 7: Build the Box
Put the box together using very small amounts of wood glue.
The three "frame" looking pieces (larger rectangle with two smaller rectangles cut out) will be what we use to space out and hold our fogged window film which will act to diffuse the light and keep it from just looking like a simple LED shining in your face. Us the frames as templates and trace the window film, cut down the middle of the traces. Place on one frame, apply small amount of wood glue to the outside perimeter and place another frame on top. Do this one more time you have two layer of diffusion.
Now cut out two small pieces of window film to cover the walking guy and arrow. Tape in place so it sits flush and taught for a professional look from the front on the finished product. Glue the frame assembly down on top of this. You should have three layers of diffusion now.
Take your two LEDs and sand the outside of them (unless already diffused). This will scratch up the surface and aid in diffusing the light. Leaving more of a glow than a focused point of light. Take your soldering iron and melt a hole in the center of your bottle caps, immediately shove your LEDs in and allow the plastic to cool and solidify, locking the LEDs in place.
Cut out a small piece of cardboard with the same dimensions as the frame assembly. Take your bottle caps, trace around them and then cut out slightly smaller holes in the cardboard. Hot glue the bottle caps to the cardboard. Use wood glue to glue the cardboard to the back of the frame. Now your LEDs will be isolated and only light up the icon they are behind!
Drill holes in the side panel of the box for your buttons (I suggest panel mount switches). Install the buttons.
Drill a hole in the back panel just big enough for your USB power cord to fit through.
Glue all sides of the box together except for the back! Use as little glue as possible. If you know your way around the laser cutter your box should fit together pretty tightly even before the glue.
Step 8: Transfer From the Breadboard to the Perf Board
Now it is time to take your project from the breadboard and onto the perf board. Wire yours the best way you know how. Everyone has their own preferred perf board and their own preferred wiring/soldering style. Do what works for you. I had to cut my perf board down to size.
Chop the non-USB end off your old cable and pass it through the hole in the back panel. Strip away the insulation and isolate the V++ and GND wires (typically red and black, respectively). Trim away the data wires (usually green and white). Tie a knot in the cable for strain relief. Solder the power leads to the breadboard, drop in your ATtiny MCU and function test!
Step 9: Close It Up, All Done!
If you had close tolerances on your laser cut and properly accounted for kerf your back panel should snap on tight with no need for glue. If not it may be necessary to glue the back panel on. Just make sure to test everything first! Plug into any USB power source. Mine plugs into the USB hub/ports of the monitor it sits underneath!
Once complete this little box sits nicely on my desk and lets me know when I need to get off my butt! It works great. Hopefully it will help me even more with blood sugar control, back pain and overall health.
Couple of notes:
ATtiny - Although this think is using an internal oscillator and no tight timing control I have found it to be within 30 seconds at the one hour mark. Since this gets reset every day that is a margin of error that is very easy to live with. Using any type of additional timing control (external oscillator, RTC module, etc) would quickly add complexity and cost, no thanks.
You will see that my desk doesn't really have a modular sit/stand station. That is because it gets delivered next week!
If you like this project please vote for me in the Microcontroller contest. Just click that orange Vote button toward the upper right!