Detecting Bed Presence Using Thin Film Pressure Sensors with ESPHome

Disclosure: This post contains affiliate links. If you click through and make a purchase, I will earn a commission, at no additional cost to you. Read my full disclosure here.

Today, we're delving into an ESPHome project that elevates bed automation to impressive new heights. A creative tech enthusiast has ingeniously crafted a DIY bed presence detector using thin film pressure sensors and an ESP32. Remarkably, this device distinguishes between different sides of the bed! It's a tad more complex than other ESPHome endeavours, employing the ADC sensor. Fear not—the creator thoroughly explains how it all comes together.

Illustration of a stylized bedroom with a large bed in the center, adorned with yellow and blue geometric patterned bedding. Two matching wooden nightstands are placed on either side of the bed, each with a yellow lamp. On the left, a bench holds books and a pitcher beneath a window with billowing curtains. To the right, a framed picture hangs above the bed. The room has a blue wall and grey tiled floor, casting a shadow from the natural light entering through the window.

Contents

The Wonders of Good-Night Automation in Home Assistant

Ever experienced the magic of good-night automation? It was my first foray into using Home Assistant, and it utterly transformed my bedtime routine. It wasn't fully automated since it required manual activation through my sleep tracker, but it was still a revelation. Furthermore, it ensured my cat didn't trigger motion sensors and protected me from harsh bathroom lights during midnight visits. Not to mention, the Google Nest Mini serenaded me with soothing white-noise lullabies.

Illustration of a stylized night sky with a large crescent moon. The sky is dotted with numerous stars of varying brightness, and wispy clouds in hues of pink and purple add a dreamlike quality to the scene.

Essentials for Bed Presence Detection With ESPHome

Like projects with PWM LED strips, this detector utilizes an ESP32. These boards are equipped with several Analog To Digital (ADC) pins, essential for connecting each analogue pressure sensor. If you're monitoring more than one person, you'll need additional sensors.

Powering the ESP32 is straightforward—just use the onboard USB Micro-B connector and a spare phone charger. The components aren't demanding, but if you're incorporating under-bed lighting, a more robust power supply is necessary for the LED strips.

The thin film pressure sensors are the project's unsung heroes. These modest devices measure pressure between two surfaces—your mattress and bed frame. Each sensor requires a resistor connected to the ground pin; the creator used a 5k Ohm resistor. Depending on your mattress and body weight, some experimentation may be needed.

Although the project is well-documented, the wiring details are scarce. However, this guide is a great resource. Just replace the ESP8266 with your ESP32. Remember, wiring thin film pressure sensors differs from digital sensors, so accuracy is key.

Bed Presence Detection Mechanism

Configuring each sensor requires only a snippet of YAML code. The creator has shared the necessary code for replication. The ESPHome code determines bed occupancy. Using on_value_range, an input_boolean in Home Assistant activates when pressure exceeds a preset threshold. The creator even provides their complete Node-RED configuration for the bed presence detection. So, why not upgrade your bed into a smart bed? That's truly sleeping in style!

YouTube video
A portrait photo oif Liam Alexander Colman, the author, creator, and owner of Home Assistant Guide wearing a suit.

About Liam Alexander Colman

is an experienced Home Assistant user who has been utilizing the platform for a variety of projects over an extended period. His journey began with a Raspberry Pi, which quickly grew to three Raspberry Pis and eventually a full-fledged server. Liam's current operating system of choice is Unraid, with Home Assistant comfortably running in a Docker container.
With a deep understanding of the intricacies of Home Assistant, Liam has an impressive setup, consisting of various Zigbee devices, and seamless integrations with existing products such as his Android TV box. For those interested in learning more about Liam's experience with Home Assistant, he shares his insights on how he first started using the platform and his subsequent journey.

Leave a comment

Share to...