Ultrasonic sensor freezes


#1

Hi all

We have been programming an object collision avoidance program using the ultrasonic sensor.

The mbot is driving around. If the sensor detects a distance to an object smaller than 5 cm the mbot turns around and continues its journey.

This works fine for some time but then somehow the sensor starts detecting objects where there are none… Reading the value of the sensor shows it seems to be frozen to a fixed value.

It can be reset by updating the firmware, after which the program runs fine again for some time but then fails again.

I have replaced the battery pack already as I have the impression it works better with fresh batteries.

Any ideas on how to solve this?

thanks!
Bart


#2

Hi,

You could include your code in .sb2
Save to disk and rename to .sb2
I could look at the reason.


#3

Hi Michel

2 files attached…

“Collision avoidance” was the real program not working, after which I used “test ultrasone sensor” to check if the sensor worked.

Bart
collision avoidance.sb2 (75.1 KB)
test ultrasone sensor.sb2 (76.4 KB)


#4

Hi Bart,

I did some tests and if the ultrasonic freeze, you must put the firmware before use and upload / live after. Then the Ultrasonic goes pretty well. Live, I never had the problem.

However, the robot stops and seems to freeze a few times but it is the motors that do not run fast enough. The Robot is not freeze, it does not move because of the speed.

Conclusion: The loop in 8 provided by Makeblock is too small. I would have to think about my code and I am not considering it.
mbot.sb2 (4,6 Ko)

PS Sorry for my english at google translate.


#5

Hi Michel

Thanks for your feedback but I’m afraid I don’t understand… What do you mean by saying “the loop in 8 provided by makeblock is too small”?

Bonjou Michel

Je ne comprends pas ce que vous voulez dire avec “the loop in 8 provided by makeblock is too small”. Mon probléme c’est que le capteur commence à transmettre des mesures de distance fautives…

merci
Bart

thanks
Bart


#6

Hi Bart,

Here is a code that will allow you to see the value of the Ultrasonic in LIVE your mBot. Your mbot must not touch the ground but the wheels must turn without problem. It will run through a list of routes and when you present it with an obstacle, it displays the value.
mBotLive.sb2 (4,3 Ko)

LIVE mode with your USB cable. Give me the news …


#7

Hi Michel

Thinks something’s wrong with the mbotlive.sb2 file you shared? It’s only 4kB and looks empty…
–> Sorry I tried opening it in an older version of mblock. With the latest version I can open the file, but the sensor still looks frozen. Made a small video using my mbot and your code: https://share.icloud.com/photos/0xH9X_JhiH209vTvRW9rdmftw Sensor does not change its value.

thanks
Bart


#8

hmmm, l’upload n’accepte pas le .mblock.
Je l’ai mis sur mon site.

mBotLive.mblock


#9

Thanks Michel
I managed to use your code, but the sensor still freezes… See video: https://share.icloud.com/photos/0xH9X_JhiH209vTvRW9rdmftw

Bart


#10

Ok, according to the video, the Ultrasonic sensor has a problem. Personally, I would change PORT ultrasonic on the mBot Board.

  • Pass from port 3 to port 4 …
    if not
  • Let’s try without the motors for your if the ultrasonic works well
    mbot

#11

Hi Bart,

Sorry for the delay. Not sure if your problem is solved or not.
If not, please try the example program as Crackel shared. Once there is the freeze problem, please try connect the Ultrasonic sensor to mCore on another port and change the RJ25 cable between the Ultrasonic sensor and mCore board have a check.
Please kindly note, before you run the online program, you need upgrade firmware for mBot first.


#12

Hi Tech support

No I still have the same problem, also with Crackel’s program so I really think it is a hardware issue.
We have tried with a borrowed sensor from a friend and then everyting works great.

Do you guys have a returns policy so I can exchange the sensor?

Bart


#13

Hi Bart.

The borrowed sensor works properly, is it also the makeblock ultrasonic sensor?

If yes, I suppose there is problem on your Ultrasonic sensor. May I know where and when (the date) you bought the mBot robot. Could you please kindly send the receipt to my email address (daisy@makeblock,com). Then we can check its warranty and from where you can ask for it.


#14

Thanks Daisy

The borrowed sensor was from a friend’s mbot so the same part as the one that failed.

I have sent you an email with some details. Hope it can be replaced. The mbots are used by our children in a programming / robotics club and they absolutely love the product (if it works :wink: )

Thanks!
Bart


#15

Hi Bart,

I have received your email and replied to you. Please refer to the suggested way to request the warranty.


#16

Hi Daisy

FYI just to close this topic… The sensor was replaced and everything works great again!

Thanks for your help!
Bart


#17

It’s ok


#18

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.