Page 1 of 1

Grove Ultrasonic Ranger

Posted: Mon Apr 01, 2019 9:07 am
by poohbear
Hi
I am trying to use your Grove Ultrasonic sensor. I have downloaded the example program from the wiki. It appears to work but the example program is set to read in mm and it is more like CM, although it is not very accurate. When I try to read distance in CM or inches then the readings just appear to be random.
Can anyone advise please

Thanks

Gary

Re: Grove Ultrasonic Ranger

Posted: Mon Apr 01, 2019 10:52 am
by Benj
Hi Gary,

Please can you attach your program and I'll have a look for you. We have had very good results using the sensor so maybe the program needs a small alteration.

Re: Grove Ultrasonic Ranger

Posted: Mon Apr 01, 2019 10:56 am
by poohbear
Hi BenJ
I have attached the program. But it is the one from the wiki with the display type changed. As I said this is set to read in mm but is more like CM

Regards

Gary

Re: Grove Ultrasonic Ranger

Posted: Thu Apr 04, 2019 9:10 am
by poohbear
Hi Benj
Have you any update on this please. I have contacted Alistair but he has not replied

Regards

Gary

Re: Grove Ultrasonic Ranger

Posted: Thu Apr 04, 2019 11:24 am
by Benj
Hi Gary,

I looked at your program but couldn't see anything wrong. I'll dig out a sensor and have another test for you.

Re: Grove Ultrasonic Ranger

Posted: Thu Apr 04, 2019 12:01 pm
by Benj
Hi Gary,

Are you running Flowcode version 8.1?

If you are not then you will need to update to get the latest component fixes.

Once you are running 8.1 please load your ultrasonic project and then go to Help -> Check for updates and ensure you have the latest version of the Ultrasonic component.

Re: Grove Ultrasonic Ranger

Posted: Thu Apr 04, 2019 2:41 pm
by poohbear
Hi BenJ
We are using version 8.1.1.11 with latest downloads

Regards

Gary

Re: Grove Ultrasonic Ranger

Posted: Thu Apr 04, 2019 3:36 pm
by Benj
Hi Gary,

I've just tried it here using a BL0032 and the sensor is working very nicely with stable values in the correct range. I'll try again tomorrow with a BL0011 and double check this is also running ok.

What sort of values are you getting from the sensor? There was a bug with this component a number of months back which is why I was asking if you were running the latest version of the component. You should be on v4.
Comp.jpg
Comp.jpg (99.17 KiB) Viewed 5955 times

Re: Grove Ultrasonic Ranger

Posted: Thu Apr 04, 2019 4:17 pm
by poohbear
Hi BenJ
Thanks for this. if the BL0032 is the original EBlocks ultrasonic sensor then I have that one working OK. The grove ultrasonic sensor appears to just give random numbers if you try to measure in CM or inches if you set it to read in mm then it appears to measure in CM but not that accurately.

Regards

Gary

Re: Grove Ultrasonic Ranger

Posted: Thu Apr 04, 2019 4:58 pm
by Benj
Hi Gary.

The BL0032 is the upstream dsPIC board. I don't currently have a PIC board handy but it should be similar. I'll double check tomorrow.

Can you confirm you are using component version 4. Just go into help -> Check for updates and then tick the show up to date files checkbox. The problem you are describing sounds a lot like the problem that was previously fixed.

Re: Grove Ultrasonic Ranger

Posted: Fri Apr 05, 2019 8:34 am
by poohbear
Morning BenJ
We are definitely using Version 4. Can't seem to import the image so saved it as an attachment.

Regards

Gary

Re: Grove Ultrasonic Ranger

Posted: Fri Apr 05, 2019 9:57 am
by Benj
Hi Gary,

Right the measurements using the BL0011 PIC board are not as good as the dsPIC board and I'm also getting the mm reading as more like cm.

Mainly because it is a significantly slower processor on the PIC board. Saying this the measurement is stable and varies nicely with range adjustments.

I'll have a look at the component code and see if there is a way to make this run better on an 8-bit PIC device.

Re: Grove Ultrasonic Ranger

Posted: Fri Apr 05, 2019 10:35 am
by Benj
Hi Gary,

Right I've had a go at adding hardware based timing using a timer peripheral rather then relying on delays. This will give significantly better accuracy on slower devices e.g. the PIC devices.

There is a new component property to allow you to select the timing method. If you select the timer method then you must also select a timer peripheral to use.

I've pushed the new component update to the update system now.

Here is your program setup for the new component using timer 0 and now working very nicely.
361 - ultrasonic_ranger sensor cm.fcfx
(10.3 KiB) Downloaded 208 times

Re: Grove Ultrasonic Ranger

Posted: Fri Apr 05, 2019 10:37 am
by poohbear
Thanks for this Ben most appreciated