Hi everyone!
This idea was posted somewhere in the forum. Unfortunately, I can no longer find the original thread. I thought the idea was so brilliant and tried it myself. I did a write-up here with steps more in detail.
Check it out
Hi everyone!
This idea was posted somewhere in the forum. Unfortunately, I can no longer find the original thread. I thought the idea was so brilliant and tried it myself. I did a write-up here with steps more in detail.
Check it out
This seems interesting. Out of curiosity why can’t you use an nodemcu 8266?
The esp32 has the capacitive touch options on several gpio which i don’t believe the esp8266 does
So do you place the mat under your mattress or under the bed sheet? Any how durable they are?
have a look at this
I looked. And it does not answer either of these questions.
Because you are not using this type of sensor. Your pressure mat may work under the mattress but a capacitive sensor like the one outlined in this topic may not.
Occupancy sensor for us is a power measuring plug behind the phone chargers, if the phones are charging we’ve gone to bed.
Have overrides in case one of us is away based on presence.
I use strain gauges on my bed slats but this is an intriguing alternative. If it does work from below the mattress. It would solve the problem of strain gauge drift due to the wooden slats expanding and contracting with temperature and humidity.
I wonder if my robot vacuum passing under it would set it off though.
Certainly something to experiment with when I get home next year. Thanks for posting.
It does and is intended to work under the mattress. I don’t think a robot vacuum would set it off
This is not working off capacitance from the human body. The sensor is a capacitor (2 sheets of foil separated by an insulator). As you press the sheets of foil closer together, the capacitance changes. it should work though several layers. (The Princess and the Pea LOL)
The point of failure IMO is the taping of the wires to the foil.
Yes the two plates form a capacitor. But I find it hard to believe the weight of a human through a mattress would have a more significant effect by compressing the paper dielectric than forming an additional capacitor in parallel by virtue of being a big conductive body. One easy way to test the theory would be to see if it detected a heavy non conducting weight.
Regarding reliability of the connection I was thinking of soldering to these: https://www.ebay.com.au/itm/Shielding-Conductive-Adhesive-Copper-Foil-Metal-Sheet-Smooth-Tape-Sell-well/253735815744?hash=item3b13d54a40:g:ca4AAOSwNJNbQBnV
The original work used wires soldered to paper clips clipped over the foil. But yes, the weak link
I take your point. Testing needed!
My sensors on two beds have been working reliably for the past week. Another Reddit user also reported success using the sensor under his mattress. Although the change in capacitance is not significant, for this use case it is enough.
Does the sensor detect a large non-conductive weight placed in the bed?
E.g. a suitcase full of clothes?
Yes, probably. The conductivity does not matter, it is the weight that changes the capacitance. Depending on how heavy the item is, the sensor value would change.
Rather than guessing, would you mind actually testing it?
This is the core of determining how the sensor works.
The weight has to be non conductive for the test.
This is a very interesting idea/solution for me, so 2 days ago I made a test sheet and put it under my mattress. Let me share my experiences.
I chose the threshold value of 5 after some testing with setup_mode
enabled. This is very low, considering without anything attached to the ESP32 pin, it was in the 1000 range, and when touching the pin, it went down to ~100 for me. With this tinfoil setup I initially got ~12 unloaded and ~0-3 when on the bed. This let me reliably detect when I was on or off the bed. However today, after the second night, the sensor was stuck “ON”, and had to decrease the threshold to 2.
This makes me think that indeed the reason it works is the two sides getting closer together, and 2 nights of sleeping on it made it compress more. I was trying to test with a non-conductive weight, as @tom_l suggested, but I don’t have anything comparably heavy and non-conductive to do it. I tried to put a wooden drawer with some clothes on it, but it was only a few kg, and it didn’t trigger the sensor.
I’m wondering if using something more springy between the two sheets, like some bubble wrap or foam would increase a bit the range between loaded and unloaded capacitance to have a bigger difference for detection of the loaded state, which seems to be only 2-4 numerical values.
Also, it seems necessary to readjust the threshold after a “bedding in period” (pun intended), or already start with a lower threshold than originally seems necessary.
Still, awesome idea and simple and cheap implementation, and so far good accuracy for me. Thanks @N-l1!
Thank you @attila_ha @tom_l
However, I do not understand why conductivity would matter in this case. The two pieces of tin foil with the paper in between forms a basic capacitor. By no means am I an expert on capacitors, but a capacitor works as two conductive plates (in this case, the two pieces of tin foil) are separated by a dielectric/insulant (in this case, the paper). Charges cannot pass through the dielectric, hence positive charges accumulate on one plate while negative charges accumulate on the other. However, the distance between the two plates affects the capacitance. If there is a large distance between the plates, even a single charge on a plate would repel further charges to enter the plate. As the distance between plates decreases, they can hold more charges due to attraction from the oppositely charged plate. With the minimum distance between the plates, the max attraction between them enables both to hold the max amount of charges. That is why sitting on the bed (decreasing the distance between the two plates) changes the capacitance.
I don’t see how the conductively of an object would affect the capacitance. In other words, a non-conductive object with the same weight as a conductive object would alter the capacitance by the same amount.
As to the threshold of the sensor, I don’t have a solution for that either. Maybe some tweaking with the ESPHome capacitance detection setting would help shorten the range, resulting in a more significant difference in when you are sitting on the bed or not. After a week and so of sleeping, I have starting to notice that my difference from “on bed” to “not on bed” has started to decrease as well…
Why do you think the conductivity of an object on the bed would affect the capacitance of a capacitor underneath the mattress? I am not following your logic.