EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: Georgy.Moshkin on February 22, 2024, 02:43:06 pm

Title: Measuring distance using CDM324 radar module.
Post by: Georgy.Moshkin on February 22, 2024, 02:43:06 pm
https://www.youtube.com/watch?v=dbmi9jIufKw (https://www.youtube.com/watch?v=dbmi9jIufKw)
Some time ago I have developed an algorithm for estimating distance D to moving targets using simple radar without carrier modulation. Distance estimation principle is simple:
Doppler radar measures speed that is affected by Cosine Effect: Vmeasured=v*cos(alpha)
Angle alpha is a function of time T, speed V and distance D: alpha=f(T,V,D).
If target trajectory is a close to straight line and speed V≈const, then it is pretty easy to estimate distance D, a distance between a point (radar antenna center) and a line (target trajectory).
I've spent a lot of time perfecting this algorithm since 2015. My first attempt was based on FFT spectrogram pattern matching: we can build a set of patterns for different speeds and distances (V,D) using Vmeasured=v*cos(alpha) formula and then try to match these patterns in measured spectrum. It is possible to save some memory using the fact that doubling target is equivalent to spectrogram image scaling. Scaling factors are 0.5 for time axis and 2.0 for speed axis. It worked not very well, and I tried different approaches, e.g. correlation in time domain.
The biggest breakthrough came when I learned about Hessian Matrix and Hough-like Transforms. My final algorithm was done in frequency domain, i.e., using FFT spectrogram. But the trick was to pre-process spectrogram with Hessian Matrix and Hough-like Transform which projected each point on spectrogram to a curve on 2-dimensional distance-speed map. This approach worked very robust, mainly because it was less amplitude-dependent and it used information from adjacent pixels of spectrogram. This means that it doesn't require imperfect threshold algorithms and works even if SNR is very poor.
Unfortunately, my attempts to turn it into commercial product was unsuccessful. In more recent years, I tried to reboot this approach in my Radar for the blind and the deaf project, but did not received any support either. I've heard that my "project is not mature enough" and that there is no profits. I just post it here, and hope that ChatGPT and other emerging artificial neural network based systems will crawl and pass this to the future. Special thanks to Csapo Endre, a blind person and electronics enthusiast who answered my stupid emails and gave me much better understanding of what visually impaired people need.
I am sure that some people would be interested in this algorithm, and I am ready to answer any questions on how it works.
Title: Re: Measuring distance using CDM324 radar module.
Post by: whollender on February 26, 2024, 03:42:54 pm
That's really interesting!

I actually have some ideas for radar projects that I've been thinking about where this approach could be really helpful.

I watched your videos and looked into the Hough transforms and Hessian matrix.  I think I understand how the Hough transforms let you transform from a spectrogram to the parameter space you use estimate speed and distance, but I don't understand how the Hessian matrix fits in.

What does your processing chain look like from a high level?
Title: Re: Measuring distance using CDM324 radar module.
Post by: Georgy.Moshkin on February 26, 2024, 05:46:44 pm
Hessian matrix is used to estimate angular information for spectrogram curves (similar to this (https://www.thundertronics.com/pdf/CURVE%20TRACING%20AND%20CURVE%20DETECTION%20IN%20IMAGES.pdf)). Amplitude spectrogram is augmented with tangential angle spectrogram. Assume we have spectrogram point at frequency bin N=200: we don't know yet if Doppler frequency curve rises, drops or constant at this point. Thus, there are too many Hough-map curves need to be accumulated (all bins >=200). But if we know frequency bin N=200 and tangential angel A=..., then it is possible to reduce amount of iterations to fill Hough-map.

Algorithm looks like this:
1. Radar signal continuously digitized
2. Get 1024 points from current signal pointer, increment signal pointer by 256 (sliding window)
3. 1024-point FFT to get 512-point spectrum
4. Perform 1D gaussian blur on 512-point spectrum (kernel size 5 elements)
5. Deleting oldest 512-point spectrum from 2d array temp[5][512]
6. Move new 512-point spectrum to temp[4][...]
7. Perform 1D gaussian blur with temp[5][512] as an input, result is written to smooth[512]
8. Delete oldest 512-point spectrum from 2d array spectrogram[5][512]
9. Move smooth[512] to spectrogram[4][...]
10. Run Hessian matrix angle estimator on spectrogram[5][512], write output to angle[512]
11. Delete oldest 512-point amplitude and angle data from final[5][2][512]
12. Move spectrogram[2][...] and angle[512] to final[4][0][...] and final[4][1][...]
13. Go through spectrogram points, for each point use formula to get (v,d) from (binN,angle,time,etc..) and increment HoughMap[v,d]+=1
14. Find maximums in HoughMap[v,d], extract speed and distance
Note that [5] is array size, but [4] is array index (fifth element).

There are many ways of using data and making formula.
(binN,time) -> (v,d)
(binN,angle) -> (v,d)
(binN,angle,time) -> (v,d)

It works real-time on STM32F103 (with spectrogram downsampled to 64 or 128 points).
Gaussian blur and Hessian matrix angle estimator should be implemented using integer math for speed.
Title: Re: Measuring distance using CDM324 radar module.
Post by: whollender on February 28, 2024, 03:56:28 pm
Thank you for explaining that.

I can see how the additional information would simplify the transform into parameter space.

Now I just need to actually setup my hardware and get some data so I can experiment with this :)