return to table of content

Inside a $1 radar motion sensor

transpute
36 replies
15h11m

Through-wall 2.4Ghz Wi-Fi CSI radar can be done with $20 ESP32 boards, https://github.com/Marsrocky/Awesome-WiFi-CSI-Sensing & https://www.cnx-software.com/2022/08/08/esp-wifi-csi-detects...

> Espressif claims it can also capture subtle movements caused by small movements such as breathing and chewing of people or animals in a static environment.. works with all ESP32 series microcontrollers including ESP32, ESP32-S2, and ESP32-C3, and does not require any changes to the hardware

2024 AI/NPU laptops with Wi-Fi 7 from Intel and Qualcomm can combine RF radar and on-device inference to identify human activity.

Related:

DIY Radio Telescope: Building a Camera That Can See WiFi (2019) https://www.youtube.com/watch?v=g3LT_b6K0Mc

Wi-Fi devices set to become object sensors by 2024 via IEEE 802.11bf standard (2021), https://news.ycombinator.com/item?id=40458766

How automotive radar measures the velocity of objects (2024) https://news.ycombinator.com/item?id=40768959

How Wi-Fi sensing of movement became usable (2024) https://www.technologyreview.com/2024/02/27/1088154/wifi-sen...

throwup238
14 replies
14h32m

> chewing of people or animals

The ESP32 can detect the difference between a cannibal and a vegan?

That's impressive.

lopis
13 replies
13h2m

How can you tell someone is a vegan? Don't worry, this 1$ radar motion sensor can tell you.

silisili
11 replies
12h47m

I think you could go cheaper. A sound detection sensor is a bit cheaper, and it just needs to detect the word 'vegan.'

tstrimple
10 replies
11h30m

Strangely enough I've heard far more people make this "joke" than actual vegans speaking up. Even when living in LA.

stavros
6 replies
9h19m

The issue with this joke is that it's 100% confirmation bias. You know that all the vegans tell you they're vegan because you don't know about the ones that didn't.

LoganDark
4 replies
7h50m

I think it's also survivorship bias. All the people who tell you they're vegan being vegan does not mean that all the people who are vegan will tell you they're vegan, just like all the people who won the lottery probably having bought lots of tickets does not mean that buying lots of tickets will win you the lottery.

stavros
3 replies
7h32m

That's what I meant, maybe I used the wrong bias name.

TeMPOraL
1 replies
5h26m

I know this under "selection bias", so now we have three contenders.

Still, I'm not sure if it's a big factor. You likely know who is vegan in your circles, because veganism is unusual enough to be a good topic for gossip, you can easily see it when sharing a meal with someone, and it's also something you'd like to know when inviting people over, if you want to be a good host. So I think a more relevant estimate would be number of vegans you know vs. how many of them announce their veganism at the earliest opportunity.

LoganDark
0 replies
3h41m

I believe survivorship bias is a specific type of selection bias.

LoganDark
0 replies
5h1m

Confirmation bias typically refers to accepting very little evidence or rejecting disproofs. Survivorship bias is the one where you forget to account for the non-survivors of a particular selection criteria.

marcosdumay
0 replies
3h8m

There are people that I discovered were vegans when discussing what to eat. And there are people that loudly announced they'd become vegans without any context.

The later group used to be larger, but I don't remember anybody doing that recently.

nothacking_
0 replies
2h41m

That's the trick, you invert the logic. If you hear the word vegan, assume the person saying it is not.

01100011
0 replies
2h30m

It made more sense 20 years ago when it was more generally true. Veganism seems to have spread beyond the merely self-righteous now. It's a very old joke (possibly from the 90?s).

the_third_wave
0 replies
7h48m

Come on, that's simple, just use voice recognition since the vegan won't stop telling the sensor about it.

t0mas88
12 replies
10h58m

Wifi sensing is interesting, but you can combine a $3 ESP chip with one of these for a much easier project at lower cost: https://www.dfrobot.com/product-2795.html

I use those for presence detection in my house. 3D print a small case and for < $20 you have highly accurate presence detection that also works when sitting still. Ideal for automatic light and climate control.

