Ultrasonic sensor

Grove is a modulated, ready-to-use tool set.
Much like Lego, it takes a building block approach to assembling electronics.

Moderators: lily.li, violet, salmanfarisvp, jeremy882, crail.lyu969

Post Reply
issa76
Pre-kindergarten
Pre-kindergarten
Posts: 3
Joined: Tue Jul 02, 2019 5:49 am

Ultrasonic sensor

Post by issa76 » Tue Jul 23, 2019 5:20 pm

Hello

I have a problem with the Ultrasonic sensor.

The script gives me directly the distance based on the speed of sound in the air. But I want to try it in water. So the speed is not the same! How to do to just have the time of the echo on not the distance calculated directely.

In the sensor HC-SR04 we have two outputs TRIG and ECHO and it was easy to have the time of echo but on GROVE I don't know how to do

Thanks a sorry for my poor english

bill.yu
Junior-7
Junior-7
Posts: 735
Joined: Mon Apr 02, 2018 11:05 am

Re: Ultrasonic sensor

Post by bill.yu » Wed Jul 24, 2019 2:26 pm

Hi there~,

You can get the duration(unit is uS) from below code.
If it transmits @ air, the distance is 58 * duration.
You can base on ultrasonic speed difference between water and air to get the number for water, which is 58 for air.
Then you can get the distance for water. thanks.

https://github.com/Seeed-Studio/Grove_U ... ic.cpp#L79

Post Reply