Posts

Multi SSD1306 OLED, on Raspberry Pi Pico 2/MicroPython

Image
My exercise on  Raspberry Pi Pico 2 (RP2350) running MicroPython v1.24.0-preview.321, to display on two  128x64 SSD1315 I2C OLED (SSD1306 compatible) , and one  128x64 SSD1306 SPI OLED . The 3rd, 4th and 5th exercises display on three OLEDs as one framebuf. In the 4th and 5th exercises, groupedOLED_class is implemented, make it easier to append OLEDs at runtime. Two I2C SSD1306 OLED share the same I2C bus with different address. Connection: Exercise code: mpyPico2_tri_oled_hello.py , a simple hello world display on 3 OLED separately. """ MicroPython/Raspberry Pi Pico 2 exercise display on three OLED, 0.96" 128x64 SSD1306 OLED - two I2C OLED share one I2C with different I2C address - and one SPI OLED. To install MicroPython ssd1306 driver on Pico 2. read: https://coxxect.blogspot.com/2024/09/i2c-oled-ssd1306ssd1315-screen-with.html Two I2C OLEDs are connected to the same I2C(0) with different I2C address The I2C address of the left

Raspberry Pi Pico 2 (RP2350)/MicroPython display on two OLED, SSD1306 I2C and SPI.

Image
In previous I exercised on Raspberry Pi Pico 2 /MicroPython to display on I2C SSD1306 OLED and SPI SSD1306 OLED . In this post display on both I2C and SPI SSD1306 OLED. Remark: when I test the code, base on MicroPython v1.24.0-preview.321 on Raspberry Pi Pico 2 normal RP2350 and RP2350-RISCV version. It's found something strange when running on  RP2350-RISCV version. Check the video at 4:30. - The MicroPython running in a loop, without time.sleep(). - If "Stop" on Thonny IDE clicked to stop from running, the Pico 2 will disconnected, and REPL fail. - ----- Have to reboot the Pico to re-connect. It should be a MicroPython issue, not SSD1306 issue. Connection: Connection between Raspberry Pi Pico 2 and I2C/SPI SSD1306 OLED I2C SSD1306 - SCL GP5 - SDA GP4 SPI SSD1306 - D/C GP13 - RST GP12 - SDA GP11 (mosi) - SCL GP10 (sck) - VCC 3V3 - GND GND GP9 (dummy cs) - No connection GP8 (miso) - No connection Exercise Code: To install ssd13

Install Pillow(PIL) for Python in Windows 11/Thonny

Image
To install Pillow (or PIL) in Windows 11, simple enter the command in Terminal: pip install Pillow To install in Thonny, > Click on Tools > Manager packages... > Search "pillow" and install it. Remark: ~ Both the Python Slideshow code and the images in the video are generated by Copilot .

Ask Copilot to create a Python

Image
It's my first try  asking Copilot to create a Python/Tkinter Image Slideshow, test on Windows 11 . I just enter the prompt in Copilot and submit. I even typo the word of "create". Please creaate a Python/tkinter program to display all jpg images in current folder in slideshow. coPython_slideshow.py , the Python code created. I just change the code of geometry() and resize() to match with my images. from tkinter import * from PIL import ImageTk, Image import os # Get a list of all .jpg files in the current folder image_files = [filename for filename in os.listdir() if filename.lower().endswith(".jpg")] # Initialize the Tkinter window root = Tk() root.title("Image Slideshow") root.geometry( "800x800" ) # Set your desired window size # Load the images and create PhotoImage objects image_list = [] for filename in image_files: img = Image.open(filename).resize(( 400, 400 )) # Resize the images as needed image_list.appen

Raspberry Pi Pico 2/MicroPython display on SPI SSD1306 OLED

Image
Last post show how to install MicroPython ssd1306 driver on Raspberry Pi Pico 2 in Thonny, and display on 0.96 inch 128x64 SSD1315 I2C OLED (SSD1306 compatible) . Here is how to using the ssd1306 driver, display on 0.96 inch 128x64 SSD1306 SPI OLED . Connection: SPI SSD1306 OLED     Raspberry Pi Pico 2 ======================================== - D/C      GP13 - RST      GP12 - SDA      GP11 (mosi) - SCL      GP10 (sck) - VCC      3V3 - GND      GND      GP9 (dummy cs) - No connection      GP8 (miso) - No connection Notice that my SPI SSD1306 OLED is 6 pins version, no cs on board. But it's required in ssd1306 driver, so I have to assign dummy GP9 for it. Also GP8 is the SPI MISO, not use in this case. Exercise Code: mpyPico2_SSD1306_spi_hello.py , a simple exercise to say Hello. """ MicroPython/Raspberry Pi Pico 2 exercise display on 0.96" 128x64 SSD1306/SSD1306 SPI OLED. (It should work on both Pico/Pico 2) Ins

MicroPython code to list available I2C/SPI and default GPIO assigned

Image
Simple MicroPython code to list available I2C/SPI and default GPIO assigned. Tested on  Raspberry Pi Pico 2 (RP2350) running micropython v1.24.0-preview.201. mpy_list_i2c_spi.py """ MicroPython to list available I2C/SPI and default GPIO assigned """ import sys, os import machine print("====================================") print(sys.implementation[0], os.uname()[3], "\nrun on", os.uname()[4]) print("====================================") print("List available I2C and SPI\n") print("Available I2C and default GPIO assigned:") n = 0 while True: try: i2c = machine.I2C(n) print(i2c) n = n+1 except ValueError as exc: print("ValueError:", exc) break print() print("Available SPI and default GPIO assigned:") n = 0 while True: try: spi = machine.SPI(n) print(spi) n = n+1 except ValueError as exc: pr

I2C OLED (SSD1306/SSD1315) screen with Raspberry Pi Pico 2 (RP2350) using MicroPython

Image
This video show steps to install ssd1306@micropython-lib OLED driver on Raspberry Pi Pico 2 (RP2350)  running MicroPython v1.24.0-preview.201 to display with 0.96 inch 128x64 SSD1315 I2C OLED (SSD1306 compatible) and 0.91 inch 128x32 SSD1306 I2C OLED . Also compare with another driver micropython-ssd1306@PyPI. Connection:      I2C OLED Pico      ====================      SDA GP4      SCL GP5      VCC 3V3      GND GND Exercise code: mpy_i2c_scanner.py , I2C devices scanner. import machine import os print(os.uname()) print() # How many hardware I2C supported # and show the I2C info print("number of I2C supported:") print("========================") i=0 while True: try: print(machine.I2C(i)) except ValueError as e: print(e) break i += 1 print() #Using machine.SoftI2C #scl = machine.Pin(9, mode=machine.Pin.OUT, pull=machine.Pin.PULL_UP) #sda = machine.Pin(8, mode=machine.Pin.OUT, pull=machine.Pin.PUL