Bed occupancy sensor, using parts you have

My experience is that you need a sensor area around your butt. This is where the human body press the hardest on the mattress. My 4 load cells are placed so that two are where the butt is when I sleep and two a little higher matching my back when I sleep and butt when I sit up in bed.

1 Like

Any chance we can see some pictures of your sensor to get a better perspective of the sizes and materials used. I also only get a count difference of one or two, though I thing it could be that I have a heavy pocket coil mattress. My readings are unreliable.

Sunil

I followed this guide:

All my mattresses are pocket coil.

The only thing I added was very thin foam wrapping sheet between foil and paper (not sure of proper name of this - but it came in an AliExpress delivery I had). I have pulled it out slightly so you can see it.

See photo of a the 2xsensor that I use on a single bed (double beds have 4 of these sensors).

You sir are a genius.
A couple of hours and a stray esp32 sitting in my drawer and I now have a bed senspr that works first time every time

I’ve been using these sensors for a while now, but keep having the issue that the difference between “loaded” and “unloaded” decreases over time. Usually the difference starts out as at least 3 points, but after +/- 6 months I’m down to 1 point, causing wild fluctuations. After an “out of bed” event the sensor will switch on and continuously for at least an hour before finally settling on the lower value.

Does anyone have a way to increase the range gap between loaded and unloaded? What is the science behind this; would we need to find some material that has very high flex without compression? Any suggestions that are easily available?

Kind Regards,

Eduard

I am not sure if this will help, but I added coil springs. Take a look at these images.

Try using these settings in esphome. It really helps amplify the small capacity differences. I’d also make sure you’ve got one conductive sheet properly grounded and be certain they are not touching each other. I made one incorrectly and had them effectively touching, and capacitance will still work with readings, but it varies wildly. Once I got them properly separated and with one plate grounded, it works significantly better. My readings with the below settings are between 600 with no pressure and below 550 with pressure.

I also ended up using a thin sheet of glass packing foam between the positive plate and the card stock. We’ll see how long this lasts, but it works really good now.

esp32_touch:
  setup_mode: false
  low_voltage_reference: 0.5V
  high_voltage_reference: 2.4V
  voltage_attenuation: 1.5V
  iir_filter: 50ms

Did almost everything like in main post, but instead I used two A4 size paper with foil+wire taped on both of them and closed cell foam in between. I made 2 sensors like this and taped it under sofa cushions.

I’m keep getting these value spikes for 1-2 minutes when sensor is on/off, which makes my sensor go unoccupied when person is sitting on a cushion.

(around 90 - unoccupied, below 80 - occupied)





Any ideas why it’s behaving like this?

These things are simply not reliable. Wasted a lot of time and different materials, did many different versions trying differing thicknesses etc, it’s simply not reliable enough. Load cells are probably the most reliable type of sensor for bed occupancy.

Mysteriously, it works in a lot of cases, as this thread shows… :wink:

In my case, I can say it is reliable for over a year (nearly two years to be exact). Works like a charme and I’ve adjusted the sensors only one or two times (one I remember, when we got new mattresses). :slight_smile:

I’m not saying it will work reliable in all cases, but for most people it does…

A guy sits in his car and is driving the wrong way on a highway.

He turns on the radio, an alert comes in, “…there is a wrong-way driver on the highway…”.

“One?!”, he shouts, “hundreds!!!”

:wink:

So what is your setup like? How is your bed, flat or slatted? Mine is slatted base that the mattress sits on top. Thickness of your mattress? Mine is 25cm, what materials are inside the mattress (mine is IKEA Hesseng firm) it has these materials:
Natural latex, horse hair, wool and lyocell, pocket type independent springs. Quilted cover.
I know what you are saying but honestly they aren’t reliable just because it works for some people. Reliability means it works pretty much 99% and it really doesn’t. I spent so much time and materials trying to come up with a solution. Padding between the sheets, one sheet of paper, two sheets of paper, thick foil, thin foil, stranded wire, solid wire, soldering the wire, using wire connectors, using dupont connectors, long length of wire, “just enough” length of wire, square shaped pad, rectangle shaped pad, long shaped pad covering only one slat, the other shapes covering a couple of slats, tried to use a book on the slats and the sensor on top of the hard book so the sensor was flat, left it over the slats and had no pressure on the gaps, so as you can see I definitely can say this is not reliable. Good for you that it works but I didn’t appreciate people not talking about the pain in the ass to make it work. When I read about this, I thought it would be a fool-proof easy way and it’s really not. I spent literally 24hrs trying things, without sleeping, as I was home all week this week. A whole day wasted for unreliable sensor.

I can see your frustration, and I wouldn’t dispute your experiences, but they are not universally adaptable for everyone and every situation. It is your experience. So for you the sensors may not be reliable, but for most of the people that tried it, they are… :wink:

And to be honest, I doubt you put that much of an effort in reading in advance. Otherwise you might have noted, that I already posted eight or more times in this very thread, including, I think, three pics and explaining what my setup looks like and how it works. And how reliable it is.

I’m not with you, that it doesn’t work for the majority of people, quite the opposite. But we don’t need to agree on that, you see it your way, I see it mine. And as I said, I can see your frustration.

So I wish you good luck in trying another solution, there are a few more threads in the forum, using other parts (sensors) for this setup. Some people seem very happy with weighing strips, others use weight sensors under each pole. Try to find your setup, that works for you. But no need to mark something as unreliable, just because it doesn’t work for you. :slight_smile:

Good luck!

1 Like

Seems like you have a personal attachment to this sensor, as you’re acting really defensive…

Why do you think reading the whole thread would change anything. Part of the time I spent was uploading dozens if not about a hundred different values for the esp_touch: part of the yaml.

You’re claiming that it works for most people but there’s no survey to prove that. I’m claiming it’s unreliable from extensive testing. Yay, it works for you, good for you! It works for some other people, good for them! I wonder how many tried to make it work and just gave up because it’s basically a throw-away item.

Unless instructions can be provided that work 100% of the time then this is not reliable, you can be defensive all day long but it won’t change that fact, ever. My account is to warn future users that this solution isn’t fool-proof at all and that it can definitely be a waste of time or material so they don’t go in like I did thinking it’s gonna be a piece of cake that works the first time. You’re doing a disservice to everyone by not acknowledging that this isn’t 100% perfect, check any pride and ego by the door.

Ok, you’re right, the sensor is unreliable, for every one, and the whole world and especially you. It made you angry and now you’re not happy. Wanna get an ice cream? :wink:

Live long and prosper in your small, self reliant world and have a good weekend.

Seems rather pointless to discuss with you, as you stated yourself you didn’t even read the thread here.

// add to igno list

I did have some similar problems when I built this type of sensor for one of the beds in my home, however the other one was fine. In my case, I did a few things to try and sort it, but I think the effective solution was to change he wall wart feeding that ESP32. Worth testing your setup from a USB powerbank if you have issues.

I use this sensors and they work well.

Sorry for the bump but how would I implement this? Does this work with the capacitive solution mentioned in the original post, or is this for a different thing?

It works with any sensor. See:

I think I misinterpreted your earlier response, and asked you an irrelevant thing. I was wondering if there was a way to see the esp32_touch values in Home Assistant, not to import a threshold from it.

Didn’t know that arrogance was allowed in the forum. I reported, lets see.