Shrinking an IP address to fit on the PCD8544 Nokia 5110 style LCD - MicroPython Example
LCD status displays can really simplify troubleshooting IoT devices. I need to know the IP address of the device. and MDNS doesn't always work for me. I could log into my router to find the IPs of my devices but it is simpler to add a cheap display and log the IP address on the display.
I have a pile of cheap Nokia-style modules that are 84 pixels x 48 pixels. The Adafruit Python driver defaults to a 5x8 font which results in 6x10 dot character spacing. 5 lines at 10 pixels tall is more than 48 pixels but we don't need the last two padding rows because there is nothing below them. That turns out to be 14 characters on the 5110-style LCD. IP addresses can be 15 characters if all 5 octets are 3 decimal digits. This means it is possible to lose the last character of an IP address as shown below.
Video
Test Program
The driver calls our re-usable IP address to render. See the line in bold.
Comments
Post a Comment