by Floris Wouterlood – The Netherlands – January 15, 2021
The Wemos D1 mini can be regarded as a true IOT workhorse. With only two rows of eight pins its footprint is minimalist, yet please do not underestimate this midget. It has a powerful 32-bit ESP8266 chip on board with a sea of working memory (4 MB flash and 64 kB SDRAM). Compare that with what the classical Arduino Uno offers (32 kB flash and 2 kB SDRAM). Architecture is modern and it is as every ESP8266 equipped with numerous features, including I2C, SPI and, very importantly, on board WiFi. Features that have contributed to the popularity of ESP8266 based microcontroller boards are that they can be programmed via the Arduino IDE with a wide range of supporting libraries. The limited number of pins is usually not a big handicap since most sensors today support I2C communication while the good old days days of the pin-gobbling parallel interface displays are gone. Remote sensing and communication via the on-board WiFi does not require physical pins. Thus, the ESP8266 family of boards enjoys much attention in the Arduino community.
figure 1. Wiring of a Nokia 5510 LCD with a Wemos D1 mini ESP8266 board
The availability of a range of displays that are compatible with ESP8266 microcontroller boards increases the attractiveness of experimenting with combinations.
For IOT monitoring purposes a simple 16×2 LCD, a less spartan 20×4 LCD, or a Nokia 5510 LCD suffices. The 16×2 and 20×4 LCDs do not have graphical properties. The small Nokia 5510 LCD may be handy here. Its size is proportional to that of a Wemos D1 so these devices can be combined in small casings. Its screen: a modest 84 pixels wide, 48 pixels high, is based on proven and long lasting Philips PDC8544 monochrome LCD technology that offers both alphanumerical and graphical functions. Adafruit Industries have created the Adafruit_PCD8544.h and Adafruit_GFX.h libraries that perfectly support the graphical and alphanumerical functionality one needs. An advantage of a Nokia is its very modest energy consumption and its long life expectancy (in OLEDs, pixels tend to burn in after a period of static display). Further, the Nokia 5510 is cheap and easily available. 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 ESP8266 Wemos D1 mini. Previously we have discussed the wiring of a Nokia 5510 LCD to a Lolin NodeMCU ESP8266*.
Figure 1 shows the pin-to-pin wiring of a Nokia 5510 and a Wemos D1 mini. 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 the NodeMCU’s dedicated SPI pins (SCLK, D5 and MOSI, D7) 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 D1 of the Wemos D1 mini.
• DIN: data pin for serial SPI communication. Connect to pin D2 of the Wemos D1 mini.
• DC: command/data pin: Connect to pin D5 of the Wemos D1 mini.
• CE: chip enable: allows data to be clocked in. Connect to pin D6 of the Wemos D1 mini.Figure 2. Nokia 5510 LCD wired to a Wemos D1 mini and running Muybridge’s galloping horse sketch.
• RST: reset pin. If this pin is set LOW the chip on board of the display will reset. Connect to pin D7 of the Wemos D1 mini. Alternative is pin D0.
Libraries and pin configuration are in the sketch declared as follows:
#define CLK D1
#define DIN D2
#define DC D5
#define CE D6
#define RST D7
and followed by the constructor:
Adafruit_PCD8544 display = Adafruit_PCD8544 (CLK, DIN, DC, CE, RST);
and then followed by the body of the sketch.
Figure 2. Nokia 5510 LCD wired to a Wemos D1 mini and running Muybridge’s galloping horse sketch.
Figure 2 shows a real world Nokia 5510 attached to a Wemos D1 mini. Here an animation is (literally) running; the horse named ‘Sallie Gardner’ galloping on Muybridge’s photo series made in 1878 with a row of 12 big wooden plate cameras. The animation loads ten bitmap frames in memory. Each bitmap is 80 pixels wide and 48 pixels high (450 bytes). The frames are then in the loop () section displayed on screen in rapid succession such that the human eye gets the impression of a galloping horse. Frame ‘horse_10’ matches frame ‘horse_01’ in such a way that the animal seems to be galloping for ever.
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 ‘pixel response time’ appears much longer than that of the controller chip. The difference causes a blur phenomenon when the image refresh speed exceeds pixel response time. To suppress blur a delay has been to be introduced between the projection of each successive image frame. This delay had to be quite considerable: 150-180 milliseconds is optimal. With shorter delays the legs of the animal are projected too shortly on screen to get good high-contrast pixels. Application of a delay of zero millis the ‘moving’ legs become vague and blurry.
Note: the libraries “Adafruit_PCD8544.h” and “Adafruit_GFX.h” are required to compile this 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.
There are two sketches:
• Wemos_D1_mini_Nokia_5510_Hello.ino. This sketch does no more than printing the text “Hello World!” to screen
• Wemos_D1_mini_Nokia_5510_Muybridge_horse.ino that produces the horse galloping on screen à la figure 2.
The file “ESP8266_Wemos_D1_mini_Nokia_5510.zip” contains the ‘Hello World!” sketch and the sketch with the running horse.
sketches are packed in a ZIP file.
*Nokia 5510 84*48 LCD and the ESP8266 NodeMCU board – Thesolaruniverse.wordpress.com – January 13, 2021