Investigating a RCWL 9196 / RCWL-0516 “Radar” motion detector module

Investigating a RCWL 9196 / RCWL-0516 “Radar” motion detector module

posted in: Android | 21

A new type of “Radar” motion sensor has been getting a lot of attention in the last couple of months, but no one seemed to know how they worked, so I decided to buy a few of these very cheap devices (sub $1) and investigate possible methods of operation.

The boards I bought use the RCWL 9196, but appear to have identical functionality to those with the RWCL-0516 chip on them

This github site https://github.com/jdesbonnet/RCWL-0516/ contains loads of useful information on these boards, and there is also an excellent video by Andreas Spiess on YouTube https://www.youtube.com/watch?v=9WiJJgIi3W0

Where the properties of these devices was explored.

I hope to have taken this at least one step forward with my tests.

The main difference in my approach is that I have connected a wire from the analogue signal output on the only IC on the board, into an analogue input on a STM32F103C8 (aka Blue Pill) board.

The pin I connected to is Pin 12 on U1, (RCWL 9196 and is the output of the 2nd OpAmp in that chip).

(Schematic from Joe Desonnet’s github account)

 

 

My RCWL 9196 board is not exactly the same as this, but the pinout of the IC is the same.

Also the RCWL 9196 is almost identical to the BIS0001

http://www.ladyada.net/media/sensors/BISS0001.pdf

Where pin 12 is labelled as 2Out

 

 

I then wrote a very simple sketch in the Arduino IDE to print both the analogue signal from 2Out and also the normal digital output from the board

 

void setup() {
pinMode(PA0,INPUT);
pinMode(PA1,INPUT);
}
void loop() {
Serial.print(“0,”);
Serial.print(analogRead(PA0));
Serial.print(“,”);
Serial.print(analogRead(PA1)+100);
Serial.println(“,4500”);
delay(10);
}

BTW. The reason I’m writing values of 0 at the beginning of the line of output and 4500 is because the Arduino IDE “Plotter” feature is auto ranging, and if I don’t include a lower an upper bound, the vertical scale constantly changes

Looking at the output when nothing is moving I see this plot

Green is the digital output (in this case its LOW / OFF), and the Red trace is the analog signal, which is close to half the 3.3V Vdd voltage supplied to the board.

Note. The STM32F103C8 has an anlogue input range of 0 to 4096 (12 bit)

 

If I start to wave my hand, starting with a small movement and then increasing, I see this plot.

 

As you can see the hand movement causes an immediate effect on the output of the second OpAmp, but the value has to go above (or below) a threshold before the digital output triggers

 

In this next plot. I was walking towards the sensor, and then stopped.

 

As you can see the digital output holds for around 2 seconds after the end of the input fluctuations.

 

The more interesting thing about this plot are the peaks and troughs at the start where I was walking towards the sensor.

I thought this could be because its sensing the movement of my legs, so I devised a better test where I stood on a chair and dropped an object from the ceiling, and observed the results.

 

I tried a variety of objects, and the best performing object that mimicked the properties of a person moving, turned out to be a damp sponge.

I tried a dry sponge, but it had no effect on the sensor whatsoever, but as soon as I got it wet, it was immediately detected.

 

 

In this plot the sponge is falling about 1m horizontally from the sensor, which is resting on a table about 1m from the ground.

As you can see, there are still multiple peaks and troughs in the output signal.

I know that there was some speculation that these devices work by using the Doppler effect,but this does not appear to be validated my the tests I have done.

So my theory is that the peaks and troughs are caused by reflected signals from objects, interfering with the oscillator / transmitter.
When I say interfering, I mean of wave propagation, where the reflected wave can be in phase with the oscillator or out of phase, resulting in the oscillator drawing more or less current.

https://en.wikipedia.org/wiki/Interference_(wave_propagation)

From Joe Desbonnet’s github repo,he observed that the oscillation frequency is around 3.1GHz with his module. So assuming my module is similar, then the wavelength of 3.1GHz is around 10cm.

However in my tests, I am not sure the peaks and troughs match exactly with that frequency, and the effect I see if more consistent with perhaps twice that frequency.

 

