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 (D1 or GPIO5 on a LoLin)
SDA to SDA (D2 or GPIO4 on a LoLin)
(these two pins are redirectable to another set in the Wire.begin command:
Wire.begin(0, 2); // specify different 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.
Become the Maker you were born to be. Try Arduino Academy for FREE!
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.
Make sure you run the I2C scanner first, to check what I2C address your display uses. Ours uses 0x27. 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.