I’ve been spending a lot of time lately working with Pimoroni badges, and I got a bit tired of the constant “tweak code → upload to board → reboot → wait” loop. To speed things up, I started building a desktop emulator for these boards.
It basically mocks the picographics and board-specific modules so you can run your MicroPython scripts directly on your PC/Mac. It opens a window showing the display and maps your keyboard to the physical buttons.
Currently supports:
Badger 2040
Tufty 2040
Pimoroni Presto (with mouse-as-touch support)
Inky Frame / Inky Impression
Blinky 2350
It’s definitely still a work in progress, but it’s at a point where it’s actually useful for UI layout and logic testing without having to touch the hardware every 30 seconds.
If you want to give it a try: pip install pimoroni-emulator
Let me know if it works for your projects or if there are specific modules you’re missing that I should try to mock next!
This is a great idea but I’ve had two issues with it:
1 Appears to have killed itself after asking for list devices.
% pimoroni-emulator --help
usage: pimoroni-emulator [-h] [-d DEVICE] [--headless] [--autosave DIR] [--trace] [--max-frames MAX_FRAMES] [--list-devices]
[--text-output FILE] [--scale SCALE] [--memory-tracking] [--strict-memory] [--no-eink-animation] [--no-wifi]
[--network-profile {real,host,healthy,degraded,down}] [--hardware] [--hardware-test]
[app]
Pimoroni Device Emulator
--SNIP--
% pimoroni-emulator --list-devices
Traceback (most recent call last):
File "/Users/diziet/Documents/Pimoroni/pimoroni-emu/.emuenv/bin/pimoroni-emulator", line 3, in <module>
from emulator.main import main
ModuleNotFoundError: No module named 'emulator'
% pimoroni-emulator --device inky_frame apps/inky_frame/hello_inky.py
Traceback (most recent call last):
File "/Users/diziet/Documents/Pimoroni/pimoroni-emu/.emuenv/bin/pimoroni-emulator", line 3, in <module>
from emulator.main import main
ModuleNotFoundError: No module named 'emulator'
2.Not sure if it can support an app with imports/libs
% pimoroni-emulator --device inky_frame ~/Documents/Pimoroni/inkyframe7/weather/main.py
Starting emulator for Inky Frame 7.3"
Display: 800x480 eink_color
App: /Users/diziet/Documents/Pimoroni/inkyframe7/weather/main.py
Screenshot: click the camera button (top-right) or press F12
Sleep: click the moon button (top-right) or press F2; any input wakes
Library: picographics (MicroPython)
<frozen importlib._bootstrap>:491: RuntimeWarning: Your system is avx2 capable but pygame was not built with support for it. The performance of some of your blits could be adversely affected. Consider enabling compile time detection with environment variables like PYGAME_DETECT_AVX2=1 if you are compiling without cross compilation.
pygame 2.6.1 (SDL 2.32.10, Python 3.14.3)
Hello from the pygame community. https://www.pygame.org/contribute.html
/Users/diziet/Documents/Pimoroni/inkyframe7/weather/main.py:65: SyntaxWarning: "\d" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\d"? A raw string is also an option.
"([A-z ]+): ([A-z ]+)(?:, Minimum Temperature: )(\d+\xb0C) (?:\(\d+\xb0F\) Maximum Temperature: )?(\d+\xb0C)?")
/Users/diziet/Documents/Pimoroni/inkyframe7/weather/main.py:67: SyntaxWarning: "\d" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\d"? A raw string is also an option.
"Wind Direction: ([a-z-]+), Wind Speed: (\d+mph), Visibility: ([A-z ]+), Pressure: (\d+mb), Humidity: (\d+%), UV Risk: (\d+), Pollution: ([A-z\- ]+), (?:(Sunrise): ([0-9:]+) [A-Z]+)?(?:, )?(?:(Sunset): ([0-9:]+) [A-Z]+)?")
App error: No module named 'pcf85063a'
Traceback (most recent call last):
File "/Users/diziet/Documents/Pimoroni/pimoroni-emu/emulator/main.py", line 603, in app_thread
runpy.run_path(str(app_path), run_name="__main__")
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen runpy>", line 287, in run_path
File "<frozen runpy>", line 98, in _run_module_code
File "<frozen runpy>", line 88, in _run_code
File "/Users/diziet/Documents/Pimoroni/inkyframe7/weather/main.py", line 6, in <module>
import inky_helper as ih
File "/Users/diziet/Documents/Pimoroni/inkyframe7/weather/inky_helper.py", line 9, in <module>
from pcf85063a import PCF85063A
ModuleNotFoundError: No module named 'pcf85063a'
^C
Interrupted
Emulator finished. Rendered 0 frames.