Page 1 of 1
motion sensor 2 example
Posted: Tue Oct 07, 2008 4:19 pm
by khaled yasin
in the motion sensor 2 example...
why we check the that if echo >120 is it to know that now signal was returned from the sensor so that we reset the timer again or what?
also is the variable "distance" that we obtain is ready to be used or we have to convert it to inches or cm's or to any other distance value we desire???
Re: motion sensor 2 example
Posted: Wed Oct 08, 2008 9:14 am
by Benj
Hello
Please could you attach the motion sensor program to the forum and I will have a look what it is doing for you.
Re: motion sensor 2 example
Posted: Thu Oct 09, 2008 6:42 pm
by khaled yasin
this is the motion sensor example ...
Re: motion sensor 2 example
Posted: Fri Oct 10, 2008 9:20 am
by Benj
Hello
The distance variable is in mm and has a maximum range distance of 8000mm.
The If IrqCount > 120 command simply detects if the pulse has timedout without returning an echo. If this happens then we still calculate the distance before starting the detect process again.
Re: motion sensor 2 example
Posted: Fri Oct 10, 2008 10:51 am
by khaled yasin
Thank you for your help....
but can we change the distance "Range" of the sensor,why 8000mm why not more or less,also from telling that the if statement >120 so i also can control the timing of the pulses that the sensor sends each time...is that right?
and one last question do i have to use the CCP pin C2 or C3 or i can use another pin instead? because i need them for another operation "am using Pic16f877
Re: motion sensor 2 example
Posted: Fri Oct 10, 2008 12:12 pm
by Benj
Hello
Im not too sure of all the details and Sean is away on holiday this week. The CCP input is neccisary as this is controlling the interrupt that is monitoring the responce from the sensor. 8000mm is probably the limit of the sensor. However I am not sure of this without digging in further. Have you looked at the sensor datasheet to see what it is capable of?
Re: motion sensor 2 example
Posted: Fri Oct 10, 2008 5:09 pm
by khaled yasin
thank you again for your fast response...
yes the sensor has a Min of 3 Cm and a Max of 4m distance detection with up to 1- 4 % of error,so it can detect objects more than 8000mm but how to do that using the flow code3 ?? may be by increasing the time that the echo nedded to be sent and received!!!
thank you again for your help....
take care
Re: motion sensor 2 example
Posted: Tue Oct 14, 2008 10:12 am
by Benj
Hello
If the sensor is capable of a max sensing range of 4m and you are receiving 8000mm then that is equivalent to 8m. Sounds like it may be hard or impossible to push the range out any further.