by Floris Wouterlood – The Netherlands – January 17, 2021
Introduction
Not so long ago the family of ESP8266 microcontroller boards welcomed a new member: the ESP32-WROOM. This device contains an impressive 32-bit dual core Espressif Systems microprocessor that enables a long list of features. The most important of these are: timers, WiFi, Bluetooth, 4x SPI, 2x I2C, capacitative touch sensors, ethernet MAC interface, PWB, built-in Hall effect sensor, security features, GPIO wake-up, 520 kB RAM to store program instructions and 4 MB flash memory depending on the specific chip. The microprocessor moves its 32 bits of instructions powered by a crystal oscillating at 40 MHz (specifications by the manufacturer). Most important is that support for ESP32 microcontroller boards in the Arduino IDE can be acquired by going to File → Preferences → Additional Board Manager URLs and adding here to the line the following (don’t forget a separator comma if there is already support for other boards, e.g. ESP8266 types):
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
figure 1. Wiring of a Nokia 5510 LCD with a ESP32-WROOM-32 board.
There are several variations of the ESP32 on the market. The ESP32-WROOM-32 at hand has an intimidating number of 30 pins divided over two rows (figure 2). These pins are labeled in a way that is at first sight very confusing. For instance a number of GPIO pins are missing. Pins GPIO 6 through 11 are internally used to support the integrated 4MB flash memory and therefore do not appear as external, physical pins. GPIO pins 1 through 5 are scattered over the board. GPIO pins 17, 20, 24, 28, 29, 30, 37 and 38 are missing. Surprisingly a physical pin dubbed ‘GPIO 39’ in the pinout scheme is available (labeled ‘VN” on the real board) and completes the long list. Yet, the WROOM is Arduino compatible and because in terms of Arduino dimensions it is a multifunctional monster performer it is an interesting and promising platform to exploit in numerous projects, e.g. domotics and internet applications. Pinout schemes are available on several web sites (search term “WROOM pinout”). YouTube provides a score of informative videos.
As the platform is too big to fit one standard breadboard I placed one on two breadboards positioned side-by-side. On each side of the micro USB port on the short end of the board there is a push button, one labeled ‘BOOT’ and the other labeled ‘EN’. So far so good.
figure 2. Nokia 5510 LCD in action with a ESP32-WROOM-32, running a T-rex demo.
The venerable Nokia 5510 LCD
WROOM devices appear to be specifically designed for IOT applications such as server-client interactions. For monitoring purposes of processes running on a WROOM a small display can be handy. Here the venerable Nokia 5110 LCD comes into the spotlight. Pixel dimensions of the display are a modest 84 pixels wide, 48 pixels high, monochrome, with software-adjustable contrast. The Nokia 5510 LCD, albeit somewhat legacy, some say nostalgia, is perfectly capable of handling the job of visually reporting to the outside world because its controller is fast, with well readable characters and numbers.
The Adafruit_PCD8544.h library together with the Adafruit_GFX.h library provide a complete ASCII character set and most useful, graphical functions. While a 16×2 LCD or a 20×4 LCD may also do good reporting job, these displays have less flexibility than the Nokia 5510. An advantage of a Nokia compared with OLEDs is its long life expectancy in always-on circumstances (in OLEDs, pixels tend to burn in after a long period of static display). The backlight can be switched manually when a push button is included in the wire to the BL pin. Further, the Nokia 5510 is cheap and easily available. Previously, with ESP8266 microcontroller board such as the Lolin NodeMCU* and the Wemos D1 mini** it was possible to bring a Nokia 5510 LCD to perform. In a series of posts in which the Nokia 5510 has been paired with several microcontroller boards we wire here a Nokia 5510 LCD to an ESP32 WROOM-32. Previously we have discussed the wiring of a Nokia 5510 LCD to a Lolin NodeMCU ESP8266* and a Wemos D1 mini**.
Wiring diagram
Figure 1 shows the pin-to-pin wiring of the Nokia 5510 and a ESP32-WROOM-32. The Nokia uses the SPI serial protocol so there are five wires to take care of: CLK, DIN (equal to MOSI), DC, CE and RST. The wiring is soft-SPI wiring, that is we do not use dedicated SPI pins (specifications say that a WROOM has dedicated V_SPI and HSPI pins) but instead the ‘standard’ pins seen in many sketches in conjunction with the Adafruit_PDCD8455 library. The back light (pin BL) can be wired via a push button switch to the 3.3V pin of the NodeMCU.
A Nokia 5510 breakout board has 8 pins (fig 1):
• GND: ground pin. Connect to GND.
• BL: back light pin: powers the four leds mounted in the display casing. If 3.3V is applied to this pin the back-light leds will light up.
• VCC: power pin. Connect to 3V3.
• CLK: clock pin for serial SPI communication. Connect to pin labeled ‘D18’ of the WROOM.
• DIN: data pin for serial SPI communication. Connect to pin labeled ‘D23’ of the WROOM.
• DC: command/data pin: Connect to pin labeled ‘D19’ of the WROOM.
• CE: chip enable: allows data to be clocked in. Connect to pin labeled ‘D5’ of the WROOM.
• RST: reset pin. If this pin is set LOW the chip on board of the display will reset. Connect to pin labeled ‘D14’ of the WROOM.
Libraries and pin configuration are in the sketch declared as follows:
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
#define CLK 18
#define DIN 23
#define DC 19
#define CE 5
#define RST 14
and followed by the constructor:
Adafruit_PCD8544 display = Adafruit_PCD8544 (CLK, DIN, DC, CE, RST);
and then followed by the body of the sketch.
Results
Figure 2 shows a real world Nokia 5510 attached to a ESP32-WROOM-32. Here the bitmap functionality is shown. A 80*48 pixel bitmap of a Tyrannosaurus rex is loaded in memory and displayed on screen.
Discussion
The Adafruit libraries are not the only ones supporting the Nokia 5510 LCD on the ESP32 WROOM. A library named “PCD8544.h” published on Github by Carlos Rodriguez supports only alphanumerical display on the Nokia, not graphics. Also the ‘rotate’ feature is missing in Rodriguez’s library which in the Adafruit libraries makes it possible to re-orient the display in landscape, portrait or upside-down. For the sake of completeness a “Hello World!!” sketch that makes use of this “PCD8544.h” library is one of the two downloadable sketches. Note that the “PDC8544.h” library uses “lcd.print ()” instructions familiar in 16×2 and 20×4 LCD circles while the Adafruit libraries use GFX-style instructions such as “display.display ()”.
Uploading a sketch is not always smooth. If uploading stalls, pressing the button ‘BOOT’ on the microcontroller boar may be of help.
The refresh rate of the Nokia 5510 controller chip is fast, faster than the individual pixels of the LCD panel can follow. These pixels have their own light-up and fade time. This response time appears much longer than that of the controller chip. The difference causes a blur phenomenon when the image refresh speed in an animation series exceeds pixel response time. To suppress such blur a delay needs to be introduced between the calls to successive image frames. This delay can be quite considerable: 150-180 milliseconds is not unusual.
Sketches
Note: a library named “PCD8544.h” authored by Carlos Rodriguez is necessary for the Hello World! sketch. Available at https://github.com/carlosefr/pcd8544.
The libraries “Adafruit_PCD8544.h” and “Adafruit_GFX.h” are required to compile the T-rex demo sketch. These libraries can be installed via Library manager in the Arduino IDE or else located on the internet downloaded as .zip file and installed via Sketch and Include Library.
Downloadable sketches:
There are two sketches:
• ESP32_WROOM_Nokia_5510_Hello.ino. This sketch does no more than printing the text “Hello World!” to screen.
• ESP32_WROOM_Nokia_5510_T_rex_demo.ino that produces the picture seen in Figure 2.
The file “ESP32_WROOM_Nokia_5510.zip” contains the “Hello World!” sketch and the T-rex demo sketch.
sketches are packed in a ZIP file
References:
*Nokia 5510 84*48 LCD and the ESP8266 NodeMCU board
Thesolaruniverse.wordpress.com – January 13, 2021
***Nokia 5510 84*48 LCD and the ESP8266 Wemos D1 mini microcontroller board
Thesolaruniverse.wordpress.com – January 15, 2021