Sunday, September 22, 2024

Adding Human Detection To Home Automation | Hackaday

Adding Human Detection To Home Automation | Hackaday

Adding Human Detection To Home Automation | Hackaday

Radar made a huge impact when it was first invented, allowing objects to be detected using radio waves which would normally be difficult or impossible to observe through other means. Radio waves of all frequencies can be used for radar as well, whether that’s detecting ships beyond the horizon, tracking aircraft near an airport, penetrating the ground, or imaging objects with a high resolution. At the millimeter wavelength it’s fairly easy to detect humans with the right hardware, and using some inexpensive radar modules [Tech Dregs] shows us how to add this capability a home automation system.

Since these modules aren’t trying to image humans with fine detail or detect them at long range, the hardware can be fairly inexpensive. [Tech Dregs] is using the LD2410B modules which have not only an on-board microcontroller but also have the radio antennas used for radar built right onto the PCB. They have a simple binary output which can communicate whether or not a human is detected, but there’s also UART for communicating more details about what the module senses in the room. [Tech Dregs] is using this mode to connect the modules to Home Assistant, where they will be used to help automate his home’s lighting.

The only significant problem he had setting these modules up was getting them built into an enclosure. The short wavelengths used in this type of radar module don’t penetrate solid objects very well at all, so after trying to hide one behind an e-ink screen he eventually settled on hollowing out a space in a bezel with very thin plastic between the module and the room. If you need more out of your radar modules than object detection, though, you can always try building a pulse compression radar which can provide much more accurate ranging of objects.

Post navigation

Another problem I’ve had with these is they work through walls and doors. Makes finding a position for them fun.

The article says it doesn’t even work through en enclosure. Now I’m imagining making the enclosure out of doors 🤔.

λ/4 is a bitch.

That’s what I thought too. I was surprised about the mounting “behind thin plastic”. I can understand it does not work when mounted behind an E-ink screen. Those things have a lot of electrically conductive wiring in them.

Electronics at (apparently) 24GHz does weird things.

And these cheap versions are probably doppler, so they only detect movement and lying still on the couch does not work.

Reliable occupancy sensors would be difficult. With mounting a VL53L3CX time of flight sensor near every door opening, and then sensing movement direction through doors will get you close, but not perfect. You can put crotch sensors in each possible seat location: https://hackaday.com/2022/12/12/students-rebel-against-heat-sensing-crotch-monitor-surveillance-devices/

As far back as the ’70-ies and ’80-ies ultrasonic sensors were used, and they were far more sensitive then the current gadgets, because they had more purpose fully built electronics in them, instead of just the minimum to get a signal out of the sensor. There are also (at least) two types of ultrasonic sensors. Time of flight (used for distance measurement) and doppler. The doppler versions can be very sensitive to movement. Inclusive moving leaves of plants in a breeze.

so they only detect movement and lying still on the couch does not work.

Actually they are exceptionally good at detecting stationary people, and have explicit threshold settings for it. It’s the entire value proposition these have over simple PIR sensors, along with being able to tune different thresholds for different ranges.

Oops, I stand corrected. My previous experience was with a sensor that was so cheap that it barely worked, and this one actually has a datasheet with 23 pages. That looks promising. I’ll probably buy a few to do some experiments with these. I like the way you can limit the detection distance so it’ won’t sense when the neighbors come or wakeup in the morning if you don’t want to know that.

The 256kBaud makes it a bit annoying to hang of a software uart of a spare uC pin, but there are ways around that, from disabling ISR’s during the configuration, to using an uC with 2 Uarts (I need one for my home network).

HLK-LD2410B Serial Communication Protocol.pdf Section 2.2.9 Page 12 / 19 says:

Bitrate values are 9k6, 19k2, 38k4 … 460k8 (8,N,1) The factory default value is 0x0007, which is 256000

@jan vd Werken: Yes, Hackaday already mentioned that the baudrate is adjustable. The missing link is:

2.2.9 Set serial port baud rate This command is used to set the baud rate of the serial port of the module. The configuration value will not be lost after power failure.

But what a mindbogglingly stupid decision to set the default so high for a gadget that just needs a handful of bytes anyway.

