Install the Display Module

Cow Pi mk1f: Arduino Nano form factor, I2C communication

Important

You will need a Phillips-head screwdriver to adjust the contrast on the LCD character display. If you do not have one, I have placed a screwdriver at the TA desk in the SRC.

Examine the I2C-LCD serial interface. Notice that the header has 4 pins (Fig. 59): VCC (common collector voltage), GND (ground), SDA (serial data), and SCL (serial clock). When the display module is oriented for viewing, these header pins will be on the left.

../../../_images/i2c-module-header.jpg

Fig. 59 The display module’s header has 4 pins.

Fig. 60 shows a diagram of the wiring to connect the display module to the breadboard.

Diagram of display module's connections to the breadboard.

Fig. 60 Diagram of display module’s connections to the breadboard.

I2C connections on at the microcontroller.

Fig. 61 I2C connections on at the microcontroller.

Important

Before proceeding further, disconnect the USB cable from the Arduino Nano.

:[   ]:

Look at Fig. 62 to determine which display module you have:

../../../_images/blank.png

Fig. 62 Display modules that use the Serial-Parallel Interface protocol

a

../../../_images/hd44780-character-floating-display.jpg
HD44780-driven LCD character display.

(attached to serial adapter)

b

../../../_images/hd44780-character-pinned-display.jpg
HD44780-driven LCD character display.

(not attached to serial adapter)

c

../../../_images/ssd1306-oled-graphic-display.jpg

SSD1306-driven OLED graphic display.

  • If you have an LCD character display, it might be attached to the serial adapter (Fig. 62(a)) or the adapter might not be attached to the display (Fig. 62(b))

    • If your I2C-LCD serial interface is NOT attached to the LCD display module, then you will use the breadboard to provide the electrical connections between the serial interface and the display module.

      :[   ]:

      Insert the LCD display module’s sixteen pins into contact points g48-g63.

      :[   ]:

      With the four header pins pointing to the left, insert the I2C-LCD serial interface’s sixteen downward-pointing pins into contact points i48-i63.

      :[   ]:

      Take the 4-conductor female-to-male rainbow cable and attach the 4 female connectors to the display module’s 4 header pins.

    • If your I2C-LCD serial interface IS attached to the LCD display module, then the sixteen pins connecting the serial adapter to the display module do not need to be inserted into the breadboard.

      :[   ]:

      Take the 4-conductor female-to-male rainbow cable and attach the 4 female connectors to the display module’s 4 header pins.

      :[   ]:

      Optionally place a jumper wire looped from a63 to j63 to prevent the display module from sliding around.

  • If you have an OLED graphic display (Fig. 62(c)):

    :[   ]:

    Insert the header pins into 4 adjacent breadboard rows.

    :[   ]:

    Take a 4-conductor male-to-male rainbow cable and insert one end into the same rows as the display module’s 4 header pins.


:[   ]:

Identify the wire that is connected to the display module’s SCL pin; insert the male end of this wire in contact point a9 (electrically connected to the Arduino Nano’s D19/A5 pin).

:[   ]:

Insert the male end of the SDA wire into contact point a8 (electrically connected to the Arduino Nano’s D18/A4 pin).

:[   ]:

Insert the GND wire into the upper ground () rail, and the VCC wire into the upper power (+) rail.

When you have finished connecting the display module, there should be the electrical connections described in Table 34.

Table 34 Electrical Connections for Display Module.

Display Module pin

Arduino Nano pin

Power/Ground Rail

SCL

D19/A5

SDA

D18/A4

GND

ground () rail

VCC

power (+) rail

Attention

CHECKPOINT 8 | Before proceeding further, have a TA, a classmate, or a friend verify that you have correctly connected the display module to the breadboard. Update your checkpoints.txt file to indicate who checked your work and when they did so.

  • If you are using the Arduino IDE:

    :[   ]:

    Open the FileExamplesCowPi_stdiohd44780_blinky example.

  • If you are using PlatformIO:

    :[   ]:

    Create a new project named DisplayTest with the appropriate board selection for your Arduino Nano. Without removing anything from your platformio.ini file, add the following to your platformio.ini file, replacing ▶environment_name◀ with the environment name that PlatformIO created automatically for you:

    [platformio]
    src_dir = .pio/libdeps/▶environment_name◀/CowPi_stdio/examples/hd44780_blinky
    
    [env]
    lib_deps =
      docbohn/CowPi @ ^0.7.0
      docbohn/CowPi_stdio @ ^0.6.1
    monitor_echo = yes
    
:[   ]:

Compile the program and upload it to your Arduino Nano.

You should see the display module’s backlight blink on and off. If so, then you have correctly connected the display module and serial adapter even if you don’t see a message on the display module.

:[   ]:

Using a screwdriver, turn the trim potentiometer on the serial adapter until you can see the “Hello, world!” message.

../../../_images/lcd1602.gif


Kit Assembly is Complete

You have now finished assembling the class kit. In the upcoming I/O labs, you will use the kit to learn about memory-mapped I/O and about handling low-level interrupts.

Diagram of completed Cow Pi mk1f circuit with LCD1602 character display.