LCD 1602 odometer style digit rollover

I've just put together a small demonstration of implementing digit rollover (similar to an odometer style) for an LCD 1602 display. I did something similar some time ago for a Vacuum Fluorescent display which had 8 digits, each with 35 directly addressable segments so, actually, that was easier.

Anyway, this uses custom characters during the transition from one digit to the next to create the rollover effect. These are created dynamically in the character generator RAM (CGRAM) of the HD44780 chip.
I've tested it with a couple of different Arduino (I2C) Liquid Crystal libraries and it seems OK. If you have trouble, first get a "Hello World" sample sketch working, based on an example for the library you are using, then update the library specific parts in the sketch as necessary.

The complete code, including a .h file for the fonts, is in the attached zip file.

The active GIF file shows only a few seconds due to size constraints. The demonstration software is unlimited.

midnight rollover.gif

midnight rollover.gif

LCD1602_RollDigits.zip (2.66 KB)

1 Like

Nice. I did something similar some time ago( LCD Module Pushwheel Animation – Arduino++) but it always looks cool to see it working, I think.

One thing of note is that if you use the hd44780 library with the hd44780_I2Cexp i/o class with a backpack that supports reads (like the PCF8574 based ones) you can update a custom character and afterwards the library will put the LCD cursor back to where ever it was prior to calling createChar()

You don't have to call setCursor() or clear() or home() to get the LCD back into DDRAM mode after calling createChar()
The library takes care of everything for you and restores the cursor position.

--- bill