I have successfully ported MicroPython to the PicoCalc

Is the M5StickC Plus2 definitely an S3? I’ve been looking at these devices myself, but the only ones I can find use the ESP32-PICO-V3-02. The PICO (like the original ESP32, I believe, and the M5Stack NanoC6 (with its ESP32-C6FH4)) don’t have a native USB interface and rely on a USB to UART on the board. This means they don’t support the TinyUF2 bootloader (allowing flashing via a USB Mass Storage device), and with CircuitPython they won’t present a CIRCUITPYTHON drive to allow easy upload of CircuitPython code. With those ones, you’ve got to use esptool to flash CircuitPython, then use ampy or Thony to upload the Python code over an invisible connection to the REPL that just streams some commands and your code to the device.

An S3 M5StickC would tick a few boxes for me!

I guess it’s not. I went digging and found the same as you – it’s a ESP32-PICO-V3-02.

I’ve never used MicroPython (or CircuitPython) before starting to investigate for the PicoCalc. I’ve been using the ESP32 devices I have with C++ and Ardunio, via PlatformIO, and although the platform specific code is different for each device, the rest of the code has pretty much been the same and I haven’t been bothered by which particular processor or hardware differences there were.

So it seems like it won’t do what you’re looking for. :frowning: Sorry if my own ignorance in the details of these devices got your hopes up!

1 Like

It absolutely got my hopes up, but no worries :laughing: I’ve done some Micropython programming before but have only recently started experimenting with CircuitPython. I like the standard library and, on fully supported boards, the simple “copy code.py to /media/CIRCUITPYTHON” concept. I get enough of casting types and managing memory in my day job, so playing with Python in my spare time is pretty low stress; I spent a few years working in Python jobs and despite the crappy CPython toolchain (venvs are a crutch for bad tooling, and that’s a hill I’ll die on), Python as a language is really nice.

I work as a sysadmin/software engineer at a university, and every now and then one of the teaching staff will decide to run an entry level class or workshop on microcontrollers. and one of the biggest stumbling blocks for less experienced students is the typical MCU toolchain (“why do I need to ‘compile’ my program?”, “why does it take tens of seconds to compile and upload it?”, “why can’t I see results instantly when I save my code, like in JavaScript frameworks with hot reload?”). No to mention, maintaining the toolchains on our lab machines can be a pain. I’m thinking of recommending some cheap dev board with CircuitPython support to my academic colleagues in the future - write your code in VSCode or whatever, and save it to /media/CIRCUITPYTHON/code.py (or, more likely, D:\code.py…) and it instantly reloads and you can see the results. Great for zero friction teaching.

It’s also easier for me to support for researchers - many of them don’t have a solid C background and fumble their way through the IoT portions of their research; I’d much rather help them focus on their research goals (usually just reading some sensor data and sending it to some MQTT broker or a web API) than have them struggle with something more powerful but much less forgiving, when they really just need to write the code once and forget about it until they publish.

Personally, though, I like it just for tinkering. Making toy programs in (neo)vim, saving them to /Volumes/CIRCUITPYTHON/code.py and having them run instantly is pretty fun. As is opening a serial console to a real (Circuit)Python REPL where I can experiment live on the device.

On a similar note, I’m quite interested in the approach the presenter in this video takes for prototyping medical device software in MicroPython. He uses Jupyter Notebook with a remote MicroPython kernel. It looks like there’s a CircuityPython equivalent, too.

It sounds to me that the ESP32-S3 route might make the most usable system given the inclusion of WiFi and Bluetooth. It gets better with an m5launcher-type app which given the screen size makes the picocalc a much better product than the cardputer.

1 Like

Hi, jd3096,

I want to run pico or pico2 with micropython, but I’m interested in ESP32, so I bought the ( ESP32-S3-Pico - Waveshare).

PicoCalc hasn’t arrived yet! ha-ha!!

I’m building a firmware for micropython, but what “st7789_mpy” are you using?

I’m able to create the firmware by freeze .py in russhughes/st7789_mpy, but I don’t have PicoCalc so I don’t really run that firmware, so please let me about st7789 driver.

