Raspberry Pi Pico

SSD1306 Oled Display with raspberry Pi Pico

SSD1306 Oled Display with Raspberry Pi Pico:

 

SSD1306 Oled display with Raspberry pi pico- In majority of the projects, we need display units for printing text and sensor values. Nowadays one of the most commonly used displays is the Oled display. The one you can see on the screen is the SSD1306 I2C supported Oled display Module which I am going to use with Raspberry Pi Pico. I have also used this Oled display module with the Arduino boards, ESP32 WiFi + Bluetooth Module, NodeMCU ESP8266 WiFi module, and so on.

Most of the Raspberry Pi Pico Oled display module libraries display text which is too small. I have seen a lot of guys searching about how to increase the text size, so in this example, I will show you how to increase the text size.  But first, let’s go ahead and take a look at the circuit diagram.

Previous Articles:

Raspberry Pi Pico Vs Arduino.

Raspberry Pi Pico Pinout & Specs

Raspberry Pi Pico MicroPython and Thonny IDE Installation.

Raspberry Pi Pico Led examples.

Raspberry Pi Pico Digital Input.

Raspberry Pi Pico ADC Analog Sensor

Raspberry Pi Pico Temperature Sensor.

Raspberry Pi Pico Ultrasonic Sensor.

Raspberry Pi Pico PIR Motion Sensor.

Raspberry Pi Pico LDR Sensor, Day & Night Detection.


Amazon Links:

Raspberry Pi Pico

Digital LDR module

12V Relay Module

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!



SSD1306 Oled display Interfacing with Raspberry Pi Pico:

Raspberry Pi Pico

The SSD1306 Oled display module VCC and GND pins are connected with the Raspberry Pi Pico board 3.3V and GND pins. The SCL and SDA pins of the SSD1306 Oled Display module are connected with GP17 and GP16 pins of the Pico Board. These are the Minimal connections which you need to get started with the SSD1306 Oled display module.

Raspberry Pi Pico

I connected the Oled display module with the Raspberry Pi Pico board as per the connection diagram. In order to display text or values on the Oled display module first we will need to install the SSD1306 library. So let’s go ahead and install the library.


Raspberry Pi Pico SSD1306 Library Installation:

Open Thonny IDE and make sure that your Thonny IDE is in Raspberry Pi Pico mode.

Raspberry Pi Pico

If the Thonny IDE is not in the Raspberry Pi Pico mode for that simply click on the tools, in the tools menu click on the options.

 

Raspberry Pi Pico

On the options windows, click on interpreter tab, in interpreter list, select the MicroPython (Raspberry Pi Pico) and click on the ok button.

Raspberry Pi Pico

After clicking the ok button your Thonny ide will be shifted to Raspberry Pi Pico mode, as you can see in the image given below.

Raspberry Pi Pico

Once your Thonny IDE is shifted to Raspberry Pi Pico mode, again click on tools Menu and this time click on manage packages.

Raspberry Pi Pico

In the manage packages window, write SSD1306 in the text box and click on the search button.

Raspberry Pi Pico

Wait for the search results, it depends on the internet speed, once the searching is completed then click on the first micropython-ssd1306.

Raspberry Pi Pico


Then click on the install button, and wait for the installation process to complete.

Raspberry Pi Pico

 

Raspberry Pi Pico

As you can see our ssd1306 library is installed successfully.

Raspberry Pi Pico

Now we have to install another library which is the micropython-oled, you might be thinking why am I installing another library? Well if you are not interested in the text size then you don’t have to install this library, you can use the SSD1306 library for printing the text and for displaying the values; but if you want to increase the fonts size then you will need this second library which I am about to install.

This time type oled_text in the text box and press the search button, and wait for the search results, it depends on the network speed.

Raspberry Pi Pico



Click on first link micropython-oled

Raspberry Pi Pico

Click on the install button and wait for installation process to complete.

Raspberry Pi Pico

 

Raspberry Pi Pico

As you can see our both the libraries ssd1306 and oled are installed successfully in the Raspberry Pi Pico board.

Raspberry Pi Pico


Raspberry Pi Pico SSD1306 Oled Programming:

from machine import Pin, I2C

from ssd1306 import SSD1306_I2C

from oled import Write, GFX, SSD1306_I2C

from oled.fonts import ubuntu_mono_15, ubuntu_mono_20

import utime




WIDTH =128

HEIGHT= 64

i2c=I2C(0,scl=Pin(17),sda=Pin(16),freq=200000)

oled = SSD1306_I2C(WIDTH,HEIGHT,i2c)

write15 = Write(oled, ubuntu_mono_15)

write20 = Write(oled, ubuntu_mono_20)

write20.text("OLED", 0, 0)

write15.text("Display", 0, 20)

oled.text("ElectroniClinic", 0, 40)

oled.show()




The purpose of this code is to print Oled, Display, and ElectroniClinic. The fonts size will be different.

write20.text("OLED", 0, 0)

write15.text("Display", 0, 20)

These two lines of codes uses the Oled library and

oled.text("ElectroniClinic", 0, 40)

This line of code uses the SSD1306 library. I am going to run this code and you will get the idea.

Raspberry Pi Pico

This is how easily you can print text on the SSD1306 Oled display module; it depends on your requirement whether you want to use the Oled library or the SSD1306 library.

Next article, Raspberry Pi Pico ADC Analog Sensor

Watch Video:

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

4 Comments

  1. these was a really helpfull tutorial, I was searching for it for a few weeks and now my ssd1306 is working!

  2. Nope. Doesn’t work.

    Traceback (most recent call last):
    File “”, line 8, in
    File “oled.py”, line 8, in
    ImportError: can’t import name Write

  3. search for ‘oled_text’, Install the ‘Micropython-oled’ (Micropython scripts for use OLED displays).

  4. Hi,
    Thank you for this tutorial.
    I need a bigger size of font for my project, How can i do to have a font with 40 pixels high ?
    Is there a font converter to do this job (.ttf ->.py) ?
    Ty

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button