EduBlocks icon indicating copy to clipboard operation
EduBlocks copied to clipboard

Upload program for generic Micropython over Serial

Open DrSkunk opened this issue 4 years ago • 2 comments

For the next edition of our summer hacker camp Fri3d Camp we designed a badge featuring the ESP32 with Micropython. As an easy way for beginners to start programming this badge we were looking at EduBlocks.

We looked at how the Ampy tool uploads the files and it only uses commands already available on the micropython board. https://github.com/scientifichackers/ampy/blob/8162f7e918b4f1837551ab8d50f20ca4d5c4ccaa/ampy/files.py#L209

The experimental Chrome feature Web Serial exposes the UART of micropython to the browser. Here I've made an example where you can open the COM port: https://sebastiaanjansen.be/web-serial-monitor/ ,with source here: https://github.com/DrSkunk/web-serial-monitor As an alternative, the Arduino Create Agent does something similar, exposing COM ports over websockets. It has to be installed though : https://github.com/arduino/arduino-create-agent

Combining these two we built a successful proof of concept where we were able to upload a main.py file with only the browser.

We've also forked the EduBlocks repository and made a proof of concept there as well where the generated EduBlocks code gets uploaded: https://github.com/area3001/EduBlocks/tree/feature/fri3dbadge

We're curious to hear your thoughts on this!

DrSkunk avatar Jun 17 '20 19:06 DrSkunk

Hi @DrSkunk,

This sounds really cool! I've had a go with the serial upload feature and after enabling the flag in google and works well.

Please let me know what your future plans are for this, I'm really interested!

JoshuaLowe1002 avatar Jun 17 '20 19:06 JoshuaLowe1002

So far our plans are forking the project and adding our badge. We've copied the "flash" flow of the Microbit and added the serial upload there. https://github.com/area3001/EduBlocks/blob/feature/fri3dbadge/ui/src/platforms/fri3dbadge/flash.ts

The idea was if maybe we can add a generic micropython board to the screen, like you have CircuitPython and add the upload button there.

DrSkunk avatar Jun 17 '20 20:06 DrSkunk