Uber I2C LCD Controller Module

Preamble

This Instructable details how to create an HD44780 LCD based controller module (pic 1 above). The module allows the user to control all aspects of the LCD programmatically over I2C, comprising; LCD and display, contrast and back light intensity. Although the Arduino Uno R3 was used to prototype it, it will work equally well with any microcontroller which supports I2C.

Introduction

As mentioned above this article documents the creation of an I2C LCD Controller Module, it was primarily intended as a design exercise to determine how long it would take to create a practical working PCB.

The design replaces the standard generic controller module (pic 3 above) and draws on Instructables and libraries I've produced earlier.

From initial concept prototype (pic 2 above) to completed, fully tested PCB (pic 1 above) it took a total of 5.5 days.

What parts do I need?
See the bill of materials attached below

What software do I need?

  • Arduino IDE 1.6.9,
  • Kicad v4.0.7 if you want to modify the PCB. Otherwise just send 'LCD_Controller.zip' to JLCPCB.

What tools do I need?

  • Microscope at least x3 (for SMT soldering),
  • SMD soldering Iron (with liquid flux pen and flux cored solder),
  • Strong tweezers (for SMT soldering),
  • Fine pliers (point and snub nosed),
  • DMM with audible continuity check.

What skills do I need?

  • A lot of patience,
  • A great deal of manual dexterity and excellent hand/eye coordination,
  • Excellent soldering skills.

Topics covered

  • Introduction
  • Circuit Overview
  • PCB Manufacture
  • Software Overview
  • Testing the Design
  • Conclusion
  • References Used

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Circuit Overview

A full circuit diagram of all the electronics is given in picture 1 above, along with a PDF of same below.

The circuit was designed to be an exact replacement for the standard PCF8574A I2C LCD Controller Module with the following enhancements;

  • I2C user selectable 3v3 or 5v compatibility,
  • Digital contrast control or conventional pot setting,
  • Variable back light intensity selection with Quartic easing function control to achieve smooth fading.

LCD Display Control

This is a facsimile of the standard I2C LCD Controller Module utilising a PCF8574A (IC2) for I2C to parallel conversion.

The default I2C address for this is 0x3F.

3v3 or 5v I2C compatibility

For 3v3 operation fit Q1, Q2 ROpt1,2,5 & 6, IC1, C2 and C2.

If 5v operation is required then do not fit any 3v3 components, replacing them with 0 Ohm resistors ROpt 3 and 4.

Digital contrast

Digital contrast control is achieved via the use of a digital potentiometer U2 MCP4561-103E/MS and C4, R5.

If a conventional mechanical potentiometer is required then one can be fitted to the PCB, RV1 10K, instead of U2, C4 and R5. See BoM for compatible potentiometer.

By bridging jumper J6 the I2C adress is 0x2E. It it assumed for normal operation this is bridged.

Variable back light intensity selection

Variable back light intensity is controlled by PWM modulation of the LCD LED back light via U1 pin 6 an ATTiny85. In order to retain full compatibility with the standard I2C LCD Controller Module R1, T1 R7 and T2 are used to modulate the +ve supply rail.

The default I2C address for this is 0x08. This is user selectable, at compile time prior to programming U1.

Step 2: PCB Manufacture

As mentioned earlier this Instructable was an exercise, primarily intended to determine how long it would take to complete a design (which had a practical purpose).

In this instance I thought of the initial concept on Saturday afternoon and had completed the prototype by Saturday evening picture 1 above. My idea as stated, was to create my own variant of the I2C LCD controller module, with an identical footprint, offering full programmatic control of the LCD over I2C.

The schematic diagram and PCB layout were developed with Kicad v4.0.7 pics 2 and 3. This was completed on Sunday afternoon and the parts were ordered from Farnell and the PCB was uploaded to JLCPCB by Sunday evening.

The components arrived from Farnell on Wednesday, followed by the PCBs from JLCPCB on Thursday (I used the DHL delivery service to speed things up) pics 4, 5, 6 & 7.

By Thursday evening two boards (3v3 and 5v variants) had been constructed and successfully tested on a 4 by 20 LCD display. Pics 8, 9 & 10.

An amazing 5.5 days from initial concept through to completion.

It astounds me how fast JLCPCB are able to take an order, manufacture a double sided PTH PCB and ship it to the UK. A blistering 2 days for manufacture and 2 days to deliver. This is faster than UK based PCB manufacturers and at a fraction of the price.

Step 3: Software Overview

There are three main component parts to the software necessary to control the I2C LCD controller module;

1. LiquidCrystal_I2C_PCF8574 Arduino Library

Available here

To be used in your Arduino sketch to control the LCD display.

Note : This works equally well with the Generic I2C LCD Module Controller. Only it gives gives functionality than other libraries.

2. MCP4561_DIGI_POT Arduino Library

To be used in your sketch to programmatically control the LCD contrast

Available here

3. Programmatic control of LCD back light levels using PWM and Quartic easing function to achieve smooth fading.

As mentioned earlier the board contains a single ATTiny85 used to control the gradual fading of the display back light.

Details of this software are given in an earlier Instructable 'Smooth PWM LED Fading With the ATTiny85'

In this case in order to keep the final PCB dimensions the same as a generic LCD controller module the SOIC variant of the ATTiny85 was chosen. Pics 1 and 2 show how the ATTiny85 SOIC was programmed and tested in the prototype set up.

The code programmed into the ATTiny85 was 'Tiny85_I2C_Slave_PWM_2.ino' available here

For details on how to create your own ATTiny85 programmer see this Instructable 'Programming the ATTiny85, ATTiny84 and ATMega328P : Arduino As ISP'

Step 4: Testing the Design

To test the design I created a sketch named 'LCDControllerTest.ino' which allows the user to set any LCD specific parameter directly over a serial terminal connection.

The sketch can be found at my GitHub repository I2C-LCD-Controller-Module

Picture 1 above shows the 5v I2C compliant board press fitted to a 4 by 20 LCD and picture 2 the default display when running the test code for the first time.

It uses the following default values for back light and contrast;

  • #define DISPLAY_BACKLIGHT_LOWER_VALUE_DEFAULT ((unsigned long) (10))
  • #define DISPLAY_CONTRAST_VALUE_DEFAULT ((uint8_t) (40))

I found these worked well with the 4 by 20 LCD display I had lying around spare.

Step 5: Conclusion

When I first started in the electronics/software industry quite some time ago now, there was great emphasis on the use of wire-wrap or veroboard construction for prototyping with a lot of over-engineering on the final circuit in case you had made a mistake, given the cost and duration of a board re-spin.

A mistake usually cost you a few weeks on the schedule and blew the profit margin (and possibly your job).

PCBs were called 'art works', because they were truly works of art. Created twice full size using sticky black crepe tape by a 'tracer' or draughtsperson and photographically reduced by the fab house to make the photo resist stencils.

Circuit diagrams were also created by tracers and drawn by hand from your design notes. Copies were done photo-statically and called 'blue prints'. Because they were invariably blue in colour.

Micro-controllers were only in their infancy and were typically in circuit emulated if your company could afford one with the accompanying complex and expensive development environment.

As a maker at the time, the mere cost of the software development tool chain was prohibitive, you were inevitably forced to poke hex values direct into EPROM (RAM/Flash if you were very lucky) then spend hours interpreting the resultant behaviour to determine what your code was doing if it was not working as expected (bit 'wiggling' or serial printf being the most popular debug techniques. Some things never change). You typically had to write all your own libraries as none were available (there was certainly no rich source like the internet).

This meant you spent a lot of time trying to understand how something worked and spent less time creatively making.

All your diagrams were hand drawn, typically on A4 or A3 and had to be thoroughly thought through, giving them a logical flow of signal path from left to right. Corrections usually meant you needed to start with a fresh sheet.

For the most part your final circuit was developed using veroboard for permanence and mounted in a simple ABS enclosure to give it that 'professional touch'.

.

By stark contrast, I developed this entire project in 5.5 days using high quality freeware resulting in a professional standard PCB. Should the desire have taken me, I could have mounted it in a 3D printed box of my own making.

.

Something you could only have dreamed of less than a decade ago.

.

How things have changed for the better.

Step 6: References Used

KiCAD Schematic capture and PCB design

Arduino ORG Software Development Tool

LiquidCrystal_I2C_PCF8574 Arduino Library

MCP4561_DIGI_POT Arduino Library

Smooth PWM LED Fading With the ATTiny85

Programming the ATTiny85, ATTiny84 and ATMega328P : Arduino As ISP

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    Discussions