- By limpkin - My Projects -

I had no idea that you could find this kind of motion sensors on the internet for so cheap... But they come with a catch: you need to design some electronics for them .





The Doppler Effect







I'm sure you're quite familiar with the Doppler effect: you send an RF signal at a given frequency to a target, and if this object/person is moving the reflected signal's frequency will be shifted.

This is the reason why a fire truck's siren has a higher pitch when the truck is going towards you than when it is going away.





The HB100 Modules







You'll notice the 4 patch antennas to send/receive the 10.525GHz. This frequency is really nice as the sensor will still work if there is some wood/plastic in front of it!

The HB100 outputs a low level voltage (few uV) whose frequency represents the speed at which an object is moving towards or away from the sensor. The output can be very noisy, so in addition to amplifying the signal, we need to filter out frequencies that don't match what we expect from ordinary objects.





The Amplification Schematics







Let's analyze them step by step. U1 is a SOIC IC containing 2 operational amplifiers: opamp A & B.

The HB100's output is connected to P1 and C4/(R4&R2&R1) form a high pass filter. The signal at the opamp A positive input (IN+A) is centered at Vcc/2 because of this high-pass filter and the voltage divider made by R1&R2.

The opamp A, R5, C5, R6 and C6 form a non-inverting band pass filter circuit. It amplifies the signal at IN+A by 100 (R6/R5) between 3.4Hz (1/2*pi*R5*C5) and 72Hz (1/2*pi*R6*C6). The gain is 1 outside this frequencies, so the opamp A's output is also centered around Vcc/2.

The latter signal is then passed through an inverting band pass filter circuit. The gain is 121 (R7/R8) between 4.1Hz (1/2*pi*C8*R8) and 72Hz (1/2*pi*C7*R7). The gain is 0 outside these frequencies, but because Vcc/2 is present at IN+B the opamp B's output will also be centered around Vcc/2.



Here are the two types of bandpass filters presented in a better way (different component values are used):



Anyway, you might wonder why the last amplifying stage's lower cutoff frequency is slightly higher than the previous'. This is made so to avoid amplifying the DC component as the band pass filter is not ideal (see above picture).

We finally amplified the HB100 signal by 100*121 = 12100... so you can guess that a lot of noise can be amplified.

To avoid that, FB1 removes the power supply's noise and the chosen opamps have a high common mode rejection ratio (CMRR).





Amplification Stage Outputs







Finally, the amplified signal maximum voltage is detected using D1, R9 and C9. It is common to add a resistor in parrallel with C9 but as we are working with relatively low frequencies C9's leakage will do the trick.

To output a nice square signal, we use a discriminator (U2) detecting when the voltage crosses Vcc*0.55.





The Result





And there you have it: a nice Doppler motion detector!





But... What Speeds Can It Measure?







Unfortunately there is no easy answer. You can see above the simulated frequency response of the amplification schematics. The part of the green curve above the red line is between the 3Hz & 72Hz we mentioned earlier.

As you can see, speeds whose output are above 72Hz won't necessarily be filtered out!

Your speed measurement capabilities will therefore depend on:

- how RF reflective the moving object is

- how close to the sensor the moving object is

- if the sensor is at an angle with the moving object (see HB100 AN)

- if many moving objects are moving around the sensor (see radiation pattern)



For information, here's an oscilloscope trace of the Doppler IF output when my hand is waving 50cm above it:









The Source Files





So here are all the files used to make this sensor. I recently migrated to KiCAD!

Bill of Materials Production files HB100 application note HB100 datasheet



If you don't have time to make one yourself... have a look at my store on tindie .





Sample Code for Arduino





Due to popular demand, here's a very simple program that will output the object speed in your arduino terminal:



// Below: pin number for FOUT #define PIN_NUMBER 4 // Below: number of samples for averaging #define AVERAGE 4 // Below: define to use serial output with python script //#define PYTHON_OUTPUT unsigned int doppler_div = 19; unsigned int samples[AVERAGE]; unsigned int x; void setup() { Serial.begin(115200); pinMode(PIN_NUMBER, INPUT); } void loop() { noInterrupts(); pulseIn(PIN_NUMBER, HIGH); unsigned int pulse_length = 0; for (x = 0; x < AVERAGE; x++) { pulse_length = pulseIn(PIN_NUMBER, HIGH); pulse_length += pulseIn(PIN_NUMBER, LOW); samples[x] = pulse_length; } interrupts(); // Check for consistency bool samples_ok = true; unsigned int nbPulsesTime = samples[0]; for (x = 1; x < AVERAGE; x++) { nbPulsesTime += samples[x]; if ((samples[x] > samples[0] * 2) || (samples[x] < samples[0] / 2)) { samples_ok = false; } } if (samples_ok) { unsigned int Ttime = nbPulsesTime / AVERAGE; unsigned int Freq = 1000000 / Ttime; #ifdef PYTHON_OUTPUT Serial.write(Freq/doppler_div); #else //Serial.print(Ttime); Serial.print("\r

"); Serial.print(Freq); Serial.print("Hz : "); Serial.print(Freq/doppler_div); Serial.print("km/h\r

"); #endif } else { #ifndef PYTHON_OUTPUT Serial.print("."); #endif } }