UPC EETAC Bachelor's Degree in Telecommunications Systems and in Network Engineering. Bachelor's Degree in Aerospace Systems Engineering EEL

Lab6

PRJ1

Laboratory 7

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

Lab8

[16/4]

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. 

LM016L LCD

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

Areduino prototype

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. This is the PCF8574 datasheet.


I2C bus

Concept.

 


SPI bus

Concept.

 

2. Planning

Hardware

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.)

 


Software

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:

C:\EMC\LAB7\Temp_LCD\(files)

3. Development and 4. testing

Hardware

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. 


Software

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

We can proceed enhancing the previous LAB6 PCB prototype board adding the LCD header as shown in Fig. 7 (LAB7_PCB_v1.zip).

PCB prototype ED

Fig. 7. 3D view of the prototype board completely wired. Only the cooper GND plane is yet to be connected.

Once the components soldered, we can connect the I2C and the power supply to the LCD board and run the circuit downloading the code to the Arduino chip.

Another idea may be monitoring and decoding I2C frames send to the LCD display using VB8012 instrument.

 

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. 8. 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.

DS3231 RTC + EEPROM

Fig. 9. 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.