Site Tools


en:tech:bedsensor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:tech:bedsensor [2022/09/23 14:27] bullaren:tech:bedsensor [2026/08/12 13:53] (current) claude
Line 6: Line 6:
 There are alarm mats as bed rugs or professional bed sensors from the care sector. The seat sensors from the automotive industry also perform a similar task. What they all have in common, however, is the lack of connection to an open protocol such as MQTT or Home Assistant and of course the usually very high purchase costs. There are alarm mats as bed rugs or professional bed sensors from the care sector. The seat sensors from the automotive industry also perform a similar task. What they all have in common, however, is the lack of connection to an open protocol such as MQTT or Home Assistant and of course the usually very high purchase costs.
  
-{{:tech:bettsensor_prof.png?direct&300|Professional bedsensor}} +{{:media:tech:bedsensor:bettsensor_prof.png?direct&300|Professional bedsensor}} 
-{{:tech:sitzbelegungsmatte.jpg?direct&200|Car seat sensor}}+{{:media:tech:bedsensor:sitzbelegungsmatte.jpg?direct&200|Car seat sensor}}
  
 Some resourceful developers have addressed this gap and have, for example, integrated switches into the bed frame [[https://homematic-forum.de/forum/viewtopic.php?t=16239|Selbstgebauter Bettsensor... Steuern und Regeln im Schlaf!]] Some resourceful developers have addressed this gap and have, for example, integrated switches into the bed frame [[https://homematic-forum.de/forum/viewtopic.php?t=16239|Selbstgebauter Bettsensor... Steuern und Regeln im Schlaf!]]
Line 13: Line 13:
 My approach looks a little different to be as minimally invasive as possible for the bedstead. I use a pressure-sensitive resistor (FSR) as a sensor. It is also available in an extra long version of 60cm [[https://cdn.sparkfun.com/datasheets/Sensors/Pressure/FSR408-Layout2.pdf|FSR 408]]. When unloaded, the resistance is high ohm (> 10MOhm) and with a load of 10kg the value is reduced to a few 100 ohms. The sensor is self-adhesive and can be easily attached to a slatted frame, for example. My approach looks a little different to be as minimally invasive as possible for the bedstead. I use a pressure-sensitive resistor (FSR) as a sensor. It is also available in an extra long version of 60cm [[https://cdn.sparkfun.com/datasheets/Sensors/Pressure/FSR408-Layout2.pdf|FSR 408]]. When unloaded, the resistance is high ohm (> 10MOhm) and with a load of 10kg the value is reduced to a few 100 ohms. The sensor is self-adhesive and can be easily attached to a slatted frame, for example.
  
-{{ :tech:fsr408.png?direct&300 |FSR 408}}  +{{ :media:tech:bedsensor:fsr408.png?direct&300 |FSR 408}}  
-{{ :tech:force_curve.png?direct&300 |Typical Force Curve}} +{{ :media:tech:solarvilla:force_curve.png?direct&300 |Typical Force Curve}} 
-{{ :tech:bedsensor_mounted.jpeg?direct&300 |Mounted Bed Sensor}} +{{ :media:tech:bedsensor:bedsensor_mounted.jpeg?direct&300 |Mounted Bed Sensor}} 
  
 With the FSR 408, the existing pressure can easily be evaluated with a simple resistor network and an A/D converter or comparator. There are several options for getting the value into the smart home network. One of the simplest is an ESP8266 module (ESP-07) with the open-source firmware called [[https://www.letscontrolit.com/wiki/index.php/ESPEasy|ESP Easy]]. By the way, you can find a similar approach with a Raspberry Pi {{https://community.home-assistant.io/t/bed-occupancy-sensor-force-sensing-resistor-fsr-raspberry-pi-zero-wh-analogzero-phat/91999|here}}. With the FSR 408, the existing pressure can easily be evaluated with a simple resistor network and an A/D converter or comparator. There are several options for getting the value into the smart home network. One of the simplest is an ESP8266 module (ESP-07) with the open-source firmware called [[https://www.letscontrolit.com/wiki/index.php/ESPEasy|ESP Easy]]. By the way, you can find a similar approach with a Raspberry Pi {{https://community.home-assistant.io/t/bed-occupancy-sensor-force-sensing-resistor-fsr-raspberry-pi-zero-wh-analogzero-phat/91999|here}}.
  
-{{ :tech:esp07.png?direct&200 |ESP-07}}+{{ :media:tech:powermeter:esp07.png?direct&200 |ESP-07}}
  
 ====Features==== ====Features====
Line 32: Line 32:
 The resistor network for evaluating the pressure looks like this: The resistor network for evaluating the pressure looks like this:
  
-{{ :tech:bedsensor_network.png?direct&200 | Resistor Network}}+{{ :media:tech:bedsensor:bedsensor_network.png?direct&200 | Resistor Network}}
  
 The output voltage to the ADC is calculated as follows: The output voltage to the ADC is calculated as follows:
Line 51: Line 51:
 In our application, the maximum value should not exceed 1V, as the internal analog reference voltage of the ESP-07 is 1V. We also need a multiplexer to evaluate two sensors. The complete circuit diagram is still very simple. In our application, the maximum value should not exceed 1V, as the internal analog reference voltage of the ESP-07 is 1V. We also need a multiplexer to evaluate two sensors. The complete circuit diagram is still very simple.
  
-{{ :tech:bedsensor_schematic.png?direct&400 | Schematic Bed Sensor}}+{{ :media:tech:bedsensor:bedsensor_schematic.png?direct&400 | Schematic Bed Sensor}}
  
 Of course, you can also connect just one FSR408 with R2 directly to the module, possibly avoiding the circuit board with free wiring. Of course, you can also connect just one FSR408 with R2 directly to the module, possibly avoiding the circuit board with free wiring.
Line 57: Line 57:
 In order to keep the module as small as possible, the circuit is made in SMD. Suitable home soldering techniques have already been published in various places. In order to keep the module as small as possible, the circuit is made in SMD. Suitable home soldering techniques have already been published in various places.
  
-{{ :tech:bedsensor_pcb.png?direct&400 |PCB Bed Sensor}} +{{ :media:tech:bedsensor:bedsensor_pcb.png?direct&400 |PCB Bed Sensor}} 
-{{ :tech:bedsensor_pcb.jpeg?direct&400 |PCB Bed Sensor}}+{{ :media:tech:bedsensor:bedsensor_pcb.jpeg?direct&400 |PCB Bed Sensor}}
  
 The sensors are connected via standard 2.5mm jack sockets (JY029). The power supply can also be plugged in with a 5.5 / 2.1mm hollow socket (HEBW21). You can find it very inexpensive [[https://www.ebay.de/itm/351218451793|Power Supplies]] with stabilized 3.3V DC voltage output. The bed sensor does not need more wired connectivity. \\ The sensors are connected via standard 2.5mm jack sockets (JY029). The power supply can also be plugged in with a 5.5 / 2.1mm hollow socket (HEBW21). You can find it very inexpensive [[https://www.ebay.de/itm/351218451793|Power Supplies]] with stabilized 3.3V DC voltage output. The bed sensor does not need more wired connectivity. \\
 With a 3D printer an inconspicuous housing can be realized which can easily be attached with double-sided adhesive tape underneath the bed. With a 3D printer an inconspicuous housing can be realized which can easily be attached with double-sided adhesive tape underneath the bed.
-{{ :tech:bedsensor_case.png?direct&400 |Housing Bed Sensor}} +{{ :media:tech:bedsensor:bedsensor_case.png?direct&400 |Housing Bed Sensor}} 
-{{ :tech:bedsensor_module.jpeg?direct&400 | Bed Sensor open}}+{{ :media:tech:bedsensor:bedsensor_module.jpeg?direct&400 | Bed Sensor open}}
  
 ====Programming (ESPEasy)==== ====Programming (ESPEasy)====
Line 77: Line 77:
 The bed sensor should connect to an existing MQTT server and transfer the current occupancy information to it if there is a change. To do this, we go to the //Controller// tab and enter the relevant data. This includes the IP address of the MQTT server and the account data for logging in. The result should look similar to the following example. The bed sensor should connect to an existing MQTT server and transfer the current occupancy information to it if there is a change. To do this, we go to the //Controller// tab and enter the relevant data. This includes the IP address of the MQTT server and the account data for logging in. The result should look similar to the following example.
  
-{{ :tech:easyesp_controller.png?direct&300 | MQTT Controller Setup}}+{{ :media:tech:bedsensor:easyesp_controller.png?direct&300 | MQTT Controller Setup}}
  
 ===Devices=== ===Devices===
 Second, we need a device that measures and stores the analog value. This can be done via the //Devices// tab. There is a separate device for each sensor and we also need a dummy device to temporarily store the previous measurement value. Second, we need a device that measures and stores the analog value. This can be done via the //Devices// tab. There is a separate device for each sensor and we also need a dummy device to temporarily store the previous measurement value.
  
-{{ :tech:easyesp_devices.png?direct&400 | Devices Setup}}+{{ :media:tech:bedsensor:easyesp_devices.png?direct&400 | Devices Setup}}
  
 Incidentally, the green numbers on the right indicate the current measured values. In the example nobody is in bed. \\ Incidentally, the green numbers on the right indicate the current measured values. In the example nobody is in bed. \\
 Here are the settings for the devices: Here are the settings for the devices:
  
-{{:tech:easyesp_analog.png?direct&300| Analog Device Setup}} +{{:media:tech:bedsensor:easyesp_analog.png?direct&300| Analog Device Setup}} 
-{{:tech:easyesp_dummy.png?direct&300| Dummy Device Setup}}+{{:media:tech:bedsensor:easyesp_dummy.png?direct&300| Dummy Device Setup}}
  
 ===Rules=== ===Rules===
Line 135: Line 135:
 Both values ​​are read out every second and if there has been a change to the threshold value, the result is sent to the MQTT server. These are the states IN and OUT. You can of course also transmit the current values ​​and leave the decision as to whether IN or OUT to the home automation. In the following example I recorded a night like this. Both values ​​are read out every second and if there has been a change to the threshold value, the result is sent to the MQTT server. These are the states IN and OUT. You can of course also transmit the current values ​​and leave the decision as to whether IN or OUT to the home automation. In the following example I recorded a night like this.
  
-====Programmierung (ESPHome)====+====Programming (ESPHome)====
 The integration into [[https://www.home-assistant.io|Home Assistant]] lcan be easily done with [[https://esphome.io|ESPHome]]. All mandatory infos about the programming can also be found there online. The integration into [[https://www.home-assistant.io|Home Assistant]] lcan be easily done with [[https://esphome.io|ESPHome]]. All mandatory infos about the programming can also be found there online.
 Here the final code for Bedsensor: Here the final code for Bedsensor:
Line 225: Line 225:
 Here the recording of the converted values ​​[0..1023] for one night. The drops are not caused by age-related incontinence but rather the short-term cuddling away in the middle of the bed :-)   Here the recording of the converted values ​​[0..1023] for one night. The drops are not caused by age-related incontinence but rather the short-term cuddling away in the middle of the bed :-)  
  
-{{ :tech:bed?diagram.jpeg?direct&500 | Recoding of one night}}+{{ :media:tech:bedsensor:bed_diagram.jpeg?direct&500 | Recoding of one night}}
  
  
Line 232: Line 232:
  
 ====Downloads==== ====Downloads====
-  * {{:tech:bedsensor_BOM.pdf|Bestückungsliste (BOM)}} +  * {{:media:tech:bedsensor:bedsensor_bom.pdf|Bestückungsliste (BOM)}} 
-  * {{:tech:bedsensor.brd.zip|PCB}} Eagle format (.brd) +  * {{:media:tech:bedsensor:bedsensor.brd.zip|PCB}} Eagle format (.brd) 
-  * {{:tech:bedsensor_v3.stl.zip|Gehäuse}} (STL Datei)+  * {{:media:tech:bedsensor:bedsensor_v3.stl.zip|Gehäuse}} (STL Datei)
  
 ====Links==== ====Links====
Line 241: Line 241:
 ==== Donate ==== ==== Donate ====
  
-If you line my articles feel to donate a cappuccino or so...+If you like my articles feel to donate a cappuccino or so...
  
 <html> <html>
en/tech/bedsensor.1663943221.txt.gz · Last modified: (external edit)