Lab-3: LCDs Serial Communication Analog Inputs Temperature Measurement System

Similar documents
Electronic Brick Starter Kit

Workshop Arduino English starters workshop 2

EK307 Lab: Microcontrollers

Eng.mohammed Albhaisi. Lab#3 : arduino to proteus simulation. for simulate Arduino program that you wrote you have to have these programs :

Objectives: Learn how to input and output analogue values Be able to see what the Arduino is thinking by sending numbers to the screen

Serial.begin ( ); Serial.println( ); analogread ( ); map ( );

EXPERIMENT 7 Please visit to learn all features of arduino before you start the experiments

cs281: Introduction to Computer Systems Lab03 K-Map Simplification for an LED-based Circuit Decimal Input LED Result LED3 LED2 LED1 LED3 LED2 1, 2

keyestudio Keyestudio MEGA 2560 R3 Board

FUNCTIONS USED IN CODING pinmode()

Potentiometers. Showcase your project!

Schedule. Sanford Bernhardt, Sangster, Kumfer, Michalaka. 3:10-5:00 Workshop: Build a speedometer 5:15-7:30 Dinner and Symposium: Group 2

Liquid Crystal Displays

Laboratory 3 Working with the LCD shield and the interrupt system

Project 24 LCD Temperature Display

LCD KeyPad Shield For Arduino SKU: DFR0009

FUNCTIONS For controlling the Arduino board and performing computations.

8:1 Serial Port Expander

Lab 01 Arduino 程式設計實驗. Essential Arduino Programming and Digital Signal Process

IME-100 ECE. Lab 4. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE,

Arduino 101 AN INTRODUCTION TO ARDUINO BY WOMEN IN ENGINEERING FT T I NA A ND AW E S O ME ME NTO R S

SWITCH 10 KILOHM RESISTOR 220 OHM RESISTOR POTENTIOMETER LCD SCREEN INGREDIENTS

How to Use an Arduino

Laboratory 5 Communication Interfaces

CPEG300 Embedded System Design. Lecture Interface with Peripheral Devices

Arduino Programming Part 6: LCD Panel Output

Module 1: Crash Prevention Lesson 3: Weather Information systems Programming Activity Using Arduino Teacher Resource Grade 6-8 Time Required

Required Materials. Optional Materials. Preparation

MAE106 Laboratory Exercises Lab # 1 - Laboratory tools

STEPD StepDuino Quickstart Guide

This tutorial will show you how to take temperature readings using the Freetronics temperature sensor and an Arduino Uno.

Note. The above image and many others are courtesy of - this is a wonderful resource for designing circuits.

Experiment 10 Fall 2012

LDR_Light_Switch1 -- Overview

University of Portland EE 271 Electrical Circuits Laboratory. Experiment: Arduino

ARDUINO LEONARDO WITH HEADERS Code: A000057

Digital Pins and Constants

Introduction to Arduino

TN-192. Bar Graph shows analog trends on a dot-matrix character LCD module. Introduction. LCD Module Basics. Custom Characters

Lab 2.2 Ohm s Law and Introduction to Arduinos

Contents. List of Figures. TermDriver Datasheet 1. 1 Overview 2. 2 Features 2. 3 Installation with Arduino 3

melabs Serial LCD Firmware Version 1.0 2/7/07

3.The circuit board is composed of 4 sets which are 16x2 LCD Shield, 3 pieces of Switch, 2

LAMPIRAN I (LISTING PROGRAM)

Pridgen Vermeer Robotics ATmega128 Revision 0

ARDUINO. By Kiran Tiwari BCT 2072 CoTS.

Lab 4 LCDs and Accelerometers

EMBEDDED HARDWARE DESIGN. Tutorial Interfacing LCD with Microcontroller /I

CTEC 1802 Embedded Programming Labs

melabs Serial LCD Firmware Version 1.1 3/5/07

Introduction 1. Liquid crystal display (16 characters by 2 rows) Contrast dial: turn the dial to adjust the contrast of the display (see page 5)

Designed & Developed By: Ms. Jasleen Kaur, PhD Scholar, CSE. Computer Science & Engineering Department

Analog Input. Sure sure, but how to make a varying voltage? With a potentiometer. Or just pot.

What s inside the kit

Robotics/Electronics Review for the Final Exam

Adapted from a lab originally written by Simon Hastings and Bill Ashmanskas

The Big Idea: Background: About Serial

Developement of Multi Interface Board for Educational Trainer Kit

Lab 8: Sensor Characterization Lab (Analog)

Contents. List of Figures. SPIDriver Datasheet 1. 1 Overview 2. 2 Features 2. 3 Installation with Arduino 3

