EuroPi tips and notes

restart EuroPi in bootloader mode with USB :

You don't have to press the BOOTSEL button to go in bootloader mode. It's possible to do that through the USB connection.

With a REPL client, do :

machine.bootloader() 

MicroPython modules import order :

import sys

sys.path
['', '.frozen', '/lib']

How to test a custom europi.py module :

Place it at the root of the EuroPi filesystem. It will be used instead of the firmware one because of the import order of the modules (see above).

How to return to EuroPi main menu :

Return to main menu by pressing & holding both buttons.

How to test the OLED display without importing the europi library :

from ssd1306 import SSD1306_I2C
from machine import I2C
from machine import Pin
i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
display = SSD1306_I2C(128, 32, i2c)
display.text('Hello, World!', 0, 0, 1)
display.show()
display.fill(0)
display.show()
display.fill(1)
display.show()
display.fill(0)
display.show()

What is the OLED type of the EuroPi :

EuroPi uses a SSD1306 type display with a resolution of 128x32 pixels.

The communications between the processor and the display uses the I2C protocol.

Library :

how to connect under Linux

Check that your Linux system detect the EuroPi connection :

dmesg
[  470.983999] usb 1-3: new full-speed USB device number 5 using xhci_hcd
[  471.817383] usb 1-3: New USB device found, idVendor=2e8a, idProduct=0005
[  471.817389] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  471.817393] usb 1-3: Product: Board in FS mode
[  471.817396] usb 1-3: Manufacturer: MicroPython
[  471.817400] usb 1-3: SerialNumber: e660c0d1c7620b36
[  471.836519] cdc_acm 1-3:1.0: ttyACM0: USB ACM device
[  471.836733] usbcore: registered new interface driver cdc_acm
[  471.836734] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

Make sure your user has the permissions to access the new usb device :

sudo usermod -a -G dialout your_username
reboot

Once the Pi Pico is connected it will appear as a /dev/tty* device :

$ ls -l /dev/ttyUSB* /dev/ttyACM*
ls: cannot access '/dev/ttyUSB*': No such file or directory
crw-rw---- 1 root dialout 166, 0 Feb 10 11:19  /dev/ttyACM0

Install rshell (refer to the rshell doc) and connect to your EuroPi :

$ rshell
Connecting to /dev/ttyACM0 (buffer-size 512)...
Trying to connect to REPL  connected
Retrieving sysname ... rp2
Testing if sys.stdin.buffer exists ... Y
Retrieving root directories ... /bootloader.py/ /calibrate.py/ /contrib/ /europi.py/ /europi_script.py/ /lib/ /main.py/ /setup.py/ /ui.py/ /version.py/
Setting time ... Feb 4, 2023 11:22:05
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 1970
Welcome to rshell. Use Control-D (or the exit command) to exit rshell.

Inside rshell, type repl to start the Pi Pico REPL interpreter :

/home/francois> repl
Entering REPL. Use Control-X to exit.

MicroPython v1.19.1 on 2022-06-18; Raspberry Pi Pico with RP2040
Type "help()" for more information.
>>>

Then you can use python to interact with the EuroPi :

>>> import sys
>>> sys.implementation
(name='micropython', version=(1, 19, 1), _machine='Raspberry Pi Pico with RP2040', _mpy=4102)

The EuroPi is mapped to /pyboard

/home/francois> ls -l /pyboard/
  2988 Feb  8 21:33 bootloader.py
 13891 Feb  9 22:06 calibrate.py
268485271 Jan  1 1970  contrib/
 24812 Feb  9 21:55 europi.py
  9656 Feb  8 21:33 europi_script.py
268485271 Jan  1 1970  lib/
  1002 Feb  8 21:23 main.py
   772 Feb  8 21:33 setup.py
  2092 Feb  8 21:33 ui.py
    68 Feb  8 21:33 version.py

Type Ctrl-X to exit RPEL and Ctrl-D to exit rshell.