Yes, I didn’t even compile the firmware myself but directly used the pre-built firmware from this repository. The picocalc uses an ILI9488 screen. Fortunately, through my testing, I found that by only modifying the ST7789 initialization commands, the same program could be used to drive the screen. You can check how I initialized the screen in this file in my repository.
PICOCALC-micropython/src/utils/drivers.py at main · jd3096-mpy/PICOCALC-micropython · GitHub

Hi, jd3096,

Thanks!
Somehow I think the ST7789 module will work.
Now I just change the I2C and SPI pins for Waveshare.

And I’ll wait for PicoCalc to arrive! :grinning_face_with_smiling_eyes:

1 Like

If you’d like to share a firmware binary for testing, I also have the Waveshare ESP32-S3-Pico. So far I’ve just installed the Waveshare provided (old) version of MicroPython on it, and haven’t put it in my PicoCalc yet.

I just received my PicoCalc a day ago. I’d be happy to test your build in it, if you like. I haven’t gotten around to trying the Waveshare module, as I was checking out the samples it came with on the Pico, and also played around a bit with the Pico2 W that I also bought.

I totally understand if you’d rather test it yourself when your PicoCalc arrives. :slight_smile:

Hi, adcockm,

OK, I’ll upload firmware to another forum.

Sorry, couldn’t attach the file…

Ah, I think the forum has limits for new users. :frowning:

(Not sure if those permissions increase based on number posts or time since the forum account was created, or some combination of those.)

2 Likes

Does anyone have MicroPython running on the Pico module (RP2040)?

Of course! Initially, I ported it to the RP2040, but since the RP2040 doesn’t have PSRAM, it may run out of memory when handling complex programs. So, I moved the system to the ESP32-S3 instead. For Python programs, you only need to modify one pin, which is very simple.

How about the RP2350? Would you be interested in sharing those ports on github as well?
edit…Or I can just order the ESP32-S3 I suppose.

At present, it seems that none of the available RP2350 boards come with PSRAM—you have to design a custom PCB to add it. Of course, it’s possible to adapt the system for all boards, but I don’t think it’s necessary, and I don’t have the time to do it. You just need to refer to the schematic and change the pin numbers accordingly.

I tried using the official Waveshare firmware (MicroPython v1.19.1-746-gf2de289ef-dirty on 2023-03-14; ESP32-S3-Pico with ESP32S3):

  • copied the files from @jd3096’s github to the device
  • remapped the GPIO pins in all the code from the WalnutPi to the Waveshare (files jojo.py, kb_test.py, main.py, mpy_scr_tst.py)

As expected, it doesn’t contain the screen driver and gives the following error when using mpy_scr_test: ImportError: no module named 'st7789'

However, jojo.py successfully plays music through the PicoCalc speaker. And the kb_test.py shows the keycodes in the serial debug when I press keys on the keyboard.

Also, Thonny can only connect if I have the USB-C cable connected directly to the ESP32-S3-Pico. If I connect to the main PicoCalc USB-C, then I can’t get a serial connection with Thonny. Is this also how it works with the WalnutPi? Not really important, I guess, but it was interesting the passthrough didn’t work like it does on the actual Pico modules.

@BlackPointBeta, exactly how did you build the firmware with the screen driver? Did you follow the instructions at that repo (GitHub - russhughes/st7789_mpy: Fast MicroPython driver for ST7789 display module written in C) or did you customize it in any way? I didn’t see anything on the Waveshare website that included source code. They only posted the binary for MicroPython (which is what I used in this testing), but I’m not sure what they actually used to build it. I didn’t understand your reference to “freeze.py”. I’ve never built MicroPython before, so I’m not sure what, if anything might need to be changed for the Waveshare module during building. Or maybe everything is handled in python afterward, like the pin mappings?

Incidentally, I hacked this together as a guide for doing the pin mappings. Probably should have made it in text, but this was easier at the time. :wink:

1 Like

