Welcome to Solarduino , A blog about DIY Solar PV and Arduino projects
LCD display shield is to display the output value from Arduino

How to use LCD Display Shield?

LCD Display Shield is among the useful shield for Arduino Uno board. It is a combination of 6 buttons module and LCD Display module. The LCD screen can display 16×2 characters (16 characters x 2 rows). LCD display module always works together with button module where user can change or select the display screen information using the button command. This LCD display shield can be stacked together with Arduino Uno board without the need of extra wiring to connect the modules to Arduino board. 

Arduino UNO (compatible board)

If you still not yet own an Arduino Micro-controller Board, you can get it cheap at our affiliate link here !!!

16×2 LCD Display Shield

This is a useful shield that enables your arduino board to display output value on screen. Besides, there are 6 total usable buttons which 5 buttons can be customized or programmed based on user requirement. You can use the button to switch between display pages or input command to the Arduino board. You can get the LCD Display board at our affiliate link here !!!. 

In order to work with this LCD Display shield, some of the Arduino Uno pins are occupied. There are Analog Pin A0 for button function, Digital Pins D4 to D10 are used for LCD Display. 

Push Button Module

Let us separate the shield into the 2 parts: the push button module and LCD Display module. There are simple button modules out there which are using Digital Pins to detect the push button. However, each digital pin only can sense 1 button. If you have more buttons, you will need the same amount of Digital Pins. 

 

Come back to our Button Module in the shield, this button module here is utilizing the advantage of Analog Pin so that only 1 analog pin is sufficient to control all buttons. As you know, analog value ranges 0 to 1023 which signify 0 to 5V input range. By using voltage divider method for each button, different voltage drop due to different resistor value across each button will have different voltage output thus each button can be identified by just using 1 analog pin. In the arduino UNO board, the Analog Pin is occupied for button function is fixed at A0.

Below is the Voltage Divider method and calculation.

Each resistance will have tolerance or deviation error, thus when we write in the code, the button is detected in term of analog value range. Button module do not need to include any library as it uses normal analog read function code.

 

Push Button Modules

Looking for push button modules instead? here you can find many push button module types at our affiliate link here !!!

LCD Display Module

The LCD Display of the shield is a 1602 model LCD Display which can display the total output of 32 characters. There are 2 rows in the display with each row can support up to 16 characters.

Image above is the base unit of LCD Display module. It consists of total 16 pins that are un-soldered. I do not recommend this module if you are a beginner in Arduino as there are quite a lot of wiring to be done here. 

 

Dupont Line Wires

You may need Dupont Line Wires to connect Arduino board and LCD Display module. It is available at our affiliate link here !!! 

The 16 Pins

Some of the LCD Display module manufacturers do not show the pin numbers and pin symbols as above. However, the pins arrangement should standard and similar.

LCD Display Module can be connected to Arduino Board in 2 ways: 1) the direct connection and 2) using I2C Converter Module in between. The direct connection means the pins are directly connected to relevant pins on Arduino board while involves a lot of wiring if you were to do it by yourself. The I2C converter method is converting all the pins to only 2 analog pins (SDA and SCL) via I2C communication protocol and of cos with 2 more for power lines (5V and ground).  

To cut things short, we only focus on the LCD Display Shield and we are not going through these module wiring in detail as the shield will be internally connected to Arduino UNO board. The shield is utilizing the direct connection method where all relevant pins are directly connected to Arduino UNO board. In addition, the shield has also included the potentiometer to adjust the contrast of LCD. So in order to use the LCD Display shield, these 7 Digital Pins are occupied.

LCD Display module or shield requires the <LiquidCrystal.h> library to be included in the code. The library is already pre-installed with your Arduino IDE software. This library enables you to make settings and command codes related LCD Display. Just include the library to the code to activate the function codes.

Datalogger Shield

Normally LCD Display Shield is working together with Data logger shield. This is the convenient shield for recording your data. Please find it at our affiliate link here !!!

Example Code 

