Automated standing desk
By Phil King. Posted
Despite having a fancy motorised sit-stand desk in his workplace, David Kong ended up sitting most of the time. “I have a lot of back and neck pain,” he confides, “and moving between sitting and standing was actually great for me, when I did it. But I just never remembered to.”
Advertisement
Get started with Raspberry Pi – everything you need to know to start your journey!
His solution? A desk that would rise automatically every hour or so, encouraging him to spend more time standing. “One of the most valuable takeaways from behavioural economics is the insight that you’re far, far more likely to do the ‘right’ thing when it’s also the easiest thing, or the default thing,” he explains.
Making the connection
After opening up his desk’s control box to investigate its workings, he discovered a set of test pins that, when connected correctly, replicated the actions of the programmable buttons.

By connecting two particular pins together, he found he could cause the desk to rise to a preset height. Now all he needed was a way of connecting them in an automated way to raise it at regular intervals. The obvious choice was a relay which could be triggered with a small current. After thinking about designing a circuit with a 555 timer chip, he settled on a Raspberry Pi Zero to control the relay.
“You could argue that a Raspberry Pi was hugely overkill for this project,” he says. However, he had been wanting an excuse to play around with one for ages, and found it easy to work with. “The ability to SSH right in and to write the program in Python, which I’m much more comfortable with than C++, made it very attractive.”

The project took David a few hours to complete, altogether, over the course of a few days. “Honestly, nothing was particularly hard,” he tells us. “I had to do a bit of research to find the right type of relay, since I’m not very familiar with all of the technical specifications for those kinds of electrical components.”
He found setting up Raspberry Pi and writing the relay control code easy. Soldering the wires – from the desk’s pins to the relay, and the latter’s control pins to Raspberry Pi’s GPIO – was also simple. “I had to shave a little bit of plastic off of the control box to allow it to close fully with my wire coming out, but that was pretty easy.”
Don’t sit down
With the desk now rising at regular intervals, David found it helped him avoid sitting for too long. “When I had to make a conscious decision to stand, I did it far less often. The ‘default’ was to sit all the time. When the desk rose automatically every hour, the ‘default’ was to stand, and I almost always ended up standing for a good chunk of the hour.”
He ended up tweaking the code to make it operate a little more randomly. “I originally had it going up at exactly the same time every hour, but then I found myself anticipating it, and I found it just more pleasant to have it happen more organically.”
While he has noticed less pain in his back as a result, the desk has occasionally taken him by surprise. “It definitely has caused some funny moments! Sometimes, I would be on a video call, in the middle of a sentence, and the desk would start to rise. I would just keep on talking and stand up with it. It never caused any problems, though, and it would sometimes be a nice way to lighten the mood."
When not editing books and contributing to The MagPi, Phil enjoys playing the piano (badly), astronomy, and watching classic sitcoms.
Subscribe to Raspberry Pi Official Magazine
Save up to 37% off the cover price and get a FREE Raspberry Pi Pico 2 W with a subscription to Raspberry Pi Official Magazine.
More articles
Get started with Raspberry Pi in Raspberry Pi Official Magazine 161
There’s loads going on in this issue: first of all, how about using a capacitive touch board and Raspberry Pi 5 to turn a quilt into an input device? Nicola King shows you how. If you’re more into sawing and drilling than needlework, Jo Hinchliffe has built an underwater rover out of plastic piping and […]
Read more →
Win one of three DreamHAT+ radars!
That’s right, an actual working radar for your Raspberry Pi. We reviewed it a few months ago and have since been amazed at some of the projects that have used it, like last month’s motion sensor from the movie Aliens. Sound good? Well we have a few to give away, and you can enter below. […]
Read more →
RP2350 Pico W5 review
It’s Raspberry Pi Pico 2, but with a lot more memory
Read more →