mm Wave vs IR vs ESPresense – Big Decision?

People Sensors

As some of you know, I have a number of radar detectors including those shown here in the form of the Sonoff SNZB-06P, Aqara FP2 and many others. I also have endless simple IR detectors from AliExpress and elsewhere. One of the latter sits next to Alexa in our living room to turn it off when no-one is in the room.

The Aqara FP2 can supposedly tell how many people are in the room – but in reality often shows two “people” when there is only me in my office (where it is on test). None of these knows WHO is in the room.

All of these sensors have their uses – and downsides. And now there is ESPresense. And that is WHAT? I hear some of you ask?

Firstly some assumptions… that you have some form of DIY home automation system. For many years mine consisted of MQTT and Node-Red, largely controlling various WiFi devices with a more recent addition of Zigbee-based devices – both lights, smartplugs and sensors. My chosen tool for the latter being Zigbee2MQTT running on a USB dongle on a Raspberry Pi – the same RPi5 that is running Mosquitto, Node-Red etc.

Today my setup consists of Home Assistant, the same MQTT broker (Mosquitto) and the same Zigbee setup as before. The reason for the move to Home Assistant mainly being that I was getting sick of the number of devices I could not easily integrate into Node-Red (eWeLink and others – I HATE having lots of APPs to control stuff – and having to explain to my wife why she needs to learn how to use the various APPs). I’ve kept Node-Red up and running as it can easily talk to Home Assistant “entities” and there’s a great, free Google Home plug in for Node-Red which allows me to (freely) have my devices respond to voice commands.

Let me say something here about IR sensors and radar mm Wave sensors. Your average IR sensor detects movement… and I’m sitting here about to rip out the IR sensor in my office which detects movement and if there isn’t any, turns off my office lights and PC monitors. GREAT idea Peter… but I had no idea when fitting, just how long I could sit in front of the computer and NOT move. Accordingly I could not begin to describe just how annoying it is for the monitors to turn off when I’m deeply engrossed in a YouTube training video. Good idea, not.

The IR sensor on the other hand, sitting next to our “Echo Show” under the TV, works well, the sensor is placed maybe 2 metres above the ground and the cats rarely if ever set it off. AND IR sensors are CHEAP, especially from AliExpress.

That brings us to the mm Wave sensors shown in top photo in this entry – both types are USB-powered – that has it’s ups and downs – USB power required possibly at not the most convenient location – but then no more contributing to the dead battery mountain. I spend more time checking for dead batteries than I care to think about… and increasingly, sensors seem to be moving away from the cheap-and-cheerful CR2032 to the more bulky and more expensive CR2450 and even more expensive batteries, sometimes still without achieving any significant battery longevity.

Ok, so looking at the photo at the top of this page, both the Aqara and Sonoff sensors are pretty – but that little ESP32 board you see in the middle is not pretty but FAR smaller. It’s an Atom Lite from M5Stack and is about $7.50 + tax and delivery in the USA – I hate to think how much here in Spain. Oh, I found it – 27 Euros – someone’s having laugh, surely? For heaven’s sake, it’s an ESP32 in a little box with a tiny LED strip. I’ve just ordered a couple of cheap ESP32-C3 boards from AliExpress – just need an equally cheap suitable box, I could see the whole thing coming in at under 10 Euros per device+case… let’s say one per room?

This brings us to ESPresense. Maybe you’re familiar with Tasmota, the free firmware for the ESP8266 and ESP32 that does so much, I use it all the time. Adding sensors to ESP8266 and ESP32 is dead easy using the above firmware – one could write a book on the subject… no doubt several have.

To the point: the free ESPresense works on almost any ESP32 board.. I currently have it working on the two boards you see here and I’m only getting started. The Atom Lite is not cheap – my other ESP32 board is just 3 Euros or so.

And ESPresence is? Well, it’s free firmware, kind of like Tasmota in that you can attach lots of peripherals to an ESP32 board – but most of that is an aside. ESP32 boards have Bluetooth (except the S2 – avoid that one, no BT – may as well be an ESP8266) and while I’ve never found a great deal of use for Bluetooth outside of earplugs, now I DO.

Atom Lite and a generic ESP32 board

