EMS1EP Lecture 9 Analog to Digital Conversion (ADC) Dr. Robert Ross.

Slides:



Advertisements
Similar presentations
Sensing and Control.
Advertisements

Khaled A. Al-Utaibi Interfacing an LED The Light Emitting Diode (LED) Applications DC Characteristics & Operation Interfacing to.
EMS1EP Lecture 6 Digital Inputs
EMS1EP Lecture 5 Digital Outputs Dr. Robert Ross.
EMS1EP Lecture 7 Program Structure and Serial I/O Dr. Robert Ross.
EMS1EP Lecture 4 Intro to Programming Dr. Robert Ross.
EMS1EP Lecture 8 Pulse Width Modulation (PWM)
Lab7: Introduction to Arduino
Intermediate Electronics and Lilypad Where Electronics Meet Textiles Workshop with Lynne Bruning and Troy Robert Nachtigall Sponsored by Spark Fun and.
Servo Background Servos provide control of rotary position Servos are used extensively in the remote control hobby world for: Aircraft (flaps, ailerons,
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)
Embedded Sumo 1T4 – 1T5 UTRA.
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.
Microprocessor Motor Control Spring Introduction  Stamp projects Robots  Sensors  Motor control  Logic Rocketry  Reading acceleration (“g”
Digital & Analog Inputs. Review Fundamental parts of an Arduino program are … Setting output types using pinMode. Declaring variables Can write a digital.
Khaled A. Al-Utaibi  Digital Vs Analog Signals  Converting an Analog Signal to a Digital One  Reading Analog Sensors with the.
SENIOR DESIGN 10/16.
Analog and Digital Measurements living with the lab 14 digital input / output pins 6 analog input pins © 2011 LWTL faculty team.
Introduction.
Introduction to Arduino Prepared by R. Lamond.  “Arduino is an open-source electronics prototyping platform based on flexible, easy- to-use hardware.
Basic Circuits – Lab 2 Arduino and Sensors Xmedia Spring 2011.
Embedded Programming and Robotics
ARDUINO PROGRAMMING Working with the Arduino microcontroller.
Basic Circuits – Lab 2 Arduino and Sensors
Microcontroller Hands-on Workshop #3 Ahmad Manshad New Mexico State University Institute of Electrical and Electronics Engineers November 7, 2009.
MTI FALL 2010 By: Rohan Sharma Mini Project Documentation: Bacterial Growth Monitor.
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class 2.
Arduino. What is it? A open-source software suite and single-board microcontroller. Allows easy and affordable prototyping of microcontroller applications.
Introduction to the Arduino
Arduino Week 2 Lab ECE 1020 Prof. Ahmadi. Objectives 1. Control the rotation of standard servo motor  A standard servo motor is limited in its rotation.
Pulse Width Modulation (PWM). 100% Pulse Width Modulation (PWM) 0% On the chipKIT there are 490 periods per second. Use analogWrite(pin, value) to control.
Servos The material presented is taken from a variety of sources including:
Suleyman Demirel University CSS340 Microprocessor Systems – Lecture 2 ATMEGA328P ARCHITECTURE ANALOG INPUTS.
BM-305 Mikrodenetleyiciler Güz 2015 (3. Sunu) (Yrd. Doç. Dr. Deniz Dal)
Automatic accident avoiding system PROJECT MEMBERS MUTHUKUMAR.K (05ME33) SAKTHIDHASAN.S (05ME39) SAKTHIVEL.N (05ME40) VINOTH.S (05ME56) PROJECT GUIDE:
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.
1 - Remove LED from 13 and GND - Bring out your breadboard from HW#4 Arduino Overview:
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class3/Lab 2.
Microcontroller Hands-on Workshop #2 Ahmad Manshad New Mexico State University Institute of Electrical and Electronics Engineers October 31, 2009.
INTERNET OF EVERYTHING SDU 2016 Week 4. Simple Digital and Analog Inputs  The Arduino’s ability to sense digital and analog inputs allows it to respond.
Throttle Arduino RC Receiver Stock Golf Cart Motor Controller Motor 1 PWM signal: Voltage: 0 – 5V Period = 22ms Positive Pulse Width: 1ms – 2ms Digital.
Microcontroller basics Embedded systems for mortals.
Bdps 2 Lecture 2. Circuits and Ohm's Law For resistive circuits.
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
1 Microcontrollers. 2 Programmers work in the virtual world Machinery works in the physical world Microcontrollers connect the virtual and physical world.
BM-305 Mikrodenetleyiciler Güz 2016 (3. Sunu)
Assist. Prof. Rassim Suliyev - SDU 2017
Application Case Study Security Camera Controller
ECE 445 Smart Window Responding System
ARDUINO LINE FOLLOWER ROBOT
INC 161 , CPE 100 Computer Programming
Arduino - Introduction
Arduino Uno and sensors
How to avoid catching things on fire.
Analog Input through POT
Roller Coaster Design Project
Introduction to Arduinos
ARDUINO     What is an Arduino? Features 14 Digital I/O pins 6 Analogue inputs 6 PWM pins USB serial 16MHz Clock speed 32KB Flash memory 2KB SRAM.
Arduino Week 2 Lab ECE 1020 Prof. Ahmadi.
Digital Theremin with LED
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.
Sensors and actuators Sensors Resistive sensors
CTY SAR FCPS Shawn Lupoli, Elliot Tan
UNIT 5 Analog signals.
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Introduction to Arduinos
Arduino程式範例.
CTY SAR FCPS Alexander Velikanov
Presentation transcript:

EMS1EP Lecture 9 Analog to Digital Conversion (ADC) Dr. Robert Ross

Overview (what you should learn today) Revision of Analog and Digital ADC + Quantisation Examples of Analog Inputs Worked examples Minor Project Major Project

Analog/Digital Microcontroller (LArduino) ADC Analog to Digital Converter DAC Digital to Analog Converter Transducer (Sensor) Actuator Physical Variable (Sound, light, pressure, temp, ect) Control Physical Variable (Sound, light, pressure, temp, ect) Analog Voltages Digital Voltages

Analog to Digital Converters (ADC) Measure an analog value and provide a digital representation of this value Like a digital multimeter for your microcontroller Inside the Arduino microcontroller Several different techniques used (covered in second year microcontrollers)

ADC quantisation Converting a continuous value into a digital number Arduino has a 10bit ADC – (2 10 = 1024 voltage levels) Value returned in the range of (corresponding to 0-5V) 5/1023 = 4.89mV/step Each time you increase the voltage by 4.89mV the digital value should go up 1 step

ADC on the LArduino LArduino has 4 analog inputs (marked Analog 0-3) Analog inputs can be connected to all of these inputs at the same time Can only read one analog input at a time

Using the ADC Analog pins don’t need to be setup in the setup function To read an analog value use the analogRead() command. Syntax: int analogRead( ); Returns the analog result : specifies which ADC pin you wish to read (i.e. Pins 0-4) Typical use: int ADC_Result; ADC_Result = analogRead(2);

Examples of Analog Inputs Pressure Acceleration Temperature Voltage (Variable resistor forms voltage divider) Light

Worked Example: Potentiometer Interface a potentiometer to an analog input on the Arduino Every 500ms read the value of the potentiometer and send it via the serial port to the PC If the value is more than 500 turn ON an LED – else turn off LED

Worked Example: Potentiometer Circuit Diagram LArduino Board 5V Analog Pin2 Voltage (Variable resistor forms voltage divider) Pin5 5V

Worked Example: Potentiometer int pot1 = 2; int led1 = 5; int ADCValue; void setup() { Serial.begin( ); //Setup serial port pinMode(led1, OUTPUT); //Setup LED delay(500); }

Worked Example: Potentiometer void loop() { ADCValue = analogRead(pot1);//Read analog value Serial.print(“ADC Result: “); Serial.println(ADCValue); if(ADCValue > 500){ //Turn LED on digitalWrite(led1,LOW); } else{ //Turn LED off digitalWrite(led1,HIGH); } delay(500);//500ms delay }

Measuring multiple ADCs Only one ADC can be measured at a time If more than one need to be measured step through and measure one after another ADCValue1 = analogRead(ADC1); ADCValue2 = analogRead(ADC2); ADCValue3 = analogRead(ADC3);

Worked example: Light Sensor Create a ‘garden light sensor’ A photodiode is used to sample how much light there is and gives an analog voltage output If the voltage is below a preset threshold then turn on another LED – otherwise turn off the LED LArduino Board Analog Pin1 5V Pin6 5V 100K

Worked Example: Light Sensor int pd1 = 1; int led1 = 6; void setup() { pinMode(led1, OUTPUT); //Setup LED } void loop() {//You fill in this section }

Minor Project: Level Crossing System Construction of a train level crossing system Description – a level crossing system using 1 servo as the boom gate, activated by a debounced switch and with flashing warning lights and a audible buzzer alarm Deliverables: – Working System for demonstration day – Schematics (completed in Altium) – Code

Minor Project: Level Crossing System When the switch is pressed (and at some point released): – The boom gate should come down (servo turn 90 o ) – Two LEDs should alternately flash at 1Hz – A buzzer should be controlled to beep in 0.5 second bursts (use PWM with 50% duty cycle) The switch is a debounced switch. When the switch is pressed a second time the boom gate should come up, the LEDs should stop flashing and the buzzer should remain silent See handout for more details Minor project is to be completed in the lab (may require a small amount of extra outside lab time) Demonstrations in lab 8

What the minor project should look like

Major Project Build a robot Infrared photodiodes on the bottom (allow it to sense light/dark objects Battery powered Control algorithms Applications – Line tracking/following – Staying inside a paddock – Racing

What the major project should look like

Continuous Rotation Servos By default servo motors only have about 180 O of motion that they can travel over Servos can be modified for continuous rotation (they can go all the way around) PWM signal controls speed not position of continuous rotation servos Involves: – Removing feedback potentiometer (variable resistor) – Soldering in resistors – Cutting notch out of gears Instruction video will be provided in the labs

Control Algorithms Three light sensors on the bottom of the robot used to detect the lines For line following want to keep it close to the middle sensor Possible readings: – No Sensors (but last seen on S1) – S1 only – S1+S2 – S2 only – S2+S3 – S3 only – No Sensors (but last seen on S3) S1S2S3

Control Algorithms Suggested algorithm is a proportional one – The further away the robot is from the line (S2 only) the larger change in its relative speed between the wheels it should make – Should also give the robot a little forward bias so it keeps moving forward and doesn’t get stuck in tight bends Can switch between just driving forward and control algorithm Will need to experiment with different speeds and find a mix between speed and stability Execution tests will have races with the fastest robots receiving bonus marks (but they must not leave the track)

Summary (What you learnt in this session) Many sensors that our microcontroller needs to read are analog An ADC enables the microcontroller to read an analog value and convert it to a digital number Introduction to the minor and major project tasks