0.91 inch OLED Display 128X32

🎮 The Wake-Up

Microproject Image

Module Goal: the small strip with a big personality your robot's face. This module unlocks the secret emoji library: 11 pre-drawn images (Heart, Happy, Sad, Angry, Bored, Confused, Sleep, Silly, Paper, Rock, Scissors) that turn your robot from a text machine into a character. 

📦 CONCEPT BOX Pixels and the emoji library 

The OLED has no "character windows" like the LCD it is a grid of 128 × 32 tiny dots (pixels), and your program decides which dots glow. Text is just a pattern of glowing dots; so is everything else. 

The emoji library: someone already sat down and drew 11 images, dot by dot, and saved them in a picture module called expression_picture. One import line brings one image into your program: 

from expression_picture import Heart # Brings the Heart image into the program 

Every Show Image block you snap into your program automatically adds its own import line. The images: Heart, Angry, Bored, Confused, Happy, Paper, Rock, Sad, Scissors, Silly, Sleep. Eleven emotions and one game waiting to happen.

Goal: 

your robot SLEEPS on screen... then wakes up and greets you. First meeting of text and image. 

Concepts: 

Image Display · Image Import · Scene Sequence

import machine # Controls the board hardware
import oled128x64 # Controls the OLED display
import time	# Controls pauses and timing
from expression_picture import Sleep	# Brings the Sleep image
# Sets up the I2C connection for the OLED
# pin25 corresponds to 3 on the Sensor Shield V5.0
# pin26 corresponds to 2 on the Sensor Shield V5.0
# Sets up the OLED as a 128 x 32 pixel display
i2c_extend = machine.SoftI2C(scl = machine.Pin(26), sda = machine.Pin(25), freq = 100000)
oled = oled128x64.OLED(i2c_extend,address=0x3c,font_address=0x3A0000)
oled.image(Sleep)	# The robot sleeps on screen
print("Zzz... the robot is asleep")	# Backstage narration
time.sleep(2)	# Let it sleep 2 seconds
oled.fill(0)	# Clear the canvas
oled.show()	# Refresh
oled.shows("CLU-BOT ONLINE",x = 0,y = 12)	# The wake-up message
oled.show()	# Refresh so it appears
print("Good morning! CLU-BOT is online")	# Backstage narration

What you see: the sleeping face for 2 seconds... wipe... "CLU-BOT ONLINE" appears. A scene, not just text. 

💡 Note: oled.fill(0) paints every dot dark the erase button for the whole canvas and oled.show() is the "publish" step: the OLED keeps a hidden draft of the picture, and show() pushes the draft to the glass. Draw, publish, draw, publish that rhythm is all screen programming is. (The text and image blocks publish automatically; the drawing blocks want you to call show yourself.)

🎮 The Living Counter

Microproject Image

Goal: 

the mini-board becomes a live instrument uptime seconds, refreshed every second. 

Concepts: 

Clear-then-Write · Live Updates · Screen as Instrument

import machine # Controls the board hardware
import oled128x64 # Controls the OLED display
import time	# Controls pauses and timing
# Sets up the I2C connection for the OLED
# pin25 corresponds to 3 on the Sensor Shield V5.0
# pin26 corresponds to 2 on the Sensor Shield V5.0
# Sets up the OLED as a 128 x 32 pixel display
i2c_extend = machine.SoftI2C(scl = machine.Pin(26), sda = machine.Pin(25), freq = 100000)
oled = oled128x64.OLED(i2c_extend,address=0x3c,font_address=0x3A0000)  # Wakes the screen

while True:	# Update forever
    ms = time.ticks_ms()	# Milliseconds since wake-up
    seconds = ms // 1000	# Whole seconds
    oled.fill(0)	# Clear the canvas
    oled.show()	# Refresh
    oled.shows((('Alive ' + str(seconds)) + 's'),x = 0,y = 12,size = 1,space = 0,center = True)	# Write the fresh count
    oled.show()	# Publish it
    time.sleep(1)	# One update per second