Armed with that Atom Lite (which was lying around the office doing nothing until this week) I [plugged a USB-C lead into my PC and the Atom respectively and completely effortlessly installed ESPresense using this ESPresense web installer.

Just like installing Tasmota I had to tell the installation about my MQTT broker and nearest WiFi access point (2.4Ghz because ESP boards don’t do 5Ghz). I also had to give it a name – the first one I called “office”, the second one I called “livingroom” – long before understanding what I was doing.


The upshot here is you install one of these ESP32 devices in each room – and carry a BLE device for identification. This could be a mobile phone or as I have right now, my wife’s Mi 7 smart band – soon I’ll have cheap Bluetooth sensors from AliExpress – wish me luck.

And the point being? The ESP32 device, thanks to it’s Bluetooth knows roughly how far away my wrist device is – and you can set up in ESPresense items like maximum room edge distance so that each ESP can report it’s name or “not_home” back to the likes of Home Assistant. Without any “integration” in Home Assistant, I can now detect individuals in a room (like Bill Gates was doing last century – so not new but no longer requiring that you’re a millionaire).

Look at the photo here, this simple tile in Home Assistant is talking to the “petes mi 7” entity and reporting back “not_home”, “living room” or “office” depending where I am.

No, really, that simple – in my sensors.yaml file in Home Assistant I added…

- platform: mqtt_room
  device_id: "mifit:xxxxxxxxxx"
  name: Petes Mi
  state_topic: 'espresense/devices/mifit:xxxxxxxxxx'
  timeout: 10
  away_timeout: 120

Above the xxxxx is the ID of my Mi band (the MAC address essentially) – DAMN – see what I mean, my monitor just turned off – I NEED this setting up NOW.

To actually SEE the sensor in action (as against doing anything with it) needs (in my case) a simple tile in Home Assistant – i.e. the YAML code below..

graph: line
name: Pete's  Mi 7
type: sensor
detail: 1
entity: sensor.petes_mi

To MAKE USE OF where the Mi band IS needs only that first 6 lines of YAML – and the above-mentioned tile in Home Assistant. To DO something needs a simple Home Assistant “automation” which in my case goes as follows:

alias: mi band test turns hall light on
description: ""
  - platform: state
      - sensor.petes_mi
    to: office
condition: []
  - type: turn_on
    device_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    entity_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    domain: light
mode: single

As you can see, I’m just testing. I could have created that “integration” in the visual editing in Home Assistant but in this case I wanted to see the YAML code to understand completely what was going on. As the “entity” reports my state as changing from anything TO “office” (the name of the ESP device that is seeing the wrist band), the automation turns on the hall light (as a test). The next step later this week will be to turn on the lights and monitor in my office when I am in and turn them off when I’m not (ie the entity reporting a change fo state FROM office to anything else).

More on all of this soon. So far, so good. Whee – I just disabled the LEDs on the Atom Lite – that’ll save a bit of power – the tiny device gets slightly warm. I set ESPresence settings (using the Atom Lite M5 Stack page to get the pin number) so that any LEDs on GPIO27 would be NEOPIXEL and 3 of them – and having checked that was correct, set all 3 LED options to -1 to disable. I saved that and hit RESTART. I turned ESP device off then on – and now no lights… just checked my USB charger – 5.2v 0.1a – ie the ESP32 is using a total of 0.52w or less.

A quick look in Home Assistant’s automatic history will show that the entity is variously reporting office, livingroom and “not_home” (both office and living room ESP devices are currently both sitting on my desk in the office). Livingroom is purple, office is dark blue (I didn’t program any of this – I simply put the info in sensors.yaml and added the tile) – detail after clicking on the tile shown below.

ESPresence in Home Assistant

Less than a month ago, none of this Home Assistant stuff would have made any sense to me at all so feel free to ask in the comments.

pdate: I just added a D18b20 to the “office” ESP32 – i.e. the Atom Lite (and a pullup resistor of 10k), added that sensor in the settings of ESPresence and magically in Home Assistant I noticed a new entitty appear which I could then put in a handy TILE to show the temperature around the device. Once I find a suitable tiny ventilated box, I can see the Atom Lite doubling up as temperature sensor and BT-equipped people detector 🙂

ESPresense added DS18b20 showing up automatically in Home Assistant "entities".

This is fun.


One thought on “mm Wave vs IR vs ESPresense – Big Decision?

Leave a Reply

Your email address will not be published. Required fields are marked *

Leave the field below empty!

The maximum upload file size: 512 MB. You can upload: image, audio, video, document, spreadsheet, interactive, text, archive, code, other. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here