The Web USB API facilitates communicating with USB devices from the browser. The API is currently available in Chrome based browsers (Android, Chrome OS, Linux, macOS and Windows) and is supported in the MakeCode Editor and the  Python Editor. This enables you to flash your micro:bit straight from the browser without the need to save the .hex file first, and use serial communication between the micro:bit and the editor.


WebUSB is still in development and as such you may experience issues in using it. Here is some troubleshooting advice for using WebUSB with the micro:bit and the editors.


General

  • If you see the message 'no compatible devices found' when you try to connect, you may need to update the micro:bit firmware.

  • The micro:bit should show up in the browser as 'BBC micro:bit CMSIS-DAP'. The first time you pair the micro:bit using webUSB it may show up as 'LPC1768' and thereafter as  'BBC micro:bit CMSIS-DAP'. This does not affect the operation. See this issue on GitHub for further explanation.

  • If you are moving between editors eg Python > MakeCode, you may find that flashing via webUSB takes longer if the micro:bit already contains a program created in the previous editor.


  • If you have a battery pack plugged in to your micro:bit and are experiencing issues with WebUSB, disconnect both the battery pack and the micro USB cable to completely power down the micro:bit. Then reconnect the micro USB cable, making sure it is attached both to the computer and the micro:bit before trying to use WebUSB again. You can also reconnect the battery pack at the same time as the micro USB cable or later as you wish.


MakeCode

For further information regarding bugs and features in the MakeCode editor see issues tagged with webusb on Github.


You can also try reseting the connection in MakeCode by removing the pairing in the browser and reloading the page. You will then need to pair again using the Download button



Python Editor

error when trying to connect micro:bit or use serial

  • You will see an error if you try and use webUSB functions in an incompatible browser. As WebUSB is only available in Chrome based browsers, including the latest Edge beta, you will not be able to use the connect, flash and serial features in other browsers that do not support them.

  • Due to a technical limitation in the software you may experience data loss if you are sending data over serial at a high rate. Try adding a sleep() to the program as a workaround.

  • To use the serial console, you will need to have flashed the micro:bit from the Python editor, so that it contains valid MicroPython.

For further information regarding bugs and features in the Python editor see issues tagged with webUSB on Github.


Linux


 snap connect chromium:raw-usb

If that fails, because Chromium is old (before July 2020), it must be updated first.

snap refresh chromium --channel=candidate/raw-usb
snap connect chromium:raw-usb
  • On some Linux distributions eg. Ubuntu,  you may need to declare a udev rule. To do this:
    1. Close Chrome
    2. On Fedora, ensure that the plugdev group exists
      getent group plugdev >/dev/null || sudo groupadd -r plugdev
    3. Create a file at
      /etc/udev/rules.d/50-microbit.rules
       with the following content:
      SUBSYSTEM=="usb", ATTR{idVendor}=="0d28", MODE="0664", GROUP="plugdev"
    4. Add your user to the plugdev group (replace with your username): 
      sudo usermod -a -G plugdev <your-username>
    5. Restart the udev rules 
      sudo udevadm control --reload-rules 
    6. Log out and log back in
    7. Open Chrome and try to pair again 


Windows

  • WebUSB is only supported in Windows 8.1 or above.

  • If you have upgraded from a previous version eg Windows 7 > Windows 10 you may experience a conflict with an old driver. If the Mbed Serial driver has been manually installed (by downloading and executing the .exe) it might interfere with the Windows 8/10 automatic installation of the WebUSB driver.

To check if you have this driver already:

  1.  Open Windows Device Manager and see if the micro:bit USB device is shown. If it is...

  2. find the mbed Composite Device entry, right click on it and select Uninstall device.

  3. A new window will open, mark the Delete the driver software for this device box and click Uninstall.

  4. Unplug and replug your micro:bit and it should appear under USB devices.