Intel® Makers
Intel® Edison, Intel® Joule™, Intel® Curie™, Intel® Galileo
Announcements
Welcome - This is a Peer-to-Peer Forum only. Intel has discontinued these products but you may find support from other customers on this Forum
9881 Discussions

measuring speed

gk91
Novice
947 Views

Hi....

I want to measure speed of a moving object in real time by using Sharp distance sensor and Intel Galileo gen 1 board with MRAA 0.8.1 library and putty. Can any one has c++ code for this.

Thanks in advance.

1 Solution
Diego_V_Intel
Employee
94 Views

Hello gopal1096,

There aren't codes for this, but I'm sure you could program it by yourself. I'll try to guide you a little bit.

The SHARP distance sensor has an analog output. You can connect it to an analog input of the Galileo board, and read its value. You will need to calibrate the sensor first to know what distance is represented by a particular voltage level in the range of 0-5V. Once you know the distance (for example that 2V represents 20cm) you can measure the time the moving object requires to go from point A to point B.

If point A is 20cm (2V following the example above), and point B is 50cm (let's say an analog value of 3.2V), and it took 0.5s, you can calculate the speed with the following formula: (pointB - pointA)/time, which with the example above would be a speed of 60cm/s.

I hope you find the information above useful. I recommend you to check the MRAA documentation to know how to read analog values: https://github.com/intel-iot-devkit/mraa intel-iot-devkit/mraa · GitHub

Regards,

Diego.

View solution in original post

1 Reply
Diego_V_Intel
Employee
95 Views

Hello gopal1096,

There aren't codes for this, but I'm sure you could program it by yourself. I'll try to guide you a little bit.

The SHARP distance sensor has an analog output. You can connect it to an analog input of the Galileo board, and read its value. You will need to calibrate the sensor first to know what distance is represented by a particular voltage level in the range of 0-5V. Once you know the distance (for example that 2V represents 20cm) you can measure the time the moving object requires to go from point A to point B.

If point A is 20cm (2V following the example above), and point B is 50cm (let's say an analog value of 3.2V), and it took 0.5s, you can calculate the speed with the following formula: (pointB - pointA)/time, which with the example above would be a speed of 60cm/s.

I hope you find the information above useful. I recommend you to check the MRAA documentation to know how to read analog values: https://github.com/intel-iot-devkit/mraa intel-iot-devkit/mraa · GitHub

Regards,

Diego.

Reply