I'm a novice when it comes to electronics, so please bear with me. :) I have this idea of a Internet connected hight adjustable desk that keeps tracks of it's "modes". With other words: I would like to know when the desk is adjusted from sitting to standing and vice versa.

This is my plan:

  • Some kind of sensor connected to a Raspberry Pi through GPIO.
  • Simple daemon that reads the input from the sensor and determines if the desk is adjusted for sitting or standing.
  • The daemon logs everything to a database.
  • A web app that presents the data in some nifty way.

My only problem is the sensor. I have no idea of how I should determine the state of the desk. Any ideas?

The desk is an IKEA Galant with adjustable legs. Sorry about the Swedish on that page.

  • \$\begingroup\$ What does it mean for the desk to "sit" or "stand"? \$\endgroup\$ Aug 22, 2012 at 6:04
  • \$\begingroup\$ The desk is adjusted for sitting or standing. Eg. when I want to work standing up the desk should be in a comfortable height. When I want to sit down I adjust the desk by lowering it. This is done with the electric adjustable legs from IKEA. So one solution would be some kind of sensor that could determine the distance between the floor and tabletop. \$\endgroup\$
    – Sven
    Aug 22, 2012 at 6:11
  • \$\begingroup\$ Can you get at the motor assembly at all? \$\endgroup\$ Aug 22, 2012 at 6:15

2 Answers 2


If you would mount a distance sensor like a HC-SR04, LV-EZ4 or similar on the underside of the desk looking at the floor you would not only be able to see when the desk is moving but also you would see the height of the desk. (For detecting when the desk is moving simply check to see if the distance changes more than the )

Example of someone who hooked up a HC-SR04 to a pi


We need a bit more info on what the difference is between sitting and standing position and how you would sense it, but my first inclination would be a mechanical solution using either a simple switch with a roller on the end -- http://www.digikey.com/product-detail/en/V15T16-CZ100A06-K/480-2990-ND/1823502 for example -- or a simple optical interrupter, like http://www.digikey.com/product-detail/en/EE-SX4070/OR524-ND/154253, especially if its OK to add some sort of tab to the legs. The interrupter is a light emitter/receiver pair, and when some opaque object prevents the emitter's light from hitting the receiver, the output changes state. There are also reflection-based models, where the sensor can tell when its pointing at a reflective surface.

If for some reason, a simple switch or optical interrupter wont work, then you move to the distance sensor.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.