Week 7 · Displays & Signals
Session 31: The 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.
Session plan
- 0:0010 minRecap
Quiz: motors
- 0:1020 minDemo
Four wires and an address
Install the library, run the I2C scanner to show the address, then print on both lines.
- 0:3040 min
- 1:1040 minBuild
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.
- 1:5010 minWrap-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.