Connect the grounds

I’ve been struggling to get an LCD display working. My previous attempt was:

No output to display

So I traded that in for this:

Gravity:I2C LCD1602 Arduino LCD Display module

because it has everything included in the module to make life simpler! Problem was, that even with this simple component connected I still couldn’t get anything to display. What am I missing I thought?

I just worked out why I couldn’t get any of the displays running! Basically, the solution was I needed to ground the controller chip to the same ground as the external power supply I was using to power the display. Simple eh?

This is what I did to get the Gravity DFRobot display working.

This module has the I2C built in a 4pins:

image

Basically just power and SCL and SDA.

I connected everything up. The module I have is a LCD1602 V1.1.

I added the following library to my project:

DFRobot_RGBLCD1602

thus, in my code I added:

#include “DFRobot_RGBLCD1602.h”

according to the example file, because my module is v1.1 the RGBAddr is 0x6B. Thus, to set up the module I do:

DFRobot_RGBLCD1602 lcd(/*RGBAddr*/0x6B ,/*lcdCols*/16,/*lcdRows*/2);

which initialises an object at address 0x6B with 16 columns and 2 rows.

I then initialise the module via:

lcd.init();

and then send it a message:

lcd.print(“Hello World!”);

that is basically all the code does. It compiles and uploads top both the Huzzah ESP8266 and the ESP32-S2 WROOM but I get nothing on the display, UNTIL I connected the GND from the controller (i.e Huzzah ESP8266 and the ESP32-S2 WROOM) to the same GND as the external battery pack I was using to power the display. The controller chips get their power from the USB cable at this stage.

Once that was done I finally saw:

image

There is nothing like the feeling off finally getting something working!

So the key learning here was link the GND between the external power supply and the controller chip.

No output to display

After connecting up a

Standard HD44780 LCD

to power and being able to adjust the brightness, the next step was to get i to display some text by connecting the display to an ESP32-S2 Thing Plus.

To do that I needed to connect to these pins on the display:

LCD Pin name RS EN DB4 DB5 DB6 DB7
LCD Pin 4 6 11 12 13 14

I planned to connect these LCD pins to the range available on the ESP32-S2 Thing Plus 3,34,33,37,35,36

image

Thus:

const int rs=3; // LCD RS pin

const int en=34; // LCD Enable pin

const int d4=33; // LCD data bit 4 pin

const int d5=37; // LCD data bit 5 pin

const int d6=35; // LCD data bit 6 pin

const int d7=36; // LCD data bit 7 pin

and to initialise:

LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

The size of the display is defined buy:

lcd.begin(16,2);

and then to display text:

lcd.print(“Hello world!”)

My code compiles ok, but I get not text on the LCD display?

– I triple checked my wiring and even tried other ports (no luck)

– I defined each pin via pinmode(rs,OUTPUT); for example (noluck)

Seems like the best solution is go for this:

I2C LCD Backpack for 1602 to 2004 LC

which basically removed the need for individual ports in favour of using SDA and SCL to do the communications. In fact, I probably should have bought this to start with:

Gravity: I2C LCD1602 Arduino LCD Display Module (Blue)

which has the backpack module included!

In the long run this is a better bet as it saves and stack of pins on the ESP32-S2 Thing Plus being consumed.

I did notice that all the GPIO pins on the ESP32-S2 Thing Plus are 3.3V and perhaps the LCD display requires 5V? I couldn’t find any definitive on that.