Easy when you know

I’ve been attempting to get an LCD display connected to the ESP32-S2 WROOM controller but wasn’t having any luck:

No output to display

Luckily, I worked out that I needed to:

Connect the grounds

to make it work. For that I’d used a:

Gravity:I2C LCD1602 Arduino LCD Display module

which has everything built into the board.

After finding the error of my ways I wanted to circle back and get the original

Standard HD44780 LCD

display working with the

I2C LCD Backpack for 1602 to 2004 LC

Once I had wired the backpack to the LCD display (basically just a process of aligning pins on the breadboard), I connected up power and SCL and SDA to the backpack. I connected to the SDA and SCL on the ESP32-S2 Thing Plus as well as ensuring the grounds of the ESP32-S2 Thing Plus and the external power for the display were connected!

For the code I added the LiquidCrystal_I2C library and then the header:

#include <LiquidCrystal_I2C.h>

next I initialised an object:

LiquidCrystal_I2C lcd(0x27,16,2);

with an module address at 0x27 (the default) and 16 columns by 2 rows.

In setup I initialised the module by:

lcd.init();

turned on the backlight:

lcd.backlight();

and finally output text to the LCD display:

lcd.print(“Hello, world!”);

Once I compiled the code and uploaded to the ESP32-S2 Thing Plus I saw:

image

which was very satisfying.

The learning from all this has been to ALWAYS ensure that all the grounds are connected together. However, I’ve also learned that life is much easier with a completely integrated display like the:

Gravity:I2C LCD1602 Arduino LCD Display module

rather than trying to configure just the LCD directly or even be interfacing with a dedicated I2C backpack. It is far easier if all that stuff is built into the LCD module and all the control comes from SDA and SCL.

Lessons learned. Bring on the next challenge.

Standard HD44780 LCD

image

Scan from 2024-01-13 03_16_22 PM

I ordered a standard HD44780 LCD:

https://core-electronics.com.au/assembled-standard-lcd-16×2-extras-white-on-blue.html

HD44780 datasheet with the detailed commands for control

a datasheet that has dimensions and pin-locations

image

So I started to follow:

https://learn.adafruit.com/character-lcds

Scan from 2024-01-13 03_35_02 PM

Step one was to wire up the display just to power. So I connected 3.3V pin from the Esp32-S2 Wroom to pin 15 on the display. Importantly, you’ll note that the ESP32-S2 power is 3.3V which is enough to power the display but only just! I also connected the ground pin from the ESP32-S2 to Pin 16 on the display. This is just the power to the back light of the display.

The next step was to insert a POT (variable resistor to control the brightness of the actual display items) but when I did that turning the POT made no difference.

pot-turn

I deduced that the issue was that 3.3V input from the ESP32-S2 wasn’t high enough. Thus, I connected up my external battery pack, which outputs 4 x 1.5V = 6V and as you can see from the above when I twist the POT (i.e. a variable resistor) I can now see the lines of rectangle display items actually appear.

Thus, the display is all wired up for power, backlight and character display, now I just need to wire it for data and do some code.

image

The wiring diagram is shown above:

Pin 1 = GND (character display)
Pin 2 = +6V (character display)
Pin 3 = Output from variable resistor (i.e. POT for character brightness)
Pin 15 = +6V (backlight)
Pin 16 = GND (backlight)