💡 Note: compare this with the LCD counter (22.3) same idea, and notice the OLED needs clear + show + write + show: draft, publish, draft, publish. Slightly more ceremony than the LCD because you control the pixels directly. That extra control is exactly what the next exercises will spend.

🎮 The Boot Bar

Microproject Image

Goal: 

the game-console boot sequence a progress bar fills the strip, percent counts up, then "READY!" pure anticipation engineering. 

Concepts: 

fill_rect · Scaling Numbers to Pixels · Suspense

import machine # Controls the board hardware
import oled128x64 # Controls the OLED display
import time	# Controls pauses and timing
from expression_picture import Sleep	# Brings the Sleep image
# Sets up the I2C connection for the OLED
# pin25 corresponds to 3 on the Sensor Shield V5.0
# pin26 corresponds to 2 on the Sensor Shield V5.0
# Sets up the OLED as a 128 x 32 pixel display
i2c_extend = machine.SoftI2C(scl = machine.Pin(26), sda = machine.Pin(25), freq = 100000)
oled = oled128x64.OLED(i2c_extend,address=0x3c,font_address=0x3A0000)  # Wakes the screen

print("Booting CLU-BOTS...")	# Backstage narration
oled.shows("LOADING...",x = 0,y = 0)	# The header
oled.show()	# Publish the header
for percent in range(0, 101, 10):	# percent counts 0,10,20...100
    oled.fill_rect(4, 20, percent, 8, 1)	# Draw the filled bar: width = the percent itself!
    oled.show()	# Publish the new bar length
    print("Loaded:", percent, "%")	# Serial narration
    time.sleep_ms(400)	# Savor each step
oled.shows("READY!",x = 40,y = 0)	# The reveal, top corner
oled.show()	# Publish
print("CLU-BOTS is READY!")	# Grand ending

Serial Monitor: 

Booting CLU-BOT... 

Loaded: 0 % 

Loaded: 10 % 

... 

Loaded: 100 % 

CLU-BOT is READY! 

💡 Note: the elegant cheat in one line: fill_rect(4, 20, percent, 8, 1) uses the percent AS the pixel width no conversion needed, because 100% of 100 pixels fits the strip. When your scale and your pixels agree, math disappears. The four numbers are: x (start), y (height on screen), width, thickness. Experiment: change the 8 to 16 the bar gets fat. Bar + counting text + final reveal = every loading screen you have ever loved.

🎮 The ID Card

Microproject Image

Goal: 

combine text and image in one composed layout the robot's official identity card. 

Concepts: 

Layout Composition · Positioning Text Beside Images

import machine # Controls the board hardware
import oled128x64 # Controls the OLED display
import time	# Controls pauses and timing
from expression_picture import Heart	# Brings the Heart image
# Sets up the I2C connection for the OLED
# pin25 corresponds to 3 on the Sensor Shield V5.0
# pin26 corresponds to 2 on the Sensor Shield V5.0
# Sets up the OLED as a 128 x 32 pixel display
i2c_extend = machine.SoftI2C(scl = machine.Pin(26), sda = machine.Pin(25), freq = 100000)
oled = oled128x64.OLED(i2c_extend,address=0x3c,font_address=0x3A0000)	# Wakes the screen
oled.shows("CLU-BOT v1.0",x = 0,y = 4)	# Name, upper-left region
oled.shows("MOOD: LOVING",x = 0,y = 20)	# Status line below
oled.image(Heart,x = 20,y = 30)	# The portrait, far right
oled.show()	# Publish the whole card at once
print("ID card displayed")	# Backstage narration

💡 Note: a screen layout is a floor plan: every element gets an address. Text lives at x=0 (left wall), the Heart at x=100 (right wall), and the two text lines stack at y=4 and y=20. Draw your layout on graph paper BEFORE coding real UI designers do exactly this, on paper, first. If your Heart sprite is bigger than 16 pixels wide it may clip the right edge: move it to x=96 and see. Pixel-perfect placement is a guessing game until you try.

🎮 The Emoji Messenger

Microproject Image

Goal: 

