Tuesday, April 17, 2018

Adding a LCD to a ESP8266

Tutorials for adding a LCD to a Arduino are all over the net. It's pretty simple, and I2C makes the wiring even simpler, and libraries prevent complicating the code much. However, adding a LCD to a ESP8266 is not as common, and there is much misinformation posted about logic levels, and what not. So here is a working project using a I2C LCD, and a ESP8266. Wiring is very simple.

SCL to SCL
SDA to SDA
(these two pins are redirectable to another set in the Wire.begin command:

//Wire.begin(); default
Wire.begin(0, 2); // specified SDA, SCL pins

Gnd to Gnd
+5v to +5v (USB or Vin)

Yes, the LCD prefers 5v, and it won't affect the 3.3v logic of the ESP8266, as the ESP8266 I2C is in output, not input mode.

Some slower I2C devices won't work out of the box with the ESP8266 because of timing issues, and a stretch adjustment needs to be made. We found one I2C display that would not register on the I2C scanner sketch, but the rest did. If the scanner finds it when connected to a UNO, but not a ESP8266, place the following command after the Wire.begin line.

Wire.setClockStretchLimit(500L);

Make sure you run the I2C scanner first, to check what I2C address your display uses. See more in our Instructable at https://www.instructables.com/id/I2C-LCD-ESP8266/

If you don't have one already installed, you will need to install a I2C LCD Library. Those instructions are included in the Instructable.

2 comments:

  1. Love your instructions for a standard LCD display but would like to use a ST7735 1.8" color TFT display in colour as it looks so much better so any chance of instructions for this display Thanks Bob

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...