Introduction: Bed Presence Sensor With SONOFF

About: Software engineer and aquaponic lover

Welcome to this tutorial !

Prerequisites

This howto require you to have some knowledge of sonoff and tasmota. If you never flashed a sonoff with tasmota you should first learn to do it and then only you will be able to build it.

If you don't know sonoff or don't want to learn it I highly suggest you to follow this howto instead: https://www.instructables.com/id/In-Bed-Presence-D...

What are we going to build ?

This sensor is able to notify your home automation system or everything you want via MQTT messages if someone enter/leave a bed. note: It works also on bed for two persons you just need two sensors :) (I tested it)

What are potential usage of a such thing ?

Well it really depend on your imagination but here are a few use cases: * When everybody in the house is in bed -> turn off all the lights + tv + turn on alarm system. * if you use some motion sensors to turn on the lights, then don't turn on the top light if you or your wife is sleeping in the bed ! awesome right ? * more rules may come it's just an information more for your home automation system you can do whatever you want from there :)

Special note

This instructables is based on this one: https://www.instructables.com/id/In-Bed-Presence-D...

I just made it working with a sonoff.

Step 1: Shopping List

In order to prepare this sensor you have to buy a few parts:

  1. mat pressure sensor: Ideal Security SK630 Pressure Mat (30$ on amazon)
  2. a sonoff basic (5$ on itead.cc)
  3. a plug 230v (or what ever you use in your country note that it must works with the sonoff)
  4. 2x dupont cables (female-female) (1$ on aliexpress)
  5. (optional) heat shrink tubing like that

Step 2: Flash Your Sonoff With Tasmota

This part is something I won't explain because it's already very well documented on this video. If you encounter some issues just visit the github of tasmota and you will find some help: tasmota github.

Step 3: Connect Things Together

Cut the plug and connect the wire like on the picture. The green/yellow one is not used here so you can simply isolate it

Step 4: Connect the Sensor on the Sonoff

Use two small female to female cables and plug them to the mat pressure sensor.

The other side of the cables have to be connected (order do not mater) to GND + TX pins on the sonoff (see picture)

Step 5: Close Everything

Put the plastic enclosure back on the sonoff and fix the screws.

Optionally you can hide the two cables into this black thing so it looks better.

Step 6: Configure the Sonoff So It Read the Sensor

Go to your sonoff tasmota admin page (ip of your sonoff basically)

and then click on "Configuration" > "Configure Module" and setup the GPIO as in the picture.

Then in order to determine how the sonoff behavior regarding the sensor simply go to "Main Menu" > "Console"

and enter "switchmode1 1" or whatever you want refering to tasmota documentation.

Step 7: Place the Sensor Under Your Mat

This is the best part of this how to, simply place your sensor under your mat.

I tested a few positions and the best one in my opinion is at the back but feel free to test and change it regarding your needs.

Step 8: Thank You

Great I hope you enjoyed this how to.

It is unfortunately not a howto for a whole sonoff tasmota beginner but for some lack of time I had to focus on the real plus value: the sensor.

Feel free to share your creations or new ideas of usage of this sensor :)

Cheers,

seb