There are many types of I2C character LCDs on the hobby electronics market. To design my new open source data loggers and Phi-3 Arduino shield, I decided to move away from the bare parallel HD44780 character LCDs and go with character LCDs and I2C backpacks (aka I2C LCDs). I found out a few popular designs and thought that I would summarize them for your convenience.

Most I2C LCDs are based on the following two ICs, all of which are I2C I/O (port) expanders:

  • PCF8574 or PCF8574A
  • MCP23008


Both ICs have 8 I/O pins. MCP23008 is more versatile but that is irrelevant to simple applications in LCDs.

Adafruit designed an I2C LCD backpack and Arduino LCD shields based on MCP23008. There are compatible devices sold on ebay. I can’t tell without seeing the sample code to decide whether an ebay seller is actually selling a compatible product. But if you do want to get one on ebay, make sure you find their library code and confirm that the library contains Adafruit’s names. Libraries you find from ebay sellers are likely out of date though. One good thing is that the compatible ones are very likely using the same pin assignments as Adafruit’s so it’s easy to get it to work once you get the library installed.

FM (Francisco Malpartida) designed an I2C LCD backpack based on PCF8574. There are lots of compatible devices sold on ebay and they don’t have the same pin assignments! This creates issues when you are making purchases thinking that they have certain pin assignments. The pin assignments refer to which PCF8574 pin is connected to which HD44780 display pin. Also the I2C addresses are all different. I don’t mean one might have an address of 0x3F and another might have 0x3E. What I mean is that one might have 0x3F and another one may be 0x20. There is no way to set one display that has address 0x20 to address 0x3F! PCF8574 has address space of 0x20 to 0x27. PCF8574A has address space of 0x38-0x3F. Most common addresses I’ve seen are 0x20, 0x27, and 0x3F, with the latter two sharing pin assignments that are different from the ones with 0x20 address. Most of these displays allow you to cut traces or solder pads to change addresses. Why would you if you don’t have multiple LCDs?


Adafruit has its own library Adafruit_LiquidCrystal. This library is decent. It can take different pin assignments as parameters. On the other hand, it is a different library than Arduino’s included LiquidCrystal library. So code you wrote for LiquidCrystal library may need some change when you switch to an Adafruit compatible I2C LCD.

FM wrote a library New LiquidCrystal. This library is pretty good. You can use a number of different LCDs including parallel HD44780 LCDs, I2C LCDs using PCF8574, LCDs using shift registers etc. A nice feature is that there is a base class LCD so regardless what actual type of LCD you are using, as long as it’s supported by this library, it works the same way on the software level as another supported LCD.

Since not all PCF8574/74A I2C lcds have the same pin assignment, or even back light polarity, using the correct definition will be crucial. I found the following three definitions. Each seems to work with the particular I2C address, although there is no relation between I2C address and how the pins are assigned (by circuit designer):

The first two work on backpacks that look like this:

Notice that only the address is different. Pin assignments and back light polarity are all the same.

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Blue potentiometer with back light jumper.

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Blue potentiometer with back light jumper.

The last definition works on backpacks that look like this:

Notice that pins are very different and back light polarity is negative.

LiquidCrystal_I2C lcd(0x20, 4, 5, 6, 0, 1, 2, 3, 7, NEGATIVE); // Tiny mental potentiometer no back light jumper.


In case you can’t determine the address or pin out, say none of the above definitions work, but you’re sure the IC is PCF8574/74A, you should first scan the I2C bus for the address, and then use your meter to map out the pin assignments, and then use your definition. The lcd constructor has the following parameters: lcd(add, En, Rw, Rs, d4, d5, d6, d7, Bl, Pol).

Here is the I2C scanner I use by Tod E. Kurt:



Phi-shield revised and released


It has been a while since I gave the phi-shield a major revision. I’ve been working on this for a while and now I am releasing the Phi-3 shield. This shield continues to support user interaction with LCDs and buttons. Here is a list of the features:

The following hardware are provided by the shield:

  • 20X4 LCD with back light on/off control
  • Six buttons (up/down/left/right/B/A)
  • Two LED indicators
  • Speaker
  • MicroSD card slot
  • Real-time clock (DS3231)
  • EEPROM (32KB 24LC256)
  • Connector for Adafruit Ultimate GPS module or Bluetooth module
  • Stacking headers for easy access to all pins.
  • Recessed board right edge for easy access to MEGA’s 18X2 pin headers on the right side.
  • Reset button


The following software functions are provided by various supporting libraries:

  • User-selectable menu (LCD + buttons)
  • Number and text entry (LCD + buttons)
  • Scrollable long text (LCD + buttons)
  • Date and time (DS3231 or GPS)
  • Location (GPS)
  • Data and configuration storage (MicroSD card and EEPROM)
  • Playing simple tones (speaker)
  • Indicators (LEDs)
  • Wireless connection (Bluetooth module)