Doing some tests moving a piece of aluminium foil up and down, approximately 30cm, to 5 cm above the sensor observe these results when moving slowly

 

 

And moving quickly

 

 

What is fairly clear is that the interference is not from a single path, but rather that the aluminium foil (or the damp sponge), is reflecting signals directly from the device, but is also going to be reflecting, some reflections back to the device.

So its a complex pattern of primary and secondary signals, with the strongest effect most likely to be the primary signal straight from the device (transmitter)

Also just to complicate matters, the OpAmp IC is configured so that the output is always trying to return to a steady state.

This can be seen when the device first turns on, and the analogue output initially is at its maximum, and takes around 10 seconds to stabilise to Vdd /2

 

Looking at the schematic and also measuring the voltage from the RF oscillator / transmitter, using an oscilloscope. The oscillator output voltage, rises to around 0.4V very quickly.

However OpAmp 1, in the RCWL9196 is configured as a high gain amplifier (and filter), whose non-inverting input will be initially 0V.

The inverting input is fed from the output of the OpAmp via a resistor and capacitor network, and charges C7 via R6, and the RC network of R4 in parallel with C4

I don’t know if the resistor values on my board are identical to the schematic, but a rough calculation on the RC charge time of the inverting input would be 22uF * 1M = 22 seconds.

But thats the time to get to Vdd not to 0.4V, so I think its highly likely that the 11 seconds startup time, is the time taken to charge C7 to 0.4V.

I observed the fluctuations of the input voltage from the oscillator using my scope, but the change was minimal; at around 4mV, and I was only able to measure this using capacitive coupling on the scope.

So if C7 can charge from 0V to 0.4V in around 10 seconds, then it would compensate for a change in input from the osc (of 0.004V) in 1/100th of 10 seconds, i.e 1/10th Sec (100mS)

This effect is also observable in practice, by moving an object towards the sensor and then holding it. As you normally see a peak or a tough, but very quickly the signal is pulled back to its steady state.

 

I did attempt to increase the value of C7 from 22uF (226) a higher value, in the hope that I could make a much larger time constant, but I damaged the board somehow, whilst trying to do this, so I do not have any results for that test.

BTW. I have 2 boards, but I don’t want to modify the second one in case I damage that one as well.

 

So to sum up…

My hypotheses, is that these devices are a oscillator / transmitter, and that the detection method is by wave propagation interference.

