Skip to main content
asv-lab2
Associate
July 9, 2015
Question

Kit Laser distance meter stm32f407 50M

  • July 9, 2015
  • 3 replies
  • 908 views
Posted on July 09, 2015 at 10:30

I work on a project ''distance meter kit '' Here is the link. 

http://asv-lab.ru/blog/fazovyj_lazernyj_dalnomer_asv50m/2015-06-26-12

  There are videos. 

https://youtu.be/lnKYCIw8I4E

 

https://youtu.be/Iv_juuR2Ceg

 In the comments under the video link to the file excel. This file is recorded measurement phase at a frequency of 45 MHz, 30 MHz, 3 MHz. Measurement of the phase increments of 100 millimeters. From the values of the phase, we can calculate the distance. 45 MHz Phase 0-360 = 3,75M. 30 MHz Phase 0-360 = 5M. 3 MHz Phase 0-360 = 50M I have a problem at the time of the transition phase from 0 to 360 or 360 to 0. It is not always properly defined range 0-3,75m or 3,75-7,5m Help calculate. thank.
    This topic has been closed for replies.

    3 replies

    Tesla DeLorean
    Guru
    July 9, 2015
    Posted on July 09, 2015 at 17:01

    The first measurement for 2700 mm seems a bit bogus. Like it's 60 degrees off

    Not sure what the scope of the phase is here, assuming the phase is 16-bit, so each tick is 360/65536

    I'm going to guess you're doing an average, and when your floating in the 0 degrees region, you get some measurements (or a measurement) in the 65500 ish range and you're adding that in, skewing the numbers, instead of recognizing it as a negative number and subtracting 65536 from it to place it in the prior cycle instead of the current one.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    asv-lab2
    asv-lab2Author
    Associate
    July 9, 2015
    Posted on July 09, 2015 at 17:17

    tick = 1/120000000;

    interfal = 655350;

    average = 10;

    phase f1-f2 = 11,7358;Khz 

    asv-lab2
    asv-lab2Author
    Associate
    January 26, 2016
    Posted on January 26, 2016 at 17:09

    sorry for my bad English.

    I corrected the algorithm. The phase measurement 45 MHz and 3 MHz at a distance of 30 meters 1 step 20mm 1500 points. 3 MHz for calculating the multiplier i.

    ph_long = ph45Mhz+360*i The source code below how to do this correctly?

    [code]

    if ((phase3Mhz_deg > 33000) || (phase3Mhz_deg < 300)) {

    coefmux = 1;

    } else if ((phase3Mhz_deg >= 300) && (phase3Mhz_deg < 1100)) {

    if (phase45Mhz_deg > 18000) {

    coefmux = 1;

    } else {

    coefmux = 2;

    }

    } else if ((phase3Mhz_deg >= 1100) && (phase3Mhz_deg < 3100)) {

    coefmux = 2;

    } else if ((phase3Mhz_deg >= 3100) && (phase3Mhz_deg < 4100)) {

    if (phase45Mhz_deg > 18000) {

    coefmux = 2;

    } else {

    coefmux = 3;

    }

    } else if ((phase3Mhz_deg >= 4100) && (phase3Mhz_deg < 5100)) {

    coefmux = 3;

    } else if ((phase3Mhz_deg >= 5100) && (phase3Mhz_deg < 6400)) {

    if (phase45Mhz_deg > 18000) {

    coefmux = 3;

    } else {

    coefmux = 4;

    }

    } else if ((phase3Mhz_deg >= 6400) && (phase3Mhz_deg < 8300)) {

    coefmux = 4;

    } else if ((phase3Mhz_deg >= 8300) && (phase3Mhz_deg < 8900)) {

    if (phase45Mhz_deg > 18000) {

    coefmux = 4;

    } else {

    coefmux = 5;

    }

    } else if ((phase3Mhz_deg >= 8900) && (phase3Mhz_deg < 10700)) {

    coefmux = 5;

    } else if ((phase3Mhz_deg >= 10700) && (phase3Mhz_deg < 11500)) {

    if (phase45Mhz_deg > 18000) {

    coefmux = 5;

    } else {

    coefmux = 6;

    }

    } else if ((phase3Mhz_deg >= 11500) && (phase3Mhz_deg < 13000)) {

    coefmux = 6;

    } else if ((phase3Mhz_deg >= 13000) && (phase3Mhz_deg < 14000)) {

    if (phase45Mhz_deg > 18000) {

    coefmux = 6;

    } else {

    coefmux = 7;

    }

    } else if ((phase3Mhz_deg >= 14000) && (phase3Mhz_deg < 15500)) {

    coefmux = 7;

    } else if ((phase3Mhz_deg >= 15500) && (phase3Mhz_deg < 16500)) {

    if (phase45Mhz_deg > 18000) {

    coefmux = 7;

    } else {

    coefmux = 8;

    }

    } else if ((phase3Mhz_deg >= 16500) && (phase3Mhz_deg < 18000)) {

    coefmux = 8;

    } else if ((phase3Mhz_deg >= 18000) && (phase3Mhz_deg < 19300)) {

    if (phase45Mhz_deg > 18000) {

    coefmux = 8;

    } else {

    coefmux = 9;

    }

    } else if ((phase3Mhz_deg >= 19300) && (phase3Mhz_deg < 20400)) {

    coefmux = 9;

    } else if ((phase3Mhz_deg >= 20400) && (phase3Mhz_deg < 21700)) {

    if (phase45Mhz_deg > 18000) {

    coefmux = 9;

    } else {

    coefmux = 10;

    }

    } else if ((phase3Mhz_deg >= 21700) && (phase3Mhz_deg < 23000)) {

    coefmux = 10;

    } else if ((phase3Mhz_deg >= 23000) && (phase3Mhz_deg < 24500)) {

    if (phase45Mhz_deg > 18000) {

    coefmux = 10;

    } else {

    coefmux = 11;

    }

    } else if ((phase3Mhz_deg >= 24500) && (phase3Mhz_deg < 26500)) {

    coefmux = 11;

    } else {

    coefmux = 0;

    }

    tempdouble = 36000.0 * (coefmux - 1.0) + phase45Mhz_deg;

    ph_long = floor(tempdouble);

    [/code]

    File with the measurement results.

    https://drive.google.com/file/d/0B3blsgr5W0tTWm1menI4eHctNkU/view?usp=sharing