They make better ones that can detect zones. These things are almost useless without them. If you leave anything on or they detect any movement they go to detected. They can easily pass through solid material if the radio is strong enough. I think DFRobots new one can detect up to 25m, but it doesn’t support zones. I would stick to the one in the everything presence lite, which ships with an HLK by default but supports 5 different mmwave sensors.

The 60Mhz ones can read a person’s heart rate, only at 80% accuracy at the moment but still, can read it from maybe 6ft away. They Aqara FP2 is about the only one I would buy and that’s because you can use zigbee2mqtt in Home Assistant to mark up to 10 zones. You can have it ignore zones (like a ceiling fan) or do one thing when you’re in one are and a different thing when you’re on another area, can also detect multiple people and trigger automations based on how many are detected

I’ll stick to espresense, stick a 5 dollar ESP32 loaded with it flashed via their website in various rooms, setup MQTT, the BT devices you want to track and have auto actions based on those. Much more reliable IMO. The HA companion app even creates a sudo “BT” MAC or ID to use as disabling random BT MAC addresses is not good from a security standpoint. Really works great if you have a smartwatch because it’s always on you unlike your phone.

They make better ones that can detect zones.

Not sure what you mean by “zones”, since the LD2410B already splits things into 8 different ranges and provides separate configurable motion/stationary thresholds for each. Unless you’re confusing it with the analog RCWL-0516 someone was suggesting below?

Limiting the detection range in the module settings is the way round that. With a bit of experimentation, you can get them to ignore people walking past open doors. 😁

Commercial radar sensors for use in burglar alarms have been available for quite some time. They drove the techs at the company I did an intership crazy.. they kept getting alarms during the evening while there was nobody in the building..

Till i pointed at some thick gray pipes along the ceilings.. the sewer pipes for the owners home built on top.. the radar sensors triggered on the water and turds flowing through the pipes…

Which is one of the reasons for Dual Tech sensors, they combine PIR and Radar and only trip when both are triggered by a warm moving body

That should help keep the humanoid robots out -especially the sneaky ones who lie to the “I’m not a robot” checkbox

If the point of these is that they’re better than PIR at detecting stationary people, what’s the point to requiring both to trigger?

PIRs are already good at not producing false positives.

Pir is good for triggering when you walk into the room, but will lose track of you if you are stationary. These are slower to lock into a signal, but can keep track of you while you’re still. The dual sensors generally trigger from pir and maintain with radar.

My home automation is reduced to the bare minimum. When I enter the room, I announce my presence by gently hitting the switch next to the door, which also turns the lights ON immediately. When I leave the room, I hit the same button again and the light is switched OFF instantly. This system does not consume any energy when the light isn’t ON, it does not require updates, it cannot crash or be remotely shut-down by some hacker or an external party that decides to stop all support and shut down their “home automation” servers. This technology is called a “switch” it may seem silly to some today, but it was high-tech some 100 years ago. I’m glad I never updated it since it still works. My grandparents used it and the preferred it over candles and oil lamps, they were over the moon when it was installed, such convenience, life just doesn’t get any better.

Some may find this concept of “a switch” silly, but what I find silly about this video was that a “home automation” system was installed which somehow automatically switches on the lights at six but the user then complains about the fact that the lights are on when nobody is there and that the light wakes him… because the door is open… then blaming the dog for not being able to open the door (so the doors can’t be closed), so a solution must be created to detect humans so that the lights can be out when there aren’t any. Couldn’t he have the lights turned on at a later moment… but that may be too easy, so maybe a schedule of some kind or how about linking the lights to his alarm clock. It all seems so complicated for such a simple problem turning on the lights. Wasn’t the idea behind automation, to make things easier?

PS: I love this sensor, seems fun to play with for all other sorts of projects.

The mildly entertaining smugness aside, automating something is always a tradeoff between making it simpler to use but of course at the cost of being more complex to build (and possibly maintain). Like a washing machine over a washboard. The latter is less complex but a pain to use (literally, after a while). Most people would probably opt for the machine. But I mean, yes you are free to do it the old fashioned way.

In the end, all we strictly “need” is a cave and a fire. Yet I still love my (automated) home.

The Korean apartments have a master switch on the front door. It turns off all lights and shut off the gas line.

Americans have that too, it’s in the breaker box

200-300a switch cuts power to everything on circuit

