Introduction to ESP-01 with I2C LCD
In this section we’ll discuss setting up the ESP-01 with I2C LCD. I’ll use the LiquidCrystal_I2C Library. For the Generic ESP8266, this shows up as Incompatible under examples. Nonetheless, we’ll make a few modifications for it to work with the ESP-01. By using this method, I didn’t have any problems using this library. Nonetheless, you should thoroughly test your project when it’s set up to ensure it’s working properly for you. I’ll be using the “Hello World” Example in this post.
For example, I’ll be use the ESP-01 processor, A USB programmer for the ESP-01, and a 16×2 LCD Display. You will also need a breadboard, breadboard adapter for the ESP-01, or some soldering tools and wire. I’m setting this up on a breadboard. For this purpose, I’ll also need a 5v power source as well as a 3.3v power source.
Programming the ESP-01
Before you upload your project, double check the I2C address. In this case, it will be 0x27. Also, verify the columns and rows are set correctly on the same line. For example, I’m using a 16×2 display. Another common address is 0x3F. At the same time, I’ll add the line Wire.begin(0,2); at the top of the Setup routine.
Before uploading, be sure you have EN jumpered to 3v3. Furthermore, I’ve added a temporary jumper to GPIO0. Temporarily hold this jumper to GND, and insert the programmer with ESP0-1 into your USB Slot.
At this point, upload your project, and then remove the jumper between GPIO0 and GND.
Wiring Connections for ESP-01 with I2C LCD
After the ESP01 is programmed, the connections are very straight-forward. Connect VCC on the ESP-01 to 3.3v, and GND to GND on the breadboard. Likewise, connect VCC on the LCD to 5v, and GND to GND on the breadboard. Be sure the GND is common between both the ESP-01, and the LCD. GPIO0 on the ESP-01 connects to SDA on the LCD. At the same time, connect GPIO2 on the ESP-01 to CLK on the LCD. Furthermore, double check your jumper between EN and VCC on the ESP-01. By all means, make sure you have removed the flash jumper between GPIO0 and GND.
Once you power up, you should see text on your display. You may have to adjust the pot on the back of the I2C LED display to adjust your contrast.
If you cannot upload your project, double check the selected board and COM port. I used the Generic ESP8266 Module setting. Check for the correct setting of your Port under “Tools”. Another key point is to make sure you jumper EN to 3V3, and that GPIO0 is to GND. If your display does not work, try changing the address. In this case, I had to change my address to 0X3F, then upload again. If you still have a problem, check all of your voltages and connections.