Skip to content

Designer or ViSi: Arduino I2C Basic Example

Introduction

This codebase example demonstrates how to interface a 4D display module to an Arduino board using the I2C protocol. Since the PICASO and DIABLO-16 processors can only act as I2C masters (at the time that this codebase example was created), the Arduino board can therefore act only as an I2C slave.

Note

The PICASO processor has only one dedicated I2C port, while the DIABLO-16 has three user-configurable or user-mappable I2C ports (see the datasheet for your target display module for more specific information).

For the uLCD-32PTU, note that there are already on-board pull-up resistors for the SDA and SCL pins. For the user-mappable I2C ports of the uLCD-35DT, the user has to provide the pull-up resistors externally. Again, consult the datasheet for your target display module for more specific information.

There are several files included in this codebase example. The files are as follows:

PICASO Designer Project DIABLO-16 Designer Project Corresponding Arduino Sketch
I2CmasterWriter_R_1_0.4dg I2CmasterWriter_R_1_0b.4dg slave_receiver_R_1_0.ino
I2CmasterReader_R_1_0.4dg I2CmasterReader_R_1_0b.4dg slave_sender_R_1_0.ino

I2C-master-writer-and-slave-receiver setup: the display module (I2C master) writes to the Arduino board (I2C slave). The Arduino board receives the data and sends them to the serial monitor on the PC.


I2C-master-reader-and-slave-sender setup: the display module (I2C master) reads from the Arduino board (I2C slave). The display module then prints the received data on the screen.

Prerequisites

This codebase example assumes the reader can program the 4D Systems display module using Workshop4 IDE Designer or ViSi environment. Beginners are advised to read the following aplication notes.

Instructions

  1. Compile the Designer project and upload the program to the target display module. Refer to the table above to determine the project for your target display module.

  2. Compile the Arduino sketch and upload the program to the target Arduino board. Refer to the table above to determine the correct sketch for the chosen Designer project.

  3. Connect the display module to the Arduino board properly. See the attached schematic diagrams.

  4. Power on both the display module and the Arduino board.

For the I2C-master-writer-and-slave-receiver setup, the Arduino board should be able to print to the serial monitor the values of the variable x.

For the I2C-master-reader-and-slave-sender setup, the display module should be able to print the correct string on the screen.

See the videos for the expected output. Ideally, the I2C slave device (the Arduino board) should be up and running before the I2C master device (the display module) starts sending messages.

Attachment

Project File