I have successfully ported MicroPython to the PicoCalc

I utilized the Pico form factor of the ESP32-S3 to replace the Raspberry Pi Pico and have ported MicroPython onto it. Everyone can see the specifics in the video demonstration. If needed, I will contribute the code to GitHub.
BASIC 你很好 可是 我还是忘不了PYTHON_哔哩哔哩_bilibili

14 Likes

It would be great to make the code available on github. I’m interested in doing some things with the ESP32 as well. It was encouraging to see you got the screen and keyboard working. Thanks!

1 Like

Great job! I’m not able to access the video, is it anywhere else so I can have a watch please?

I used a web tool to grab the video and uploaded it to a free host. Unfortunately, this file host claims to wipe stuff after a few days. If anyone else wants to host it permanently, that would be better. It’s only 20MB anyway.

4 Likes

jd3096-mpy/PICOCALC-micropython
This is only a test version. Feel free to share your ideas and suggestions in the Issues section!

3 Likes

Thank you! I haven’t received my PicoCalc yet (or a shipping notice, but I’m hoping for that soon), but when I do, I’ll be trying this out.

I couldn’t find a good source for the WalnutPi-Pico where I am, so I bought this instead:

I think the one I bought might be a Waveshare, or at least a clone of one. Since it’s pin compatible with the Pico, I think it will work, but I may need to adjust your firmware. I’ll share what I find when I can test this.

2 Likes

You did a really good work! I’ve followed your instructions on the GitHub, downloaded the image and all the files and installed them on a walnut pi pico esp32-s3. But when the PicoCalc is powered on, the screen is back with no display. Actually, the MicroPython on the pico must be working, because I can connect to the pico in Thonny, and when I try jojo.py, the speaker works well and the song plays. And the keyboard also works, I can get the output for punched keys in the shell window when I run the kb_test.py. Then I check out the main.py, it seems like the st7789 driver has already been loaded but why the screen doesn’t work? ( I am sure the screen works well on the raspberry pico with the MMBasic.) Could you help me to deal with this problem, thank you!

Don’t rush, follow my steps to troubleshoot the issue:

  1. Confirm whether the screen backlight is turned on. If the backlight is off, press Alt + > on the keyboard to increase the brightness.
  2. Check if you have flashed the firmware s3-psram-7789.bin from the firmware folder according to the tutorial in the GitHub repository. The default firmware of Walnut Pi does not include the ST7789 driver library, so it cannot drive the screen.
  3. Ensure you are using the same hardware as the Walnut Pi Pico. If you are using another ESP32 board with a Pico-like form factor, check the pin configuration and adjust accordingly.

If you have followed these three steps and the screen is still black, contact me again, and I will write a screen test program for you.

By the way, this screen is actually an ILI9488, not an ST7789—I was just too lazy to rename it, haha. You can check the source code to see how I modified its initialization commands to make it work and how I defined the pin configurations.

2 Likes

Thanks for your help! :handshake: Following your steps, I check my system: 1. the backlight is on. 2. the old firmware of is erased, and I flashed the new firmware 3-psram-7789 into esp32s correctly, and all files in the src folder were uploaded into the esp32s. 3. The dev board I used in the PicoCalc is Walnut Pi PicoW. I repeated this process once again, the screen is still black with nothing. I test your codes on the Walnut Pi PicoW: both jojo.py and kb_test.py work. and I try to run the code mpy_scr_test.py which is to make a demo on ILI9488 based screen, but I get error message: ImportError: no module named ‘ili9488’ , I guess the ili9488 driver is not loaded successfully. Then I check the code “drivers.py” in the utils folder, it actually loads the st7789 driver. So I try to load the st7789 using the statement: import st7789, no error messages report. it seems like the driver is loaded correctly. Where is the problem occurring? I expect your solution. Thanks.

"This is so strange. I can’t think of any possible mistakes. I modified the contents of mpy_scr_test.py on GitHub. Now, if you run it, you’ll see a logo pattern and the text ‘screen test’ on the screen. Run it and tell me what result it returns. Also, what result does main.py return when you run it?

I erased and re-uploaded the program on my PicoCalc to ensure that the program on my GitHub is correct.

If you are Chinese and have WeChat, you can add me directly at WeChat ID: jd3096 to contact me."

This is so strange. I can’t think of any possible mistakes. I modified the contents of mpy_scr_test.py on GitHub. Now, if you run it, you’ll see a logo pattern and the text ‘screen test’ on the screen. Run it and tell me what result it returns. Also, what result does main.py return when you run it?

I erased and re-uploaded the program on my PicoCalc to ensure that the program on my GitHub is correct.

If you are Chinese and have WeChat, you can add me directly at WeChat ID: jd3096 to contact me.

