Enable MicroBlocks IDE to support Bluetooth or Wi-Fi connection

Issue #305 resolved
Wenjie Wu created an issue

Can we make MicroBlocks IDE support Bluetooth or Wi-Fi connection to program the device,like:

Typical use cases include:

  1. Debug a running car, such as a line follower. It is inconvenient to have a wired connection to a running device.
  2. Debug the board that has been fixed in a specific position and is inconvenient to remove, such as a board fixed on the top of the Christmas tree 🌲, or a device fixed on the ceiling.
  3. Program a wearable.
  4. …

β€Œ

There may be some security issues(such as unauthorized access), micropython WebREPL use passwords to deal with this problem

β€Œ

Comments (9)

  1. John Maloney repo owner

    Interesting that you mention pybricks -- I just met those guys (Laurens Valk and David Lechner) today! I haven't used it, but pybricks looks pretty nice.

    There are definitely some good use-cases for connecting the MicroBlocks IDE wirelessly to the target microcontroller, and it is definitely something we've thought about. WiFi (e.g. a websocket) would be easier to implement than BLE, and more likely to provide acceptable performance, although it would be limited to boards that support WiFi (e.g. ESP3, ESP8266, and the Pico-W).

    I don't see us implementing this in the short term but it is a good idea to keep on the wish list...

  2. Wenjie Wu reporter

    Interesting that you mention pybricks -- I just met those guys (Laurens Valk and David Lechner) today! I haven't used it, but pybricks looks pretty nice.

    wow! Such a coincidence :-)

    I used pybricks to program my LEGO BOOST and LEGO SPIKE, that was a very pleasant experience. I like pybricks more than Lego's official programming environment.

    There are definitely some good use-cases for connecting the MicroBlocks IDE wirelessly to the target microcontroller, and it is definitely something we've thought about.

    Cool !

    Looking forward to using it in the future.

    β€Œ

    β€Œ

    β€Œ

  3. John Maloney repo owner

    Interesting. Thanks for sharing these links.

    This new wireless workflow uses HTTP because the Raspberry Pi Pico W does not currently support Bluetooth. An advantage of that approach is that, in theory, it should work in any web browser, including ones running on mobile devices. It doesn depend on the browser or the device supporting Bluetooth.

    However, while an HTTP approach would work for ESP boards and the Pico W, it would not support nRF5x boards like the micro:bit which support BLE but not WiFi.

    In any case, it would be worth looking at the details of what MicroPython is doing with HTTP.

  4. Wenjie Wu reporter

    β€Œ

    However, while an HTTP approach would work for ESP boards and the Pico W, it would not support nRF5x boards like the micro:bit which support BLE but not WiFi.

    circuitpython currently seems to support BLE-based workflow

    ​

  5. John Maloney repo owner

    Have you make much use of the ESP32 BLE primitives that you added to MicroBlocks about a year ago? If so, how stable are they? Have you measured the throughput?

    With the latest ESP libraries, enabling BLE support consumes around 13k bytes of RAM whether you use it or not., I had to reduce the dynamic memory pool (the memory available for lists and strings) to allow the esp32-ble version of the firmware to compile.

    Although the ESP32 has a lot of RAM, much of it is used by the OS. Apparently only 128k are available for MicroBlocks, and BLE support eats into that.

    The newer versions of the ESP32 (e.g. S3, C3, and C6) may make more RAM available to applications.

    Meanwhile, I continue to think that WebSockets may be a better way to support wireless programming of WiFi-enabled boards. But we haven't yet done any experiments with that.

  6. Wenjie Wu reporter

    Have you make much use of the ESP32 BLE primitives that you added to MicroBlocks about a year ago? If so, how stable are they? Have you measured the throughput?

    Not using it much. It has only been used on some little projects, and no problems have been found yet. Since MQTT is available out of the box and is easy to use, I am using MQTT most of the time.

    As far as I know, a high school teacher used it in a physics experiment(work with phyphox), and the stability seems to be good.

    Meanwhile, I continue to think that WebSockets may be a better way to support wireless programming of WiFi-enabled boards. But we haven't yet done any experiments with that.

    I've read some articles before complaining about the complexity of the bluetooth stack, Websockets may be more promising

    β€Œ

    β€Œ

    β€Œ

    β€Œ

    β€Œ

  7. John Maloney repo owner

    Marking this resolved.

    We now have BLE support on ESP32, the micro:bit V2, and a few other nRF52 boards. Not yet support on Pico-W because the underlying BLE support is still under development.

  8. Log in to comment