Presence sensor V2 - microwave RF sensors

So I’m a MASSIVE fan of these little ESP8266 chips so been tinkering away
RF Ceiling Remote Hack

anddddd purchased a bag of these: Microwave RF motion sensor

<First up, I am documenting the process I went through - you may have a different set up, or you may have different components - so please check everything before proceeding. I take no responsibility for any damage to ANYTHING if you decide to replicate these steps>

Detailed video here - NOT mine credit to JohnAudioTech: Youtube 6:30 is a little demo. interestingly ignores the pet but not the human through the door!

I’m going to try and wire it properly but for now this works (albeit inverted)

What you’ll need (will edit as I progress) - soldering iron (and solder)

1 x SONOFF Basic
1 x microwave motion sensor
1 x bag of header pins
1 x 2 prong power cable (needs cutting)
1 x bag of connector cables

Step 1:
header pins - not really sure I need a picture here but just in case:

Also solder the header pins on to the motion sensor

Step 2:

Flash the SONOFF with Tasmota firmware
The best tutorial to flash the firmware is here:

Be sure to edit user_config.h with your wifi settings (the rest is less important as you can edit from the web interface it puts on the device). After, check it powers and you can connect to the IP address (go into your wifi router and look for the device named sonoff-xxxx, then type that IP address in your browser).

you should then see this page:

Click on configuration and then Module configuration so you see this page:

I chose Switch 2, as after testing i want to stop it triggering the relay.

Step 3:
Wire up for testing

Now it takes a few seconds on powering up, but when you move you will hear the relay click. Note as before its inverted so movement turns the relay off (on the todo list)

Feel free to test around the house, behind doors, through monitors :wink: whatever you want.

Step 4:
Home Assistant connection. This has been on my list FOREVER (to connect up MQTT).

So after a lot of reading i finally figured out the topics and prefixes.
I chose to use Mosquitto and there is an awesome video from Bruh Automation

If you follow the instructions you should have a working MQTT install.
NOTE when configuring the SONOFF Basic, on the main Web UI of the basic, this guy:

this time click configuration and MQTT configuration.

Your settings will be:
Host: <IP Address of MQTT instance, which should be your Home Assistant IP>
Port: 1883 #unless you have a custom install
Client: home-assistant-p1 #i fell for using the same client as the MQTT server, DONT.
Topic: lab/sonoff/presence
Full Topic: %prefix%/%topic%/

