Computing stuff tied to the physical world

LCD display via I2C

In AVR, Software on Sep 28, 2009 at 00:01

Ok, it’s working – always takes longer than expected, especially if you mess up in both hardware and software!


There’s a miniature trim pot on the left to set the contrast level. I haven’t yet added the transistor to turn the backlight on and off.

Note that with an MCP23017 chip there are 9 I/O lines available for other purposes. On the upcoming LCD Plug, I’ll probably use the smaller MCP23008 instead.

This particular setup works at the maximum I2C bus speed supported by bit-banging, which should be well over 1 MHz – I haven’t measured it. If the bus is long or is shared with slower peripherals it can be lowered to 400 KHz or 100 KHz by specifying an extra argument in the PortI2C constructor.

The sample code is available here. It will be integrated with the Ports library later.

PS. There are a few days left for the special offer in the shop. If you’ve ordered before or have participated on this weblog or in the forum, you can get 20% off until the end of September. Email me for a discount code.

  1. Hi JC, What special offer? I didn’t see it at the shop site… I’m also interested in this LCD display plug, please let me know more details about pricing and shipping delay.

  2. Cool!!

    Will it daisychain?


  3. Nice, very nice… Who’s for Zork on the Jee-node :)

    I did notice a I2C port on the node, could you use this as well? It would save one of the four I/O ports.

    • Yes, you can. This does require different software – the Ports library does not know about the Wire library right now. I’d like to find an easy way to switch between either hardware- or software-supported I2C.

      I’ve also been experimenting with a little “I2C Connector” board with a 3.3V regulator on it which connects to the 4-pin PWR/I2C header on one side and has a Port-compatible 6-pin header on the other (having both PWR and 3.3V, as expected by most I2C plugs).

Comments are closed.