User Tools

Site Tools


using_pico_with_ssd1306_based_lcd_and_spi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
using_pico_with_ssd1306_based_lcd_and_spi [2026/08/21 14:50] – [Using Pico with SSD1306 based LCD and SPI] walkeradminusing_pico_with_ssd1306_based_lcd_and_spi [2026/08/24 20:01] (current) – [Python Code] walkeradmin
Line 1: Line 1:
 ====== Using Pico with SSD1306 based LCD and SPI ====== ====== Using Pico with SSD1306 based LCD and SPI ======
-\\  
 <color #db5f0b>Aug 2026</color> <color #db5f0b>Aug 2026</color>
 \\  \\ 
Line 51: Line 50:
 So SPI is faster, but there is no addressing, so you cannot chain multiple SPI devices from a single set of Pico GPIO Pins. If you need to run multiple displays, your choice is to either use I2C LCDs, or use multiple sets of SPI pins for each LCD. So SPI is faster, but there is no addressing, so you cannot chain multiple SPI devices from a single set of Pico GPIO Pins. If you need to run multiple displays, your choice is to either use I2C LCDs, or use multiple sets of SPI pins for each LCD.
 \\  \\ 
 +\\ 
 +----
 +==== The Driver for SPI (1306 driver chip) ====
 +\\ 
 +Below is the driver you will need for the LCD. You need to put it in to the <color #ed1c24>lib</color> folder on your Pico.
 +
 +<code:python | download>
 +from machine import Pin, SPI
 +from ssd1306_spi import SSD1306_SPI
 +import time
 +
 +# SPI1 setup
 +spi = SPI(1, baudrate=8000000, polarity=0, phase=0)
 +
 +dc  = Pin(13, Pin.OUT)
 +res = Pin(12, Pin.OUT)
 +cs  = Pin(14, Pin.OUT)
 +
 +oled = SSD1306_SPI(128, 64, spi, dc, res, cs)
 +
 +oled.fill(0)
 +oled.text("Hello Alan!", 0, 0)
 +oled.text("SSD1306 SPI OK", 0, 16)
 +oled.text("Pico 2 Ready", 0, 32)
 +oled.show()
 +
 +# call the function below from your main code with the value 255 (max  brightness)
 +oled.set_brightness(255)
 +</code>
 +\\ 
 +\\ 
 +----
 +==== LCD Test Code ----
 \\  \\ 
 I want to look at the old I2C code and compare to the SPI code to point out some differences, this is the Python code that just prints 8 static lines on the LCD for a simple test. I want to look at the old I2C code and compare to the SPI code to point out some differences, this is the Python code that just prints 8 static lines on the LCD for a simple test.
using_pico_with_ssd1306_based_lcd_and_spi.1787323834.txt.gz · Last modified: by walkeradmin