Adafruit SSD1306 OLED display working. Specifically 0.91" 128x32
I have looked through the code example that are listed on the adafruit website and they are for circuit python or python3. Micropython is neither of these and does not appear to be cross compatible from my struggles. Lets just start with where I am at and what I have tried to do to get it to work.
I have the board wired up on a bread board to the Pi Pico using GPIO pin1 (GP0) for SDA, Pin2(GP1) for SCL, pin19(GP14) for reset, pin36 for 3.3v for Vin and pin38 is ground.
The panel board power led come on green, no display light up.
Used the following code example from page 119 of 'The Official Raspberry Pi Pico Guide'
Code: Select all
1 import machine 2 3 sda=machine.Pin(0) 4 scl=machine.Pin(1) 5 i2c=machine.I2C(0,sda=sda, scl=scl, freq=400000) 6 7 print(i2c.scan())
but this is as far as I can go with the included code due to the examples they are using are specific to the SerLCD from SparkFun. I downloaded the Adafruit 1306 library for python but it downloads into my python3 directories and is of no use as a module for micropython.
Anyways this is where my show stops until I get some outside intervention.
Here is the rest of the example code that will pull the data from the onboard temp sensor and display it to the LCD, perhaps someone can help me navigate a way to accomplish the same outcome using the SSD1306 with micropython on Pico.
Code: Select all
import machine import utime sda=machine.Pin(0) scl=machine.Pin(1) i2c=machine.I2C(0,sda=sda, scl=scl, freq=400000) adc = machine.ADC(4) conversion_factor = 3.3 / (65535) while True: reading = adc.read_u16() * conversion_factor temperature = 25 - (reading - 0.706)/0.001721 i2c.writeto(114, '\x7C') i2c.writeto(114, '\x2D') out_string = "Temp: " + str(temperature) i2c.writeto([b]114, out_string) utime.sleep(2)
Now this is where things get tricky because obviously the SSD1306 has its own nomenclature requirements and these code example where specifically written for the Spark Fun SerLCD.The next bits that may look a little odd are the \x7C and \x2D commands that are written. Each
I2C device requires data sent in a specific format. There’s no standard for this, so you’ll have to
refer to the documentation for whatever I2C device you’re setting up. The \x at the start of each
of these tells MicroPython that we’re sending a hexadecimal string (see ‘Hexadecimal’ box)
which is a common way of ensuring you’re sending the exact data you want. For our LCD, 7C
enters command mode and 2D blanks the LCD and sets the cursor to the beginning.
Anyways, here we are, hoping I can get some help getting this up and running.
Here is product page for display:
Adafruit tutorial page:
I have cross posted this to the Adafruit forum as well, but so far no response.
I appreciate the help, Thanks,