There are three tiers of Phi-3 shield kits: kit0, kit1, and kit2, none of which includes a GPS module. The kits are immediately available. Buttons with color caps as pictured will be included while supplies last.

Here is the Phi-3 shield’s own page. There are links on the page to make purchases. Or you can visit the BUY page to see what stores carry this shield.

Phi-3 shield

Video demonstrations will be available next week. Meanwhile, the support of Phi-2 shield will remain. If you need Phi-2 shields, I have them available.


Directional keypad for phi-panel

This is a directional keypad I developed for phi-panel, together with the rotary encoder keypad.

There are two sizes, 20X4 and 16X2.


  • Laser-cut 3mm-thick glossy/matte black acrylic face plate with window to mount a 20X4 or 16X2 character LCD and a 8 push buttons. You choose which side to use, glassy or matte. Brown/white color is removable protective layer on both sides.
  • 4 push buttons are arranged in up/down/left/right
  • 2 buttons above the directional buttons and 2 above.
  • 8 short standoffs for LCD and keypad circuit board, 4 long standoffs for the face plate, 12 screws and 12 nuts, all M3 in size
  • 6 button covers in case you want to cover up the button holes you don’t use
  • PCB for the keypad and 8 buttons

Currently the 20X4 version is out of stock. I only made 2 in a batch of 4 new keypad face plates. If you want the 20X4 kit please respond with a comment.

Initial tests are all positive with phi-panel functions with new firmware. The directional keypad is very nice if you don’t need the 0-9 numbers provided by the matrix keypad. There is no more setup menu you can call up with the escape key.

It took me forever to make those white connectors. The female crimp end was so hard to make that if you add just a bit too much solder the spring is soldered on and can’t accept pins. These are not the best ways to connect the keypad to phi-panels. I did it only because I want to switch between keypads between photos and videos so I don’t have to tie up two assembled panels with keypads.

In the kit, I included regular male headers. You can simply solder wires to the pins or use male headers and wire wrap to the pins for connection, much easier than the white wafer connectors.

I am writing documents for these keypads but you can already purchase these kits and tinker with them. It’s pretty easy to hook them up to phi-panels or your arduino in case you don’t want a phi-panel.

Videos (20X4 version):

Still shots:

New phi-panels documentation

I have been procrastinating but there is no shame to release a documentation with one or two things not yet documented, out of hundreds that have. So here we go. This documentation matches firmware version 1.6.2

http://code.google.com/p/phi-panel/downloads/detail?name=Phi-panel-serial documentation 20121029.pdf

New functions are added to family of phi-panels

Arend requested some new features that I thought was useful to everyone:

1) Have up to 32 items on a menu/list

2) Have a way to set which item is high lighted so the user will not have to go through the entire list from item 1.

This resulted in quite a bit of work and time (I have about 3,000 lines of code that I have not touched for a while). Anyway now let’s welcome firmeware 1.6.2 with the following additions:

Dennis also requested some discrete button options but that will not be released to everyone (unless you all want that).


1) Added support for 8 discrete buttons with back_pack version. Firmware will be uploaded in a separate file

2) Updated EEPROM key to 0x61 for back_pack_8_keys and 0x62 for this version

3) Added support for up to 32 items on a list.

4) Added support for up to 660 characters for long messages or menus.

5) Added option to preset highlighted menu item with menu_highlighted_item. It updates with each selection.

6) Added a serial command to set this menu_highlighted_item value with “\eWn~”. Eg. “\eW3~” highlights item 3 (1 based) for the next menu phi-panel receives.

Download the firmware here if you want to get the update and MAKE SURE YOU DOWNLOAD THE RIGHT ONE FOR YOUR PANEL OR BACKPACK SIZE.

First read the wiki about how to upload firmware then download the correct 1.6.2 version for your hardware 🙂


Arduino Emulation on PC

I have worked on this for a while and was able to run arduino code on my PC. This is to make debugging much easier and compiling much faster (1 second compared with minutes of compile and upload). Since the purpose was to develop phi_prompt programs, I only made emulations on key Arduino functions, liquidcrystal, DS1307, phi_interface, and phi_prompt libraries. There are no real hardware hooked up to arduino. Future development may include some limited feature such as digitalWrite or other hardware that I might need for projects. Here are some pictures to accompany my previous post about the professional development kit for phi_prompt:

The supported Arduino stuff is here:

microSeconds(); //Good luck with this on a multitasking operating system!

PROGMEM related definitions and functions. Seems to be working with “c-strings in PROGMEM and a pointer array in PROGMEM to point to these strings”. I have not tested other data types. Be careful with this though, pitfalls may still exist
strlcpy(); // This is only available with GNU C not a standard one but I need it.

LiquidCrystal library. Will work on write(char), print(int) and print(float)

