Displaying Text to LCD via i2c Module on DIY Arduino Board

From my previous blog article My First DIY Arduino Board, I have detailed the step by step process on how I created a programmable board based from the Atmega328P-PU microcontroller. From that DIY board, we will proceed with using a 1602 Blue LCD Module to display texts controlled by the microcontroller.

Resources needed:

Our DIY Arduino programmable board
1 FTDI232 Serial to TTL Converter Module
1 1602 Blue LCD Module
Several jumper wires (Male-to-male and Male-to-female jumper wires.


If you look at the 1602 Blue LCD Module’s screen, you will see from the top portion of the module the 16 pins. The leftmost pin (the one with the number 1 at its side) is pin 1. The rightmost pin (the one with the number 16 at its side) is pin 16. This tells you the pins between 1 and 16 are pins 2 to 15 respectively.


Pin 1 (VSS) – Connected directly to GND
Pin 2 (VDD) – Connected directly to +5V Power Suply
Pin 3 (V0)- Connected to +5V Power Suply via Potentiometer (10k)
Pin 4 – Register Select (RX), connected to Pin 12 of Arduino Uno (Atmega328P-PU IC)
Pin 5 – Read/Write (RS), which is connected to GND
Pin 6 – Enable (EN), connected to Pin 11 of the Arduino Uno(Atmega328P-PU IC)
Pin 7 – Not connected
Pin 8 – Not connected
Pin 9 – Not connected
Pin 10 – Not connected
Pin 11 – Connected to Pin 5 of the Arduino Uno (Atmega328P-PU IC)
Pin 12 – Connected to Pin 4 of the Arduino Uno (Atmega328P-PU IC)
Pin 13 – Connected to Pin 3 of the Arduino Uno (Atmega328P-PU IC)
Pin 14 – Connected to Pin 2 of the Arduino Uno (Atmega328P-PU IC)
Pin 15 – Connected to +5V via 1k resistor
Pin 16 – Connected directly to GND

The i²c module has only four (4) pins which are labeled on the module as well:


GND Pin – Connected directly to GND
VCC Pin – Connected directly to +5V Power Supply
SDA Pin – Connected to pin 27 of the Atmega328P-PU microcontroller
SCL Pin – Connected to pin 28 of the Atmega328P-PU microcontroller

Also, I have modified my DIY board and set it up on an 800-point breadboad. I also detached the FTDI Serial to TTL module from the DIY board, and attached one female-to-male jumper as seen below:

To give you a close up view of the FTDI Serial to TTL module, here it is:


White jumper wire : DTR
Yellow jumper wire : RX
Blue jumper wire : TX
Red jumper wire : VCC (+5 volts)
Green jumber wire : GND

The reason being is to free up some space from the breadboard.

To continue, we need the i²c module to connect to our DIY board. The i²c module has four (4) pins in it, of which, I have already explained in the previous portion of this article. Now, we need to have this module connected with four (4) male-to-female jumper wires for each pin as shown below:


Green jumper wire : GND
Red jumper wire : VCC (+5 volts)
Blue jumper wire : SDA
Yellow jumper wire : SCL

Close up of the the i²c module is shown below:

Next step will be to add 16 male header pins to the breadboard as shown in the image below:

Now attached the the i²c module pins to the breadboard, with the same alignment of pins as the male header pins. Take note of end portion of the the i²c module with the 4 pins. The holes from that end towards the other side are holes 1 to 16 in that order. Refer to the image below:

As said earlier, there are four (4) pins in the i2c module, and I have used colored jumper wires for each of the pins. Connect the red jumper wire to +5 volts on the rail at the side of the board (red line), and connect the green jumper wire to the GND (blue line). Connect the blue jumper wire (SDA) to pin 27 (PC4) of the Atmega328P-PU chip and lastly, connect the yellow jumper (SCL) wire to pin 28 (PC5) of the Atmega328P-PU chip. Refer to the image below. This is a close up view of the connections:

The next image is just a wider view of the breadboard showing the other connections to the Atmega328P-PU micrtocontroller:
Image 12.jpg

Next is to attach the Blue LCD module to the male header pins on the breadboard. I have not soldered any male header pins yet to the LCD, as I need to have this tested if it works or not. Refer to the image below:

With the set up above, we are now ready to do some programming and display texts to our LCD.

Before doing the actual coding, we need to download a library (C/C++ header files). You may find this library at Sunfounder’s page by clicking this link : LiquidCrystal_I2C.zip.

Open the Arduino IDE, and add the downloaded Library by going to Sketch > Include Library > Add Library from the Arduino IDE menu. Locate the downloaded library from the link above.


After having done so, you should have it already in the list of Contributed Library. Refer to the screenshot below:

Now, we’ll do some coding. I have prepared a simple sketch and here is the screenshot:

The code listing above is shown below:

// Include the following libraries
#include #include

LiquidCrystal_I2C lcd(0x3F,16,2); // Set the LCD I2C address : NOTE: Some LCD modules have 0x27, and some have 0x3F

void setup()
// Initialize the LCD

// Turn on and off the backlight just to verify that we are sending signals to the LCD module successfully

void loop()
lcd.print(“Hello, World!”);

The LCD to I2C address could be 0x27 or 0x3F. Mine is 0x3F. How did I find it? Please refer to the i2c scanner from the Arduino website. The link can be found here: i2c scanner.

Provided that every thing has been set up correctly, we are now ready to upload the sketch above to the microcontroller.

Upload the sketch, and you should see the text displayed to the LCD module. Sample outputs I have is shown below:

So there. You have now displayed some texts to the LCD.

Component sources:
Sun Kist Enterprises (https://web.facebook.com/SunKistEnterprise/) thru
Mr. Mark Rudolph C. Domasin (https://www.facebook.com/Rudolphchase)


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s