1 Like

Thank you again. Here are the results shown in the Thonny shell window I got for running the mpy_scr_test.py and main.py. But there is still nothing displayed on my picocalc.

I purchased a new Walnut Pi PicoW and installed it again, now it works. :grinning_face: Maybe my previous Walnut Pi PicoW had some problems with the SPI interface that caused the screen to go black.

2 Likes

Though I don’t have my PicoCalc yet (should arrive in the next 12ish hours), I’m hoping to be able to start working with it later this week.

But my ESP32-S3 Pico arrived from Aliexpress and it is indeed a Waveshare. Or at least it’s got that logo silkscreened on it and looks legit, so if not, then it’s a convincing clone. (As expected, it came with no documentation.) I plan to test it with the Waveshare examples and if those work then I think it’s safe to say that’s what it is. Then I can try getting it to work on the PicoCalc using your WalnutPi example as a guide. Hopefully the only things that might need to change are some pin definitions.

EDIT: Confirmed it’s a Waveshare ESP32-S3 Pico, as the official Waveshare flashing tool and firmware image flashes and works fine. Once my PicoCalc arrives and I have time, I’ll see about getting it to work on there. I’m hoping it shouldn’t be too difficult, with the WalnutPi repo as a guide. :slight_smile:

(Also, if anyone was thinking of getting a Waveshare ESP32-S3 Pico, and that Aliexpress seller is also cheaper for them, then it’s a pretty safe bet you’ll get one that way. Whether or not it works in the PicoCalc remains to be seen, but I’m guessing it will, with a little encouragement.)

1 Like

What’s the advantage of this over the Pico?

Both the WalnutPi (which I couldn’t easily/cheaply find) and the Waveshare device are using ESP32-S3 hardware. While the OP here is using it for MicroPython, and that was also an easy way to test and verify the one I received worked (so far without the PicoCalc), my plan is to use it like other EPS32-S3 devices I’ve already been using. They are a pretty solid Arduino platform, and there’s tons of software projects on github (not to mention hardware hacks too). Personally, I like the PlatformIO dev environment, and so far adapting existing software has been pretty easy, even if the orignial target has slightly different pinouts or hardware attached to the device.

For instance, I’ve been using the M5 StickC Plus2 for a few months now. After trying out lots of existing software, I’ve been working on getting BLE communication working with a LED badge that I’m trying to reverse engineer. (I’m a software guy, not a hardware guy, so I’m mostly just working out how to communicate with the thing and control it properly.) I also picked up one of these small TV-like devices from Aliexpress (cheaper than direct from Spotpear), and while like most of these things, the documentation is a bit of a challenge, it seems to be a pretty capable device. Mostly the same code can run on both these devices, though it has to be rebuilt to handle the different diisplays, etc. All the ESP32 devices seem to have amazing wifi and bluetooth signal range, as well as last a surprisingly long time on relatively small batteries. So they seem great for mobile wireless stuff, or talking to mobile stuff if you want to just plug it in as a sort of basestation or server. And the hardware is more powerful than the Pico, and maybe even a bit friendlier on battery life (not that this should be an issue for the PicoCalc.) There are a couple of standard graphics libraries that seem to be used across the devices, which makes it easier to get stuff working across them all. ANd the displays seem to offer fast enough refresh rates that animation and games are a possibilty too. I’ve been enjoying the videos Volos posts, as he seems to be really into the ESP32 devices, and posts some nice simple example projects, many of which have some clever ideas. He’s also got a good eye for interface design, which can be a challenge on tiny display such as these.

My personal goal for the PicoCalc and this Waveshare module is to treat it like the M5StickC-Plus2 or that little touchscreen “TV” device. It would essentially be the same hardware (with some differences in flash and RAM size), but also have an integrated keyboard, and the 320x320 display. Some people have already been building program loaders for ESP32 devices (to make it easier to load multiple applications), and there are even some OS projects like Tactility that aim to be a more proper OS also capable of launching separate programs.

By default though, these things usually just load a single program, kind of like the Pico devices. In the case of MicroPython, that program is MicroPython, which can also run code. In the case of PicoMite it can run Basic code. In the case of uLisp it can run Lisp code. But in all those cases there’s really just a single program running – the interpreter that handles whatever code you’re throwing at it. And to do something else with it, you need to flash a new firmware on the device. I’m sure we’ll eventually see emulators ported, and other stuff like that, but unless they are packaged up together in a single firmware, switching between them would require updating that firmware. The Luckfox Lyra offers an advantage – since it’s running an actual OS, a port of Ubuntu Linux, it can actually run multiple applications without having to reflash the firmware every time. But it also lacks on board wireless, so without extra hardware it’s going to be isolated and not nearly as useful.

