wolfgang ziegler


„make stuff and blog about it“

Office Presence Detection Solved (via Pressure Sensor)

February 8, 2022

The Problem

I have a bunch of ZigBee light sources and light strips in my office that are activated via a (also ZigBee) motion sensor controlled with a Home Assistant automation.

So far, so good. Or not ... because as well as the motion sensor responds when I enter the office or move around, it still is a motion sensor and not a presence detector. This means as soon as I sit in my chair and hardly move, the sensor "decides" at some point that due to this lack of motion it's fine to turn off the lights.

I already made this a gradual process:

  • After n minutes, the first light source fades out.
  • After n + 2 minutes, the whole office goes dark.
  • n is a higher number on workdays and during the day because once I'm in the office, this usually means I'll spend a longer time in there.

But this is still not great, because even though I usually notice the first dimming of the light source (I don't always), it requires me to wave my arm or something to trigger the motion detector. This breaks my concentration and feels incredibly stupid when I'm on a video call.

The Solution

The solution is obviously presence detection but I haven't yet found a hardware device that would solve this problem for me.

If you know where to find an actual presence (again: not motion) sensor (preferably ZigBee), let me know!

I experimented with various things like cameras, ultrasound distance sensors in the past, but nothing was really reliable and unobtrusive enough for permanent usage.

If you think about it, the solution is painfully obvious. It's me sitting in the desk chair that is both the problem (no motion) but also the state I want to detect. So adding a "someone is sitting in the desk chair" (aka pressure) sensor solves this problem. As it turned out, it's really not that hard to build such a sensor.

What you need

  • An actual pressure sensor: you probably have that same thing in your car seat. It makes your car angry when you drive without having the seat belt on (or a heavy object in the passenger seat, for that matter). I ordered it on Amazon but those are way cheaper on AliExpress or somewhere if you are more patient than I am.

The pressure sensor

  • A door/window (open/close) sensor: This is a really small (battery powered) sensor that consists of two parts (one of them is just a magnet) that you stick to a door/window and respectively its frame to detect its open or closed state. Again, I ordered it on Amazon.

Aqara ZigBee door/window sensor

How to build your chair sensor

First, I tested the pressure sensor with a simple LED circuit. I just wanted to see if and how it works.

Testing the pressure sensor with an LED

It did, check ✅.

Then, I disassembled the door/window sensor.

Aqara ZigBee door/window sensor taken apart

As expected, it contains a Reed switch which responds to the presence of the magnet part.

I was feeling lucky (as in: "this project will be successful"), so I unsoldered the Reed switch. I could have just kept it in, but this gave me a little more space for the cables that would need to go in there later.

The Reed switch unsoldered

After that, I connected the wires of the pressure sensor to the solder points where the Reed switch had been. The pressure sensor effectively became the open/close switch of the door/window sensor now.

Connecting the pressure sensor and the door/window sensor

The last step would be to integrate this pressure sensor into my IKEA Markus desk chair. Unfortunately, this chair has no way of getting inside the seat cushion without cutting it open. So, I added an extra chair cushion for now to which I attached the pressure sensor.

Attaching the pressure sensor to a chair cushion

This is meant as a temporary workaround until I am confident that this solution really works and then I'll surgically cut my chair open and integrate the sensor permanently.

Does it work?

You bet! So far it has been the perfect success. Below you can see Home Assistant reporting my chair as "closed" (read: occupied) which prevents the lights from going out while I write this blog post.

State of the chair reported in Home Assistant

What about standing?

Great question: if you have read this blog post you might remember that I spend a good deal of the day (usually afternoons) standing. But fortunately this was never a problem in this scenario. Apparently, once I stand, I fidget around enough that my motion sensor detects this. Which is a real win-win situation, it should benefit my health since I am not only standing but also moving and the lights stay on 💡.