We are experiencing high volumes, online orders are 2-8 weeks lead time.
In observance of the Good Friday Holiday, Matrix Orbital will be closed on Friday March 29, 2024
No shipping or processing of orders will take place during this time.
We will resume regular business hours on Monday April 1, 2024.

Intelligent I2C LCD HMI control using an Arduino and I2C protocol

Posted by Troy 17/04/2018 0 Comment(s) App Notes,

Installing Arduino IDE

This application note was created to showcase the ease of use offered by a Matrix Orbital I2C Intelligent LCD in the open source Arduino hardware/software environment.  Additional information regarding the Arduino Uno development board and compiler used for this project can be found at www.arduino.cc.  Our Uno hardware was purchased from the good folks at Solarbotics here in Calgary, www.solarbotics.com.

 

The compiler and installation instructions can both be found under the Downloads heading.  Once installed, the Arduinodevelopment environment will centre on a simple, C-based language.  References for all functions used below can be found on the Arduino website.

 

Connecting an Intelligent I2C LCD to Arduino Uno

The display chosen for this demo is an I2C version of the External HMI LCD ELK204-7T which uses the LK204-7T 1U HMI LCD. This required that the protocol select resistors be moved from the RS232 serial block to the I2C setting.  No pull-up resistors were used in this demo, but if necessary there are pads below the I2C block.

Description: Matrix Orbital Intelligent LCD to Arduino Uno Wiring Diagram

The Arduino Uno board offers SDA and SCL connections via analogue input pins A4 and A5 respectively; revision 3.0 also has dedicated I2C pins above AREF.  The cable used was again modified, this time from a BBPDC parallel development cable, connections are shown above.

 

Arduino Wire (I2C) Instructions

The Arduino software environment offers a built in I2C library, which can be accessed by including Wire.h in your project.  Please note that Arduino uses a 7bit I2C address while your Matrix Orbital Intelligent I2C LCD uses 8 bits.  To convert addresses, simply shift them one bit to the right: the default 0x50 becomes 0x28.

 

All I2C transactions begin with the begin function, which can be added to your setup routine.  Writing is a three step process: the write function is nestled between begin and end transmission calls.  Reading can also take three steps: a request, followed by a recommended check for available data, and finally the actual read.  Additional information regarding this wire library code can be found at arduino.cc/en/Reference/WireWrite and arduino.cc/en/Reference/WireRead.

 

Intelligent I2C LCD Control

With reading and writing sorted, it becomes quite easy to create functions to send data to and read information from a Matrix Orbital Intelligent I2C LCD.  Text as simple strings and commands as character arrays can be passed with their lengths directly to the I2C write function.

Intelligent LCDControl Menu Screens

Description: https://www.matrixorbital.com/image/catalog/Blog%20Images/LK204-7T%20Arduino%20Demo%20Home.png

Description: https://www.matrixorbital.com/image/catalog/Blog%20Images/LK204-7T%20Arduino%20Demo%20Backlight_1.png

Description: https://www.matrixorbital.com/image/catalog/Blog%20Images/LK204-7T%20Arduino%20Demo%20Contrast.png

Description: https://www.matrixorbital.com/image/catalog/Blog%20Images/LK204-7T%20Arduino%20Demo%20LED.png

Reading from the LK204-7T-1U Intelligent I2C LCD requires a little more setup: reporting mode should be set to I2C and auto-transmit of key presses should be turned off.  At this point the poll command can be issued to query the Matrix Orbital intelligent I2C LCD for a byte and the I2C read algorithm can be used to return it to the program.  If it all goes right you’ll be able to navigate through the screens pictured above.

 

For complete code associated with this Matrix Orbital Intelligent LCD Control using I2C on Arduino" Application Note, please visit www.matrixorbital.com/app/arduino.