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

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

posted in: Android | 71

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

 

 

71 Responses

  1. Roger Clark
    |

    Thats interesting.

    Can you explain a bit more ?

    When you say “detects movement when my air conditioning IR control is used.”

    Do you mean its sensing when you push the button on the control, or have you built something which uses this detector and a IR LED and an Arduino etc, to sense movement and then turn your Air conditioner off if no movement has been detected in 10 mins etc ??

  2. Julio Gouy
    |

    Hi Roger, actually I created a sensor that detects the lack of movement for a period of time and sends an IR command to turn it off. I changed the motion sensor I use, and works, HC-SR501 to the new RCWL-0516 that I just received. Actually the code was exactly the same I used for the old one. At the beginning everything was working fine, I could verify that the sensitivity of the new sensor is a lot more precise. I left home and when I came back my air conditioner was still turned on. So after trying to understand what was happening I saw that when I send the IR command the sensor automatically detected a movement. So after some time, a repower timeout I defined, the conditioner was turned on since there were a movement detected at the last IR command I sent, the power off one. If this is the normal behavior this won’t be of any use for my project.
    Best regards, Julio.

  3. Roger Clark
    |

    A few things I can think of…

    Firstly, I suspect the RCWL is picking up something completely different and possibly nothing to do with sending the IR command

    Or… Its so sensitive that its detecting the movement inside your air conditioner, e.g. mine has vents which move when I turn it on or off.

    I think you need to isolate whether the retriggering is in response to the IR signals being sent, (e.g. turn off the circuit breaker to your air conditioner and see if the RCWL gets retriggered just by your project sending the command.

    Its possible that small fluctuations in supply voltage are trigger it as well, because the IC on the RCWL is a very high gain OpAmp and I doubt it has good voltage noise immunity

    Re: Turning the air con , on and off commands.

    My Daikin air conditioner seems to have a separate command for ON, and OFF, but perhaps yours has a command to toggle between On and Off

    Mine is a pain to use from its own remote, as if you don’t press with the remote pointing at the air conditioner, it does not see the first command e.g. ON
    So you press again, but the remote then sends OFF, So the air con stays off
    So I have to press again to send ON.

    But I suppose for Arduino style control my Daikin would be better

    Also….
    To save false retriggering, I’d simply put more code in the arduino etc, so that it does not turn the air conditioner on, unless its constantly getting triggers from the RCWL sensor.

    Note. I think the RCWL sensors is designed for security lights, etc, where its better to turn on even if it was a false trigger

    But in your case this is no good

  4. Júlio Gouy
    |

    Hi Roger, thanks for the feedback. I’ll do more tests and send you the results. Not today because it’s already late here 🙂
    Very best regards, Júlio

  5. Roger Clark
    |

    OK…. No Worries

    Its Monday morning here already…

  6. Julio Gouy
    |

    Hi Roger, so you are from the future 🙂
    There is a saying here: “The curiosity killed the fish” so I could not wait to make some more tests.
    The results are: Every time I send a command using my prototype, the RCWL sensor detects a movement. So I decided to try with the remote controls themselves and nothing happened. So it’s nothing to do with the IR commands as you suspected. I don’t have an oscilloscope to verify the power source fluctuation you mentioned. I’ll do a better research and try to understand what is happening to the sensor that causes this RCWL sensor behavior. If I find anything useful, I’ll let you know.
    Thanks a lot!

  7. Roger Clark
    |

    Hi Julio

    I’m not sure if its the same saying, but in UK English there is a saying “Curiosity killed the cat”
    https://en.wikipedia.org/wiki/Curiosity_killed_the_cat

    I think its the same thing.

    I would try putting some capacitors across the power input to the RCWL.

    Its probably overkill, but I sometimes use this isolated power module. called a B0505S (there is also a 3V version I think)

    https://www.aliexpress.com/w/wholesale-B0505S.html?spm=2114.search0104.0.0.59edc8d9oj7R1s&initiative_id=SB_20180128161911&site=glo&groupsort=1&SortType=price_asc&g=y&SearchText=B0505S

    They are $1 each, and provide total DC isolation between the input and output voltage, as they contain a mini transformer

    However perhaps in this case, its not the correct solution, as you need to have a common ground between both parts of the circuit

    I would try removing the IR LEDs from your circuit and see if the problem still occurs.

    The problem is likely to be the high frequency pulses changing the supply voltage a tiny bit.

    I don’t know if you drive the IR LEDs directly from an Arduino etc, but if they are driven by a FET or transistor, you perhaps supply that via a different regulator

    Or perhaps put a inductor in series with the RCWL to prevent the high frequency noise getting to the RCWL

  8. Julio Gouy
    |

    Yes, it seems that it is the same saying 😉
    Yes, I use a PNP transistor to drive the LED and unfortunately I need to use the same regulator since both uses a 5V logic. I have another one with 3.3V but I think that the RCWL won’t work at this voltage. Thanks for the isolated power module tip, I’ll try to find one here so I can test. About the capacitor/inductor filter seems to be a great idea, I’ll try this, but not today, I am serious now 🙂
    Thanks Roger for your support and attention.

  9. John Taylor
    |

    This sensor is very sensitive to changes in VDD of the motion sensor circuit. For instance, if too much current is drawn from the logic output, this will pull down the VDD which changes the bias point of the amplifier appearing as s new trigger. By the same token, drawing any current from the on board 3.3V regulator will result in a false trigger.

    If you connect the motion sensor directly to the IR transmitter you have no way to lock out the false trigger while the IR teansmitter operates.

  10. John Taylor
    |

    The board I built with a PIC on it has a Red/Green LED which I programmed to track the output of the two comparators. At 10mA the LEDs pulled on the 3.3V regulator just enough to go into a continuous “Detection” mode, blinking forever. Reducing the LED current to 2.5mA fixed that problem. The second spin of the board (Arriving tomorrow) has better bypassing of the second amplifier bias point and the oscillator collector, both of which are very sensitive to noise.

  11. Roger Clark
    |

    John

    No worries. Its good to point out how sensitive these things are to supply voltage noise

    PS. the comments system seems to not be displaying one of the 3 comments you posted. i.e the one that read.

    Yes, it seems that it is the same saying 😉 Yes, I use a PNP transistor to drive the LED and unfortunately I need to use the same regulator since both uses a 5V logic. I have another one with 3.3V but I think that the RCWL won’t work at this voltage. Thanks for the isolated power module tip, I’ll try to find one here so I can test. About the capacitor/inductor filter seems to be a great idea, I’ll try this, but not today, I am serious now 🙂 Thanks Roger for your support and attention.

    Anyway.

    No worries

  12. Dejan Gjorgjevikj
    |

    Hi,
    I have noticed this conversation about the sensitivity of RCWL 0516 to supply voltage and I wish I have read it a few days ago…

    I am experimenting using the radar sensor myself. I am logging the analog output of pin12 (and the regular digital output) of RCWL and also from PIR sensor on an Arduino (Nano) setup.
    Later I have added a small red LED to the setup that emits very short flashes while flushing that data on a SD card.

    This had hardly noticeable effect on the analog signal from the sensor, but adding a second white LED configured to draw 15mA (I needed strong flashes that would be easily noticeable on surveillance camera) that emits kind-of slow code (1/25s) flashes that last several seconds caused the problems.

    The interference was slightly less defined when I power the Arduino using a power supply and not the USB.

    Adding capacitors next to the sensor, the LED and a big one close to the Arduino power input, did not help much.

    Reducing the current through the LED did reduce (but not quite remove) the effect. Driving the LED using a transistor (that draws about 0.2mA for the base current from the Arduino) reduced the effect to bearable one but I think that fluctuations in the analog signal can still been noticed when the white LED is doing its light-show every 15 seconds in my setup (that I intend to use for synchronization).

    The analog signal is also full of small noise all the time and I suspect that the power requirements from all the modules I am using (RTC 3231, LDR, Microphone, RCWL, PIR and especially the micro SD card) have an effect on this.

    I am still experimenting. I also have several other radar sensors and to try…

    I forgot to mention that I have configured the Arduino to use the external 3.3V reference from the Arduino for its A/D conversion (because as I have noticed the analog output from the PIR and radar sensor are 3.3V max) that should be slightly more stabilized than the default Vcc of the Arduino.

  13. Roger Clark
    |

    Thanks Dejan

    (I edited your comment to add some line breaks to make it easier to read)

    I used a 3.3V MCU with ADC input (STM32F103) so I didn’t have to change anything, but I can see that using an AVR Arduino (ATMega….) that using an external 3.3V reference would increase the resolution.

    I’d not noticed any noise issues, but I was not doing anything except logging the data into a PC.

    I initially thought that perhaps a OpAmp with better supply noise immunity than the RCWL IC, could be used instead, as the analogue output is just taken after 2 stages of OpAmp amplification (and filtering).

    However, because of the nature of the GHz oscillator its self, I doubt that replacing the RCWL would improve things.

    Ensuring a stable, noise free supply for the whole module is more likely to yield better results.

  14. John Taylor
    |

    It is not the amplifier PSRR that makes this device sensitive, it is the fact that the divider that sets the amplifier bias point is tied to Vdd and so disturbances to Vdd show up at this bias point; the amplifier can’t tell the difference between detector and bias point fluctuations.

  15. Roger Clark
    |

    OK

    Thanks

  16. MagnusT
    |

    Thank you for this very interesting run through! Just some feedback that might be interesting:

    1.
    I’ve been running a RCWL-0516 connected to an ESP8266 Wemos D1 Mini which in turn runs on the power on it’s USB connection. Using the 3.3V from the Wemos to drive the RCWL the detection is totally unstable, but using the 5V from the Wemos everything is rock solid and works perfectly. When running on the 3.3V from the Wemos the analog signal is all over the place but when using the 5V it’s perfect! Some people have thought the ESP8266 disturbs the detection if it’s too close to the RCWL but it’s a matter of choosing the right power source.

    2.
    In the two pictures showing the wiring to your Arduino you have connected power to the wrong pin. This confused me for a while so I double, triple quadruple-checked this.
    – The connection marked “3.3V” is an output that you can use to drive other items.
    – The connection “VIN” is where you connect power 4V-28V

  17. Julio Gouy
    |

    Hi Roger, finally the B0505S you suggested I test, see my previous post, arrived at my home and I have just installed to isolate the power source of the RCWL-0516 sensor and so far so good! The IR commands are not triggering the sensor anymore. So now I’ll continue analyzing the possibility of including this sensor to my project.

    Thank you for the support! Best regards, Julio.

  18. Roger Clark
    |

    OK.

    I’m glad that worked.

    You may still need to add some capacitors on the side of the B05005S connected to the RCWL-0516 as the BS0505S only has a small amount of capacitance inside it,

  19. Roger Clark
    |

    I think the 3.3V pin is the output from the voltage regulator , so when you use a higher voltage on Vin, it only gives 3.3V to the rest of the circuit.

    I did not have a 5V output from my 3.3V board, so I fed 3.3V into that (output).
    Normally this is not a problem as the voltage regulator does not draw much current in through its output under those conditions, but technically its wrong unless I remove the regulator

    Re: Less noise when supplying from 5V

    That makes sense because the regulator will remove a lot of the supply noise.

    e.g. if input is 5V with 0.25V noise. The regulator can still produce a stable output from a 4.75V input (5V – 0.25V) so the 3.3V rail will remain almost at 3.3V

    This will partially depend on the frequency of the noise, as the regulator will have a limited response time.
    But it sounds like under normal conditions the noise is not too fast for the regulator to manage

  20. MagnusT
    |

    “I think the 3.3V pin is the output from the voltage regulator , so when you use a higher voltage on Vin, it only gives 3.3V to the rest of the circuit.”

    Agree totally!

    So feeding the VIN with 3.3V is a no go.

    Maybe clearify that you preferably feed it 4V-28V on the VIN connector but that you can feed it with 3,3V on the 3V3 connector?

  21. Roger Clark
    |

    I think it depends on how you are using the device.

    If you are simply logging movement and perhaps uploading that data to the web etc, and not doing anything which causes supply fluctuations, And are using a 3.3V device with no access to 5V, then feeding in via the 3.3V will work under some circumstances.

    But it looks like supplying the board with 5V (or more) if available resolves a lot of the problems associated with supply noise.

    However, I suspect in some instances even using the 5V input could still potentially have problems, due to the extreme noise sensitivity of this module.

Leave a Reply