You are on page 1of 5

Like

409k

Follow @EngineersGarage
Follow

Home

Insight

Contribute

EG Labs

Advertise

Articles

Subscribe

Invention Stories

Forum

Knowledge Base

Contact Us

Arduino Projects | Raspberry Pi | Electronic Circuits | Electronics Reference Design


Library | AVR | PIC | 8051 | Electronic Projects
MAE
Invite a friend
My account

How to Use Arduino to Display Sensor


Values on LCD

Change Password
Log out
FEATURED
ARDUINO
PROJECTS
Getting Started
with Arduino
LCD Arduino
Interfacing
Xbee Arduino
Interfacing
Interface GPS with
Arduino
Interface SD Card
with Arduino
Call using Keyboard,
GSM & Arduino
SPI Module of
Arduino
... more arduino
projects

TI REFERENCE
DESIGN LIBRARY

Featured
Design
ELECTRONIC
POINT OF
SALE/SERVICE
REFERENCE
DESIGN

ARD008

Summary

Description

Circuit Diagram

Video

Code

Components

Embedded WLAN Module


eztcp.com
Serial to WIFI with microcontroller Ralink RT3070 chipset
The Arduino board has all the required circuitary to get the built-in AVR microcontroller
running. It has also pins which can be configure as digital output only, digital or analog
output, digital input only and digital or analog input. Any AVR microcontroller based
board which follows the standard Arduino schematic and is flashed with the
Arduino bootloader can be called an Arduino board. The Arduino IDE is also very simple
that anyone who have basic knowledge of c programming can quickly get started with
it. The tutorial on Getting started with the Arduino explains about the steps required to
get start with an Arduino board.
The Arduino board used in this project is the Arduino pro-mini board and the IDE version
of the Arduino is 1.0.3 for windows. The image of the Arduino pro-mini board and the
Arduino IDE are shown below;

Available Files:
Schematic
Diagram, Source
Codes, Design
Guide, etc.
ViewDesign

Search More
Designs
Industrial
Smart Grid
Lighting

Since the Arduino pro-mini board has no circuitary for interfacing it with the serial
port or the USB port of the PC, an external USB to TTL converter board is required to
connect it with the PC. This hardware helps in programming the Arduino board and also
helps in the serial communication with the USB port of the PC.

Alternative Energy
Automation &
Process Control
Automotive &
Transportation
Comm & Telecom
Computing &
Multimedia
Consumer
Electronics
HealthTech
Motor Drive &
Control
Safety & Security

It is assumed that the reader has gone through the project how to get started with the
Arduino and tried out all the things discussed there.
A previous project on how to use analog input and output of the Arduino discusses

Space & Defense


Video & Vision

about how to use analog input /output channels of the Arduino board to read analog
values and to write analog values. Another project explains how it is possible to debug

ACTIVE FORUM
TOPICS

Query about
ATmega16

the values which are received by the Arduino board and which the Arduino board write to
the external pin so as to generate a voltage.The variable pin of a potentiometer is
connected to the analog pin;in this project the pin A0. The other two pins of the
potentiometer is connected to the VCC and GND so that as the variable moves it can

How to setup
communication
between two
zigbee(cc2500)
devices using
PIC16F877A.
topics on 8051
Coding RF IC

divide the entire supply voltage and provide it as the analog input voltage for the Arduino
board. An LED is connected to the analog output pin through a current limiting resistor;
in this project it is connected to the pin 6. The code continuously reads the value from
the potentiometer and writes the corresponding value to change the brightness of the
LED connected to the pin 6.
The code written for this project make use of the analog read and write functions like
analogRead() andanalogWrite() etc. It also uses library functions which help to access

more

the LCD module like lcd.begin(), and lcd.print() . These functions for accessing the LCD
are available in the header file <LiquidCrystal.h>. The details of the analog read and
write functions are explained in a previous project on how to use analog input and
output of the Arduino. The functions for interfacing the LCD are discussed in the

