# I need a speed and distance sensor

Hi,

as the title suggest, I need a sensor that can detect the speed of an object in front of it. Preferably something cheap like <\$20. Also, I need a cheap distance sensor that can give accurate readings up to 2 feet. For finding the speed of the object ahead, the only solution I found was to put 2 IR sensors next to each other and using s=d/t to find the speed but that won’t work because I need to find the speed of the object ahead not to the left or right. I added an “illustration” showing my question

Thank you

the speed of the object ahead

If it is moving directly away from or toward a distance sensor,

speed = (change in distance)/(time to change). If not, brush up on your trigonometry.

What speeds? What accuracy?

jremington:
If it is moving directly away from or toward a distance sensor,

speed = (change in distance)/(time to change). If not, brush up on your trigonometry.

What speeds? What accuracy?

Ok, so basically my project is collision detection on the road and for that I need to find the speed of the object in front of me(car). So what I am saying is I need a sensor that can detect the speeds of the "cars" in front of me and can find the distance between the 2. Also, just forget about the s=d/t
My apologies if I wasn't clear enough

In that situation, a single distance sensor should work fine. Make two distance measurements, d1 at time t1, d2 at time t2.

speed = (d2-d1)/(t2 - t1)

The sign of the speed result (positive or negative) tells you whether the object in front is moving toward you or away from you.

Ultrasonic sensors are very cheap, reasonably reliable, fast and accurate, with range up to about 4 meters to larger objects.

also consider TOF sensors such as