stavros
11 replies
9h20m

My problem with similar sensors is that they don't work very well if you're sitting still around 3m away. Maybe my sensor isn't great, but when I'm sitting still at the computer, it frequently thinks I'm not there any more, which ruins any benefit.

victorbjorklund
5 replies
5h54m

A hack is to put a sensor on the chair

stavros
2 replies
5h48m

Hmmmmm that's not a bad idea, I'll have to see how to do that, though. I don't want cables restricting me.

stavros
0 replies
2h27m

Zigbee is great, but my chair has a mesh :/ I'll see if I can print something below, so that the sensor is activated, but yes, it does seem that it would be pretty finicky...

mytailorisrich
1 replies
5h47m

I solved the issue by linking my lights to a switch that I turn on when needed. It has worked very well so far, with no false detection at all!

banku_brougham
0 replies
5h23m

plz let us know how it goes after sufficient testi g

squarefoot
2 replies
7h34m

Pairing them with PIR detection should help to also detect stationary warm objects.

stavros
0 replies
7h33m

I did pair them, unfortunately PIR sensors are even worse at detecting stationary objects (less sensitive to body micromovements).

Avamander
0 replies
7h16m

It's difficult to find good PIR sensors though. The commonly found cheap modules don't include a thermistor to compensate for room temperature. Finding one with analog output or continuous detection is even more difficult, most detect changes.

Avamander
1 replies
7h15m

There are some that detect heartbeat, I guess those might work. But those are mmWave, not just cheap 2.4GHz radars or PIR.

stavros
0 replies
7h6m

I've got LD2410B, which are mmWave, so they should detect heartbeat (and do), but not from more than 2-3m away.

037
2 replies
9h44m

The “Vital Sign Detection & Healthcare”[1] section is very interesting, thank you! I am looking for a way to measure the heartbeat of a single person in a completely non-invasive manner (so without contact) and I see that it can be done with Wi-Fi (2019 Paper [2]). However, I’ve noticed that there are a lot of methods (video analysis, thermal camera, etc.), but they are hard to find as ready-made products at a reasonable price. The simplest solution is under-mattress sleep trackers, but unfortunately they are not an option for me.

1. https://github.com/Marsrocky/Awesome-WiFi-CSI-Sensing#vital-...

2. https://arxiv.org/abs/1908.05108

amelius
1 replies
8h20m

Interesting. I'd be interested in a breathing sensor that can work on someone working at a computer.

037
0 replies
8h8m

I’m sure it can be done with a normal camera and enough light, especially with the advancement of AI technologies in recent years. I haven’t had time to experiment, but if you have an iPhone, you can try this app [1] I installed yesterday to study its feasibility.

On the homepage, there is a video [2] explaining more as well, and their paper [3].

1. https://www.rouast.com/vitallens/

2. https://www.youtube.com/watch?v=_0HHjovI8hc

3. https://arxiv.org/pdf/2312.06892

amelius
1 replies
8h46m

These $1 boards also work through walls (I tried this).

withinboredom
0 replies
7h53m

I always go through walls.

— kool aid man

utensil4778
0 replies
3h22m

The gesture recognition sounds incredibly interesting. I work with vision based band tracking, and performance really isn't good enough for my application.

I wonder what kind of resolution you can reasonably achieve? Is it good enough to detect finger pose?

Aside: is there a way around IEEE paywall? I'd really love to read some of these papers

slicktux
0 replies
12h0m

Great links! I recall seeing somewhere that AMEX was investing in WiFi object detection…can’t remember exactly for what or how…

roger_
0 replies
5h30m

You can also use a single ESP and your WiFi AP as a source of packets.

037
13 replies
11h32m

A little tangential, but are these things safe for humans? I have a couple of LD2410 devices and I’d like to use one of them with ESPHome in the bedroom. I did some research and they seem to be very low power and safe, but you know, before sleeping with a radar pointing at us all night long, I’m looking for as much feedback as possible.

perlgeek
6 replies
5h43m

Non-ionizing radio waves are generally safe for humans.

The only mechanism besides ionization that could harm humans is through the transfer of lots of power into the human body (think soldiers keeping themselves warm by stepping in front of a radar emitter).