FEATURED
RASPBERRY PI
PROJECTS

previous project on how to interface 16*2 LCD with the Arduino board.
In this particular project one more function from the <LiquidCrystal.h> is used which is
not there in the previous project and is discussed below.

How to Load
Ubuntu on
Raspberry Pi
How to Configure
Raspberry Pi

lcd.setCursor()

How to use Alarm


Signal in Raspberry
Pi
How to Get GUI on
Raspberry Pi
Playing Snake
Game using
Raspberry Pi Game
Pad
How to Use
Raspberry Pi as a
Game Server
... more raspberry pi
projects

The lcd.setCursor() function is used to set the position of the cursor in the LCD screen
in such a way that the subsequent letters will be displayed from that particular position
only. The function has two parameters and the first one represents the column number
and the second one represents the row number. The row and column number starts
with zero and the maximum value depend on the type of LCD used.
The lcd.setCursor() can be used to set the cursor at a particular position of the LCD
screen as shown in the following statement;
lcd.setCursor(7,0);
The above statement will set the cursor at the 8th position of the first line of an LCD
screen and further display will happen from that position onwards.

RELATED
CONTENT

THE CODE
The code initializes the 16*2 LCD using the function lcd.begin() after initializing the

Getting Started
with Arduino

library using the function LiquidCrystallcd(). The analog value is read from the analog

How To Use Digital


Input And Digital
Output Of Arduino

mode using the function map(). The value is thgen multiplied by 5 and is divided by 255

How to Use Analog


Input and Analog
Output of an

input pin using the function analogRead() and is then mapped from 10 bit mode to 8 bit

to get the 5V equivalent of that value. The lcd.print() function is then used to print the
value after setting the cursor using lcd.setCursor() function.
// include the library code:
#include <LiquidCrystal.h>

Arduino Board

// initialize the library with the numbers of the interface pins

How to Send Serial


Data from Arduino

LiquidCrystallcd(12, 11, 5, 4, 3, 2);

How to Receive
and Send Serial
Data using Arduino

constintanalogInPin = A0; // Analog input pin that the potentiometer is attached to

Pressure
Sensors

constintanalogOutPin = 6; // Analog output pin that the LED is attached to


intpotvalue = 0;
intoutputvalue=0;

alibaba.com/Press

void setup()

Find Quality Products


from Verified
Suppliers. Get a Live
Quote Now!

{
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.print("ENGINEERS GARAGE");
}
void loop()
{
// read the analog in value:
potvalue = analogRead(analogInPin);
// map it to the range of the analog out:
outputvalue = map(potvalue, 0, 1023, 0, 255);
lcd.setCursor(7, 2);
lcd.print((outputvalue * 5)/255);
lcd.print("V");
// change the analog out value:
analogWrite(analogOutPin, outputvalue);
delay(100) ;
}

The code also glows an LED with the brightness which is equivalent to the value read
from the analog input pin as discusses in a previous project on how to use analog input
and output of the Arduino.
Once done with the coding one can verify and upload the code to the Arduino board as
explained in the project how to get started with the Arduino and the brightness of the
LED can be observed to vary as the variable of the potentiometer moves. The voltage
read from the analog input pin will be displayed in the LCD along with varying the
brightness of the LED.
Like

3937 reads

Tw eet

4 Free Projects For 2014


dbasesite.mistermail.nl
Our Favorite Electronics Projects. Get Your Free E-book Today!
Featured Designs - Electronics Reference Design Library

1A Single-Input Single-Cell LiIon Battery Charger Reference


Design

6W USB Charger Reference


Design with Quasi
Resonant/Flyback Controller

YOU ARE HERE Home


Copyright 2012 EngineersGarage. All rights reserved. Privacy Policy | Refund Policy | About Us

CC2531 USB Dongle Refere


Design

Top

You might also like