Bed occupancy sensor, using parts you have

It will form a third plate with parasitic capacitances to earth. It’s how touch sensors work.

https://www.arrow.com/en/research-and-events/articles/how-touch-sensors-work

You all seem to think it works by compressing the paper. I just don’t see that happening under a mattress.

1 Like

Hi @tom_l,

I disagree. Yes, a capacitive touch sensor/screen works when a conductor (your finger) disrupts the electrostatic field. However, it is near impossible for a touch to register through a mattress. As I explained in my previous post, the capacitance of this sensor change because of the change in distance between the two plates. The paper is not compressing, it is the tin foils that are pushed together. Although the change might be slight, it is enough to tell the difference.

The original poster linked to this blog for making the pressure mats, more info can also be found there.

Thank you for your thoughts! :grinning:

The weight of the mattress will compress the foil hard up against the paper. There would be no “gap” to change. Even if there was a gap initially, the sensor should become unresponsive over time.

If it does indeed work this way, bubble wrap (as suggested earlier) would make a much better dialectic.

1 Like

I totally agree, there should be further experimentation with different dielectrics.

Edit: I can confirm, a large non-conductive weight (plastic laundry basket filled will clothes) does trigger the sensor.

2 Likes

Well that’s that sorted then.

So a more responsive sensor would require a flexible dielectric that won’t compress over time.

Open cell foam would be bad.

Closed cell foam would compress a bit initially but retain some 'springyness". Tiny bubble wrap would probably work too, though the flat surface of closed cell foam would make it easier to construct.

Hi folks,

So I cut open my tinfoil sensor on one side and put a piece of foam in it.

It made the sensing range go to about 40 unloaded and 10-30 loaded, based on how closely I lay on top of it. It’s definitely sensing the pressure, not the capacitance of my body, as I can’t really change the value if I just move my body around it without pressure on it. I settled on a threshold of 20, and added a delayed_on_off: 1s filter for it, to not spam HA with events during the transition, or when it’s close to the threshold.

I was thinking about making an alternative sensor design, based on how Espressif recommends it. Sort of a big circular tinfoil part going to the sensing pin, and then another part of ground around it for noise isolation. But I foresee it as something a lot more fiddly, susceptible to electrical noise and harder to make.

I think the original design with the addition to something springy between the sheets of foils is a really great solution for a pressure sensor. :+1:

Another idea for cabling is that probably the ground cable can be daisy-chained between the multiple pads, reducing the amount of cables needed to connect to the node to n+1, instead of 2n.

2 Likes

That appears to be open cell foam. It will compress over time. See if you can find some closed cell foam.

Using the adhesive copper sheet I linked to in an earlier post could help with construction of this. It would be a truly capacitive sensor between the body and touch plate. It might help to make the sensing electrode at least as wide as your mattress is thick. Doesn’t have to be round. Square with rounded corners should also work.

You’re right, I’ll see if I can find some closed cell one. I agree that making this the “proper” touch sensitive way sounds like a fun project, however using those fancy copper sheets would make this project’s cost a lot higher, especially if you want to have multiple sensing areas. I don’t see the taped on wire ends going anywhere, but it’s definitely not that elegant. :grinning:

Spray adhesive and the foil then. Glue it to a backing sheet of thick card and cut out a 3-5mm strip round the inner electrode foil (not all the way through the card!).

The capacitive sensor between the body and touch plate seems like a very interesting idea. However, I just don’t think the body would ever trigger the sensor through the mattress. Different dielectrics seems to increase the accuracy of the sensor though. In the original blog, I saw someone mention using plastic chip bags, might be interesting to try.

Thank you for sharing. I really liked the idea and will try it out once our lockdown is over and we can buy stuff.

1 Like

I also made it and it works really good, had to decrease th threshold to 3 after one night.
What does removing setup mode do?

After removing setup mode, the logs will no longer fill up with sensor capacitance values :slightly_smiling_face:

1 Like

In the comments under the linked blog post, there is an idea about trying the foil of a potatoe chips bag. Anybody tried that? :slight_smile:

I ordered an ESP32 from Amazon and it arrived today, I need to test this. :slight_smile: I have another problem, because in Germany we normally have a slatted frame under the mattress, not a flat surface… I’ll take a look how this will work, if I do this with small stripes on a few of the slats. :slight_smile:

@tom_l’s strain gauge system was for a slatted bed. Bed occupancy sensor, using parts you have - #8 by tom_l

put a piece of thin wood (like mdf) and put the pressure pad on top?

I have a similar setup for the SIDS monitor in our infants cot as its slatted base.

One of our beds is actually also slated, I just put the pressure pad on the slats. Probably wouldn’t recommend it though since the results are far less reliable than the flat-surfaced bed. However, it does still work…

Put a rug over the slats

Is it possible to reduce the polling of the sensor? I think my mosquitto mqtt broker is getting flooded and cant handle all the incoming messages.

Log Details (ERROR)

Logger: homeassistant.components.websocket_api.http.connection.1760921232
Source: components/websocket_api/http.py:141
Integration: Home Asssitant WebSocket API (documentation, issues)
First occurred: 1:02:11 AM (1 occurrences)
Last logged: 1:02:11 AM

Client unable to keep up with pending messages. Stayed over 512 for 5 seconds

I don’t think that’s an MQTT issue.

But yes, you can technically change the polling time by setting a delayed on and delayed off.

1 Like