So let's try to do a ballpark estimate of how much that could matter.

I haven't found (from a quick search) any data regarding the transmission power, but the data sheet at https://fcc.report/FCC-ID/2AD56HLK-LD2410B-P/6620025.pdf says the average current consumption is 79mA at 5V, which means it uses 0.4W.

How much of that is actually transmitted? I'd guess 10%-50% (likely much less, but let's go with this more conservative estimate, from a safety perspective), so now we're in the range of 40mW to 200mW.

If you absorb 1/4th of that (again, somewhat conservative estimate; you'll likely also reflect some, and most of it is going to pass you), we're at 10mW to 50mW extra power that is absorbed by your tissue.

Again, this is a super high (and thus for our purpose, conservative) estimate. Somebody else in this thread mentioned microwatts being absorbed, which sounds much more plausible.

To put this into context, the base level of power that an adult human operates on at rest is about 100W. This is a factor of 500 to 2500 more than the power absorbed from our millimeter wave radar. Unless all the absorption happens by a very specific and sensitive part of the body (like your eyes or so), this should just be background noise.

If you want another perspective, you could try to compare it with whatever radiation (both RF and heat) that your phone emits, that you likely carry in your pocket for hours at a time.

lpcvoid
4 replies
5h37m

soldiers keeping themselves warm by stepping in front of a radar emitter

Holy, did people actually do this? A quick search yielded no results. Not sure if thankful or not.

moffkalast
2 replies
4h54m

Weren't microwave ovens invented because someone's chocolate melted in their pocket while operating a radio transmitter? Maybe it's just a lady godiva story since it seems weird that the person wouldn't feel overly hot as well, but maybe.

marcosdumay
1 replies
3h0m

It's a well known story, he was doing maintenance:

https://en.wikipedia.org/wiki/Microwave_oven#Discovery

The thing is, you don't need a lot of extra heat to melt a chocolate bar on your pocket. It's perfectly possible that everybody felt hot when working on an active radar, but didn't discuss it or maybe even notice the correlation.

moffkalast
0 replies
1h13m

Oh wow it's even known what brand of a bar it was, funny that.

The first food deliberately cooked with Spencer's microwave oven was popcorn, and the second was an egg, which exploded in the face of one of the experimenters.

They were having a blast I see.

wyager
0 replies
3h7m

The only mechanism besides ionization that could harm humans [is heat]

This claim is, IMO, too strong given available evidence.

There are many chemical interactions with characteristic energies well below 1eV, or any reasonable threshold for "ionizing". Photons can couple with these interactions without ionizing anything. 4GHz range is probably fine, because the per photon energy is a small fraction of a mEv, but even then I would not rule out the possibility of multiple photons coupling to a structure without the imparted energy immediately being dispersed as heat.

Any time you have EM with low entropy/etendue, it is always theoretically possible for interactions to occur outside of the thermal regime.

t0mas88
4 replies
10h52m

I have these all around the house, but not in the bedrooms. I use weight sensors to detect that someone is in bed and traditional PIR for motion in bedrooms.

Probably overly careful, but I didn't want to point a radar at my sleeping kids (and myself) for 12 hours per day. Similar for the WiFi access point upstairs, it's only in the hallway and not at maximum power.

Avamander
2 replies
7h8m

Probably overly careful, but I didn't want to point a radar at my sleeping kids (and myself) for 12 hours per day.

While I understand the sentiment. It's very very unlikely to be dangerous and there are plenty of other environmental dangers.

The biggest being the sun. But the most common man-made ones are probably auditory. Like toys and TVs being too loud or high-frequency sounds blasted from speakers in malls or under bridges to avoid "loitering."

moffkalast
0 replies
4h50m

Yeah on one hand you have people afraid of wifi and simultaneously sending their kids to play all day outside in UV index 11 without a hat or sunscreen. Things that are "natural" being inherently safe and anything technological literally death itself.

davidwritesbugs
0 replies
6h45m

Loud toys are definitely dangerous for my children, they make me angry.

037
0 replies
10h8m

I agree with you, especially regarding children and anyone who hasn’t explicitly made this choice, which is why I asked the question. The only thing is, I suspect we get scared by certain words, like “radar” and “microwaves”, and then we might spend all day with our heads next to a Wi-Fi router or a phone constantly downloading files on 4G.

For example: maybe the ESP32 transmitting the bed weight exposes us to more danger than the radar sensor (that can also be placed very far from the bed)? Maybe with our smartphones charging on the nightstand too.

I’m not a big fan of fear-based, illogical decisions. But, again, I understand perfectly.

05
0 replies
11h25m

Some phones have a SAR of almost 2W/kg, compared to that milliwatts of 10GHz RF are nothing. Not to mention that with standard energy dissipation formula of E~R^(-2) you're getting into microwatts at any practical distance from the antenna.

mrcsharp
6 replies
13h15m

The LD2410 (B) is another option and it operates over UART. It is a bit more expensive ~$5 but has more configuration options.

stavros
5 replies
9h15m

Get the B variant, you can configure it over Bluetooth from your phone. Otherwise it's a huge hassle.

That said, it doesn't work very well for me when sitting still 4-5m away, it thinks I've left.

amelius
4 replies
8h18m

These radars are designed to detect motion, not someone sitting still.

mianos
3 replies
8h4m

Wrong, most of these radars are 24Ghz and specifically designed to detect body micro movements. They specifically give both human 'occupancy' and dynamic ranging information.

I wrote low level drivers for the ESP32 for all the ones I could buy and have tested all of them. The only one that does not try to give a human occupancy position is the car speed sensor.

The ld2450 can track three people at once.

https://github.com/mianos/hk-heltec-radar/tree/main/src

stavros
2 replies
7h33m

This sounds very interesting, how do your drivers work? I'd love to try them out, but there's no documentation. I've made a sensor board with various sensors, I could really use some occupancy detection improvements on the LD2450B.

mianos
1 replies
5h8m

All the boards provided by HiLink have an on board MCU and offer a serial protocol of some sort. I wrote a finite state machine based decoder for each them from the basic info on some documents,random example code and the textual description of the protocol from the aliexpress page. They are all wrapped in an outer state machine that provides entry and exit triggers. If you can read C++ the code is nothing fancy.

I have another more complete project for just the 2450 in another repo for the esp-idf with wifi provisioning and publishes presence to mqtt. I have 3 of these around the house.

stavros
0 replies
4h27m

That's great, I'll have a look, thank you!

farceSpherule
5 replies
1h59m

You cannot try to rationalize the prices that China charges for goods. Everything is, more or less, state-owned and state-controlled.

If the Chinese government wants to undercut an American product, they will tell the manufacturer to drop the price to X, and the manufacturer will comply.

This also does not take into account Chinese currency manipulation.

Profit or loss be damned.

marcinzm
1 replies
1h55m

Isn't the US basically the same? The US government gives massive subsidies, tax breaks or just has the military buy components for 10x the price (to offset commercial loses and R&D).

ein0p
0 replies
49m

And creates regulatory capture for the rest, e.g. healthcare and big pharma ($4T a year), both of which too charge nontrivial multiples of what the rest of the world pays.

What2159
1 replies
1h44m

You make China sound like a VC,

Uber, AirBNB, etc ran at a loss to try to own the market.

dclowd9901
0 replies
1h36m

The government also stands to benefit greatly if they throw their weight behind smart ideas, just like VCs. It would be interesting if the government could fund itself with investment.

Aurornis
0 replies
1h33m

The BOM of this circuit really is very minimal because it’s a clever circuit.

It’s not without flaws (regulatory approval is non-existent for this) but they really did combine some dirt cheap components on to a dirt cheap PCB.

You, too, could assemble this circuit at scale for extremely low prices, no government intervention necessary.

transpute
0 replies
14h45m

  I don’t know who designed this, but they were a master of the black art of Radio Frequency waveguide engineering. I am impressed. The PCB, itself, is a major component. Not only for the patch antennas but also several RF filters, the local oscillator, and the mixer are all largely made from peculiarly-shaped PCB tracks. Apart from the PCB, there are only five “components" on the board. Five passive components to implement a Doppler radar module. C’mon. You have to be impressed by that!

hippich
2 replies
7h3m

Almost not related, but reminded me about recent RC hack I was working on.

I have an driveway alarm from mighty mule, which uses 433Mhz radio powered by two AA batteries to communicate signal from the coil sensor detection sitting next to the driveway to the base station in the house using OOK modulation. The stock PCB antenna was not very good at the distance I had it to work with, so I started experimenting with external antenna. I tried loaded antenna (i think it is what it is called - the one with the coil) and straight piece of wire.

I quickly realized that formula for 1/4 length is more of a starting point, and a lot depends on actual output components of the RC circuit (I have little to no understanding of how all of that works). I tried to cut slightly different sets of wires trying them next to HackRF/PortaPack showing me signal strength in the real time. Basically was eyeballing how strong and clear OOK bursts are, and how well or noisy they sounds through the built-in speaker... (again, I have no idea what I am doing...)

At some point I got tired of cutting wires and soldering them, so I tried to cut slightly longer wire and use thin piece of copper tubing to cover end of the antenna at various depth, hoping to simulate the antenna length changes. But at some point something weird to me happened - when just the tip of the antenna was covered by the tube, signal increased dramatically. I am talking about -55db - -50db to -36db on HackRF at the lowest usable gains settings...

I ended up with the antenna length slightly below 173mm ideal antenna length with a about 5mm-10mm "cap" made of aluminum foil tape (used for air ducts and such) at the very tip of the antenna. I also closed the other end of this wrap (in my imagination so that the signal does not escape this cap???). The cap itself is electrically disconnected from the antenna, it is just that - a cap.

I have no idea why it worked this way. I suspect by adding such a "cap" I modified something related to the capacitance or perhaps there is some resonance thing coming to play - no clue. But it became much more reliable at communicating over the distance I have it installed.

Perhaps someone who knows about such things, might give me a clue what I was dealing with.

Another thing that probably plays a role in this hack - outdoor transmitter is in the plastic box sitting vertically on a pvc pole, with batteries inside the same box. 1/4 straight antenna would not fit into it, but I also did not want to cut a hole at the top of the box to avoid water intrusion, so I pointed it down. But it also means it goes in parallel with the "USB" cable that connects to the coil-sensor next to the driveway. While system is not grounded, I suspect this USB cable is somehow became part of the antenna, since the best signal was when the line of sight between the antenna and base station, the usb cable was right behind the antenna. Distance between the antenna and usb cable running inside PVC pole is probably about 20-30mm.

aeonik
1 replies
5h56m

I need to see a picture, but fyi some of components of an antenna are "electrically" disconnected, but still play a role, wave guides being one example.

Also note, if you are just receiving signals you have more freedom to experiment. Antenna tuning matters a lot more when transmitting (especially at larger powers). (Not implying that it doesn't matter with reception)

hippich
0 replies
4h1m

Just to clarify - I changed transmitters antenna.

boguscoder
2 replies
14h58m

MCU rp2040 from Pi Pico also costs 1$. We really are in great time for affordable hacking

amelius
1 replies
6h34m

Now if only the GHz-range oscilloscopes came down in price ...

mastax
0 replies
5h32m

The competition between Siglent Rigol and Uni-T will most likely drive down the cost. From a high baseline but still.

zer00eyz
1 replies
13h52m

USB C mm wave "radars" that hook to home automation are a thing.

Priced between 11 and 20 bucks they are fairly feature rich...

If you want to roll your own check out what the folks over at ESP home have going on (google esp home mm wave).

stavros
0 replies
9h16m

The actual component costs about $5, if you want to roll your own with an ESP32.

perlgeek
1 replies
5h36m

Since the user manual for this sensor mentions security monitoring as a possible application, I'm wondering: is there any simple way to prevent detection from such a mm wave radar? (Assuming for simplicity that we know where it's mounted, and in which direction it's pointing).

robertclaus
0 replies
14h8m

I've played with these all the time! Great to know how they work!

Havoc
0 replies
5h14m

LD2410 work well too (do by the cable too, they have tiny non-standard pins)