I bought several modules (Pico2W, this Waveshare ESP32-S3, Luckfox Lyra) because I wasn’t sure what I’d want to do with the PicoCalc long term, and because they were all fairly cheap. Assuming I can get wireless going on it, I expect long term I’d use the Luckfox Lyra, since it would be far more flexible and more powerful. For a specific project I have in mind, I think the ESP32-S3 in the PicoCalc will be great, since it will give me a portable device with a keyboard and screen. But it kinda feels like I’d be wasting the PicoCalc if I only used it that way. My gut feeling is that using a Pico(2W) in it would feel like a waste (for me) too. But I won’t really know until I start playing with it. I’m more comfortable coding in C++ (which is what the Arduino/ESP32 stuff uses), but I do want to play around a bit with BASIC just to see what it can do. I’m sad the WEB functionality isn’t already working, but if I really do decide to dive in and no one else has done it yet, I’ll probably end up trying to add that to PicoMite because it seems silly to me to have a wireless device (with the Pico2 W) that can’t actually go online. If MMBasic/PicoMite/WebMite also supported BLE on the Pico(2) W, I’d be more inclined to jump into it, but I can’t see myself trying to add support for that. Porting something over is one thing, but doing it from scratch… Hehe. I’m not keen on Python either, but I might play around with that a bit too (either MicroPython, or CircuitPython depending on how that progresses).

I see the PicoCalc first as a thing to experiment with, and try to push the limits in directions that interest me, then as a way to focus on a few projects, and finally as a sort of general purpose “case” (with keyboard and screen) for various different hardware that can plug into it. I have no idea what final form it will take for me though. I just hope it doesn’t become a dust collector, but given the potential it’s already shown in the community, I think that’s unlikely for a while, at least until something else new and shiner comes along. :slight_smile:

3 Likes

Just a quick note: You do understand the ESP32-S3 uses a completely different processor type than an ESP32-C3, correct?

The latter is RISCV-based single-core ultra-low-power while the former is ESP32-S3-based (iow Xtensa LX7 dual-core MCU, embedded SoC but nowhere near as “low-power” as the ESP32-C3).

I only mention because you’re talking about an ESP32-S3 “Pico-like” and an ESP32-C3 “Mini-TV” as if they’d use the same MCUs, toolchains, etc.

Lots of people make that mistake, along with mistaking different “loadouts” of WROOMs, etc. for each other. Everyone I know who works with them has done it at least a couple times. Seemed worth highlighting the difference.

Espressif historically keeps their naming patterms utterly opaque and confusing, presumably in order to prevent wily parts buyers from ever being 100% certain what they’re ordering is what they want. ;D

ESP32-C3: https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf

ESP32-S3: https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf

1 Like

The best strategy with Espressif products appears to be to ignore everything but the last few characters of the designation, and then if there are differences between those, they’re usually worth understanding – for example, in this case, only the “Sx” vs “Cx” are meaningful.

“ESP32” used to exclusively indicate Xtensa LXx core devices, but now it really doesn’t mean much of anything as an identifier other than “Some Espressif product”, alas.

1 Like

Good point. I had forgotten the M5 StickC-Plus2 is an S3 while that noname TV thing is actually a C3. That said, I do have roughly the same code (using NimBLE, among other things) running on them. The only difference is the interface code, and the platform/toolchain code that gets pulled in by PlatformIO. The fact that they both support Arduino and can use the same libraries is helpful. As far as development goes, as long as I’m not doing anything with the specific/unique hardware on these devices, the platform differences are pretty transparent in the PlatformIO dev environment.

Funny enough, this TV-like device was made in such a way that the backlight can’t be turned off on the display. So while it should have better battery usage, it’s not really any better than the M5 device even though it could be. But yeah, it also has less flash and probably less RAM. And a different processor. I wasn’t pushing up against the limits with what I was doing so it didn’t really matter to me and I forgot and misspoke above.

And you’re right about the naming – it’s confusing!

Up until now, it also indicated to me that it was supported on the Arduino platform, but I guess that was an incorrect assumption on my part. The Waveshare ESP32-S3 Pico is the first ESP32 device I’ve encountered where the sample code doesn’t also include Arduino information/examples. I haven’t gone looking on github, but I imagine someone has already set up Ardunio and probably PlatofrmIO for it. Worst case, a generic ESP32-S3 target would probably work for it, and the documentation already has all the info about how to connect to flash MicroPython, so I’m assuming that will be enough to go on to set up a connection via Arduino IDE and/or PlatformIO.

That TV thing didn’t come with a PlatformIO example setup, but I adapted the Arduino IDE setup they did document and it worked fine as a generic ESP32-C3. Just had to identify the right library for the screen and touchscreen, and then I was good to go.