Bed Presence Sensor With SONOFF

3,572

23

6

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

Share

    Recommendations

    • Barbecue Challenge

      Barbecue Challenge
    • Sensors Contest

      Sensors Contest
    • Beauty Tips Contest

      Beauty Tips Contest

    6 Discussions

    0
    None
    ElyM6

    6 months ago

    I'm going to do this. Would wiring to GPIO14 instead of TX allow for a sensor that is independent of the relay?
    EDIT: Actually, I got GPIO14 to work. I followed this video on how to bypass the relay and make the sensor independent of the relay: https://youtu.be/qZqmkhpJ55A

    1
    None
    BenW222

    6 months ago on Step 8

    I didn't know about those pressure sensor mats, they're pretty handy. If I were to do this though I'd wire it into a wireless zigbee/zwave/whatever Xiaomi door sensor, they're about £5. There'd be no mains power needed and it'll last on battery for like 2 years, and a new battery is like 50p/cents and take a minute to change. Of couse you'd need to be using an Xiaomi hub in your house though but Im sure there's many wireless sensors that don't require being plugged in using a sonoff under your mattress which is shady even for me lol.

    1 reply
    0
    None
    svermeilleBenW222

    Reply 6 months ago

    It's a point of view absolutely ;)
    I prefere the sonoff as it allows me to put a ledstrip under by bed and turn it on when I left the bed.

    Feel free to share your creation so we can see concretely what you do :)

    0
    None
    gmorrison2

    6 months ago on Step 1

    #5 we call "heat shrink tubing" in the US. Not sure if other English speaking nations use the same name.

    2 replies
    0
    None
    svermeillegmorrison2

    Reply 6 months ago

    Hi @gmorrison2 I will adapt the howto with it thank you !

    0
    None
    gmorrison2svermeille

    Reply 6 months ago

    Great instructable BTW!!! Ordering a couple of those pressure sensors soon!