type a mood and your robot wears it the matching face appears with a matching phrase. Unknown words get the Confused face. This is a chatbot with a face. 

Concepts: 

Command Menu · Image Selection · The Polite Refusal · Full Synthesis

import machine # Controls the board hardware
import oled128x64 # Controls the OLED display
import time	# Controls pauses and timing
from expression_picture import Happy	# Brings the Happy image
from expression_picture import Sad	# Brings the Sad image
from expression_picture import Angry	# Brings the Angry image
from expression_picture import Bored	# Brings the Bored image
from expression_picture import Sleep	# Brings the Sleep image
from expression_picture import Silly	# Brings the Silly image
from expression_picture import Confused	# Brings the Confused image
# Sets up the I2C connection for the OLED
# pin25 corresponds to 3 on the Sensor Shield V5.0
# pin26 corresponds to 2 on the Sensor Shield V5.0
# Sets up the OLED as a 128 x 32 pixel display
i2c_extend = machine.SoftI2C(scl = machine.Pin(26), sda = machine.Pin(25), freq = 100000)
oled = oled128x64.OLED(i2c_extend,address=0x3c,font_address=0x3A0000)
print("=== EMOJI MESSENGER ===")	# Title
print("Moods: HAPPY SAD ANGRY BORED SLEEP SILLY (EXIT to quit)")	# The menu
while True:	# Serve moods forever
    mood = input("Mood: ")	# Wait for your word
    if mood == "EXIT":	# The quit command
        break	# Leave the loop lesson from the security system!
    oled.fill(0)	# Clear the canvas for the new face
    oled.show()	# Publish the wipe
    if mood == "HAPPY":	# The happy branch
        oled.image(Happy,x = 0,y = 8)	# Wear the face
        oled.shows("BEST DAY EVER!",x = 40,y = 12)	# The matching words
        print("Robot feels: HAPPY")	# Backstage narration
    elif mood == "SAD":	# The sad branch
        oled.image(Sad,x = 0,y = 8)	# Wear the face
        oled.shows("so sad...",x = 40,y = 12)	# The words
        print("Robot feels: SAD")	# Narration
    elif mood == "ANGRY":	# The angry branch
        oled.image(Angry,x = 0,y = 8)	# Wear the face
        oled.shows("GRRRR!",x = 40,y = 12)	# The words
        print("Robot feels: ANGRY")	# Narration
    elif mood == "BORED":	# The bored branch
        oled.image(Bored,x = 0,y = 8)	# Wear the face
        oled.shows("nothing to do",x = 40,y = 12)	# The words
        print("Robot feels: BORED")	# Narration
    elif mood == "SLEEP":	# The sleepy branch
        oled.image(Sleep,x = 0,y = 8)	# Wear the face
        oled.shows("Zzz...",x = 40,y = 12)	# The words
        print("Robot feels: SLEEPY")	# Narration
    elif mood == "SILLY":	# The silly branch
        oled.image(Silly,x = 0,y = 8)	# Wear the face
        oled.shows("hehehe!",x = 40,y = 12)	# The words
        print("Robot feels: SILLY")	# Narration
    else:	# Anything unknown
        oled.image(Confused,x = 0,y = 8)	# The polite refusal face
        oled.shows("UNKNOWN MOOD",x = 40,y = 12)	# The explanation
        print("I do not know that mood:", mood)	# Serial explains
    oled.show()	# Publish the new face + words

Serial Monitor: 

=== EMOJI MESSENGER === 

Moods: HAPPY SAD ANGRY BORED SLEEP SILLY (EXIT to quit) 

Mood: HAPPY 

Robot feels: HAPPY 

Mood: SLEEP 

Robot feels: SLEEPY 

Mood: PIZZA 

I do not know that mood: PIZZA 

💡 Note: count everything you reused the command menu (Module 1), the else safety net (Mini-Assistant), break (security system), clear-publish rhythm (today). The only new atoms were the import lines and image placements. Seven images, one personality: your robot now expresses itself. Advanced teams: add your own moods what phrase fits Bored differently than Sad? You are designing a character, and character design is where programming meets art.