Often you will like to add a display to your RFzero, and many of the standard programs also enable the use of a display. Displays for Arduinos are typically Liquid Crystal Displays (LCD) or graphical displays. A display is a neat thing to put on your RFzero to let the user view the status of different things.

Please see the display description page for more information on how to connect a display.

Liquid crystal displays – LCD

In the world of Arduino the Hitachi HD44780 LCD library has become the de facto standard. Fortunately, the LCD library is part of the Arduino IDE standard installation.

A HD44780 parallel LCD can operate in either four bits or eight bits mode. The first requires 12 connections and latter 16 connections. Due to the lower number of connections in the four bits mode this is the most used one also because there is hardly any speed advantage using the eight bits mode. On the RFzero the LCD connector, JP12, is designed specifically for four bits mode and connect the RFzero to the LCD using a pair of six wire cables.

You can also use the I2C (Wire) bus to write to a LCD. This way you will reduce the number of connections from 12/16 to just four. This solution requires a I2C to parallel converter, shift register, thus is a bit more expensive and slower too.

When you have installed the RFzero library you will also have installed support for an I2C LCD use.

Graphical displays – TFT

There are many different graphical displays available and probably many of them can be used with your RFzero. However, the RFzero programs only support the ILI9341 320 pixels x 240 pixels and the ILI9488 480 pixels x 320 pixels via SPI.

If you have a different graphical display or with a different kind of interface, you will have to integrate this yourself.

When you have installed the RFzero library you will also have installed support for the ILI9341 and the ILI9488 TFTs

LCD examples

Below are two examples that show how to make use of an LCD with the RFzero. The first example uses parallel access, the standard Arduino library, and the RFzero on-board backlight and contrast circuit. The second example uses I2C/Wire and an external converter board for communication with the LCD. Both examples make an LCD, with 20 characters by four lines, look like below.

In the programs parallel access to the LCD are being used. If you want to change to I2C/Wire access, using the RFzero LCD I2C included library, originally made by DFRobot and johnrickman, you will have to change the LCD inclusion at the top of the .ino files and the initialization in the setup() function, i.e. from




Parallel access

In the below example a LCD 20 characters wide and with four lines is used in parallel mode using the JP12 LCD tailored connector on the RFzero. Any Hitachi HD44780 compatible LCD should work just fine.

I2C/Wire access

In the below example the RFzero LCD I2C library and an external board, with a PCF8574T, backlight and contrast control is used.

In the below example the I2C address of the LCD is 0x27, has 20 characters  and four lines. The LCD is connected to the default I2C bus on the RFzero on D8 (SDA) and D9 (SCL).

TFT examples

The graphical displays use primarily two libraries by Adafruit (Adafruit_ILI9431 and Adafruit_GFX) for the ILI9341 and the ILI9488 library by Jarret Burkett. Below are two examples that show how to use the ILI9341 and the ILI9488 graphical displays.

Example of ILI9341 use.

Example of ILI9488 use.

Display in other files than .ino

What if you want to access the display in one or more of your .cpp files? Well, you will have to create a display object in each .h file but this will take up precious and unnecessary memory. Instead you can use the extern keyword, and only have one instance of the display library declared in the .ino file. The use of the extern keyword tells the compiler to look elsewhere for the display object but it is accessible in the .cpp and .h files.

Below is how to do it, using an LCD, but the TFT works the same way, where one set of .cpp and .h files are in use, but this could be one or as many as needed.

File: MyProgram.ino.

So in the .ino file just do as you normally would do.

File: foo.h.

I.e. in the .h file add the #include to the library and the extern to the object for the LCD library.

File: foo.cpp.

In the .cpp file you can now access the LCD library just as you would to in the .ino file.