Making the Electronics for a 24GHz Doppler Sensor

cdm324_assembled_quarter.JPG I couldn't believe my eyes when I saw how tiny that sensor is !

2023 Edit - New Project Version!

I just made an improved version of this project, check it out here!
Otherwise, feel free to read about the non-MCU based version below:

The Doppler Effect

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 CDM324 / IPM165 Motion Sensor

cdm324_size.JPG
You may recall the article I wrote a couple of years ago about a nearly identical Doppler sensor, the HB100.
While the HB100 is using a 10.525GHz frequency, this new module uses 24.125GHz! This has the main advantage of being compatible with European regulations (ETSI #300 400) and having good penetration in dry materials. Moreover, as the main frequency is higher the patch antennas are smaller, hence the tiny 25x25x6mm module.
This motion sensor can easily be purchased on eBay under the name CDM324. Oddly enough, looking for "cdm324" on your favorite search engine won't bring any interesting results.
I therefore spent several hours tracing the origins of this tiny sensor. I finally arrived to the conclusion that it likely is a clone of the InnoSenT IPM 165, which is itself very similar to the AP96 from Agilsense.
Specification-wise, the CDM324 antenna pattern is slightly narrower than the HB100's: 80° azimuth and 32° elevation versus 80° azimuth and 40° elevation. The Radiated Power (EIRP) is more or less the same: 16dBm vs 15dBm. Finally, the advertised power consumption is identical to the HB100's: up to 40mA @ 5V.

Finding the Right Amplification Circuit

cdm324_ampl_innosent.png
Now that I had traced the origins of this CDM324, I could find its recommended amplifier schematics.
The one you see above comes from InnoSenT. It consists in 2 cascaded inverting band pass filter circuits:
pass_band_amplifier.png
You'll however notice that the op-amp positive input in our suggested schematics is tied to vcc/2, allowing us to have a centered amplification output as well.
From the formulas above, we can compute the circuit total gain and cutoff frequencies. I'll spare you the maths, the suggested amplification is 1018 (60dB) and a band pass filter from 3.4Hz to 1.06kHz.
The InnoSenT application note allows us to put these frequencies in context:
Innosent_app_note_doppler.png
The high cutoff frequency is therefore set for a 24km/h or 15.4m/h speed. However, this isn't exactly true as the filter cutoff slope isn't vertical. Here's the simulated amplification output generated using LTspice:

simul_seller.png
You may therefore be able to measure much higher speeds if the moving object is close to the sensor.

Amplification Circuit from Chinese Sellers

cdm324_ampl_ebay.jpg
This is the (very low resolution) recommended amplification circuit that you will find online.
Simulating it leads to raising eyebrows:

simul_ebay.png

Many many things are odd with this recommended amplification circuit:
- No high pass filter on the second amplifier (remember, the cutoff slope in the first amplifier stage isn't vertical)
- I don't see any reason for that 1nF capacitor when the high pass filter is done using the first op-amp
- Amplification on the first stage is 510 while the amplification on the second stage is 100
- Which leads to a total gain of 51000 (94dB)
- ... while the LM258 has a gain bandwidth product of 1MHz!
The last point is crucial. Given the first amplification stage has a gain of 510, this means there's only 1.96kHz of bandwith "left" inside the LM258. As the cutoff slope isn't vertical, this means that the LM258 isn't the right op-amp for the job! For example, at 10kHz the amplification is 3162, which is a GBW product of 31.6MHz!

Chosen Amplification Circuit

cdm324_ampl_limpkin.png
After lots of experimentation and performance comparisons with my previous HB100 module, you can see above the final amplification circuit I chose.
- As you can imagine, it is based on the manufacturer's
- Each amplification stage has a gain of 125.5
- Total gain is therefore 15758 (84dB)
- Cutoff frequencies are 3.4Hz and 999Hz (< 1 km/h or m/h and 22.7km/h / 14.5m/h respectively)
Not so surprisingly the total gain is quite close to the one I had set on the HB100 (12100) and I'm fairly sure I could have set the same one. It was simply more convenient to choose the same resistors & capacitors values in my circuit.

simul_limpkin.png
As with my previous HB100 amplification circuit, I chose the OPA2365 operational amplifier. It has a 50MHz Gain Bandwidth product, which is more than the 15758*(84dB-3dB) = 11.2MHz product at the high cutoff frequency point.

Final Schematics

cdm324_backpack_schematics.png
You can see above the final schematics:
- FB1 is here to filter the power supply noise
- the voltage at the C10/R11 node is proportional to the amount of reflected RF energy
- Q1 allows pulse mode operation: you may power on/off the CDM324 using the module nEN pin
- U2 is a simple comparator that will transform our amplified output to a neat square wave:

cdm324_print.png
In the scope capture above the yellow trace is the amplified output while the pink one is the comparator's output.
Using a comparator is a simple way to 'extract' the amplified output main frequency but I'm quite sure running an FFT on that signal would be quite interesting!

Assembled PCB

cdm324_pcb2.JPG
Here's what the assembled PCB looks like! It has the same size as the CDM324 (25x25mm) and uses a 3pins header to connect with the sensor. 0805 passive components were chosen to make the soldering job easier.
Please do not pay attention to the silkscreen as some values have changed since then: have a look at the end of this article to download all the source files.

3D Printed Holder

cdm324_assembled.JPG
The HB100 doppler module had 4 connectors at each corner to solder my 'backpack PCB' to.
Unfortunately the CDM324 only offers a single 3 pins connection, which is why I designed and 3D printed a neat assembly holder: the CDM324 with its amplification circuit simply slide in it!

The Sensors in Action & Sample Code

Here's the video of the HB100 and CDM324 working side by side!

I'm guessing that if you were to use such a module you'd definitely like some sample code.
Below is some arduino code that will output the detected speed in your favorite 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 = 44;
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\n");
      Serial.print(Freq);
      Serial.print("Hz : ");
      Serial.print(Freq/doppler_div);
      Serial.print("km/h\r\n");
    #endif
  }
  else
  {
    #ifndef PYTHON_OUTPUT
      Serial.print(".");
    #endif
  }
}


