Ultrasonic sensor blocked at 400


Hello everybody,

my ultrasonic sensor seems broken as it’s blocked at the 400 value (so the B program simply doesn’t work).
Both firmware and mBlock version are updated.

Any suggestions?


Ultrasonic sensor not working(stuck at 400)

What do you mean by blocked?


Hi Moaiamorfo,

The measuring distance of the ultrasonic sensor is in the range of 3cm to 400cm.
If the distance is out of this range, the value will always be 400.

Besides, which main board do you use with Ultrasonic sensor, you may upgrade firwmare for the main board first and test it again.
If you are using the mBot (mCore), you may refer to this instruction to do some troubleshooting on the Ultrasonic sensor module.14. The example program to test if the Ultrasonic module is working properly.docx.zip (20.3 KB)
1. How to Upgrade Firmware for mBot.docx.zip (690.6 KB)


Hi chuckmcknight,

thank you for your reply.

I mean that the sensor, applied on a mBot, always outputs the 400 value.

Thanks again.


Hi tec_support,

thank you for your reply.

The distance in my case is in range: I simply put my hand in front of mBot (yes I’m using it) at about 1 meter but I always get the 400 value as output from the sensor.

I will give a try to suggestions you attached. :wink:

Thank you!


Hi tec_support,

nothing to do: I’ve tried all the tips from the document you attached but the sprite always says “400”.

Any other suggestions?

Thanks again.


Hi Moaiamorfo,

Could you add my skype account (1021306172@qq.com) , then we may arrange a remote access to double check the issue for you.


I have the same problem.
Everything else works fine on mbot and Windows10, except the Ultrasonic sensor.
When I execute the following program

I always get 400

Any ideas what might be possibly wrong?


Hi mbot,

Was the ultrasonic sensor working before? Did it stop working sudently.
Before you tesing above program, have ou upgrade firmware for mBot to clear the history program on mCore?

Besides, it is stongly suggest that you can unplug the RJ25 cable (both side) between Ultrasonic sensor and mCore and then replug it again to make sure there is no connection loose.
Once still the same issue, kindly add my skype account either and we will arrange a remote access to double check it.


Hi mbot,

I had the same problem: I simply fixed it by plugging in with more force the RJ45 plug on the back side of the sensor. Plug in it better while connected to mBot and you will see that real values will start to come from the sensor. Give it a try!



Hi moaiamorfo,
Thank you so much! That was the problem. Eveything works fine now!



Hi, tried everything that I found on this topic, always showing 400, even when not plugged. Any help appreciated!


Ok, I was connected with the mBot card, I connected now with the Orion card and it’s ok, but I’m sure I’m not the only one who is doing this error, because the firmware transfert is operational and no error succeed. Hope this can help!


I am sorry for adding to an old topic but I read what has been posted out there before commenting on an issue. I have the same problem. My ultrasonic Sensor is stuck a 400. I try plunging the rj25 with more force, replacing the cable and other ports and no success. The unit is brand new. I am using an Me Auriga board with two 180 optical encoder motors. That is all. Please help. Thank you.


Works as designed. If the sensor can not detect anything in range, 400 is returned.


I do agree. That is how it should work. I own a moot which it work as stated. My ranger does not. When I put my hand in front of the ranger I expect this number to change and it does NOT.


A few questions:

  1. Are you working in mBlock, one of the tablet/phone apps, or native Arduino code?
  2. If you are working in native Arduino code, can you post a screen shot of the serial monitor?
  3. If you are working in mBlock (or one of the phone/tablet apps), are you using the MeAuriga board?
  4. Can you post your code (or a screenshot of your code if you are using one of the graphical environments)?
  5. May I assume that you have the code block using the same port number that the sensor is plugged into?
  6. Did you try a different cable?
  7. Have you updated the firmware via mBlock?

Sorry for asking questions that might be obvious, but without physically being there we need more information to work with. :slight_smile:

  1. Yes, I am using mBlock. And and an iPhone 7
    2I was using the same code as posted by you on ealier response
  2. On the iPhone I don’t get the option to change boards, it seems that it recognizes it automatically once Bluetooth is connected
  3. Same as you posted
    5 yes the ports have been verified
    6 yes I replaced the cables several time.
    7 firmware was updated when I first build the robot. About a two weeks ago.

Note on the issue: last night I connected the robot to my laptop via the serial port and was able to run your test program successfully. It seems that the issue is only when using mBlock app on my phone. Tonight I will test with the IPad.


So I ran the test with the iPad and it does not work. It only works when I is mBlock on my laptop. But I have use the same phone and iPad with my Mbot and it work but not with my ranger. Any suggestions?


Hi gtt115-wc,

Could you upgrade firmware for the Ranger again, then test it with mBlock APP? Here is an instruction guiding upgrade firmware to you for reference to make sure your steps are correct.How to Upgrade Firmware for Ranger with mBlock 3.4.x.docx.zip (358.8 KB)

When you test it with mBlock APP, could you please kindly take a video to show your operation and the phenomenon of the problem?

Btw, what is the language settings on your phone and iPad?