Bed occupancy sensor, using parts you have

Quick question, do you use 3rd printed case for the load cells?
Or is the couch surface flat/hard that you can just place the load cells only below the couch cushion?

Not sure if your question is directed at me or someone else, but I used the foil capacitance mat method at the top of this thread, which goes under the cushion in my case. No load cells at all, but I donā€™t think theyā€™d work under the cushion without some kind of rigid plate attached.

Did you find out anything interesting for battery power btw? Iā€™ve just been using a USB power pack which lasts 3 days before needing a recharge :confused:

Sorry, i assumed you were using load cells
Not yet, as for the portable power pack youā€™re using, whatā€™s the battery capacity before it run out in 3 days?

Itā€™s a 10,000 mAh pack from 2014, I imagine youā€™d get a bit longer from a new pack at the same capacity. I havenā€™t tried with the setup_mode flag disabled, not sure if that might help battery life.

I see, as for the couches/chairs, Iā€™m using the zigbee door sensor + car seat sensor which seems to be a better option. If itā€™s nearby to power outlet, i would just stick to esp32 + foil

I might try with a bigger battery capacity, anything else we could add to the code that might reduce power consumption?

Iā€™ve just tried setting this up and everything seemed to workā€¦kind ofā€¦

When I have no pressure on the pad (mattress only no person) the readings are around 33-34.

When I sit on the bed the readings only change to around 31-32.

I expected a much bigger difference.

I set the threshold to 32 and it worked last night but when I got up this morning it stayed on and checking the values it is reading 31 unoccupied. but when I sit on the bed it no onger changes - it stays around 31 the whole time either way.

my pad is using heavy duty foil separated by 1/16 - 1/8 inch closed cell foam. Itā€™s in a sleeve that is 11x17 inches.

any suggestions?

Try a smaller pad, that seems quite large.

What size do you suggest?

I was going for better coverage of the king size bed.

@finity
I use 4xA4 size pads for our king size - basically positioned top and bottom for each person (assuming you only have two people sleeping in your bedā€¦)

would just one in the middle of that size (A4) work?

Iā€™d always go with ā€œmore and smallerā€ than ā€œless and biggerā€. As you can see from the pics I posted above, mine are only wide enough to fit the latches and are placed at 45% and 65% (seen from the bottom side). :slight_smile:

I donā€™t think so.

I think beds are specifically designed to try to minimise the area of disruption when someone lies down/ moves and so there isnā€™t enough displacement from edge to middle to set off the pad.

Correct me if Iā€™m wrong but my understanding is that these pads are each stand-alone sensors so putting more than one pad wonā€™t help with each individual pad to increase the sensitivity of the system.

Isnā€™t that how you can have two different sensors (or sets of sensors) for different sides of the bed?

Yep, thatā€™s correct. Every pad is a different sensor. You can connect the ā€œgroundā€ from all sensors together.

But if I understand the physical principle behind this correctly, the smaller the ā€œfootprintā€ of each sensor, the more difference in measurement. :slight_smile: Or better, the less tin foil you use for each pad, the more difference you should get. But Iā€™m not a physicist, so I might be heading in a totally different direction. :smiley: :rofl:

EDIT: And you need to have enough foil to ā€œtouchā€ it, so this should be a compromise. :smiley:

Capacitance is proportional to the size of the plates and inversely proportional to the distance between them.

we are effectively changing the second parameter (squishing the plates together).

I guess my problem is Iā€™m not sure how the ESP32 actually measures the change in capacitance.

Still havenā€™t had a try to use smaller plates yet but itā€™s on the agenda!

I need to solder up some more terminals to add more pads.

The increase in sensitivity comes from the fact that I am able to measure changes in more specific regions.

I have Left top, Left bottom, Right top, right bottom.

Based on this I am able to detect whether someone is sat on the top or bottom, left or right hand side of the bed (as sitting only provides enough displacement to trigger one sensor), two sensors are triggered if someone is lying on one side of the bed, or all 4 are triggered if we are both in bed.

I then use these different triggers/ conditions to create different template sensors to manage light settings (turn on lights at 15% if one person has already been in bed for 10 minutes), turn on lights to 90% brightness if both people are up in the morning etc, turn off all downstairs lights and set alarm when both in bed for 5 minutes after 11pm etc, turn the kettle on when someone gets up after 6am etc.

EDIT - BTW - all 4 pads are linked to a single esp32, which is also performing BLE duties and has a tag reader attached for music jukebox selection.

but I donā€™t think that will help me.

Iā€™m not looking for zone coverage. Iā€™m looking for more individual pad sensitivity.

I did an additional test today and if I lift the mattress off the pad the numbers rise so the sensor is actually picking up the weight of the mattress (I thinkā€¦unless itā€™s some other stray capacitance that itā€™s picking up with the mattress on it) but even without a mattress on it and me directly sitting on the pad the numbers only change by two or three (38 to maybe 35 or 36).

I havenā€™t tried a smaller pad yet tho.

Or maybe a different insulator?

Like I said right now iā€™m using 2mm closed cell foam. Maybe I do need to use paper instead.

I guess I just need to do some testing to see what I can come up with.

Right now it has to detect a change of only 2 or 3 counts (33/34 to 31/32). I was really hoping for a wider range to keep the accuracy up.

You monster :rofl:

2 Likes

I understand now. Sorry for confusion. Mine are paper with a small square of single layer of 1mm polyfoam - I get change of around 15 counts.

1 Like

yeah I would have thought that a thicker insulator and bigger plates would have caused the capacitance value to be a lot higher and that my weight would have squished the foam together more causing a bigger drop in capacitance but it doesnā€™t seem to have worked out like that.

I even tried playing around with the different voltage options. those changes made the values increase but the difference between weighted and unweighted was still only a couple of counts.