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

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:3040 min
  4. 1:1040 min
    Build

    A live reading: Code Along at the bench

    One activity, not two: students run the scanner on their own backpack and write its address on the module, then write A live reading in Code Along until it passes and upload the same sketch to their LCD with the potentiometer on A0. There is no separate build of the worked sketch.

  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

Catch-up path

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

Homework and practice

Code Along I2C LCD: the crumbs counter if not finished.

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.
  • The lesson's See I2C on the oscilloscope section is covered in S32, which captures I2C traffic on the scope.