This is consistent with many of the results I observed.

  1. Objects moving towards (or away) from the sensor, produce peaks and toughs rather than a steady state offset; which would be caused by the Doppler effect
  2. The peaks and troughs are complex, as the interference is generated by reflections of reflections.
  3. Waving a length of wire, (which would act as an inductor), near the sensor, produces little or no variation in the output
  4. As the unit has a range of around 4 or 5m, and detection does not seem to diminish strongly with increasing distance, it seems unlikely that the effect is being caused by capacitive coupling between the observed object and the oscillator (and its surroundings_

 

And where does this leave us…

Well, at the moment, I don’t see a use for these devices apart from their intended application of motion sensing.

I think that using the analogue output from pin 12, is beneficial, as it can be used to get some indication of the scale of the detection, and would allow the trigger level, and hold time etc, to be controlled in the application (e.g. Arduino sketch).

 

I think if a method was devised to be able to observe the output from the oscillator, without the current system that always returns the output to a mid point steady state, even if the oscillator is not in that state; that perhaps the device could be used more easily to perhaps determine the speed of an object. By determining the time difference between each peak.

However even with the necessary hardware modifications to facilitate this, there would still be the problem of reflections of reflections; which would cause the data to be difficult if not impossible to analyse

 

 

21 Responses

  1. Chris Chuter
    |

    Hi Roger, I’ve been reading your blog posts about the RCWL-0516 with great interest. I’ve got a bunch of them that I’m tinkering with that we might use in our hardware, but we have one issue. It’s 360 degrees. I’ve been scouring the net, and we really like the RCWL, but we cannot seem to find a version that is 180 degrees or anything less than 360. Do you know of any mods or any modules that are like this one, but not 360 degrees? I’ve seen a mod on thingiverse (https://www.thingiverse.com/thing:2315777) for a directional shield, but I have limited space around my enclosure, so I can’t make something that big.

    So far of all the modules we’ve tested, the RCWL looks the most promising (only 2.4mA draw, 3.3V, and few/no false positives), but we really need to either find the manufacturer to get a 180 degree version or come up with a creative solution.

  2. Roger Clark
    |

    Hi Chris

    I have not tried to make it directional, but I think it may be very hard or potentially impossible to make it totally directional.

    The waveforms I observed seem to indicate that the device gets effected substantially by reflected waves, which means that if you are using in a confined space e.g. indoors, that its entirely possible that the wave could reflect off an object in front of the device to an object behind the device.

    I also think that the method of detection, which seems to be “interference” between the device’s oscillator / transmitter and the reflected waves; would mean that anything you use as a shield could get energised by the transmissions and re-radiate etc

    I have noticed that the device will not penetrate window glass, so the material you use to shield does not need to be metal foil and potentially its better not to use metal foil but use something that absorbs the radio waves.

    I’m not sure what material would be best, but things with high water content seem to be detected the best by the device, so you could try following that avenue.

    You may also like to try absorbing rather than reflecting the waves from the back of the sensor

    The other thing you could try is adding an additional antenna at 90 deg to the board. You’d need to calculate the length of this, but is only going to be a few cm at the most (based on the wavelength of the oscillator.
    e.g. solder some stiff wire to the circular pad on the back of the device, at 90 to the board and see if that still works and also if it effects the directionality of the board.
    Not, you may find doing this makes it stop working altogether as the unit is a combined oscillator and transmitter , so the oscillator may simply fail to start

  3. David Fisher
    |

    In the video https://www.youtube.com/watch?v=9WiJJgIi3W0 Andreas Spiess did a review of different modules of this type and found the module HFS-DC06 is 180 degrees directional.

  4. Roger Clark
    |

    I saw that, but the DC06 module is a lot different from the other type. Its method of operation is probably different.
    It looks like a Doppler module.

  5. Anonymous
    |

    Can you try it with material classification? https://www.youtube.com/watch?v=B6sn2vRJXJ4

  6. Roger Clark
    |

    All my modules seem to have stopped working. If I get time I’ll order some more to do some testing

    However I don’t think it would work in the same way as the video.

    The diagram shown in the video has 2 transmitting antennas and 4 receiving antennas. It shows 4 different waveforms on the laptop.

    It appears to use the Google SOLI radar chip, which is a true radar in that it transmits a pulse and then listens for reflections.
    These motion detection modules do not seem to use that principal of operation

    From what I recall the output from these modules just becomes a stable flat line, when there is no movement.

    I’m also a bit sceptical about this video. I suspect its trained just to recognise the specific objects shown in the video, e.g. that specific orange, and that specific metal plate etc.

    Considering how revolutionary this system would be to numerous industries, I’m surprised that this has not been big news, e.g. the Video was released 9 months ago.

    I suspect there is some limitation eg. it must learn specific objects, and could not simply detect different size PET plastic bottles as being PET etc

  7. Gert
    |

    I see that you’re using STM32 and programming it using the USB port? What steps do I need to take to get that far?

  8. Roger Clark
    |

    I’m using Arduino on the STM32

    It uses my Arduino STM32 core (which has based on the abandoned LibMaple core from Leaflabs)

    I’ve posted various articles and youtube videos about this.

    Search on Arduino STM32 and you’ll find loads of resources, including our community forum http://www.stm32duino.com

  9. Gert
    |

    Thanks, I’m sure that is going to help me out

  10. juan3211
    |

    Hi, could we drive with the OUT pin a transistor to drive the transistor a relay t switch on lights ?

  11. Roger Clark
    |

    Yes.

    That’s what its sold to do.

    I am more interested in alternative more interesting uses

  12. Ian Paterson
    |

    Hi Roger good work, most useful. I have an interest in this module too and have been trying to get directional transmission. I`m using a rudimentary copper feedhorn attached to the transmitting side of the pcb. (the component side from what I have read).
    I do seem to be able to transmit through my kitchen glass door, but not through the house double glazing. I suspect the kitchen door results are suspect as it has multi panel glass and a lot of wood!
    Hooked onto an Arduino for simplicity of sensing. Doing some rough check on frequency of operation it appears to be 3.15Ghz.on my sample, Using an HP 8350B Sweep oscillator and HP 83595A plugin,and loose coupling at -60dbm output, I get trigger on at 3.147Ghz and off at 3.156Ghz using a .5 second sweep. For triggering the module (LED on at Arduino) my minimum sweep time is .026 secs, and a delta frequency sweep minimum of 5Mhz. More checks to do, but it is interesting. !

  13. Roger Clark
    |

    I know some people have had limited success using a horn to get some degree of directionality, but I think its mainly that it is shielding the oscillator / transmitter, rather than actually directing its radiation.

    If it was a more conventional transmitter, then a dish style antenna would make it quite directional, but this module is rather unconventional;-)

    Thanks for posting about what frequency it is transmitting on. I think I’ve seen similar figures in various articles on the internet.

    Re: Different types of glass.

    Its possible that the metal content in the glass is different, or perhaps just the thickness, or like you have suggested, its the wood that is making the difference.
    Its really hard to know, as the method of operation of this device is rather mysterious.

  14. Miguel
    |

    Hi Roger

    I’m currently playing with these boards and i have a application for them if i can get the detection range to be around 1m. In the specs say, the default detection range is 7m, adding a 1M resistor to R-GN it reduces it to 5m.
    Do you know if i add a higher value resistor will the distance be shorter?

  15. Roger Clark
    |

    If add a different resistor the range will change.

    However I’m not sure if you need to add a lower or higher resistor to reduce the range even further. I suspect a lower value resistor would be required e.g. perhaps 470k

  16. Chris Chuter
    |

    Yes, I’ve tested with various resistors for R-GN and lower resistors do appear to reduce the range of sensing, but it’s still all guess work. If you know of any references that explain it better please pass it along.

  17. Roger Clark
    |

    That resistor is part of the circuit that connects the output of the initial OpAmp, to its inverting input. Hence controlling its gain.

    The lower the resistor you use, the more “negative” feedback goes into the OpAmp which makes the overall gain of the OpAmp lower
    Just to complicate matters, the feedback path also has capacitors in it, so its also acting as a filter.

    You could try modelling the circuit using LTSpice, but as there probably isnt a “model” for the RCWL-0516 IC available, or even the necessary data to build a model for its internal operation, I think it would be a waste of time.

    Additionally, as the whole device, operates in a very strange way, which no one precisely understands; your best option is simply to fit a 1M ohm potentiometer instead of the resistor and try different settings and see what works for you.

    I don’t think you can damage it the device even if you shorted out the resistor, as on the circuit diagram, capacitor C3 blocks any DC component from getting though.

    I’d be interested if you posted a comment with your results

  18. Adrian
    |

    Hi Roger, love your posts, particularly your cover of this radar. i’m no engineer but wondering if its possible to remotely control its sensitivity and distance. what would be a better method than digital potentiometers? (using PiZero to take pictures in different enviroments)

  19. Roger Clark
    |

    You could possibly use a “digital potentiometer ” in place of the resistor which controls the sensitivity (it controls the gain / amplification of the signal from the oscillator / detector)

    However the value of resistor that is needed, i.e around 1 Meg ohm, is a lot higher then the “digital potentiometer” IC’s can produce. (as most of these have a maximum of 100k )

    Your best option is to the take the output from the first opamp, and read it via an ADC. I presume the PiZero has a ADC which you can use to measure that voltage

  20. Mike DeCarlo
    |

    Hi, what is the closest distance I can place the RCWL-0516 sensor and get accurate readings? I’m looking for a sensor that can be placed about 7 inches from the target and detect motion up to 4 inches accurately. Thanks!

  21. Roger Clark
    |

    These modules can’t tell you the distance to an object, they just sense whether it has moved or not.

    They also will not detect all types of materials, they seem to detect things with high water content better then other types of object.

    They can detect motion from about 0mm to 5000mm (5m).

Leave a Reply