Let’s take an example from my previous post : how to measure DC Voltage with Arduino? We are planning to upgrade this simple code (code that without display module) to add display function using this LCD Display Shield. The sensor wiring is still the same as stated in the post but instead of doing wiring on Arduino board, this time doing wiring on LCD Display Shield as the shield will be stacked on top of Arduino UNO pins. 

DC Voltage Measurement Hardware Connection

DC Voltage Sensor Module

This is a cheap and reliable voltage sensor module available in the market using voltage division method. The voltage sensor module is designed to measure voltage up to 25Vdc with its resistors tolerance of 1%. The R1 is 30k ohm while R2 is 7.5k ohm. You can get the module via our affiliate link here !!

Screw Shield / Expansion Shield

When there are a lot of wiring around especially more than 1 sensor, sharing pins will be difficult as existing pins (ground and 5V) are limited. This shield provides a lot of convenient terminals for each of the input and output pins. The shield can be mounted directly on top of the Arduino Uno board or in between the shields which made it very convenient to use. You can get it at our affiliate link here !!!

Software Codes

The final step would be adding source code onto Arduino board. I assume you have installed the Arduino Software. If you still have not installed the software, the link here can bring you to the official download site. Once you have downloaded the software, you may download the code file (.ino) for this application below (right click save link). 

There is source code file as attached below, the code is programmed to display measured DC voltage from Analog Pin A2. The display measured voltage value is actually same as value shown in Serial Monitor but with a slight delay. 

Datalogger Shield

If you plan to record the data in a proper way, you may consider this Datalogger Shield. It allows your arduino to record your data in SD Card. Datalogger shield is often installed together with LCD Display shield. Please find it at our affiliate link here !!! For more about this Datalogger Shield, kindly visit our post here.

Codes for DC Voltmeter with LCD Display Shield. Note: the codes shown here may not be 100% correct due to translation error. For accurate code, kindly download the .ino file.   

// DC Voltage Module with LCD Display Shield By Solarduino

// 1 - DC Voltage Measurement

int analogInputPin = A2;
float vArduino = 0.0;
float vActual = 0.0;
float R1 = 30000.0;
float R2 = 7500.0;
int rawValueRead= 0;

// 2 - LCD Display

#includeLiquidCrystal LCD(8,9,4,5,6,7);
unsigned long startMillisLCD;
unsigned long currentMillisLCD;
const unsigned long periodLCD = 1000;

void setup()
{

// 1 - DC Voltage Measurement

pinMode(analogInputPin, INPUT);
Serial.begin(9600);
Serial.println("DC VOLTMETER");

// 2 - LCD Display

LCD.begin(16,2);
LCD.setCursor(0,0);
startMillisLCD = millis();

}

void loop()

{
// 1 - DC Voltage Measurement

rawValueRead = analogRead(analogInputPin);
vArduino = (rawValueRead * 5.0) / 1024.0;
vActual = vArduino / (R2/(R1+R2));

Serial.print("Vdc = ");
Serial.println(vActual,2);
delay(1000);

// 2 - LCD Display

currentMillisLCD = millis();
if (currentMillisLCD - startMillisLCD &gt;= periodLCD)
{
LCD.setCursor(0,0);
LCD.print(vActual,2);
LCD.print(" Vdc ");
startMillisLCD = currentMillisLCD ;
}

}

Before we end, we would like to give gratitude to you for taking the time to read the post. We would need readers like you to support us in order to keep growing. You can support us in the following ways :

Donate & Fund Raising

If you like my work, please send me a donation to encourage me to do more. Thanks

Aliexpress Affiliate

We are the member of Aliexpress affiliate marketing. Do support us by clicking the affiliate product links if you do wish to purchase them.

Like and Share

If you like our post, we need your support to like and share our posts or videos so that it can reach more and more people like you !!

Result – In Serial Monitor

Result – In LCD Display

For Arduino Code Files, Remember to Right Click > Save Link As … You may alter the internal code as you wish. Happy coding !! 

DC Voltage Module with LCD Display.ino