Wimpie van den Berg
Published © GPL3+

Displaying Sensor Values on LCD

This project will show how to set up a 16 x 2 LCD screen and display multiple sensor values.

BeginnerProtip1 hour152,287
Displaying Sensor Values on LCD

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Standard LCD - 16x2 White on Blue
Adafruit Standard LCD - 16x2 White on Blue
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
RM065 10K ohm 103 Trim Pot Potentiometer
×1
RM065 1K ohm 102 Trim Pot Potentiometer
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Wiring Diagram

I did not have enough orange wire so used blue instead, however I made the 4 wires for data orange in the sketch.

Code

The Software part

Arduino
The software will communicate with the LCD and the analog pins of the Arduino. Because we use the LiquidCrystal library, we don't have to communicate with the digital pins.
// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7,8,9,10,11,12);

int potPin1 = A1;
int potPin2 = A2;

void setup()
{
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.clear();

pinMode(potPin1, INPUT);
pinMode(potPin2, INPUT);
}

void loop()
{
lcd.setCursor(0,0); // Sets the cursor to col 0 and row 0
lcd.print("SensorVal1: "); // Prints Sensor Val: to LCD
lcd.print(analogRead(potPin1)); // Prints value on Potpin1 to LCD
lcd.setCursor(0,1); // Sets the cursor to col 1 and row 0
lcd.print("SensorVal2: "); // Prints Sensor Val: to LCD
lcd.print(analogRead(potPin2)); // Prints value on Potpin1 to LCD
}

Credits

Wimpie van den Berg

Wimpie van den Berg

2 projects • 27 followers
I am an Industrial Engineer and Entrepreneur, now exploring the opportunities with Arduino, Raspberry Pi and 3D printing.

Comments