If you have followed everything correctly (and by the way you can use the same settings for your other SONOFF basic devices now, just remember to change the client to say p2 at the end, and topic to presence2
you can now add the binary_sensor to home assistant:

  -  platform: mqtt
     name: lab_movement
     state_topic: "stat/lab/sonoff/presence/POWER"
     payload_on: "OFF"
     payload_off: "ON"
     availability_topic: "tele/lab/sonoff/presence/LWT"
     payload_available: "Online"
     payload_not_available: "Offline"
     qos: 0
     device_class: motion
     value_template: '{{ value.x }}'

Now questions to the readers:

  1. I want to invert the signal, and have read some items on a pull up resistor - however is just inverting the payload enough?
  2. I am looking to decouple ‘Switch2’ on the GPIO14 from the physical relay. However i’m not familiar with the SwitchTopics so need a little direction:
    GitHub - arendst/Tasmota: Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at

Ultimately the firmware should create a fake relay, and have Switch 2 turn it on (not the physical relay, which will continue to click)

Next step:
I plan to miniaturize this and 3D print a custom surround.

  1. New parts needed:
    1 x ESP8266
    1 x Mains 5V step down (note this is for 110V so check your countries voltage)
    1 x US plug
    1 x screw terminals

I should be able to squeeze the components into a similar size as an iphone charger. Then my plan is to hide them round the house. All the parts are pretty cheap, and given they come in packs of 5 - i’ll make at least a couple for testing (especially any interference).

What got me interested was however its a very complete solution (although doesnt differentiate between people, and i doubt integrating where someone is on the HASS floorplan will be all that easy). So thought it may be easier to test this out.

Hope you enjoyed


Thanks for the share and link about these little sensors based on radio that looks more efficient than PIR I try to use right one :wink:

Looks great. Please make the title little more descriptive. Presence sensor v2 doesn’t tell anything about what is in there.

Interesting. I just bought a set of 5, and I think I’m going to put a single one in my kitchen to cut down on false positives at night by my PIRs (in the winter the window gets to cold and the vent is right in front of it and triggers the light on). I’ll probably combine the PIRs and microwave sensor require both high within a timeframe for it to consider having detected motion.

I love this idea and glad I read to the bottom. My thoughts (from the top part) was couldn’t an 8266 be used?

This sounds similar to the BRUH mutlisensor and if it could be used to replace/upgrade it (since I already have 4 of those) I will definitely order some of these RF sensors.

Is this the same technology that Xandem is using? How many of these do we need for an average two level house?

good question - my thought would be yes - however…
I imagine from one of the pins you can get a variable output based on distance from the unit.

Couple a few of these together and overlap and they will give you a 2D grid reference X, Y and thus be able to track you in the space.

Whilst Xandem looks awesome, i’m not sure i need to know i’m on the couch vs in the livingroom (yet lol)

plus, i doubt Xandem and floorplan will play nice together so likely separate instances :frowning:

if you make 10 of these, it will cost about $100

the house is less of a calculation, it will depend on rooms. they seemed to be accurate to about 5-6m
you’ll need to test one to see if it will work in your house (brick, steel etc in walls)

Good luck and update us. I’ve built three and struggle with false sensing outside the house. The inside ones work pretty good but I must have some big noise outside these things don’t like. Bummer as I wanted to replace my old X10 motion floods with them but no luck so far.

Hi jaburges,

any further updates in youre project ? I read that the microwave motion sensor need 4 v are they working well with 3.3v from sonoff ?


yeah so far, they work great as binary sensors. I havent spent much more time on looking at combining the readings (i was at one point going to try and triangulate location based on a number of sensors - but have had other things on)

Hi Guys,

I try to get this working for over a week now :frowning: . I followed your guide step by step with two different sonoff and also two different sensors, to ensure that it not a hardware problem.

The problem is that’s the sensor seems to react complety randomly.

Even if I dance in front of the sensor, it detects me for some seconds, then again not and then it dectects me again. For me it really looks completely random.

Did you add some resistor or anything’s else.
That you didn’t mentioned here ?


no resistors, some people have but i had good results. do you have the sensor facing the correct way? I also noticed some interference when i put the sensor on the step down converter so I tested with a longer wire set up

hi could you help me a little, i cant get anything from the hassio setup you provide.

i done just like you and hassio is not reacting, nodered works fine

about switchmode you could look at this

This page has a good descriptions of the microwave sensor. Detection distance seems to be adjustable with use of resistor.
OP got my interest in this.

Disclaimer: not associate in any way with the link page.


Hi Guys,

thanks a lot for your help. My Setup looks like this :

I tryed to extend also the wires and changed the direction, but noo success :frowning:
The Sonoff is confihured with SwitchTopic=1.
I will check out your links.


No success so far . My log file still looks like this :

21:42:53 MQT: stat/BathRightOne/RESULT = {“Command”:“Unknown”}
21:42:55 MQT: cmnd/BathRightOne/POWER2 = ON
21:42:55 MQT: stat/BathRightOne/RESULT = {“Command”:“Unknown”}
21:43:00 CMD: cmnd/BathRightOne/POWER2 on
21:43:00 MQT: stat/BathRightOne/RESULT = {“Command”:“Unknown”}
21:43:16 MQT: cmnd/BathRightOne/POWER2 = ON
21:43:16 MQT: stat/BathRightOne/RESULT = {“Command”:“Unknown”}
21:43:16 MQT: cmnd/BathRightOne/POWER2 = ON
21:43:17 MQT: stat/BathRightOne/RESULT = {“Command”:“Unknown”}


so does this detect you if your sitting down and not moving?

For the ones getting a lot of false positives: the RCWL-0516 requires a minimum of 4V, so it should be connected to 5V out on the Sonoff. For the Sonoff Basic R2 version, connect here:

How is project getting along?