Smart Home

A Wi-Fi MQTT Multi-Sensor

Old but gold, I came across the Bruh Automation Multi-sensor video about 12 months ago. Intrigued, I set forth and built a couple of these Wi-Fi devices. Over the year I have iterated on the design and software – getting to a place where the sensors themselves are reliable for use in environment monitoring and automation flows.

Part Selection

The final parts list is as below:

  • BH1750 light sensor
  • AM312 PIR sensor (anything else seemed to produce false triggers)
  • NodeMCU v1 (Amica, not Lolin version)
  • Red LED (used to show PIR triggered)
  • 470 ohm resistor
  • DHT22 Temperature/ Humidity Sensor
  • Header wires
  • USB Power Supply
  • 3D Printed Case (I used 3D Hubs to print this)

I tested several sensors in arriving at the specification outlined above:

  • RCWL-0516 (this was *far* too sensitive, would pickup movement in another room/ behind a wall/ door and even outside the house itself)
  • TEMT6000 (poor low-light performance)
  • LDR (poor low-light performance)
  • Various PIR sensors (all of which generated false positives on a regular basis, likely wireless interference)
  • NodeMCU Lolin boards (these will not fit in the case!)

The Case

Different electronics demanded a (slightly) different case, I also found the original case to be somewhat “cosy” – it was a real squeeze getting everything into the 3D printed case. I ended up iterating on Ben’s design, modifying it to be taller, with a cut out for the BH1750 to sit on top. You can see/ download the revised design at Thingiverse.


My initial goal was to use the PIR as a trigger for a Node-RED-based automation that would switch the MQTT-enabled lights *OFF* in a room where there had been no movement for some time. The sensors, and modified code worked well for this purpose, however I started to run into issues as I expand the use of the devices, namely:

  • When collecting data in InfluxDB, measurements would sometimes come through as zero, despite previous/ next being nothing close
  • Occasional hanging/ freezing, requiring power reset

Tasmota to the rescue! I’ve been using Tasmota-powered MQTT/ Wifi light switches throughout my house for a while and it hadn’t dawned on my that I could use the same software in my multi-sensors.

Using the configuration below, with the device set to “Generic (18)” I was able to get like-for-like performance/ functionality (including the PIR triggering the red LED on motion) without the hanging/ zero-value measurement issues:

Wiring diagram below for reference:

Leave a Reply

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