Yes, you nailed it with the switch idea—it works perfectly for me. But there’s this quirky feature: it always triggers on when my wife or kids enter the room, any time of day or night. The odd complication? It seems to never trigger off when they leave. I guess I’m in the market for a smart switch-turner-offer!”

Blah, blah, someone always has to be a jerk about “new fangled inventions” right?

Let me guess.. you live alone. I’d be fine with just a switch if I lived alone. Getting other people to do things though… so hard!

It took years to get the family to turn the fan on reliably. All that steam… lot’s of extra bathroom repainting for no good reason. Now getting them to turn it off as reliably… yah right! We are constantly blowing our air-conditioned air out the vent during the summer and heated air out during the winter. I’ve mentioned it a few times but if I start really trying to get them to turn their shit off… they will probably stop turning it on again.

That’s how real world people are. Live with family, roomates, etc… and you will start to get the value of automation.

I want to add air humidity/quality sensors to the bathrooms and automate the fans. Automating the lights… not so important but kind of seems like if you are doing one the other is just a natural right?

No need to complain, your bathroom problems were already fixed in the past century. There are PIR switches and mechanical timers that fit into standard wall switch boxes. Your local electric supply stores have so many of these parts that they are forced to sell them.

“Let me guess.. you live alone.” wrong, guess again…

I put an esp in the cheapo IKEA air quality sensor and it talks to the kitchen fan through espnow. It works so well that I made one for my dad who doesn’t bother with TV or Internet. He likes it so much he asked what else I can automate. Since he lives alone, there’s really not much that needs it.

we haff located the Luddite

There is a type C version like this LD2410C which has bluetooth application

These are extremely interesting modules at a reasonable price. Very little documentation https://hlktech.net/index.php?id=product&cate=SensorModule

Glad you mention them! I got them a few months ago with the intention of integrating into my HA system but have yet to give it a try.

The ‘B’ version also has bluetooth, that’s literally what the ‘B’ is for. The ‘C’ version appears to just be a different formfactor.

How about we simply use the Wi-Fi channel to detect human movement. I read about some papers regarding this issue and they can even build 3D models solely based on that.

So why does the PCB say WiGig on it, are these repurposed data transmission modules? Can you send data between a pair of them?

It’s sort of a pain to find function 802.11ad hardware that’ll work on both ends of the link, especially in a small package, so I’m really intrigued to see that mark on the board…

How hackable are these chips? would it be possible to beamform using a bunch of them in an array???

I’ve used these things and they are very good for the price point. As long as you can mount them away from conductive objects, I’ve found they reliably detect around 3-4m in front with about 120deg FOV and around 1.5m behind.

I put them in old plastic containers and use them in gelsoft games as simple motion detector alarms. Shove them in a tree trunk, in a pallet or partially bury them in the sand.

I use espresense which uses Bluetooth. Place a 5 dollar ESP32 flashed with it in each room and have it track your phone to trigger automations. I also use it for dynamic dashboards. My HA companion app auto switches dashboards depending on the room I’m in. But still, it’s tracking my phone, not me.

These are super accurate though. Some have zones, others can detect up to 25 meters. The 60Mhz ones can detect a person’s heart rate from about 6ft away at most. Not 100 percent accurate (yet). Wi-Fi can’t detect super small movements like human breathing of you are sayi, laying on the couch watching TV. You can’t fake these things out no matter how still you are.

HA companion app also supports doing this in reverse, where you don’t need MQQT or anything flashed on your esp32. You just need a Bluetooth device that is always on in a zone. Sure, a beacon works, but I’ve found that so does any other Bluetooth device.

Why use this particular module instead of the MUCH cheaper RCWL-0516 ones which have very similar specs?

For the whole 2 dollars you save the RCWL-0516 loses the bluetooth configuration, the multi-zone thresholding and the discrimination between moving and stationary people. I can’t say they’re all that comparable.

The price differential is MUCH greater on Amazon: $10 each vs $10 for 8. As far as specs are concerned, I was just going by operating frequency and range. I didn’t see the features you mention included in the article here although the UART comm was.

Leave a ReplyCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

By using our website and services, you expressly agree to the placement of our performance, functionality and advertising cookies. Learn more

No comments:

Post a Comment