Bed presence with pressure strips

Using ESP32 along with a couple pressure strips to report back to HA if myself or my wife is in bed. My use case for this right now is for when we turn on our “night mode” before we go to bed; I can have it check to see if anyone is in bed. If not, then the lights in our bedroom will turn on and the TV will turn on.

But for example, if my wife goes to bed before me, then when I turn on night mode, it wont turn the lights on because she is sensed in bed.

Worked off of this project ( GitHub - eoncire/HA_bed_presence: HomeAssitant / ESPHome / NodeRed bed presence and automations ) with a few modificaitons.

1.) i had to use 44kOhm resistors in order to get a good voltage drop when we laid in the bed.
2.) I am not using the ESP32 itself to turn on any input_boolean. I am doing it all through node red. I find it easier personally to jump into node red and modify that way, then go into the YAML in ESPHome. Just personal preference.

Heres a video:

Heres a couple pictures:

Here is the ESPHome yaml:

  name: bed4
  platform: ESP32
  board: esp-wrover-kit

  ssid: "mynetwork"
  password: "mypassword"


# Enable logging

# Enable Home Assistant API


  - platform: adc
    pin: GPIO35
    name: "Jim_in_bed"
    update_interval: 60s
    attenuation: 11db
  - platform: adc
    pin: GPIO34
    name: "Christina_in_bed"
    update_interval: 60s
    attenuation: 11db

Heres node red flow I am using to turn on the helpers

[{"id":"e021d41b.581a08","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"501dc52d.91512c","type":"inject","z":"e021d41b.581a08","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":133,"y":225,"wires":[["3f492e4b.ac47a2","10579d98.0f3f42"]]},{"id":"3f492e4b.ac47a2","type":"api-current-state","z":"e021d41b.581a08","name":"Jims sensor < 1.5V?","server":"ab3e2c53.e3491","version":1,"outputs":2,"halt_if":"1.5","halt_if_type":"num","halt_if_compare":"lt","override_topic":false,"entity_id":"sensor.jim_in_bed","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":334,"y":126,"wires":[["17d8f6f2.007b69"],["cc00cdc9.5601a"]]},{"id":"17d8f6f2.007b69","type":"api-call-service","z":"e021d41b.581a08","name":"ON: Jim_in_bed helper","server":"ab3e2c53.e3491","version":1,"debugenabled":false,"service_domain":"input_boolean","service":"turn_on","entityId":"input_boolean.jim_in_bed","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":605,"y":90,"wires":[[]]},{"id":"cc00cdc9.5601a","type":"api-call-service","z":"e021d41b.581a08","name":"OFF: Jim_in_bed helper","server":"ab3e2c53.e3491","version":1,"debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.jim_in_bed","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":615,"y":144,"wires":[[]]},{"id":"10579d98.0f3f42","type":"api-current-state","z":"e021d41b.581a08","name":"Christinas sensor < 1.5V?","server":"ab3e2c53.e3491","version":1,"outputs":2,"halt_if":"1.5","halt_if_type":"num","halt_if_compare":"lt","override_topic":false,"entity_id":"sensor.christina_in_bed","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":354,"y":315,"wires":[["2cf39be2.1c5784"],["9be4e6b.2aee318"]]},{"id":"2cf39be2.1c5784","type":"api-call-service","z":"e021d41b.581a08","name":"ON: christina_in_bed helper","server":"ab3e2c53.e3491","version":1,"debugenabled":false,"service_domain":"input_boolean","service":"turn_on","entityId":"input_boolean.christina_in_bed","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":652,"y":279,"wires":[[]]},{"id":"9be4e6b.2aee318","type":"api-call-service","z":"e021d41b.581a08","name":"OFF: christina_in_bed helper","server":"ab3e2c53.e3491","version":1,"debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.christina_in_bed","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":652,"y":351,"wires":[[]]},{"id":"ab3e2c53.e3491","type":"server","name":"AvilaSmartHomeRpi","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
1 Like

would the pressure strips work in a bed that has an adjustable base? How do you think they would hold up to constant flexing?

Hmmm, I mean they came rolled up, so they can flex. I’d think if your not doing 90 deg angles you would be ok.

1 Like

Any updates on reliability? Any false positives or failed detection over the past couple weeks?

How did you connect the wires to the resistors?

@silvrr So far so good, no issues. I’m thinking of adding in a automation so when my wife or I lay down, Alexa tells us good night and starts playing some low music for 30min.


You can see that in first picture of the breadboard. The red wires and black wires going into those terminal blocks are from the strips. And you can see the resistors in line with those blocks.

I was thinking of the other end.
How do you connect the wire to the force resistor. Usually they are those pads that is weak and useless.

Oh. At the strip, I soldered the wires to the little metal pins coming off the strips and also put heat shrink around them. Was pretty careful laying them onto the bed.

Hey there - stumbled on your post and looking to do the same thing, however i’ve never setup ESPHome before and I dont have any experience with electrical boards like this, I’, just figuring this out as i go. :slight_smile:

I put together an Amazon list of the stuff i think i need. Would you mind checking it over and letting me know if this will work. I have an old USB cable to power the ESP32.

One thing that is missing is the 44k Resistors, can you recommend any from Amazon ?

Here’s my list:

This was my first ESPHome project too. I still dont really know what I am doing. Just following prcoedures.

I got these resistors, more than I’ll have use.


Breaboard jumpers:

1 Like

Thanks for the response.
Couple more questions, the green and white wires, which pin-outs do they connect to on the ESP-32?

Why did you need the resistors?

Without the resistors, the strips were either way to sensitive (just pressure of mattress itself would send them to 0v) or not sensitive enough. Cant remember.

Thank you so much. I completed this project last night and its working :slight_smile: couldn’t have done without your help.

The soldering was the hardest part and its not a pretty job at all. Hoping to do a better job when i complete my wife’s sensor.

1 Like