Week 7 · Displays & Signals

Session 31: The I2C LCD

Teach & build120 minLesson 20: I2C, Address Scanning & I2C LCD

Learning outcomes

  • Wire an I2C LCD to SDA and SCL with a common GND
  • Find the backpack address with a scanner
  • Print at positions with setCursor and update values without leftover characters
  • Use the LiquidCrystal I2C library by Frank de Brabander

Kit and components

  • Uno, I2C 16x2 LCD, 10 kΩ potentiometer, jumpers
  • Oscilloscope

Pre-reading about 20 min

Students read these on their phones before class. They are listed on the student Before class page.

  1. Lesson 20: What I2C adds
  2. Lesson 20: Addresses and scanning
  3. Lesson 20: Same 16x2 coordinates
  4. Theory Reference: I2C bus

Session plan

  1. 0:0010 min
    Recap

    Quiz: motors

  2. 0:1020 min
    Demo

    Four wires and an address

    Install the library, run the I2C scanner to show the address, then print on both lines.

  3. 0:3035 min
    Build

    Live reading on the LCD

    Students build the worked sketch, run the scanner on their own backpack and write its address on the module.

  4. 1:0545 min
  5. 1:5010 min
    Wrap-up

    Why the leftover digit?

Checkpoint: ready to move on?

Each student's LCD shows a live potentiometer value that updates without leftover characters, and they know their backpack address.

Extension for fast finishers

Capture an LCD update on the scope using the lesson's I2C section.

Catch-up path

Blank screen checklist: backlight, contrast pot, address, SDA and SCL swapped.

Homework and practice

Code Along 13.4 and 13.5.

Facilitator notes

  • Install the library on lab PCs before the session. Packages with similar names use different APIs.
  • Most blank screens are the contrast pot on the back of the backpack.