Everything except for below functions, which I don’t use
        void noDisplay();                                                         ///< Turns off the display
        void display();                                                           ///< Turn on the display
        void scrollDisplayLeft(); // Hate these scroll functions. Useless
        void scrollDisplayRight();
        void leftToRight();
        void rightToLeft();
        void autoscroll();
        void noAutoscroll();
        void createChar(uint8_t, unit8_t*); // I can’t create char on PC

DS1307 all working except for this one I didn’t implement. Easy to do though. Also start and stop have no actions. You can’t change DOW without changing dates.
    int get(int, boolean);

phi_interfaces input device library only has the phi_serial_keypads class which takes inputs from keyboard. Function keys are wsadfg of course (who didn’t play some FPS games?)

phi_prompt user interface library works except that the right arrow looks different and the scroll bar is not as awesome as on real LCD

Phi_prompt advanced features video demo

I have developed many features with my famous phi_prompt user interface library. These features are too specific to be turned into library function calls but I have a well-documented set of examples for lots of these features that will open your eyes.

These feature code and some professional consultation will be offered under “Arduino User Interface Professional development kit for phi_prompt” together with a PC emulation engine that you can emulate arduino and tweak on a PC with debugger and use your keyboard to operate the emulated code and copy paste to arduino to load to arduino when you are finally satisfied. It saves you tons of time for waiting for uploads and saves your hair from pulled off when debugging with arduino IDE.

Here is a video, take a look at these eye candies features:

I’ll be adding more features including variable length of list (say you adjust one parameter and the list expands to show its details).

By no means can I support newbies with these features that can’t even be turned into generic library function calls but to more experienced people trying to make money with their products, these features add values. Hope I can use fund I get from professional help with professional projects using these features to support the free end of my library (actually all library function calls are free to use but how you use them to make advanced features are not yet open).

Phi-panel face plates

Face plates are coming out! These are white 3mm acrylic face plates made from laser cutting. I didn’t choose color since I thought I could just paint the white to any color I wanted. Well, I don’t really have a spray painting can :((

If you want to make them, just leave a message here. I’ll be posting the design file in a while.

This is the design file in Corel Draw 11 (super old version). It should export into the .svg file for laser cutting at ponoko.com with the 180mm*180mm service (cheapest) if you also have Corel Draw. Otherwise, download the .svg file. I am not sure what software to use to modify .svg if you want some changes though.

To make it, set up an account at ponoko.com and choose acrylic (3mm thickness suggested).

Contains 2 16×2 face plate, 1 20×4 face plate, and one arduino uno support.

Corel Draw file:


Exported .svg file:


Suggested push buttons: EG1861-ND, caps: EG1882-ND, EG1881-ND, EG1880-ND. All these are digikey.com part numbers. These are the cheapest ones I could find.
Suggested spacers: M3 thread 8mm spacing and M3 screw: 25509K-ND, H742-ND.

Serial LCD backpack

Since my success on phi-panels with integrated keypads, I’ve decided to make a serial LCD backpack as well. This backpack will support membrane matrix keypads and buzzer off board with all the same great features of the original phi-panels, just cheaper and more flexible if you want the serial backpack to make the least impact to how your project has been set up. Here it is:

At the moment, I only have 16*2 and 20*4 displays in stock but you should have no problem with 20*2 display and 40*2 displays. If in the rare occasion your display has double row pin holes, you can always solder wires between your display and the backpack.

You can set the size of the display over serial or on the on-board menu, with a 4*4 membrane matrix keypad.

This is the cheapest serial backpack out there. The I2C backpacks sold by adafruit etc. don’t have any processors on them so they will waste your arduino just as much time and FLASH space to operate as a parallel display. With the vast 24KB on-board firmware and functions, this backpack trumps any of its competitors!

I am offering these for sale on inmojo at the moment, although if you are interested in trading with me (I collect old CPUs, in the early 1990’s and earlier), I can trade with you as well. Read this post if you are interested in exchange:


New multi-tap keypad

After a Phi-panel user (Daniel) has requested for more symbols on the multi-tap keyboard, I added all symbols to the keypad, why not? 🙂

Now the keypad has 7 symbols for each numeric key except for 9, with 6 symbols only. The symbols such as greater and less, brackets, parentheses, and curly braces, are all symmetrically located so if you get used to the pad, say memorized “(” is 5 presses on key “4”, then the “)” will be also 5 presses on the next key, “5”. Again all + – * / are located together on key 1.

On HD44780 displays, the ‘~’ and the ‘\’ are displayed as right arrow and the Japanese Yen (HD probably means Hitachi display). That’s unfortunate. Hope that would be a big deal for most of us.

New keypad:

Old keypad:

To update your panel firmware, please go to the google code download page to download the firmware and follow the steps in the wiki page at the code site for updating. If you have questions, leave them here so I can answer them. Thanks.


%d bloggers like this: