UPC EETAC Bachelor's Degree in Aerospace Systems Engineering EEL



Laboratory 7

LCD and other displays. I2C and SPI buses, digital sensors and actuators.



1. Specifications

Our goal is to add an LCD to our temperature measurement system inherited from LAB6. Let us use it for representing ASCII messages and numbers showing temperature values and FSM states. An alternative system or  complementary representation to the serial port. 

The schematic of our application is represented in Fig. 1.

LCD inteface

Fig. 1. Adding an LCD display to our data acquisition system.

One of the simplest LCD displays available is the LM016L represented in Fig. 2, already studied in detail in P11 where it is directly interfaced to a PIC microcontroller system using  seven wires: 3 control lines (E, RS and R/W) and a DB(7..4) data bus for sending messages and commands. 


Fig. 2. LM016L board that is also simulated as a component in Proteus. 

Arduino does not have that number of available I/O pins if we are thinking on inheriting and enhancing previous projects, thus we will consider the alternative connection shown in Fig. 3 using only the 2-wire bus I2C explained in detail in the section below.  

I2C interface

Fig. 3. LM016L connected to an 8-bit input/output (I/O) expander for the two-line bidirectional bus (I2C) to simplify the hardware connection to a microcontroller such Arduino. PCF8574 datasheet.


I2C bus



SPI bus



2. Planning


I2C port is available in Arduino at IO18 (SDA) and IO19 (SCL). Using I2C interface implies that AD4 and AD5 are not available. The same drawback happens with the SPI bus used by many more sensors and devices. If the SPI port is used, IO13, IO12, IO11 and IO10 are no longer available as digital inputs or outputs.

Pinning Arduino UNO

Fig. 4. Arduino UNO board hardware (ref.)



The key idea on using such complex peripherals and buses is the library of functions that will make easy programming the device. The other idea is to write the LCD only when there is new information to display, this is why a new indicator is used: var_LCD_flag = 1 when there is new information to write on the LCD.

Project location:


3. Development and 4. testing


We can take full advantage of Proteus virtual laboratory copying and enhancing LAB6 projects adding I2C (and SPI) headers where to connect the LCD and other sensors or actuators. Temp_meter_LCD.zip.


Board capture

Fig. 5. Board including the LCD. 


Indications on how to install the LCD I2C library are posted in this CSD similar example Temp_meter

This is the board running.

Board running

Fig. 6. Board running representing temperatures on the LCD screen.


Topics in EMC


5. Prototyping

As a first idea we can connect the I2C and the power supply the LCD board and run the circuit downloading the code to the Arduino chip. Using VB8012 instrument we can decode I2C frames.

As a second idea we can proceed adding a few more components and headers to the Arduino shield PCB board under development in Ultiboard.


6. Reporting

- Add another digital output, name it Q_ACT,  and drive it ON while acquiring/measuring/transmitting and OFF while doing nothing, so that a pulsed rectangular waveform can be visualised on the oscilloscope. Check that its frequency is 2 Hz and measure its TON duration. Determine the maximum sampling frequency of this system.

Acquisition waveform

Fig. 7. Waveform showing acquisition activity during an small fraction of the sampling period.

- Find examples of other sensors or actuators with I2C or SPI interface. For instance, this DS3231 real-time chip plus AT24C32 serial EPROM chip where to store temperature measurements every minute. The DS3234 is a similar RTC with SPI interface.


Fig. 8. I2C Breakout containing a RTC DS3231 and a 32 Kbit EEPROM. Find the board schematic and also the corresponding software libraries for communicating with the chips.