T3.2 with FFT improves performance of cheap doppler radar

Status
Not open for further replies.
Well. Works like a charm with the T3.5. Made an aluminum horn using your first pattern and a bunch of the hvac tape. Still getting some readings from the back = have to work on that. It starts to pick up motion at about the edge of the horn about 6 inches away. Saw a couple of horns with what looks like a scallop divider on top and bottom, down the center. Guess same idea as yours. May try that as well as extending the horn straight out. I am attaching a snapshot of the data from plotter - think it looks ok. Works a lot better than what I did a few years ago. Again great job.

Mike

UPDATE: I ran two additional tests tonight to check out the actual raw data I am getting with the existing setup. Actually pretty happy with the results but still sorting through the differences between the HB100 backpack that I got from tindie vs your design. Anyway, in this first test I am first moving my hand back and forth across the horn and then towards and away and back again. I wind up with two peaks as expected the first at around 0.45 seconds and the second at 0.7 seconds (mid points). Guess the speed of my hand movements would be between 3.4-3.8 mph across and around 3 mph back and forth?
Hand.png

The second test is me getting up from my desk and walking to the front of the house and the walking back and sitting down. Both directions the speed seems to be around 3 mph or so, I think.
Walking.png

Is this analysis about right?
 

Attachments

  • 2017-10-29 14.51.07.jpg
    2017-10-29 14.51.07.jpg
    81.6 KB · Views: 238
  • HB100FFT.PNG
    HB100FFT.PNG
    338 KB · Views: 194
Last edited:
Was looking at the data a little more now that I am not asleep and running a few more tests and no matter how slow or fast I move my hand in front of the sensor I always seem to get the max bin at f8 and when moving slowly I will see large peaks but a bit smaller at the lower frequencies (f1 or f2). In looking at the code I was wondering if you could explain the bin ranges for fft that used, read(9,13) etc as well as the addition multiplication factors you are using for each level:

Code:
    level[0] = ((1.0-fa)*level[0]) + fa * myFFT.read(0) * 0.5 * A_GAIN;
    level[1] =  ((1.0-fa)*level[1]) + fa * myFFT.read(1) * 1.5 * A_GAIN;
    level[2] =  ((1.0-fa)*level[2]) + fa * myFFT.read(2) * 2 * A_GAIN;
    level[3] =  ((1.0-fa)*level[3]) + fa * myFFT.read(3) * 3.5 * A_GAIN;
    level[4] =  ((1.0-fa)*level[4]) + fa * myFFT.read(4, 5) * 5 * A_GAIN;
    level[5] =  ((1.0-fa)*level[5]) + fa * myFFT.read(6, 8) * 7 * A_GAIN;
    level[6] =  ((1.0-fa)*level[6]) + fa * myFFT.read(9, 13) * 9 * A_GAIN;
    level[7] =  ((1.0-fa)*level[7]) + fa * myFFT.read(14, 22) * 11.0 * A_GAIN;
    level[8] =  ((1.0-fa)*level[8]) + fa * myFFT.read(23, 40) * 15 * A_GAIN;
    level[9] =  ((1.0-fa)*level[9]) + fa * myFFT.read(41, 66) * 15 * A_GAIN;
    level[10] = ((1.0-fa)*level[10]) + fa * myFFT.read(67, 93) * 18 * A_GAIN;
    level[11] = ((1.0-fa)*level[11]) + fa * myFFT.read(94, 131) * 10 * A_GAIN;

Thanks
Mike

EDIT: in looking at the equations some more, assuming I am doing the calcs right, each freq bin is 10.25 (43/4). I think this would imply that for level 8 you frequency range is (40-23+1) = 18 * 10.75 = 193.5hz or 247.25 to 442.75 hz. The power that you list for level 8, I would think should that be the average power over the entire range centered at 344 hz since the read is the sum over the specified range. Please let me know if this is correct?
 
Last edited:
I went ahead and implement my perception of the fft in the previous post with the following results: 1) peak frequency at 43 hz which I think equates to about 1.35 mph. I am attaching the charts for reference. Peaks are definitely not as pronounced but that may be because of the basic horn I am using. Here is the code if you want to give it a try:

Code:
// FFT to select freq. bins from signal on Teensy 3.2 pin A2 (ADC input)
// Set OUT_ALARM pin high if signal in some freq. bins over threshold
// Thanks to Teensy forum users: neutronned and Frank B.

#include <Audio.h>

AudioInputAnalog         adc1;       
AudioAnalyzeFFT1024      myFFT;
AudioConnection  patchCord1(adc1, myFFT);

#define A_GAIN (5.0)    // gain applied to analog input signal
#define THRESH (5)    // threshold above which "movement" detected  
#define LED1 (13)       // onboard signal LED
#define OUT_ALARM (3)   // alarm signal (motion detected)
#define CPRINT (12)      // frequency bins (columns) to print

