Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 35 of 35

Thread: T3.2 with FFT improves performance of cheap doppler radar

  1. #26
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    New York
    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.


    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?
    Click image for larger version. 

Name:	Hand.png 
Views:	95 
Size:	73.5 KB 
ID:	11928

    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.
    Click image for larger version. 

Name:	Walking.png 
Views:	87 
Size:	115.6 KB 
ID:	11929

    Is this analysis about right?
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	2017-10-29 14.51.07.jpg 
Views:	109 
Size:	81.6 KB 
ID:	11924   Click image for larger version. 

Name:	HB100FFT.PNG 
Views:	84 
Size:	338.0 KB 
ID:	11925  

    Last edited by mjs513; 10-30-2017 at 03:18 AM.

  2. #27
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    New York
    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:

        level[0] = ((1.0-fa)*level[0]) + fa * * 0.5 * A_GAIN;
        level[1] =  ((1.0-fa)*level[1]) + fa * * 1.5 * A_GAIN;
        level[2] =  ((1.0-fa)*level[2]) + fa * * 2 * A_GAIN;
        level[3] =  ((1.0-fa)*level[3]) + fa * * 3.5 * A_GAIN;
        level[4] =  ((1.0-fa)*level[4]) + fa *, 5) * 5 * A_GAIN;
        level[5] =  ((1.0-fa)*level[5]) + fa *, 8) * 7 * A_GAIN;
        level[6] =  ((1.0-fa)*level[6]) + fa *, 13) * 9 * A_GAIN;
        level[7] =  ((1.0-fa)*level[7]) + fa *, 22) * 11.0 * A_GAIN;
        level[8] =  ((1.0-fa)*level[8]) + fa *, 40) * 15 * A_GAIN;
        level[9] =  ((1.0-fa)*level[9]) + fa *, 66) * 15 * A_GAIN;
        level[10] = ((1.0-fa)*level[10]) + fa *, 93) * 18 * A_GAIN;
        level[11] = ((1.0-fa)*level[11]) + fa *, 131) * 10 * A_GAIN;

    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 by mjs513; 10-30-2017 at 02:10 PM.

  3. #28
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    New York
    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:

    // 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() {
      digitalWrite(LED1, false);
      pinMode(LED1, OUTPUT);
      digitalWrite(OUT_ALARM, false);
      pinMode(OUT_ALARM, OUTPUT);
      digitalWrite(LED1, true);
      digitalWrite(OUT_ALARM, true);
      // 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];
      for (int i=0; i<CPRINT; i++) {  // print column headers
      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 * * 0.5 * A_GAIN;
        level[1] =  ((1.0-fa)*level[1]) + fa * * 1.5 * A_GAIN;
        level[2] =  ((1.0-fa)*level[2]) + fa * * 2 * A_GAIN;
        level[3] =  ((1.0-fa)*level[3]) + fa * * 3.5 * A_GAIN;
        level[4] =  (((1.0-fa)*level[4]) + fa *, 5) * 5 * A_GAIN) / 2.;
        level[5] =  (((1.0-fa)*level[5]) + fa *, 8) * 7 * A_GAIN) / 3.;
        level[6] =  (((1.0-fa)*level[6]) + fa *, 13) * 9 * A_GAIN) / 5.;
        level[7] =  (((1.0-fa)*level[7]) + fa *, 22) * 11.0 * A_GAIN) / 5.;
        level[8] =  (((1.0-fa)*level[8]) + fa *, 40) * 15 * A_GAIN) / 18.;
        level[9] =  (((1.0-fa)*level[9]) + fa *, 66) * 15 * A_GAIN) / 26.;
        level[10] = (((1.0-fa)*level[10]) + fa *, 93) * 18 * A_GAIN) / 27.;
        level[11] = (((1.0-fa)*level[11]) + fa *, 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) ) {
         for (int i=0; i<CPRINT; i++) {
    } // 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
    Click image for larger version. 

Name:	Walking-BH.png 
Views:	80 
Size:	80.0 KB 
ID:	11946

    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

    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Picture1.png 
Views:	72 
Size:	186.5 KB 
ID:	11942  
    Last edited by mjs513; 10-31-2017 at 01:15 PM.

  4. #29
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    New York

    Spectrogram Visualizer

    I was looking for something else and came across a link to an adafruit site for fun with fft. It uses a teensy for sampling and uses the dsp library directly. You might wan to check it out:

    I tried it and it does work.

  5. #30
    Hope you're well and great work.

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

    I used this copper clad : 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 : 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

  6. #31

    What type of shielding did you use?
    What works best? Other than lead hah
    I tried using the copper clad ( this one ) and this foil ( around the edges to make everything covered.

    Any suggestions are greatly appreciated

  7. #32

    radiation pattern results

    Quote Originally Posted by JBeale View Post
    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.
    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

  8. #33
    Junior Member
    Join Date
    Aug 2018
    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.

  9. #34
    Senior Member
    Join Date
    Oct 2012
    Portland OR

    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: 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.

    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.

    Click image for larger version. 

Name:	20170916_120104.jpg 
Views:	51 
Size:	123.5 KB 
ID:	14342 Click image for larger version. 

Name:	20170916_120116.jpg 
Views:	56 
Size:	122.0 KB 
ID:	14343 Click image for larger version. 

Name:	20170917_150037.jpg 
Views:	69 
Size:	102.1 KB 
ID:	14344 Click image for larger version. 

Name:	20170917_155313.jpg 
Views:	55 
Size:	154.8 KB 
ID:	14345
    Last edited by JBeale; 08-03-2018 at 06:04 PM. Reason: add links to horn antenna models

  10. #35
    Senior Member
    Join Date
    Oct 2012
    Portland OR
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts