motion sensor 2 example

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
khaled yasin
Posts: 43
Joined: Sat Sep 13, 2008 10:36 pm
Contact:

motion sensor 2 example

Post 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???

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: motion sensor 2 example

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

khaled yasin
Posts: 43
Joined: Sat Sep 13, 2008 10:36 pm
Contact:

Re: motion sensor 2 example

Post by khaled yasin »

this is the motion sensor example ...
Attachments
MotionSensor2.fcf
this the motion sensor example...
(7 KiB) Downloaded 319 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: motion sensor 2 example

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

khaled yasin
Posts: 43
Joined: Sat Sep 13, 2008 10:36 pm
Contact:

Re: motion sensor 2 example

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: motion sensor 2 example

Post 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?

khaled yasin
Posts: 43
Joined: Sat Sep 13, 2008 10:36 pm
Contact:

Re: motion sensor 2 example

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: motion sensor 2 example

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

Post Reply