float level[16];  // frequency bins
float freq[16];   // frequencies
float frange[16]; //frequency ranges
float alarm;
static float fa = 0.10;  // smoothing fraction for low-pass filter
int loops = 0;   // how many times through loop
boolean motion = false;  // if motion detected

void setDACFreq(int freq) {  // change sampling rate of internal ADC and DAC
const unsigned config = PDB_SC_TRGSEL(15) | PDB_SC_PDBEN | PDB_SC_CONT | PDB_SC_PDBIE | PDB_SC_DMAEN;
    PDB0_SC = 0; //<--add this line
    PDB0_IDLY = 1;
    PDB0_MOD = round((float)F_BUS / freq ) - 1;    
    PDB0_SC = config | PDB_SC_LDOK;
    PDB0_SC = config | PDB_SC_SWTRIG;
    PDB0_CH0C1 = 0x0101;    
}

void setup() {
  AudioMemory(12);
  AudioNoInterrupts();
  setDACFreq(11025);
  myFFT.windowFunction(AudioWindowHanning1024);
  AudioInterrupts();
  
  Serial.begin(115200);
  digitalWrite(LED1, false);
  pinMode(LED1, OUTPUT);
  digitalWrite(OUT_ALARM, false);
  pinMode(OUT_ALARM, OUTPUT);
  digitalWrite(LED1, true);
  digitalWrite(OUT_ALARM, true);
  delay(1000);

  // single frequency bins
  freq[0] = 10.75;
  freq[1] = freq[0] * 2;
  freq[2] = freq[0] * 3;  
  freq[3] = freq[0] * 4;
  //multiple frequency bins
  // frequency range /2 for mid point of range
  frange[0] = freq[0] * 2 / 2.;
  frange[1] = freq[0] * 3 / 2.;
  frange[2] = freq[0] * 5 / 2.;
  frange[3] = freq[0] * 5 / 2.;
  frange[4] = freq[0] * 18 / 2.;
  frange[5] = freq[0] * 26 / 2.;
  frange[6] = freq[0] * 27 / 2.;
  frange[7] = freq[0] * 38 / 2.;
  
  //mid-point frequency
  freq[4] = frange[0] + 5 * freq[0];
  freq[5] = frange[1] + 7 * freq[0];
  freq[6] = frange[2] + 10 * freq[0];
  freq[7] = frange[3] + 15 * freq[0];
  freq[8] = frange[4] + 24 * freq[0];
  freq[9] = frange[5] + 42 * freq[0];
  freq[10] = frange[6] + 68 * freq[0];
  freq[11] = frange[7] + 95 * freq[0];
  
  Serial.print("min");
  Serial.print(",");
  Serial.print("alm");
  for (int i=0; i<CPRINT; i++) {  // print column headers
      Serial.print(",");
      Serial.print("f");
      Serial.print(freq[i]);
      //Serial.print(i);
  }
  Serial.println();
  Serial.println("# Doppler Microwave FFT on Teensy 3.1  5-AUG-2017");
  digitalWrite(LED1, false);  digitalWrite(OUT_ALARM, false);
  
} // end setup()

void loop() {
  if (myFFT.available()) {
    level[0] = ((1.0-fa)*level[0]) + fa * myFFT.read(0) * 0.5 * A_GAIN;
    level[1] =  ((1.0-fa)*level[1]) + fa * myFFT.read(1) * 1.5 * A_GAIN;
    level[2] =  ((1.0-fa)*level[2]) + fa * myFFT.read(2) * 2 * A_GAIN;
    level[3] =  ((1.0-fa)*level[3]) + fa * myFFT.read(3) * 3.5 * A_GAIN;
    level[4] =  (((1.0-fa)*level[4]) + fa * myFFT.read(4, 5) * 5 * A_GAIN) / 2.;
    level[5] =  (((1.0-fa)*level[5]) + fa * myFFT.read(6, 8) * 7 * A_GAIN) / 3.;
    level[6] =  (((1.0-fa)*level[6]) + fa * myFFT.read(9, 13) * 9 * A_GAIN) / 5.;
    level[7] =  (((1.0-fa)*level[7]) + fa * myFFT.read(14, 22) * 11.0 * A_GAIN) / 5.;
    level[8] =  (((1.0-fa)*level[8]) + fa * myFFT.read(23, 40) * 15 * A_GAIN) / 18.;
    level[9] =  (((1.0-fa)*level[9]) + fa * myFFT.read(41, 66) * 15 * A_GAIN) / 26.;
    level[10] = (((1.0-fa)*level[10]) + fa * myFFT.read(67, 93) * 18 * A_GAIN) / 27.;
    level[11] = (((1.0-fa)*level[11]) + fa * myFFT.read(94, 131) * 10 * A_GAIN) / 38.;
    alarm =  level[1] + level[2] + (2*level[3]) + (2*level[4]);

    if (alarm > THRESH) {
      motion = true;
      digitalWrite(OUT_ALARM, true);
    } else {
      motion = false;
      digitalWrite(OUT_ALARM, false);
    }
    
    if ( ((loops++)%10 == 0) ) {
     Serial.print((float)millis()/60000.0);
     Serial.print(",");
     Serial.print(alarm);    
     for (int i=0; i<CPRINT; i++) {
      Serial.print(",");
      Serial.print(level[i]);
     }
     Serial.println();
    }
  }
} // end main loop()