Arduino: LCD Diagrams & Code Brown County Library

Blinking an LED 1 PARTS: Circuit 2 LED. Wire. 330Ω Resistor

Physical Computing Self-Quiz

8051 Intermidiate Development Board. Product Manual. Contents. 1) Overview 2) Features 3) Using the board 4) Troubleshooting and getting help

Introduction to Arduino. Wilson Wingston Sharon

ARDUINO LEONARDO ETH Code: A000022

Thursday, September 15, electronic components

Lab 2 - Powering the Fubarino. Fubarino,, Intro to Serial, Functions and Variables

Arduino Prof. Dr. Magdy M. Abdelhameed

Lab 3 XBees and LCDs and Accelerometers, Oh My! Part 1: Wireless Communication Using XBee Modules and the Arduino

StenBOT Robot Kit. Stensat Group LLC, Copyright 2018

Device: LDP This document Version: 1.0. Date: July Description: 80x08 1R1G LED Display Panel

GUIDE TO SP STARTER SHIELD (V3.0)

User Manual. ESP8266 Wifi Shield

Downloaded from Elcodis.com electronic components distributor

Lab 5: LCD and A/D: Digital Voltmeter

ARDUINO MICRO WITHOUT HEADERS Code: A000093

Laboratory 1 Introduction to the Arduino boards

Prototyping & Engineering Electronics Kits Basic Kit Guide

ARDUINO M0 PRO Code: A000111

ARDUINO EXPERIMENTS ARDUINO EXPERIMENTS

SC1602LC 16x2 Large Characters RS232 LCD Module. User s Manual. Large Viewing Area 99mm x 24mm. Large Character Size. 4.84mm x 9.66mm.

Arduino. (Digital-to-Analog Converter D/A D2A) (Digital to Analog Conversion) 3. (Analog to Digital conversion)

REQUIRED MATERIALS Epiphany-DAQ board Wire Jumpers IR Rangefinder Sensor LED Resistors Breadboard Multimeter (if needed)

ENGG1015: Lab 7. In Search of Light

Earthshine Design Arduino Starters Kit Manual - A Complete Beginners Guide to the Arduino. Project 13. Serial Temperature Sensor

The Atmel ATmega328P Microcontroller

LDR_Light_Switch2 -- Overview

Alessandra de Vitis. Arduino

DEV-1 HamStack Development Board

Lab 5: LCD and A/D: Digital Voltmeter

GOOD MORNING SUNSHINE

Bill of Materials: Turn Off the Lights Reminder PART NO

Goal: We want to build an autonomous vehicle (robot)

CARTOOINO Projects Book

Lab 2 - Powering the Fubarino, Intro to Serial, Functions and Variables

SPDM Level 2 Smart Electronics Unit, Level 2

CORTESIA ELECTRONICCA

Arduino UNO R3 ESP8266 Web Server Serial Port WiFi Shield ESP13

LDR_Light_Switch5 -- Overview

Transcription:

Mechatronics Engineering and Automation Faculty of Engineering, Ain Shams University MCT-151, Spring 2015 Lab-3: LCDs Serial Communication Analog Inputs Temperature Measurement System Ahmed Okasha okasha1st@gmail.com

Understanding LCD LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These modules are preferred over seven segments and other multi segment LEDs. The reasons being: LCDs are economical; easily programmable; have no limitation of displaying special & even custom characters (unlike in seven segments), animations and so on. A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers, namely, Command and Data.

Understanding LCD pins

Understanding LCD pins Pin No Function Name 1 Ground (0V) Ground 2 Supply voltage; 5V (4.7V 5.3V) Vcc 3 Contrast adjustment; through a variable resistor V EE 4 Selects command register when low; and data register when Register high Select 5 Low to write to the register; High to read from the register Read/write 6 Sends data to data pins when a high to low pulse is given Enable 7 DB0 8 DB1 9 DB2 10 DB3 8-bit data pins 11 DB4 12 DB5 13 DB6 14 DB7 15 Backlight V CC (5V) Led+ 16 Backlight Ground (0V) Led-

LCD Registers The command register stores the command instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting the cursor position, controlling display etc. The data register stores the data to be displayed on the LCD. The data is the ASCII value of the character to be displayed on the LCD. Click to learn more about internal structure of a LCD. Why only 4 data bit not 8? The idea of 4 bit communication is introduced to save pins of a microcontroller. You may think that 4 bit mode will be slower than 8 bit. But the speed difference is only minimal.

