The best, simplest, bed sensor * - wireless and no soldering!

*if you have a slatted bed and access to a 3D printer!

I feel like I’ve made and tested enough iterations of this project now to call it a success!

This is a 3D printed spring that clips onto and fits between the slats of a bed. A small magnet is attached to the flap on the end and sits next to an Aqara door/window sensor. When a person gets on the mattress, it gets slightly squashed between the slats and pushes on the spring. This is sufficient to push the magnet away from the sensor, marking the bed as occupied.

Unoccupied:

Occupied:

Advantages:

  • No soldering needed
  • Very cheap - Aqara sensors are low cost - therefore scalable
  • Wireless - no trailing cables to ESP-powered devices - and long battery life
  • No sensor drift - load cells, FSRs etc can all be prone to drift and need recalibration after periods of time. Whilst a tiny amount of plastic deformation is possible, it is unlikely to affect performance - mine have been working for months without needing adjustment
  • Extremely low false positive/negative rate - for me, zero!

Design and assembly:

Create a shape like this in your preferred CAD software. The clip end should fit around your bed slat, the spring should extend the distance between slats, and the arm should be the width of the next slat. I used Fusion 360 and the Thin Extrude option. A thickness of 2.5mm works well for PETG, and extruded to 15mm height. Extrude a plate at the end of the arm to attach your magnet to.

I recommend making the depth of the spring segment slightly less that the depth of the slat so that when unoccupied, the mattress is not touching the spring and the arm can lie flat against the next slat.

Blu-tack the small magnet to the printed piece as shown above, clip the piece into your slats, and blu-tack the Aqara sensor next to the magnet. Use the same orientation as shown above - it works best due to the position of the reed switch. I also recommend putting blu-tack inside the clip to stop it sliding along the slat, and if your slats are not fixed in position, blu-tack them to the bed frame to prevent unwanted movement.

Test your sensor - you may need to adjust the position of the sensor or the magnet to get the best results. I advise positioning the setup on the slats under where your abdomen would be when lying in bed.

Tips:

  • Print in PETG - PLA is too rigid and will undergo more plastic deformation
  • Don’t use the magnet that comes with the Aqara sensor - it is too big and heavy and will drag the arm down. Use a small magnet - I’m using a 6mm N42
  • For double beds and larger, make one sensor for each side of the bed. Place each sensor closer to the edge of the bed to avoid false positives from the person on the other side
  • If you want detection when sitting on the foot end of the bed, you will probably need another sensor at this end too
5 Likes

I don’t have a slatted bed but this is very clever.

2 Likes

An example of reliability - no false negatives last night and no false positives during the day today

2 Likes