Text written in serial terminals is so small though... why not print it bigger using ASCII art?

python_script.png
Simply define PYTHON_OUTPUT in the script above, install python on your computer, run "pip install pyfiglet pyserial" and use that awesome little python script (don't forget to replace COM3 with your COM port):

from pyfiglet import *
import serial
import os

ser = serial.Serial('COM3', 115200)
while True:
	speed = ord(ser.read())
	os.system('cls||clear')
	print(figlet_format(" ",font="clb8x10"))
	print(figlet_format(" ",font="clb8x10"))
	print(figlet_format(str(speed)+" km/h",font="clb8x10"))
	print(figlet_format(" ",font="clb8x10"))


Want to Make or Buy One?

Here's the GitHub repository I made for this project: https://github.com/limpkin/cdm324_backpack.
If you're interested by this module and don't want to produce it by yourself, you may buy it from my store here.
You may also purchase my cheaper HB100 module there.

Comments

1. On Thursday, March 30 2017, 02:23 by Masoud

Excellent write up, research and explanation. Thanks a lot.

2. On Friday, March 31 2017, 16:51 by carlos

Very nice! And very nice productfor sale as well. One question: have you thought of making the cut off frequency higher so it can measure up to 100 km/h or more? What problems wou!d that pose?

3. On Friday, March 31 2017, 20:05 by limpkin

@carlos : Thanks! I actually thought of doing so, but figured that this sensor is mostly used as a presence sensor or for "standard" uses. But in theory I don't see why it wouldn't be able to measure higher speeds. You may however pickup some noise.

4. On Sunday, April 2 2017, 04:29 by Frank

Just wondered- is doing something like building a photogate for characterizing ammunition way out of the question? Velocities can easily exceed 2000 mph, so things happen quickly- but commercial radars for this run $500+. Thanks.

5. On Sunday, April 2 2017, 16:58 by limpkin

@Frank : photogates are indeed the best choice in that case. Having dealt with high frequency circuits before, I'd say that $500 isn't such a terrible price.

6. On Wednesday, April 5 2017, 06:04 by JBeale

Nice description. Do you think this could reliably detect if someone was walking or running down the hall, vs no one there? In other words, any good way to determine what is "background noise" and what is not?

7. On Wednesday, April 5 2017, 14:51 by limpkin

@JBeale : Yes! It's actually quite easy: you just need to make sure VOUT is at a reasonably high level :)

8. On Thursday, April 6 2017, 06:05 by adz

See you this creation, really very powerful, I as an electronic enthusiast, but also want to do a play, but did not find your antenna file, the antenna with HB100 can? Thank you!

9. On Thursday, April 6 2017, 10:06 by solipso

The output comparartor should have been set up with some hysteresis to act as a Schmitt trigger in order to cancel spurious switching in zero-crossing range.
Other than that, nice circuit.

10. On Thursday, April 6 2017, 19:51 by DS

Great little module and write-up - thanks for that.

One question I had, similar to the HB100 module, is about range. On your HB100 thread many asked the same question. We've tested the HB100 and found the detection range is at best 50 to 100cm. Beyond 1m there is not much detection sensitivity.

Have you found the same? Datasheets state 25 feet or 8m. Does this newer module have better range? Seems like these are meant for only close-up detection.

Thanks.
-DS

11. On Friday, April 7 2017, 07:47 by limpkin

@solipso : actually if you look at the circuit, the comparison voltage isn't set at vcc/2!

12. On Friday, April 7 2017, 07:47 by limpkin

@adz : the cdm324 must be bought on ebay or similar!

13. On Friday, April 7 2017, 07:48 by limpkin

@DS : It really depends on the amplification you add and its environment. If there's only one thing moving, you can easily get 8m range.

14. On Saturday, April 8 2017, 08:13 by gss

Fantastic tech write up.

Turning this around, could this unit be used as a ground speed sensor when mounted on a vehicle?

15. On Saturday, April 8 2017, 22:13 by limpkin

@gss : thanks! I guess so... it's just a matter of frame of reference after all

16. On Tuesday, April 11 2017, 09:48 by Simon

Have you any idea what the detection range of this sensor is? Thanks

17. On Tuesday, April 11 2017, 13:26 by limpkin

@Simon : it highly depends on the moving object! but at least 7 meters i'd say

18. On Sunday, April 23 2017, 11:25 by korban

Hi.

Why do you need diode D1?

19. On Friday, May 5 2017, 02:16 by Peter King

Hello,

I am new to electronics, but I think, I understood this article. Thank you very much for spending your time for this article.

But there are two questions:

1. MOS_P is a PNP mosfet, right? Which model did you use?
2. What model exactly is FILTER, you have used?

I was not able to find a item list on GitHub.

Thank you for your answer.

Regards
Peter

20. On Wednesday, May 10 2017, 17:00 by limpkin

@Peter King  it is a P mosfet, have a look at the bom on the repository: https://github.com/limpkin/cdm324_backpack/blob/master/BoM.xlsx

21. On Thursday, May 18 2017, 03:35 by Dave

Nice sensor and and interesting write up. For lower power consumption would it feasible to pulse nEN (say at 5Hz with a 25% duty cycle), or would there be some settling time issues? The application I have in mind is more the characterisation of a moving object (combining speed and amount of returned signal) rather than an accurate absolute speed measurement.

22. On Saturday, May 27 2017, 21:36 by limpkin

@Dave : That's actually what nEN is for! :)

23. On Tuesday, June 6 2017, 21:04 by Ar1s

Nice work limpkin!
I'm currently looking for a module that I could use to measure the speed of cars passing by the street in front of my house. I suspect some of them are very fast (> 130km/h at night). Is there any luck with your device? I suspect I'll have to go with laser range finders but the ones I could find are for professional use and quite expensive.

24. On Friday, June 23 2017, 21:24 by limpkin

@Ar1s : you may have some luck by changing the high pass filter yes.

25. On Tuesday, July 4 2017, 01:26 by pumper_nickel

@gss any luck with using it as a ground speed sensor? having difficulty making it work reading the road moving past/on an angle. only really seems to detect objects moving directly away/toward it

26. On Saturday, September 23 2017, 15:31 by Vijay

Hi.. Can I fix this module below an agricultural tractor to measure the true speed with which the tractor is moving, having a range between 1 Km/hr to 30 Km/hr. Thanks

27. On Friday, September 29 2017, 18:26 by limpkin

@Vijay : yes you can :)

28. On Saturday, January 27 2024, 00:43 by Greg

Hi @limpkin, thank you for the great project. Before you rolled out the new version that takes advantage of FFT, I started looking for a way to adapt this circuit to get an analog signal out of it and perform FFT on a MC. To achieve that, I just removed the comparator branch, and it worked with a 5V MC (Arduino Uno). Now I'm trying to feed the signal to a ESP07 which operates at 3.3V and takes no more than 1V on its ADC. Am I getting it right that only R2 and R3 values need to be modified, so that the analog signal on VOUTB of the amplifier is centered around 0.5V?

29. On Sunday, January 28 2024, 22:52 by limpkin

@Greg: that's correct yes :)

Add a comment

Comments can be formatted using a simple wiki syntax.

They posted on the same topic

1. On Thursday, August 24 2023, 11:43 by MyMentorsWorld

Doppler Speed Sensor Puts FFT And AGC To Work -

(…)

Trackback URL : https://www.limpkin.fr/index.php?trackback/211

This post's comments feed