Understanding the example code #include <LiquidCrystal.h> LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // include the library code: // initialize the library with the numbers of the interface pins void setup() { lcd.begin(16, 2); lcd.print("hello, world!"); // set up the LCD's number of columns and rows // Print a message to the LCD. } void loop() { lcd.setcursor(0, 1); lcd.print(millis() / 1000); // set the cursor to column 0, line 1, note: line 1 is the second row, since counting begins with 0): // print the number of seconds since reset: }

Serial Communication Serial data transfer is when we transfer data one bit at a time, one right after the other. Used for communication between the Arduino board and a computer or other devices. All Arduino boards have at least one serial port (also known as a UART or USART): Serial. It communicates on digital pins 0 (RX) and 1 (TX) as well as with the computer via USB. Thus, if you use these functions, you cannot also use pins 0 and 1 for digital input or output.

Serial Communication When you Compile/Verify what you're really doing is turning the sketch into binary data (ones and zeros). When you Upload it to the Arduino, the bits are shoved out one at a time through the USB cable to the Arduino where they are stored in the main chip.

Notes library name procedure name (input values) Serial begin (9600) Baud rate: 9600 bps, this is how fast the connection can read and write bits on the wire. TO show the serial monitor: Tools>>serial monitor Baud rate match up! If you ever find that you're getting a whole lot of garbage instead of proper text, make sure that you have the correct baud rate selected in the drop down menu of the Serial Monitor. Note that this communication baud rate is indepedent of the upload process, which is fixed at 19200 bps.

Example /* * Hello World! * * This is the Hello World! for Arduino. * It shows how to send data to the computer */ void setup() // run once, when the sketch starts { Serial.begin(9600); // set up Serial library at 9600 bps } void loop() // run over and over again { } Serial.println("Hello world!"); // prints hello with ending line break delay(1000);

Example Go to Tools>> Serial Monitor

Analog Inputs Arduino UNO has 6 analog inputs pins to deal with a wide variety of analog sensors such as Potentiometers, LDRs, pressure sensor, etc.

How to read from analog pins? analogread(pin): Reads the value from the specified analog pin. The Arduino board contains a 6 channel,10-bit analog to digital converter. This means that it will map input voltages between 0 and 5 volts into integer values between 0 and 1023. This yields a resolution between readings of: 5 volts / 1024 units or,.0049 volts (4.9 mv) per unit.

Analog Sensor Examples Potentiometer Photo-resistor LM35 Temperature sensor

Potentiometer Your pot has a circular 'track' that acts as a resistor, in our case it's a 10 kω resistor. However, the difference with a pot, is that there is also a middle connection called the 'slider'. This connection is rotated when you turn the pot. So if you connect one end of the pot to 5V and the other to GND, then the voltage at the slider will vary between 0 and 5V as you turn it.

Example: int val = 0; // variable to store the value read void setup() { Serial.begin(9600); } // setup serial void loop() { val = analogread(analogpin); Serial.println(val); } // read the input pin //Serial print

Photocell/Photoresistor/LDR The photocell used is of a type called a light dependent resistor, sometimes called an LDR. As the name suggests, these components act just like a resistor, except that the resistance changes in response to how much light is falling on them. This one has a resistance of about 50 kω in near darkness and 500 Ω in bright light. To convert this varying value of resistance into something we can measure on an Arduino's analog input, it need to be converted into a voltage.

Interfacing LDR to Arduino The simplest way to do that is to combine it with a fixed resistor. The resistor and photocell together behave rather like a pot. When the light is very bright, then the resistance of the photocell is very low compared with the fixed value resistor, and so it is as if the pot were turned to maximum. When the photocell is in dull light the resistance becomes greater than the fixed 1kΩ resistor and it is as if the pot were being turned towards GND.

LM35 The LM35 is an integrated circuit analog sensor that can be used to measure temperature with an electrical output proportional to the temperature (in o C)

LM35 sensitivity equation The analog value read from LM35 is converted to a digital value in the range of (0-1023). LM35 sensitivity: Output Voltage (Vin) mv Sensitivity = = 10 = 0.01 V Input Temperature (T) C C This means: For Vin = 1023 (5V) T = 5 = 500 C 1023 500 C Vin T =? T = Vin 1023 500 The value read from the sensor 0.01

Temperature measurement system Using the same LCD Hardware, expand your work to integrate the temperature sensor LM35, and make the necessary change to read from the sensor, convert the read value using the proper conversion, and display the reading on the LCD

References http://www.engineersgarage.com/electroniccomponents/16x2-lcd-module-datasheet https://electrosome.com/interfacing-lcd-with-picmicrocontroller-hi-tech-c/