Detecting humans is one of the biggest challenge
in Home Automation. Most of us use PIR sensors for that purpose. Unfortunately, they do not detect presence
without movement and switch off. Who wants that the TV switches off when you
quietly watch a video? Recently, new radar sensors appeared that
solve this problem. But they have a slow reaction when you enter
the room. Some YouTubers suggest combining such a sensor
with a PIR. An expensive workaround. Maybe I found a better sensor for you? Let’s check! Grüezi YouTubers. Here is the guy with the Swiss accent. With a new episode and fresh ideas around
sensors and microcontrollers. Remember: If you subscribe, you will always
sit in the first row. First: I want to thank all my supporters on
Patreon, the guys using “Super Thanks”, and the viewers using my links in the video
description. You are awesome! You make it possible that nobody needs to
watch an advertisement for a PCB manufacturer. And you are not interrupted by midroll ads. PIR sensors measure the IR emission of warm
bodies. As soon as they see movement, they switch
the light on. But we all know: If we sit quietly in front
of the PC or the TV, the PIR sensor switches off, and we have to wave with our arms to
switch it on again. A good laugh for our wives about our newest
“invention.” Recently I saw this new sensor: The LD2410
from Hi-Link. It is a 24GHz FMCW Radar. FMCW Radar? Yes, a
Frequency Modulated Continuous Wave radar. Standard radars rely on the doppler effect. They transmit a continuous signal that is
reflected by conducting materials like metal or water. A moving object shifts the received frequency,
as we know from police cars. It is higher when the car approaches and lower
when it moves away from us. The frequency shift is proportional to the
speed. So, no speed, no signal. The last time we saw such a device was in
video #181, where we tried to create a cheap speed meter for cars or bicycles. These sensors are perfect for detecting a
human entering a room because they switch in a fraction of a second. Unfortunately, they cannot measure distance
other than guessing from the signal strength of the reflected signal. This is unreliable, particularly if persons
with different weights have to be detected. As always on this channel, we want more. We want to measure distance with a radar. To do that, we have to use a trick: Extend
the “CW” with a “Frequency Modulated” part to the FMCW radar. How does it work? Let’s assume the transmitter changes the
frequency with a saw-tooth curve. Because the reflected signal is delayed, the
two frequencies are slightly different. Measuring frequency differences is easy and
is also known from doppler radars. As you see, the measured frequency shift is
now proportional to the distance. Of course, the doppler effect still influences
the result. So this method is only accurate for slow-moving
objects. Our sensor works on 24GHz. This has two advantages: First, this band
is legal and does not interfere with your 2.4GHz Wi-Fi as these cheap sensors from video
#135 did. And second, we can build sensitive radars
because sensitivity to small movements increases with frequency. Unfortunately, I have no instrument to measure
frequencies of 24GHz. But of course, we have one or two aces in
our sleeves to find out if they really work on 24GHz. The first is Google. And really, I found the manufacturer of the
chip, a block diagram, and a reference design that is very similar to this one. The block diagram confirms that it is an FMCW
radar with a saw-tooth modulation. Its output power is 12dBm or 15mW. Not very strong. Hi-Link writes, “Compliant with typical
certification standards.” So let’s check if they have an FCC certification. FCCID.io helps find it out. Unfortunately, I did not find it in their
database. So most probably, it has no certification. But I found another 24GHz device from the
manufacturer of the IC. So they seem to be able to pass an FCC certification
at 24GHz, and maybe it is just a matter of time until this sensor is certified. You often find interesting information about
all kinds of wireless devices in this database, BTW. And we see that the FCC guys play with expensive
instruments. They measured frequencies up to 100GHz… Looking at the block diagram, we see that
this tiny chip has digital outputs for a microprocessor. Similar to an SDR receiver. A closer look reveals an MPU on the other
side of the PCB. Here I had no luck. Google was no help, and I do not know the
type of the MPU. So let's continue with playing Sherlock Holmes. I still do not have an English datasheet. Fortunately, I found some trashy videos on
youtube showing a tool to monitor the output. And after some searching, I had the English
manual, the English description of the interface, and an English version of the tool. Chrome did not like the zip file of the tool
at all. I only was able to download it using Edge. And then, Windows did not like it. But I do everything needed for my viewers,
and here it is. I ordered an interface PCB with the sensor. This was a good idea because it not only has
a USB to serial chip, but it also has the proper connector for the sensor: Tiny 1.27mm
pin headers. Now we have it all on my table, and we can
start testing. This sensor is astonishing. It can be programmed with the tool, and the
chip keeps these parameters during power down. If properly programmed, you only need to monitor
one output pin. If high, either motion or presence is detected. Otherwise, the pin is low. Easy. But how can we program the sensor? The tool has two modes. If you select the correct COM port, tick “engineering
mode,” and hit “start,” it shows the output in two diagrams. On the left, “moving,” and on the right,
“motionless target.” From left to right, you see eight distance
sectors. Each measures 0.75m. The green curves show the selected sensitivity. As soon as the measurement is above one of
the green curves, the big button becomes purple or red, and the sensor switches its output
pin to high. Obviously, the measurement cannot pass the
green line if it is at 100. So, 100 means the sensor does not react in
this bucket. With those two values, you can restrict the
range of your sensor. Which somehow is similar to setting the green
curve to 100 for those buckets. It took me a while till I found out how it
works. But now it is pretty handy. I do the testing in our living room because
my lab is too small. If I move, the motion part immediately shows
movement. The “motionless” is calm. If I stop, the movement part goes away, and
the motionless part increases. The distance reading sometimes shows numbers,
and sometimes not. It is not very reliable. The curves really move through the buckets
when I increase the distance from the sensor. Cool. The radar can measure distance as promised. Let’s test the sensor in the sitting area. I placed the LD2410 on the table in front
of our sofa without me watching TV. Here is the reading. Now I place myself in my typical TV-watching
position. Here is the result: No movement but presence
detected. With these readings, it is easy to fit the
green curve so that the sensor can distinguish the two events. How is this done? After stopping the measurement, we enter the
thresholds or sensitivities per bucket. The green curves show the entries, and after
storing the values, we can remove the sensor from the programming environment and connect
it wherever we want. An ESP-01 would be sufficient because we only
need one input pin. And the right mounting place probably would
be on the ceiling. As a first application, I will use it in my
lab to replace my PIR sensor. For good reasons, I want to be very sure before
I use it in the living room! Unfortunately, the firmware on the sensor
shows some strange behavior. First: If you select 100 to switch off the
motion sensor, the motionless part does not work anymore. Second: For longer distances, the output pin
does not trigger when the motionless indicator clearly surpasses the green line. Not what I expected. Maybe it is possible to change the firmware
in the future to correct these flaws. The readings from the sensor seem to be ok. So, if you write your software, you can modify
the trigger processes based on the measured values. I even found a project for an ESPhome sensor
that does that. With this project, you do not need the upfront
programming. Currently, the project still is a “work
in progress.” Another difference to most PIR sensors is
the high power consumption. This sensor has to be powered by mains, not
batteries. What is my verdict? - This is the best radar sensor for home automation
I have seen so far because it combines motion and motionless sensing
- The visualization and programming tool is handy
- The current firmware does not correctly trigger for longer distances in motionless
mode - It is extremely easy to deploy if you can
live with the current firmware. Once programmed, you only have to connect
one pin, and hardly any programming is needed for the ESP. An ESP-01 with a simple MQTT library example
will do the job - The tiny pin header is described as difficult
to solder. I had a few 1.27mm pin headers in stock. After cutting a small piece with five pins,
I soldered the three needed wires to the female pin header. Now I can check a single module without problems. You can add two more wires to connect the
sensor to a USB to Serial converter. Like that, you could save the adapter. RX and TX will also be needed for the ESPhome
sensor. - Its price is outstanding if we compare it
with other FMCW radar sensors - You also get other 24GHz sensors. I assume they use similar chips but are more
expensive. Maybe you used one of those? One last thing: If you do not want to build
your own sensor, you can buy this one from Tuya. It has the same module inside. Just the price is different. Because of the outstanding price performance,
I assume many more sensors with this module will come to the market soon. This was all for today. As always, you find all the relevant links
in the description. I hope this video was useful or at least interesting
for you. If true, please consider supporting the channel
to secure its future existence. Thank you! Bye