EDIT 10/31: I made one more change. I changed the window to a Blackman Harris and here is a shot of me walking away and coming back
Walking-BH.png

the first three peaks at 21.5 is me moving my hands on the mouse in front of the horn. The next two peaks is me walking away and coming back at 43 hz. Then again at the end you see the 21.5 hz line increasing, that the mouse moves again. Ok that's it until I figure out what I want to do with horn - a new one or play with this one some more :)

Thanks
Mike
 

Attachments

  • Picture1.png
    Picture1.png
    186.5 KB · Views: 182
Last edited:
Hello
Hope you're well and great work.

You say it doesn't detect movement in the back or sides.

I used this copper clad : http://amzn.to/2E7H1Mw and this foil and it still detected - any thoughts?

Also, is it possible it's a bad version of copper clad?
Or, something to do with the sensor? I'm using : http://amzn.to/2CAX7Bh which uses the HB100 and has a detection range of 2 - 16 m
And I'm using a frequency library so that shouldn't be the issue
 
radiation pattern results

In case of interest, a measured transmitted-power antenna pattern from the HB100 sitting in the truncated pyramidal horn. Using a laughable kludged-together pile of uncalibrated gear. I was curious what the effect of the dual patch sitting at the base of the horn offset from center, would look like. The pattern is offset from the centerline as I expected; I didn't guess the horizontal lobes would be quite so pronounced though.
View attachment 11535

sir i appreciate this great work and it so helpful.

i wnat to know that how did you get this radiation pattern results?
in case i want to test my antenna
 
Thanks, and nice project!

I have my application running on either FFT1024 or FFT256. At 1Khz span there is about 1Hz resolution with FFT1024 and about 4Hz on the FFT256.
I plan to post my project on this same forum category soon. I will add the link after I'm done.
 
measuring antenna pattern at 10 GHz

By the way, about my antenna pattern, that was a project in itself. You need a detector of some kind. I tried an old HP X421A (8 - 12.4 GHz crystal detector on WR-90 waveguide flange) and also a newer breakout board for AD8317 log detector good to 10 GHz, both from ebay. Both of those worked to detect a useful amount of signal at short range eg. a few feet away. Here's a few examples of those parts:
https://www.ebay.com/itm/HP-X421A-X-Band-Waveguide-Crystal-Detector/263042048425
https://www.ebay.com/itm/AD8317-1MH...-Detector-Controller-f-Amplifier/172248001491
...by the way, both of them and especially the broadband AD8317 chip, are happy to detect 2.4 GHz wifi signals as well, so locate your test setup appropriately. The X421A has the wavguide flange built-in, the AD8317 board had only a SMA connector so I had to make my own antenna/waveguide setup connecting a length of WR-75 + horn to a length of microwave cable with SMA connector.
https://www.thingiverse.com/thing:2538873
https://www.thingiverse.com/thing:2512601

I 3D-printed a WR-90 type microwave horn shape for the receive unit, and put copper foil on the inside surface. Then I used a motorized rotation stage I had from another project, to move the Tx antenna around 360 degrees, and I put a GPIB multimeter on the detector output, and logged the output so I could plot it. I did everything twice, once per antenna orientation so I could get H and V orientations. In the photos you see white polystyrene sheets in front of the horn apertures, I was also experimenting there (impedance different from air so you can do a little bit of tuning as you move it out in front of the horn, to improve signal level). Don't forget to check detector orientation, because both Tx and Rx are linearly polarized and you can lose 20 dB with the wrong orientation. Like I said, it was a project.

20170916_120104.jpg 20170916_120116.jpg 20170917_150037.jpg 20170917_155313.jpg
 
Last edited:
One other note about sensitivity towards the backside. It is actually quite difficult to shield microwaves 100% because even a very tiny gap or crack in your groundplane can act as a slot antenna and give you some radiation, plus diffraction around the edges, not to mention of course reflection from anything in front of the antenna that will scatter towards the rear. Also, the power and signal lines going to the board can act as transmission lines and also antennas unless you have an efficient series choke at 10 GHz. When I say I did not pick up motion from the back, I meant sensitivity was much reduced towards the rear, but I did not totally eliminate it. The antenna pattern shows I had a front-to-back ratio of at least 15 dB or so, but that is about as much dynamic range as I had so I can't say more (noise floor of my simple un-amplified receiver). And also that device was uncalibrated to start with, plus operating a bit outside it's spec range (10.525 GHz on a 10 GHz board) so who knows what the calibration really was.
 
Status
Not open for further replies.
Back
Top