I built micropython with SPIRAM removed based on ESP32-S3 N16R8.
So I am not sure if it works correctly.
Note that ESP-IDF is v5.2.2 based on micropython/ports/esp32 at master.

When I get some free time, I’ll post a few more details on how to build on the Waveshare forum.

By the way, below is my build of micropython.

>>> import os
>>> os.uname()
(sysname='esp32', nodename='esp32', release='1.25.0-preview', version='v1.25.0-preview.430.g5eee5a67d.dirty on 2025-04-03', machine='Generic Board:16MB-FLASH & 2MB-PSRAM. Built-in russhughesi/ST7789_mpy module with ESP32S3-N16R2')
>>> import micropython
>>> micropython.mem_info()
stack: 704 out of 15360
GC: total: 64000, used: 1920, free: 62080, max new split: 159744
 No. of 1-blocks: 45, 2-blocks: 8, max blk sz: 18, max free sz: 3867
>>> import gc
>>> gc.mem_free()
221520
>>> gc.mem_alloc()
2384
>>> help('modules')
NotoSansMono_32   cyrilc            lowmat            socket
NotoSans_32       deflate           machine           ssl
NotoSerif_32      dht               marker            st7789
__main__          ds18x20           math              struct
_asyncio          errno             meteo             symbol
_boot             esp               micropython       sys
_espnow           esp32             mip/__init__      time
_onewire          espnow            music             tls
_thread           flashbdev         neopixel          uasyncio
_webrepl          framebuf          network           uctypes
aioespnow         gc                ntptime           umqtt/robust
array             gotheng           onewire           umqtt/simple
astrol            gothger           os                uppmat
asyncio/__init__  gothita           platform          upysh
asyncio/core      greekc            random            urequests
asyncio/event     greekcs           re                vfs
asyncio/funcs     greekp            requests/__init__ vga1_16x16
asyncio/lock      greeks            romanc            vga1_16x32
asyncio/stream    hashlib           romancs           vga1_8x16
binascii          heapq             romand            vga1_8x8
bluetooth         inisetup          romanp            vga1_bold_16x16
btree             io                romans            vga1_bold_16x32
builtins          italicc           romant            webrepl
cmath             italiccs          scriptc           webrepl_setup
collections       italict           scripts           websocket
cryptolib         json              select
Plus any modules on the filesystem
>>> help(st7789)
object <module 'st7789'> is of type module
  __name__ -- st7789
  color565 -- <function>
  map_bitarray_to_rgb565 -- <function>
  ST7789 -- <class 'ST7789'>
  BLACK -- 0
  BLUE -- 31
  RED -- 63488
  GREEN -- 2016
  CYAN -- 2047
  MAGENTA -- 63519
  YELLOW -- 65504
  WHITE -- 65535
  FAST -- 0
  SLOW -- 1
  MADCTL_MY -- 128
  MADCTL_MX -- 64
  MADCTL_MV -- 32
  MADCTL_ML -- 16
  MADCTL_MH -- 4
  RGB -- 0
  BGR -- 8
  WRAP -- 3
  WRAP_H -- 2
  WRAP_V -- 1
1 Like

I’m not sure what I was doing wrong before (I might have just been tired!), but I’ve successfuly flashed my Waveshare ESP32-S3-Pico with the same firmware @jd3096 used on the WalnutPi Pico.

I forked the repository and updated mine with the Waveshare pinouts (and a comment to that effect in the readme):

The device successfully boots up, shows the logo, and gets me to a repl prompt. The keyboard works, jojo plays music, etc.

I tried to set up WebREPL, but it seems to conflict and deny connections because of the repl running on the device. I was hoping to be able to connect to it over wifi and not only be able to use the keybaord on the PicoCalc. Using Thonny with the USB-C connected directly to the Waveshare (not the main PicoCalc USB-C) works with the device running on batteries. But when using the serial connection repl in Thonny, the PicoCalc screen fills with text and the keybaord becomes unusable. Scripts still rung though, and I could show the logo, etc.

I couldn’t get some of the scripts to work, but I’m guessing they are just a work in progress? For instance, run.py gives me an error.