Please read the disclaimer at the bottom before printing.
Hello everyone 👋, this has been one of my biggest projects so far. If you have any questions about the project please ask them in the comments then I can answer them and everyone can learn from that.
When I started building my smart home, I realized that most devices only cover very specific use cases. To get full functionality in each room, you usually need to buy multiple different devices.
My goal with this project was to create the ultimate DIY smart home sensor device that integrates all the essential sensors needed to achieve the following:
🎯 Goals:
Control the lighting in a room by turning it on when motion is detected and keeping it on as long as someone is present (even if the person is not moving).
Monitor the brightness in the room and only turn lights on if needed (and off again when no longer required).
Measure air quality, humidity, and temperature.
Use Bluetooth to track a person’s smartphone and thereby determine which room they are in, so the smart home can react accordingly.
Keep the footprint as small as possible.
Powered by a single cable. USB-C in particular.
Ensure the design is unobtrusive and blends seamlessly into the living room.
Integrate with Home Assistant.
No cloud dependency.
🔢 Steps:
Source all the parts from the shopping list
Print the enclosure
Solder all sensors to the esp
Flash the ESP with the software and verify that all sensors work (connect it to your Home Assistant instance to monitor them).
Assemble the sensors and ESP into the enclosure.
Place the device in its designated spot.
After a few minutes, calibrate the sensors and re-flash the software.
Create your Home Assistant automations using the sensors.
🛒 Shopping List
You can also buy the parts from other sites. If you don’t mind waiting, AliExpress is usually cheaper. I’ve listed the exact products I used because I can confirm they worked for me.
Name
Hint
Link
ESP32 (form factor as shown)
Must use this form factor. There’s also a Micro-USB variant, but I haven’t tested it with the case. If you still have Micro-USB cables, you can try it.
The sensor case is specifically designed for a motion sensor with this form factor. I know they are not the best, but they are reasonably cheap, see Disclaimer for more details
The sensor case is specifically designed for a presence sensor with this form factor. I experienced that they are not the best, but they are reasonably cheap, see Disclaimer for more details.
The soldering points of this sensor are smaller than the ones of the other sensor and the esp. It is very hard to remove the pins. I would advise to buy the variant without the pins.
It might be possible to use jumper wires here so you don't have to solder, but the pins are smaller than the standard jumper wire ones and need the appropriate smaller jumper wires.
I printed my case in Kingroon White PLA, but that filament is relatively translucent, that's why you can see the presence sensor through the case. That may change with different filament. I am solely using it because it is very cheap, you can use bambu labs filament of course.
I printed the brightness sensor cover out of translucent PLA. Translucent PETG might work even better but PLA works fine for me.
I broke something off proto boards that I got lying around and used that to distribute the cables which needed to go to multiple sensors. I added a link to something similar. You can try a different approach. I might use WAGO clamps in the future, but I don't know if they will fit into the current case. Don't try to solder every cable from every sensor directly to the ESP as this will be a mess 😅
Will be used to connect the ESP32 which is screwed to the back, to the proto boards that are attached to the front part of the enclosure. This enables us to separate front and back without unscrewing everything.
Desolder the pins and pull them out with pliers. It’s also possible to heat the solder and pull the pins with pliers without a desoldering pump.
Desolder Motion sensor (HC-SR501) pins:
Remove the pin spacers with pliers.
Clamp the motion sensor in a vise.
Desolder and remove the pins. It’s also possible to heat the solder and pull the pins with pliers without a desoldering pump.
Desolder Presence sensor (LD2410B) pins (only if you bought the pinned version or if you are not using jumper wires here):
Remove the pin spacers with pliers.
Clamp the presence sensor in a vise.
Desolder and remove the pins. Avoid using a desoldering pump here — it’s easy to accidentally desolder components right next to the pins.
Break a 5×3 matrix from the proto board — for motion and presence sensors.
Break a 4×3 matrix from the proto board — for brightness and temperature sensors.
Cut wires to length
ESP → 5-pin distribution proto board (use jumper wires with a female pin header on one end)
Color
Pin
Length (mm)
excluding the pin header
Yellow
GPIO27
65
Grey/White
GND (from the site where the GPIO27 is)
70
Black
5V
75
Green
TXD
50
Orange
RXD
50
ESP → 4-pin distribution proto board (use jumper wires with a female pin header on one end)
Color
Pin
Length (mm)
excluding the pin header
Brown
GPIO22
110
Violett
GPIO21
100
Red
3.3V
130
Grey/White
GND (from the Site where the RXD pin is)
100
5-pin distribution proto board → motion sensor
Color
Pin
Length (mm)
Yellow
Output
45
Grey/White
GND
45
Black
5V
45
5-pin distribution proto board → presence sensor
Color
Pin
Length (mm)
Grey/White
GND
70
Black
5V
70
Green
RXD
70
Orange
TXD
70
4-pin distribution proto board → brightness sensor
Color
Pin
Length (mm)
Brown
SCL
30
Violett
SDA
30
Red
3.3V
30
Grey/White
GND
30
4-pin distribution proto board → temperature sensor
Color
Pin
Length (mm)
Brown
SCL
55
Violett
SDA
55
Red
3.3V
55
Grey/White
GND
55
Make sure to tin the wire ends
Solder the 5-pin male header (from the brightness sensor kit) to the 5×3 proto board.
Solder the 4-pin male header (from the temperature sensor kit) to the 4×3 proto board.
Connection Drawings. I show the two distribution boards separately to make things easier to follow. (There are further steps below on soldering order.)
Temperature and brightness sensor distribution board:
Presence and motion Sensor distribution board:
Solder one end of each wire to the sensors as described in the tables from step 6
Motion Sensor
Presence Sensor
Brightness Sensor
Temperature Sensor
Solder the other end of the wires to the distribution proto boards. Connect wires of the same color together. If you used a proto board where the lines are already connected via the board you don't need to do any extra step. My proto board has separated solder points so I had to bridge them.
The 4 pin distribution board is connected to the brightness and temperature sensors.
The 5 pin distribution board is connected to the motion and presence sensors.
Use a multimeter to verify that solder joints of different colors do not bridge. Any short can damage components and may cause smoke or even fire.
Solder the jumper wires to the ESP pins as described in the wiring tables above. Whether you attach the cables from the front or back of the board does matter — attach them as shown in the photos.
Now it's time to check whether all the soldering has worked out. Connect the jumper wires of the ESP to the distribution boards. Match the colors.
Flash the software onto the ESP. It can be found in the software section. Verify that all sensors are detected and reporting, then return here to complete assembly.
Place the brightness sensor shield in its place from the inside.
Put in the 5-pin distribution board into its designated position:
Put in the 4-pin distribution board into its designated position:
Screw in the presence sensor shield, with 2 or 3 screws 😅 (3x M2x3mm)
Screw the motion sensor in place (2x M1.7x3mm)
Screw the temperature sensor in place. For the BME680 There is already a cone protruding from the wall that holds the sensor in place on the lower screw hole. (1x M2.5x3mm)
Screw the brightness sensor in place (2x M1.7x3mm)
Slide the divider wall into place. It shields the temperature sensor from ESP board heat. It won’t eliminate the effect entirely, but it’s an improvement.
Attach the ball head or other mounting hardware to the back of the enclosure. This screw is no longer accessible once the ESP is mounted (M3×5–10 mm).
Screw the ESP board onto the back of the enclosure. The USB port must line up with the cutout at the bottom (4× M1.7×5 mm).
Attach the shorter ESP jumper wires (matching colors) to the 5-pin distribution board.
Attach the longer ESP jumper wires (matching colors) to the 4-pin distribution board.
Close the lid — it snaps into place.
Congratulations — you’re done! 🥳🎉 Post a picture and a comment to this model — I’d love to see your results 🤗
💾 Software
This project uses ESPHomeas the underlying software. It’s easy to set up and flash. You need a single YAML file that defines the sensors connected to the device and their properties. I won’t provide general ESPHome flashing instructions — the official documentation is excellent: Guide:https://esphome.io/guides/installing_esphome/
Download the YAML file that matches your temperature sensor from my GitHub, along with the secrets file.
In bmexxx.yaml, change the friendly name, name, and optionally the area to your liking.
In secrets.yaml, set wifi-password and wifi-ssid to your Wi-Fi credentials.
Set the esp-password and esp-username to any values you like. You will need this password to add the device to Home Assistant.
Run ‘esphome run bmexxx.yaml’ to flash the device.
Test whether all sensors work as expected.
Once deployed in its final location, proceed with calibration.
🎯 Calibration
Calibration is non-trivial and may take time and multiple iterations. I mainly use offset calibration, which is the easiest approach, though there are more accurate methods also available.
BME680:
I only calibrated temperature and humidity. I don’t use air pressure, and air quality is meant to auto-calibrate.
Let the device sit in its final location for 5–10 minutes to saturate with heat from the ESP.
Place a trusted temperature & humidity sensor nearby.
In the bme68x_bsec2_i2c section of your ESPHome file, set temperature_offset to the difference between your device and the trusted sensor. Flash the new values — this also changes humidity readings.
In sensor/platform: bme68x_bsec2, set the humidity filter with offset to the difference compared to your trusted sensor.
BME280:
Again, I only calibrated temperature and humidity; I don’t use air pressure.
Let the device sit for 5–10 minutes to heat-soak.
Place a trusted sensor nearby.
In sensor/platform: bme280_i2c, set the temperature filter offset to match the trusted sensor, and do the same for humidity.
Motion Sensor:
The motion sensor has a jumper that defines the mode of the sensor.
H (Repeat Trigger / Retriggerable mode)
As long as motion is detected, the output stays HIGH. Example: If the delay time is set to 10 s and motion is detected again after 5 s, the timer resets and the output remains HIGH continuously until no more motion is detected.
L (Single Trigger / Non-Retriggerable mode)
When motion is detected, the output goes HIGH for the set delay time, then returns to LOW — even if motion is still happening during that period. Only after the delay finishes and the sensor is ready again can it trigger once more.
The default seems to be L, while I use H.
The sensor has two potentiometers: one for trigger time and one for sensitivity. Looking from the back, the left is sensitivity and the right is time delay (I always mix them up 😅).
Set the time delay long enough that the presence sensor has already triggered, but short enough to release in a timely manner when a person leaves. This makes automations easier.
Set sensitivity just high enough to trigger where needed, but as low as possible to reduce false positives.
Presence Sensor:
This sensor is the most challenging to calibrate. The g0-g8 values depict the different distances from the sensor.
Enable all the extra sensor readings of the ld2410b in the esphome yaml file.
These are
the g0-g8 move and still energy sensors
the button to enable engineering mode
the numbers g0-g8 move and still thresholds
While engineering mode is on, memory usage is high. For calibration, it’s best to disable bluetooth_proxy and esp32_ble_tracker (comment them out).
Consider reducing the LD2410 throttle to something small like 250 ms to collect more data quickly.
Flash the new software.
Ensure no one is in the room while calibrating.
Let the sensor sit for 10 minutes while Home Assistant gathers g0–g8 move/still energy values.
Review the history of each g0–g8 value in Home Assistant. Find the highest value each.
Set the g0–g8 thresholds to 5–10 % higher than the highest observed value for this distance.
Disable engineering mode
Revert the YAML changes
Flash again.
🚫 Don'ts:
Don’t mount the device too high. Hot air rises and will skew and destabilize temperature readings; it may also affect the motion sensor.
Don’t place the device near a heater — it reduces temperature accuracy and can trigger the motion sensor.
Don’t place it directly in strong airflow (e.g., when airing the room), as the motion sensor detects rapid heat changes.
It’s preferable to position the device facing the area where you stay rather than just facing the door. The motion sensor has a wide field of view and covers most of the room, while the presence sensor works best when pointed directly at the target.
You can test all sensors with jumper wires before committing to soldering.
⚠️ Disclaimer:
This project is not easy: you have to solder a lot, including very small pins. You have been warned — but I’d love to see people try it 😊
The finished product is not perfect — that’s why the title is not “Ultimate Smart Home Sensor Device” 😅. I plan to release a revised version with other sensors when I have time and when the sensors I want become more accessible. Since I don’t know when that will be, I’m sharing this version for now.
Things that bug me on the current version:
The motion sensor is very cheap and sometimes triggers when no one is in the room. (This can be minimized by reducing the ESP’s Wi-Fi signal strength, as cheap motion sensors are prone to misfire due to Wi-Fi interference.)
The motion sensor can trigger when you air the room, as it detects heat changes.
The presence sensor uses 24 GHz. While it can detect mostly stationary humans, it cannot detect very small movements or someone under a blanket. (This mostly applies to my girlfriend — somehow I am tracked a bit better 😅).
ESP32 RAM is limited; enabling additional features (e.g., the web server) can cause reboots. I avoided reboots by disabling all non-essential features.
The presence sensor is extremely hard to solder. I actually broke a sensor by accidentally desoldering the resistor right next to the pins.