contrib-drivers icon indicating copy to clipboard operation
contrib-drivers copied to clipboard

[driver] Add driver for Ultrasonic ranging module

Open kevalpatel2106 opened this issue 7 years ago • 9 comments

I have added driver for the ultrasonic ranging module to measure the distance of the object from the sensor. I have tested this driver using HC-SR04 ultrasonic sensor. It has simple implementation and a callback listener to get the distance value in centimeters.

kevalpatel2106 avatar May 10 '17 06:05 kevalpatel2106

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

googlebot avatar May 10 '17 06:05 googlebot

I signed it!

kevalpatel2106 avatar May 10 '17 06:05 kevalpatel2106

CLAs look good, thanks!

googlebot avatar May 10 '17 06:05 googlebot

Any plans to merge this PR?

kevalpatel2106 avatar Jul 04 '17 02:07 kevalpatel2106

@kevalpatel2106 , thanks for the PR. Are you getting reliable measurements using this driver? Android Things is not a real time OS, so there's no guarantee that a timing-sensitive protocol like the one in HCSR04 wouldn't be affected by competing threads/processes. We are working on a solution for it, and when we have it, we will work with you to review and add your driver to the official library. How does that sound?

mangini avatar Jul 06 '17 20:07 mangini

@mangini That sounds good. I am getting almost up to 4-5 cm accuracy with this driver. I am using it one of my DIY Robocar projects. To make it real time, I am spinning two different threads. One to send the pulses and another to get the echoes.

kevalpatel2106 avatar Jul 10 '17 03:07 kevalpatel2106

Great. You can define different thread priority, but it still won't be real time. I will keep this PR open until we have a better way of doing it.

mangini avatar Jul 10 '17 21:07 mangini

Good morning, We've recently added a program to let developers submit drivers from their own repository to androidthings.withgoogle.com. Can you put this change in your own repository and then submit through that site?

Fleker avatar Jul 23 '18 17:07 Fleker

@Fleker Sure I will do it.

kevalpatel2106 avatar Jul 25 '18 06:07 kevalpatel2106