Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
10 years ago

Kit Laser distance meter ep3c5e and stm32f407 50M

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. vide1<a href="https://youtu.be/lnkyciw8i4e" target="_blank" style="color: rgb(0, 0, 102); text-decoration: none; font-family: tahoma, sans-serif; font-size: 10.6666669845581px;" data-cke-saved-href="https://youtu.be/lnkyciw8i4e">[video]https://youtu.be/lnkyciw8i4e[/video] (https://youtu.be/lnkyciw8i4e) video2<a href="https://youtu.be/iv_juur2ceg" style="color: rgb(0, 0, 102); text-decoration: none; font-family: tahoma, sans-serif; font-size: 10.6666669845581px;">[video]https://youtu.be/iv_juur2ceg[/video] (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.

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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?

    
    	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);
    

    File with the measurement results.

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