- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page