Skip to content

Little Screen

You'll put a one-dollar OLED on an I2C bus and show live sensor readings, a bar graph and a menu you can scroll with two buttons.

About

Printing to the serial monitor only works with a laptop attached. A 0.96 inch OLED costs a dollar or two, needs four wires, and turns a board into a thing you can read across the room. This badge uses a library, so you'll be writing text and bars rather than talking to the controller chip; the Datasheet to Driver badge is where you do it without the library. The trap is the address. Most of these screens answer at 0x3C and some at 0x3D, and the first thing to run is an I2C scanner so you know before you blame the wiring.

At a glance

Per requirement
15 XP
Completion bonus
75 XP
Requirements
5
Takes
One evening
Skill level
Beginner (done it a few times)
Cost
Cheap (under $10)
Supplies
You need some
Where
At home
Other people
On your own

Requirements

  1. 1
    Run an I2C scanner and find the screen's address. Wire VCC, GND, SCL and SDA (A5 and A4 on an Uno, or whichever pins your board lists). The scanner sketch in the Wire examples prints every address that answers. Take a screenshot of the serial monitor showing the address. Photo
  2. 2
    Show a live reading from one sensor in large text. A thermistor, a light sensor or a DHT22 all work. Use a font big enough to read from two meters, and update it once a second without flicker, which means clearing the buffer and redrawing the whole frame rather than clearing the screen. Take a photo of the screen with the sensor in frame. Photo
  3. 3
    Draw a bar graph of the last 60 readings. Keep a 60-slot array as a ring buffer and draw one column per reading, scaled to the screen height. Breathe on the sensor and watch the bar climb. Film the graph moving. Video
  4. 4
    Add two buttons and a three-item menu. One button moves the highlight and the other selects. The items can be the sensor view, the graph and a settings page that changes units. Debounce with a 50 ms wait after a press for now; the Interrupts, Not Loops badge does it properly. Film the menu in use. Video
  5. 5
    Box it and run it from a power bank with no laptop attached. Put the board, the screen and the sensor in a small box with a window cut for the screen (a mint tin with the screen taped behind a hole works) and power it from a USB power bank or a phone charger. It should come up and show a reading within a few seconds of getting power, with no laptop anywhere. OLEDs burn in if a static image sits at full brightness for weeks, so dim it or add a screensaver if it's going to stay on. Take a photo of the boxed screen showing a reading, with the power bank in frame. Photo