Millimeter Wave Presence Sensors With ESP32
by taste_the_code in Circuits > Electronics
1295 Views, 2 Favorites, 0 Comments
Millimeter Wave Presence Sensors With ESP32
Hello everyone! Today, I'll show you how to use millimeter wave sensors, focusing on the LD2410 version C. This sensor is fascinating because it expands our capabilities in detecting human presence far beyond what traditional passive infrared sensors offer.
Unlike the simpler motion detection sensors that need the object to move to detect its presence, millimeter wave sensors can also detect stationary subjects. This means that whether a person is moving, sitting still, or even sleeping, the sensor can still recognize their presence. Its ability to detect stationary people makes it incredibly useful for a variety of applications, from automated lighting systems to security enhancements.
In this guide, I’ll walk you through the setup process, explain how to program and connect everything using an ESP32 and show you how to interpret and use the data from the sensor to control devices, such as an LED.
Supplies
Tools and materials used in the video:
- LD2410C Sensor with USB to Serial - https://s.click.aliexpress.com/e/_oDpX96x
- LD2410B Sensor - https://s.click.aliexpress.com/e/_opkuXjl
- ESP32 Development Board - https://s.click.aliexpress.com/e/_EIM9OFp
- FireBeetle ESP32 C6 Development Board - https://s.click.aliexpress.com/e/_EJokoYx
- USB to Serial Adapter - https://s.click.aliexpress.com/e/_EysNThZ
- LED Kit - https://s.click.aliexpress.com/e/_oDtOIVV
- Soldering Station - https://s.click.aliexpress.com/e/_mMjBYxA
- Dupont Wires - https://s.click.aliexpress.com/e/_EvZxhb5
- Multimeter - https://s.click.aliexpress.com/e/_ExqHGIn
Setting Up the Sensor
Getting our millimeter wave sensor operational is the first practical step in this project. We're working with the LD2410C sensor. The sensor features a convenient square form factor and offers several connection pins, including TX and RX for serial communication, VCC and ground for power, and a digital output pin for direct digital signals.
Before we connect the sensor to an ESP32, we will connect it directly to a computer so we can better understand the data that we are working with.
We begin by connecting the VCC and ground pins of the LD2410 sensor to a USB to Serial adapter. It is important to use an adapter that works with 5V as the sensor requires it for operation.
Next, connect the TX (Transmit) and RX (Receive) pins to your USB to serial adapter. Make sure to cross the pin connections from the sensor to the adapter so RX from the sensor connects to TX on the adapter and vice versa.
We can now plug the sensor to a computer and move to the next step to use some of the available tools to get the data and present it visually on screen.
Sensor Configuration and Data Visualization
Multiple tools allow you to visualize the data coming out from the sensor and two of the most popular ones are the LD2410 tool which comes from the sensor manufacturer and the LD2410 Web Configurator.
Open any of the tools, make sure the correct baud rate (usually set to 256,000) and COM port are selected as you configured earlier, and click "Start" to begin receiving data. The tool will show a graphical display of the sensor’s detections, with various zones representing different sensitivity ranges around the sensor. If you face connection issues, check that no other applications, like Arduino IDE, are using the same port.
The tool displays the eight zones of the sensor, and each one can be adjusted for sensitivity. As you move closer or farther from the sensor, you’ll see real-time changes in the zone activations. You can adjust the sensitivity settings for each zone to match your specific needs, whether that means increasing sensitivity for distant areas or decreasing it for areas close to the sensor. This tuning is important for optimizing your sensor, whether you're detecting motion in a room or monitoring an outdoor area for security.
You can also customize the sensitivity of each zone by double-clicking on the settings in the tool and adjusting the 'moving sensibility' and 'stationary sensibility'. This allows you to tailor the sensor's response to different environments and project requirements.
Connecting the ESP32 Board to the Sensor
After setting up the sensor and visualizing its data, the next step is to connect the LD2410 sensor to an ESP32 microcontroller. This connection allows us to make interactive projects and control other devices using the sensor data.
To start, you need to set up the wiring. For serial communication, connect the TX and RX pins from the LD2410 sensor to Pins 16 and 17 on the ESP32, respectively. TX from the sensor should go to RX (pin 16) on the ESP32, and RX from the sensor should go to TX (pin 17) on the ESP32. Next, to power the sensor, connect its VCC and ground pins to the ESP32. You can attach the VCC to the VIN (5V output) pin on the ESP32 and the ground pin to one of the ground pins on the ESP32.
The LED that we will control based on movement is connected from the anode to pin 15 with a 100 Ohm resistor in series to limit the current. The cathode is connected to GND.
Next, you need to program the ESP32. To communicate with the sensor, we will be using the MyLD2410 library so make sure that you install it. As a base for our sketch, we will use the 'sensor_data.ino' example sketch and just add the LED turning on/off based on movement. The full code is available on my website.
Upload the code to the ESP32 and open the serial monitor to see if data from the sensor is being received correctly. You should see output reflecting the presence and movement data as you configured it. If the data looks correct, it means your ESP32 is successfully communicating with the sensor.
Understanding Outputs and Controls
In the Arduino, we still get the same data as we did when we directly connected the sensor to a computer so we can choose to make different actions based on them. In the example, the LED is turned on any time movement is detected, no matter if it is stationary or not but we can modify this to be turned on only when a person is detected moving.
Additionally, we can choose to only react based on the detection signal in a certain gate which equals reacting to movement only at a certain distance.
Then, based on other conditions, we can also adjust the gains for each zone on the fly so we can cover a ton of different scenarios.
Next Steps
In this Instructable, we examined the LD2410 millimeter wave sensor and its benefits over traditional motion sensors. We installed and configured the sensor to communicate with the ESP32 board.
Looking ahead, think about integrating more advanced algorithms and detection scenarios. You could expand your system by adding more sensors or connecting it to a larger network of IoT devices.
Thanks for following this project guide. I hope it encourages you to innovate and explore new technologies. If you found this guide useful, please like and share. For more content on electronics and sensor technologies, consider subscribing. Your feedback helps improve future tutorials, so don't hesitate to leave comments or questions. Happy tinkering, and see you in the next project!