Khaled A. Al-Utaibi  Digital Vs Analog Signals  Converting an Analog Signal to a Digital One  Reading Analog Sensors with the.

Slides:



Advertisements
Similar presentations
Khaled A. Al-Utaibi Interfacing an LED The Light Emitting Diode (LED) Applications DC Characteristics & Operation Interfacing to.
Advertisements

EMS1EP Lecture 8 Pulse Width Modulation (PWM)
EMS1EP Lecture 9 Analog to Digital Conversion (ADC) Dr. Robert Ross.
Intermediate Electronics and Lilypad Where Electronics Meet Textiles Workshop with Lynne Bruning and Troy Robert Nachtigall Sponsored by Spark Fun and.
Anurag Dwivedi & Rudra Pratap Suman.  Open Source electronic prototyping platform based on flexible easy to use hardware and software.
What is Arduino?  Arduino is a ATMEL 168 micro-controller kit designed specially for small projects  User friendly IDE(Integrated Development Environment)
How to use Arduino By: Andrew Hoffmaster.
EET 2261 Unit 14 INCOMPLETE Analog-to-Digital Conversion (ADC) & Digital-to-Analog Conversion (DAC)  Read.  Homework #13 and Lab #13 due next week. 
Lecture 17: Analog to Digital Converters Lecturers: Professor John Devlin Mr Robert Ross.
ECE 265 – LECTURE 14 Analog Signal Acquisition The A/D converters 5/14/ ECE265.
CE 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst Analog to Digital (and back again) Interfacing a microprocessor-based system.
Digital Systems: Introductory Concepts Wen-Hung Liao, Ph.D.
Shuvra Das University of Detroit Mercy
Information Processing & Digital Systems COE 202 Digital Logic Design Dr. Aiman El-Maleh College of Computer Sciences and Engineering King Fahd University.
Interfacing Analog and Digital Circuits
Unit 4 Sensors and Actuators
Interfacing with the Analog World Wen-Hung Liao, Ph.D.
Introduction to Data Conversion
Analog-to-Digital Converters Prepared by: Mohammed Al-Ghamdi, Mohammed Al-Alawi,
Digital Outputs 7-Segment Display
Analog and Digital Measurements living with the lab 14 digital input / output pins 6 analog input pins © 2011 LWTL faculty team.
Embedded Programming and Robotics Lesson 2 C Programming Refresher C Programming1.
Objectives: Lead Switching Circuitry/Control Analog to Digital Converter Write to Computer.
Engineering 1040: Mechanisms & Electric Circuits Winter 2015 Analog & Digital Signals Analog to Digital Conversion (ADC)
ACOE2551 Microprocessors Data Converters Analog to Digital Converters (ADC) –Convert an analog quantity (voltage, current) into a digital code Digital.
Data Acquisition Systems
Khaled A. Al-Utaibi  The Push Button  Interfacing Push Buttons to Arduino  Programming Digital Inputs  Working with “Bouncy”
Digitization When data acquisition hardware receives an analog signal it converts it to a voltage. An A/D (analog-to-digital) converter then digitizes.
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
Representing Numerical Data Analog Any signal that varies continuously over time Mechanical Pneumatic Hydraulic Electrical Digital Quantities are represented.
Suleyman Demirel University CSS340 Microprocessor Systems – Lecture 2 ATMEGA328P ARCHITECTURE ANALOG INPUTS.
COE 202: Digital Logic Design Introduction Courtesy of Dr. Ahmad Almulhem KFUPM1.
Digital Inputs Interfacing Keypad
BM-305 Mikrodenetleyiciler Güz 2015 (3. Sunu) (Yrd. Doç. Dr. Deniz Dal)
ARDUINO 1. Basics  Comments  /* * Blink * * The basic Arduino example. Turns on an LED on for one second, * then off for one second, and so on... We.
Digital Control CSE 421.
Analog/Digital Conversion
ECE 2799 Electrical and Computer Engineering Design ANALOG to DIGITAL CONVERSION Prof. Bitar Last Update:
Embedded Systems Design 1 Lecture Set C Interfacing the MCS-51 to: –D/A Converter –A/D Converter.
ECE 3450 M. A. Jupina, VU, 2016 Capacitance Sensor Project Goal: Creation of a digital capacitance sensor circuit where a variation in capacitance changes.
Temperature Sensor TYWu. Seeed’s Temperature Sensor Picture.
Digital-to-Analog Analog-to-Digital Week 10. Data Handling Systems  Both data about the physical world and control signals sent to interact with the.
Arduino Microcontroller Technical Details : Arduino (UNO R3) micro-controller ATmega 328 CPU (“industry-standard” micro-controller CPU) ?? MHz clock speed.
Introduction to Data Conversion EE174 – SJSU Tan Nguyen.
ME 120: Arduino Programming Arduino Programming Part II ME 120 Mechanical and Materials Engineering Portland State University
Electronic instrumentation Digitization of Analog Signal in TD
Lecture Notes / PPT UNIT III
1 Summary Lecture: Part 1 Sensor Readout Electronics and Data Conversion Discovering Sensor Networks: Applications in Structural Health Monitoring.
Arduino Programming. THE ARDUINO IS A MICROCONTROLLER – A LOW COST, LOW PERFORMANCE COMPUTER.
BM-305 Mikrodenetleyiciler Güz 2016 (3. Sunu)
MECH 373 Instrumentation and Measurements
Microprocessors Data Converters Analog to Digital Converters (ADC)
Introduction to Sensors and Actuators
Intro to the Arduino Created by
Arduino & its hardware interfacing
Microcontroller basics
EI205 Lecture 13 Dianguang Ma Fall 2008.
INC 161 , CPE 100 Computer Programming
Arduino - Introduction
Arduino Uno and sensors
BM-305 Mikrodenetleyiciler Güz 2017 (3. Sunu)
Introduction to Arduinos
EET 2261 Unit 14 INCOMPLETE Analog-to-Digital Conversion (ADC) & Digital-to-Analog Conversion (DAC) Read. Homework #13 and Lab #13 due next week. Quiz.
Conversation between Analogue and Digital System
Arduino : Introduction & Programming
ADC and DAC Programming in AVR
ADC and DAC Data Converter
UNIT 5 Analog signals.
 Both data about the physical world and control signals sent to interact with the physical world are typically "analog" or continuously varying quantities.
Introduction to Arduinos
Presentation transcript:

Khaled A. Al-Utaibi

 Digital Vs Analog Signals  Converting an Analog Signal to a Digital One  Reading Analog Sensors with the Arduino  The TMP36 Temperature Sensor  Interfacing The TMP36 Sensor  Reading The TMP36 Sensor  Temperature Sensor Example

 Digital electrical signals have just two discrete levels: HIGH (5V) and LOW (0V)  In Arduino, we used the following functions to deal with digital signals: − digitalWrite(pin, HIGH) to set a pin HIGH, − digitalWrite(pin, LOW) to set a pin LOW, and − digitalRead(pin) to determine whether a digital pin had a voltage applied to it (HIGH) or not (LOW). Figure 1: Analog Vs digital signals

 Analog electrical signals have continuous range of values  These signals can vary with an indefinite number of steps between HIGH and LOW values.  In Arduino, HIGH is closer to 5V and LOW is closer to 0V.  In Arduino, we can use the function analogRead(pin) to read analog signals  This function will return a number between 0 and 1023 in proportion to the voltage applied to the analog pin. Figure 1: Analog Vs digital signals

 It is common to convert analog signals into digital signals in order to allow for efficient transmission and processing of these signals.  To convert an Analog signal into a digital one, some loss of accuracy is inevitable since digital systems can only represent a finite discrete set of values.  The process of conversion is known as Digitization or Quantization.  Analog-to-Digital Converters (ADC) are used to produce a digitized signals.  Digital-to-analog Converters (DAC) are used to regenerate analog signals from their digitized signals.

 We can use the Arduino ADC pins to convert analog voltage values into number representations that we can work with.  The accuracy of an ADC is determined by the resolution.  In the case of the Arduino Uno, there is a 10-bit ADC for doing your analog conversions.  “10-bit” means that the ADC can subdivide (or quantize) an analog signal into 2 10 =1024 different values.  Hence, the Arduino can assign a value from 0 to 1023 for any analog value that you give it.

 The default reference voltage of the Arduino ADC is 5V.  The reference voltage determines the maximum voltage that you are expecting, and, therefore, the value that will be mapped to  So, with a 5V reference voltage, putting − 0V on an ADC pin returns a value of 0, − 2.5V returns a value of 512 (half of 1023), and − 5V returns a value of 1023.

 To better understand what’s happening here, consider what a 3-bit ADC would do, as shown in Figure 2. − A 3-bit ADC has 3 bits of resolution. − Because 2 3 =8, there are 8 total logic levels, from 0 to 7. − Therefore, any analog value that is passed to a 3-bit ADC will have to be assigned a value from 0 to 7. − Looking at Figure 2, you can see that voltage levels are converted to discrete digital values that can be used by the microcontroller. − The higher the resolution, the more steps that are available for representing each value. − In the case of the Arduino Uno, there are 1024 steps rather than the 8 shown here.

Figure 2: 3-bit analog quantization

 Different Arduinos have different numbers of analog input pins, but you read them all the same way, using the analogRead() command.  The analogRead() function reads the value from the specified analog pin. − Syntax:  analogRead(pin) − Parameters:  pin: the number of the analog pin you want to read (int). − Return:  int (0 to 1023) − Note:  If the analog input pin is not connected to anything, the value returned by analogRead() will fluctuate based on a number of factors (e.g. the values of the other analog inputs, how close your hand is to the board, etc.).

 The TMP36 temperature sensor (Figure 3) has the following characteristics: − Provides a voltage range from -40 o C to +125 o C. − Provide typical accuracies of ±2°C. − Provides a voltage output that is linearly proportional to the Celsius (centigrade) temperature. − Provides a 750mV output at 25°C. − Provides a 500mV output at 0 o C. − Has an output scale factor of 10mV/°C (every 10mV corresponds to 1 o C). Figure 3: TMP36

 The TMP36 temperature sensor can be easily interfaced to the Arduino bard as shown in the following Figure 4. Figure 4: Interfacing the TMP36 to the Arduino board.

 The Arduino uses ADC to read the output of the TMP36 sensor as shown Figure 5.  We can determine the temperature as follows: − (1) Convert the integer value generated by the ADC to voltage (in mV) to determine the input voltage Vin:  V IN = DAC OUT x (V REF x 1000)/1024  V REF = 5V = 5x1000 mV = 5000 mV  Every division of the 1024 DAC output represents 5000/1024=4.88mV − (2) Convert input voltage V IN to the corresponding temperature (in o C):  T IN = (V IN – 500)/10  We subtract 500 from V IN because the TMP36 provides 50mV output at 0 o C.  We divide by 10 because every 10mV corresponds to 1 o C.

Figure 5: Reading the TMP36 sensor.

 Interface the TMP36 sensor to the Arduino board as in Figure 4.  Then, write a program to read the input voltage from the TMP36 and displays the corresponding temperature on on the Arduino environment’s built-in serial monitor.

int DACout;// DAC output int A0 = 0;// Analog input A0 double Vref = 5.0;// reference voltage of the DAC double Vin;// input voltage from the TMP36 double Tin;// corresponding input temperature public void setup(){ // initialize and start the serial port Serial.begin(9600); } public void loop(){ // read the DAC output corresponding to analog input A0 DACout = analogRead(A0); // compute the input voltage received from TMP36 Vin = DACout * (Vref * )/1024.0; // compute the corresponding input temperature Tin = (Vin ) / 10.0; // display the temperature on the serial port Serial.println(Tin); }