Grove Ultrasonic Ranger

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
poohbear
Posts: 26
Joined: Sat Apr 01, 2017 6:32 pm
Has thanked: 1 time
Been thanked: 8 times
Contact:

Grove Ultrasonic Ranger

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Grove Ultrasonic Ranger

Post 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.

poohbear
Posts: 26
Joined: Sat Apr 01, 2017 6:32 pm
Has thanked: 1 time
Been thanked: 8 times
Contact:

Re: Grove Ultrasonic Ranger

Post 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
Attachments
361 - ultrasonic_ranger sensor cm.fcfx
(10.18 KiB) Downloaded 241 times

poohbear
Posts: 26
Joined: Sat Apr 01, 2017 6:32 pm
Has thanked: 1 time
Been thanked: 8 times
Contact:

Re: Grove Ultrasonic Ranger

Post by poohbear »

Hi Benj
Have you any update on this please. I have contacted Alistair but he has not replied

Regards

Gary

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Grove Ultrasonic Ranger

Post 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.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Grove Ultrasonic Ranger

Post 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.

poohbear
Posts: 26
Joined: Sat Apr 01, 2017 6:32 pm
Has thanked: 1 time
Been thanked: 8 times
Contact:

Re: Grove Ultrasonic Ranger

Post by poohbear »

Hi BenJ
We are using version 8.1.1.11 with latest downloads

Regards

Gary

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Grove Ultrasonic Ranger

Post 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 5961 times

poohbear
Posts: 26
Joined: Sat Apr 01, 2017 6:32 pm
Has thanked: 1 time
Been thanked: 8 times
Contact:

Re: Grove Ultrasonic Ranger

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Grove Ultrasonic Ranger

Post 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.

poohbear
Posts: 26
Joined: Sat Apr 01, 2017 6:32 pm
Has thanked: 1 time
Been thanked: 8 times
Contact:

Re: Grove Ultrasonic Ranger

Post 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
Attachments
ultrasonic.docx
(32.57 KiB) Downloaded 189 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Grove Ultrasonic Ranger

Post 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.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Grove Ultrasonic Ranger

Post 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 209 times

poohbear
Posts: 26
Joined: Sat Apr 01, 2017 6:32 pm
Has thanked: 1 time
Been thanked: 8 times
Contact:

Re: Grove Ultrasonic Ranger

Post by poohbear »

Thanks for this Ben most appreciated

Post Reply