Problem with ULTRASONIC DISTANCE SENSOR

Hi,
My grandson & I have finally tried our new 4TRONIX ULTRASONIC DISTANCE SENSOR BREAKOUT (CE07356) with our BitBot XL & MicroBit. We cannot figure out how to get it working & are starting to wonder if it’s broken. Basically it always seems to think there is something right in front.

Running this program:
forever
show string read sonar as cm

The microbit just displays “1” all the time - whether it is plugges into the BitBot or not. If we read the sonat in usecs, it displays 46.

Otherwise the BitBot works fine.

1 Like

Hi Anthony,

Do you have the correct Bit Bot model selected in setup? Also, are you using a Micro:bit V1 or V2? Here’s some sample code which I believe should work:

image

1 Like

We just tried that code & it didn’t make any difference. It still reads 1 all the time. :frowning:

FYI, if the sonar isn’t plugged in to the BitBot, the programme returns 0 (all the time).

It’s a MicroBit V1

Thanks for your help.

Regards
Anthony

Give this a go. I know there’s been some issues with sonar libraries (mostly on the V2).

Apparently it’s fixed in the latest beta of Makecode.

I think this should link you to the beta editor, but if not it’s easy enough to recreate manually.

Have you had a close look at the ultrasonic connector? Could be a dodgy solder job? Are the pins contacting properly?

If you’ve got some photos we can try and spot something that might be a fix.

Core are pretty good on their warranty in my experience. It’s just a bit of a nuisance to have to send something back that’s otherwise working fine.

Hey Anthony,

That’s unusual, I’m not sure what’d be causing that issue with the sensor software-side. If you can please reply to the order confirmation email with some pictures of the setup that you have at the moment and a screenshot of the errors in the output you’re getting we’ll do some more troubleshooting with you, and get the appropriate returns and refunds policy sent through for you to get this fixed as soon as possible. Have a great day!

1 Like

Hi

Thank you both for the suggestions.

We tried the new/beta of makecode but it made no difference.

There are no problems with the connections or the solder joints we can see. Here are a couple of photos of the board:

And here are some shots of the whole set up:

There are no error messages from MakeCode - it’s just that the sensor always says there is something 1cm away - whether there is or not.

I’ll reply to the order confirmtion as well.

Cheers
Anthony

2 Likes

Thanks Anthony,

Without checking against a new version of the ultrasonic sensor in your setup it’s hard to tell what’s causing the issues, as the new beta should have resolved the previous bugs that were occurring on the board. I’ll get back to your email now and see what we can do to fix this up :slight_smile: :+1:

2 Likes