Most microcontrollers these days are 3.3 volt. I've been using plain old cheap 5 volt 1602 LCDs forever, but I got tired of always having to set up dual voltage to my breadboards. 1602 LCDs work fine with 3.3V signals, but the backlights are dim and the LCD is sort of faded at 3.3V. I know you can add the L7660 charge pump IC (about $3 Canadian) or a MAX660 (about $12 Canadian) and a couple caps to most 1602 LCDs to convert them to 3.3V. But either way that makes them not so cheap anymore.

So I splurged and bought a nice modern Sparkfun LCD-16397 SerLCD RGB Text LCD. Not cheap at all, but oh so nice. It's 3.3V only. It uses an AVR ATmega328P as a controller, and speaks I2C, SPI and serial. Very simple to use.

In this pic I hadn't yet figured out that it needs a 0x7c escape code before any settings command. Makes for a jumbled mess. RTFM better, ya dummy!

You can backlight the text to any of the usual 16.7 million RGB colors, and use 30 different brightness levels. The following pics are pure red, green, blue, cyan and yellow.

If you buy one and want to use it with I2C on breadboards, and not with other Qwiic devices, order a PRT-17912 cable as well. Worth it.

I'm very pleased with this LCD. I think it's worth the $$$.

Very simple demo for hardware I2C.
# ghmicro.com
# Sparkfun RGB Text 1602 LCD I2C - hardware I2c

import time, machine
from machine import I2C, Pin

i2c = machine.I2C(1,freq=50000)

# LCD functions
#**************
def lcd_string(buff):
    i2c.writeto(0x72,buff)

def line1():
    d = [0xfe,0x80]
    pair = bytearray(d)
    i2c.writeto(0x72,pair)

def line2():
    d = [0xfe,0xc0]
    pair = bytearray(d)
    i2c.writeto(0x72,pair)

def cls():
    d = [0x7c,0x2d]
    e = bytearray(d)
    i2c.writeto(0x72,e)

def rgb(red,green,blue):
    d = [0x7c,0x2b,red,green,blue]
    tri = bytearray(d)
    i2c.writeto(0x72,tri)

#------------------------------------------------------
# Begin here
#------------------------------------------------------
cls()                             #clear screen & line 1
rgb(255,0,0)
byt = "Black Pill"
string = bytearray(byt)
i2c.writeto(0x72,string)
line2()                           #line 2
while(1):
    for i in range(100000):
        string = str("%06d" % i)
        i2c.writeto(0x72,string)
        line2()
        pyb.delay(100)

Next Post Previous Post