i want to determine the distance from the time interval between pulses.
Just imagine you dropping a stone into a deep hole and waiting for the sound of the stone hitting the floor.
The shorter the time between the point of release of the stone and the sound of it hitting the floor, the shorter
the distance the stone travelled.
The is how i want to program the circuit to operate.
Basically the sequence for programming should be as follows:
Set timer to ZERO!
Send signal to transmitting IR diode
Start timer
If your receiving IR diode(active low) - indicating it received the signal the STOP timer.
Work out the distance from halving the time and using that speed formula : distance = speed * time.
if i cant get the timer to work properly maybe i try this approach... its a little crude
but should give me some results in any case...
using an arbitrary variable say T (being an integer)
Set T = ZERO.
Send signal to transmitting diode.
If your receiving IR Diode is still low (meaning no signal received as yet)
increase T by 1
The above loop will continue to run until the receiving IR Diode goes HIGH.
Now you will have an unknown positive value in T which is not associated in any equation.
But if you plot out the value of T versus the distance you set the diodes at, then you can work out the equation
for distance - straight line equation
y = mx + c
m = (y2-y1)/(x2-x1)
(x1,y1) and (x2,y2) being co-ordinates with x representing distance and y representing the various values of T.
^
| /
T| /
| /
| /
| / this is a straight line
| /
|/
|----------------------------- >
0
your two co-ordinates (x1,y1) and (x2,y2) are for the shortest and furthest distance of measurement.
So when setting the shortest distance - use a ruler and obstruct the IR diodes approximately 5cm away.
Your distance is known cos you measured it right But you will get a T value for this distance.
Now set the furthest distance (50cm) - use the ruler, obstruct again at 50cm away and get that T value.
Plot a graph and work out the equation of T versus distance.
But this is if i cannot get the timer function to work but the procedure is the same in any case.
yes i will consult with my lecturer and respond to you all.
Just imagine you dropping a stone into a deep hole and waiting for the sound of the stone hitting the floor.
The shorter the time between the point of release of the stone and the sound of it hitting the floor, the shorter
the distance the stone travelled.
The is how i want to program the circuit to operate.
Basically the sequence for programming should be as follows:
Set timer to ZERO!
Send signal to transmitting IR diode
Start timer
If your receiving IR diode(active low) - indicating it received the signal the STOP timer.
Work out the distance from halving the time and using that speed formula : distance = speed * time.
if i cant get the timer to work properly maybe i try this approach... its a little crude
but should give me some results in any case...
using an arbitrary variable say T (being an integer)
Set T = ZERO.
Send signal to transmitting diode.
If your receiving IR Diode is still low (meaning no signal received as yet)
increase T by 1
The above loop will continue to run until the receiving IR Diode goes HIGH.
Now you will have an unknown positive value in T which is not associated in any equation.
But if you plot out the value of T versus the distance you set the diodes at, then you can work out the equation
for distance - straight line equation
y = mx + c
m = (y2-y1)/(x2-x1)
(x1,y1) and (x2,y2) being co-ordinates with x representing distance and y representing the various values of T.
^
| /
T| /
| /
| /
| / this is a straight line
| /
|/
|----------------------------- >
0
your two co-ordinates (x1,y1) and (x2,y2) are for the shortest and furthest distance of measurement.
So when setting the shortest distance - use a ruler and obstruct the IR diodes approximately 5cm away.
Your distance is known cos you measured it right But you will get a T value for this distance.
Now set the furthest distance (50cm) - use the ruler, obstruct again at 50cm away and get that T value.
Plot a graph and work out the equation of T versus distance.
But this is if i cannot get the timer function to work but the procedure is the same in any case.
yes i will consult with my lecturer and respond to you all.