Skip to content

Instructions and files for creating a plug in mmWave sensor with ESPHome and Home Assistant

Notifications You must be signed in to change notification settings

kmlucy/mmwave_sensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Overview

This repository contains everything needed to build a plug-in mmWave presence sensor that works with ESPHome and Home Assistant. It plugs directly into an outlet and is position adjustable. The mmWave sensor itself is the popular model from DFRobot. The ESP32 that powers it is programmed and managed from ESPHome, and the sensor works with Home Assistant.

PXL_20220926_134027611

Parts

  • The mmWave sensor itself: DFRobot SEN0395
  • The ESP32: I used this one, but any ESP32 D1 Mini should work. Just check the pinout and size to make sure it is the same.
  • This exact USB charger. The entire project has been designed to fit this charger, so subbing in a different model would require substantial redesign.
  • A short micro USB to USB A cable, the shorter the better. I used this one.
  • The housing itself is fully 3D printed. The STLs and STEP files are available in this repository, and also on Thingiverse. You will need 1X of each part.
  • 3X M3-0.5 x 8mm flat head countersunk screws
  • 2X ~5" pieces of wire to connect the plug to the charger board. I used 20awg, but anything around 18-24awg should be fine.
  • 1X fuse. I used this one, but as long as it is small enough to fit and blows below what your wire is rated for, it is good. (not shown in photo)

PXL_20220926_114124538

3D Printing

  1. Print 1X of each file.

PXL_20220926_113806827

  1. I printed them in PLA with .100mm layer height, 20% infill, and 3 walls. Ultimately, material and print settings don't matter. Choose a color and material you like and have, and print them as fine or coarse as you want. Most, but not all, parts need supports. F_001480 and F_001486 can be printed without. For the others, I would recommend setting your support angle to be ~70° to avoid supports on the exterior corners, around the ball, or in the holes.
  2. After printing, remove supports and tap the two holes in F_001480 and one hole in F_001485 M3-0.5.

USB Charger Modifications

  1. Before opening up the charger, you should understand the risks. You are working with line voltage which carries certain dangers, both to yourself, as well as the chance of fire. If you aren't comfortable with that, there are plenty of other versions of this sensor that leave the micro USB port on the ESP32 exposed. That would allow you to use an unmodified USB charger to power it.
  2. You will need two parts from the USB charger: the plug and the circuit board.

PXL_20220926_114234905

  1. Carefully cut open the housing along the line where the gray and white plastics meet. I used a vertical bandsaw, but a rotary tool or even a hacksaw would probably be better choices. You want to just barely cut through the plastic without cutting into the circuit board.

PXL_20220926_114312025

  1. Remove the front of the housing and discard. Set the circuit board aside.
  2. Drill and countersink the center of the plug end of the housing to fit your M3 screws:

PXL_20220926_114320623

Solder mmWave Sensor to ESP32

  1. Position the mmWave sensor on the ESP32 with the pins included with the sensor. The mmWave sensor should be on the back of the ESP32 and face out. The pins should match up as follows (sensor - ESP32): TX - IO22, RX - IO21, IO1 - IO17, IO2 - IO16, G - GND, V - VCC.

PXL_20220926_114438615

  1. Carefully solder each pin to the sensor and to the ESP32.

PXL_20220926_114413633

  1. Trim the excess length on the pins.

Program the ESP32

  1. Download the esphome_config.yaml file.
  2. Rename it to whatever your device will be named and place it in your ESPHome directory.
  3. Replace all of the bracketed options with whatever you want to use.
  4. Download the leapmmw_sensor.h file to your ESPHome directory.
  5. Plug in your ESP32 to your computer and use ESPHome to install the config. For more instructions, please see the ESPHome Docs.

Add to Home Assistant

  1. Go to your Integrations page in Home Assistant:

Open your Home Assistant instance and show your integrations.

  1. Your new device should be discovered and available to add to Home Assistant. Add it and make sure all the entities are working properly.
  2. Unplug your device from your computer to get ready to assemble.

Assemble the Sensor

  1. Snap together the ball and socket joint.

PXL_20220926_132025375

  1. Solder the two wire leads to the charger board.

PXL_20220926_132143790

  1. Route the wires through the housing lid and plug housing, splitting them around the divider in the housing.

PXL_20220926_132422276

  1. Solder the other end of the wire leads to the plug, including the fuse between one of the leads and the plug.

PXL_20220929_192026678

  1. Insert the plug into the plug housing and screw it into place.

PXL_20220926_133123354

  1. Plug the micro USB cable into the ESP32 and insert the sensor/ESP32 into the front housing with the sensor facing down.

PXL_20220926_131239129

  1. Add the first spacer.

PXL_20220926_131252137

  1. Plug the other end of the USB cable into the charger board. Twist it around twice and insert it into the housing.

PXL_20220926_133310967

  1. Add the second spacer.

PXL_20220926_133356221

  1. Route the power wires as shown.

PXL_20220926_133632226

  1. Install the housing lid and screw it into place.

PXL_20220926_133923070

  1. Plug it in and make sure everything is still working.
  2. Done!

Sources

https://github.com/hjmcnew/esphome-hs2xx3a-custom-component

https://community.home-assistant.io/t/mmwave-presence-detection-esphome-style/382778

https://www.youtube.com/watch?v=Viqvx7hMMJs

About

Instructions and files for creating a plug in mmWave sensor with ESPHome and Home Assistant

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published