Power. EE 109 Unit 17 -Pulse Width Modulation. Duty Cycle. Output Devices

Similar documents
Timer 0 Modes of Operation. Normal Mode Clear Timer on Compare Match (CTC) Fast PWM Mode Phase Corrected PWM Mode

CprE 288 Introduction to Embedded Systems (Output Compare and PWM) Instructors: Dr. Phillip Jones

Training Schedule. Robotic System Design using Arduino Platform

ATmega16A Microcontroller

Microprocessor & Interfacing Lecture Programmable Interval Timer

EE283 Electrical Measurement Laboratory Laboratory Exercise #7: Digital Counter

Name & SID 1 : Name & SID 2:

DC Motor and Servo motor Control with ARM and Arduino. Created by:

EE-110 Introduction to Engineering & Laboratory Experience Saeid Rahimi, Ph.D. Lab Timer: Blinking LED Lights and Pulse Generator

A MORON'S GUIDE TO TIMER/COUNTERS v2.2. by

Lab 5: Inverted Pendulum PID Control

DASL 120 Introduction to Microcontrollers

Mechatronics Engineering and Automation Faculty of Engineering, Ain Shams University MCT-151, Spring 2015 Lab-4: Electric Actuators

Grundlagen Microcontroller Counter/Timer. Günther Gridling Bettina Weiss

Hardware Flags. and the RTI system. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

Hardware Platforms and Sensors

Lock Cracker S. Lust, E. Skjel, R. LeBlanc, C. Kim

Four Quadrant Speed Control of DC Motor with the Help of AT89S52 Microcontroller

Programming a Servo. Servo. Red Wire. Black Wire. White Wire

Pulse-Width-Modulation Motor Speed Control with a PIC (modified from lab text by Alciatore)

Timer/Counter with PWM

Counter/Timers in the Mega8

Project Final Report: Directional Remote Control

Programmable Control Introduction

CSCI1600 Lab 4: Sound

Low Cost Screening Audiometer

introduction to Digital Electronics Install the Arduino IDE on your laptop if you haven t already!

Exercise 5: PWM and Control Theory

RC Servo Interface. Figure Bipolar amplifier connected to a large DC motor

L13: (25%), (20%), (5%) ECTE333

Tarocco Closed Loop Motor Controller

PAK-VIIIa Pulse Coprocessor Data Sheet by AWC

Lecture 6: Electronics Beyond the Logic Switches Xufeng Kou School of Information Science and Technology ShanghaiTech University

Hello, and welcome to this presentation of the STM32L4 comparators. It covers the main features of the ultra-lowpower comparators and some

Practical Exercise. STM32F4 Discovery. Alessandro Palla

Montgomery Village Arduino Meetup Dec 10, 2016

FABO ACADEMY X ELECTRONIC DESIGN

PWM System. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

Designing with STM32F3x

HIGH LOW Astable multivibrators HIGH LOW 1:1

Interfacing Sensors & Modules to Microcontrollers

Direct Current Waveforms

Measuring Distance Using Sound

Electronic Instrumentation ENGR-4300 Fall 2004 Section Experiment 7 Introduction to the 555 Timer, LEDs and Photodiodes

International Journal of Advanced Research in Electrical, Electronics and Instrumentation Engineering. (An ISO 3297: 2007 Certified Organization)

Application Note: Using the Motor Driver on the 3pi Robot and Orangutan Robot Controllers

Java Bread Board Introductory Digital Electronics Exercise 2, Page 1

ME 461 Laboratory #5 Characterization and Control of PMDC Motors

I2C Demonstration Board LED Dimmers and Blinkers PCA9531 and PCA9551

PCB & Circuit Designing (Summer Training Program) 6 Weeks/ 45 Days PRESENTED BY

Master Thesis Presentation Future Electric Vehicle on Lego By Karan Savant. Guide: Dr. Kai Huang

University of California at Berkeley Donald A. Glaser Physics 111A Instrumentation Laboratory

Sensors and Sensing Motors, Encoders and Motor Control

ESE 350 Microcontroller Laboratory Lab 5: Sensor-Actuator Lab

In the Mr Bit control system, one control module creates the image, whilst the other creates the message.

EE 308 Spring S12 SUBSYSTEMS: PULSE WIDTH MODULATION, A/D CONVERTER, AND SYNCHRONOUS SERIAN INTERFACE

EE 110 Introduction to Engineering & Laboratory Experience Saeid Rahimi, Ph.D. Lab 0: Course Introduction

Course Introduction. Content 20 pages 3 questions. Learning Time 30 minutes

PCB & Circuit Designing

DC-Motor Driver circuits

Design with Microprocessors

Internet of Things (Winter Training Program) 6 Weeks/45 Days

Adafruit 16-Channel Servo Driver with Arduino

ELECTRONICS PULSE-WIDTH MODULATION

PCB & Circuit Designing (Summer Training Program 2014)

Microcontrollers and Interfacing

Industrial Automation Training Academy. Arduino, LabVIEW & PLC Training Programs Duration: 6 Months (180 ~ 240 Hours)

D - Robot break time - make a game!

EECS 270: Lab 7. Real-World Interfacing with an Ultrasonic Sensor and a Servo

DC motor control using arduino

Controlling DC Brush Motor using MD10B or MD30B. Version 1.2. Aug Cytron Technologies Sdn. Bhd.

LV8716QAGEVK Evaluation Kit User Guide

Microcontrollers: Lecture 3 Interrupts, Timers. Michele Magno

uc Crash Course Whats is covered in this lecture Joshua Childs Joshua Hartman A. A. Arroyo 9/7/10

Intro to Engineering II for ECE: Lab 3 Controlling Servo Motors Erin Webster and Dr. Jay Weitzen, c 2012 All rights reserved

Embedded Systems & Robotics (Winter Training Program) 6 Weeks/45 Days

EE-110 Introduction to Engineering & Laboratory Experience Saeid Rahimi, Ph.D. Labs Introduction to Arduino

Arbeitskreis Hardware. Prof. Dr. Michael Rohs, Dipl.-Inform. Sven Kratz MHCI Lab, LMU München

EE 308 Lab Spring 2009

Multipurpose Iron Man Glove & Moveable Platform

Class #6: Experiment The 555-Timer & Pulse Width Modulation

Low Power Microphone Acquisition and Processing for Always-on Applications Based on Microcontrollers

Unit 3 Digital Circuits (Logic)

1 Introduction. 2 Embedded Electronics Primer. 2.1 The Arduino

Lab 8. Stepper Motor Controller

University of North Carolina-Charlotte Department of Electrical and Computer Engineering ECGR 3157 Electrical Engineering Design II Fall 2013

PreLab 6 PWM Design for H-bridge Driver (due Oct 23)

Example KodeKLIX Circuits

Serial communication inverter. Lab bench scenario. Inverter Board, A/D, D/A, PWM, Filters, Encoders. Inverter board. and Dimmer introduction

EE 3101 ELECTRONICS I LABORATORY EXPERIMENT 9 LAB MANUAL APPLICATIONS OF IC BUILDING BLOCKS

Police Siren Circuit using NE555 Timer

UNIVERSITY OF VICTORIA FACULTY OF ENGINEERING. SENG 466 Software for Embedded and Mechatronic Systems. Project 1 Report. May 25, 2006.

Comparison between Analog and Digital Current To PWM Converter for Optical Readout Systems

Microcontroller Based MPPT Buck-Boost Converter

Advanced Soldier Monitoring and Tracking System Using GPS and GSM Introduction

Experiment #3: Micro-controlled Movement

Lab 6. Binary Counter

LM4: The timer unit of the MC9S12DP256B/C

Adafruit 16-Channel PWM/Servo HAT & Bonnet for Raspberry Pi

Electronics, Sensors, and Actuators

Transcription:

17.1 Power 17.2 EE 109 Unit 17 -Pulse Width Modulation Recall (or learn) that Power is a measure of: In an electronic circuit, P = Power = Current & Voltage (each may be w/ time) A circuit that draws a constant 2 ma of current at a constant would consume Since voltage and current may change rapidly, it is often helpful to calculate the average power Just sum the total power and divide by the total time 1 s 1 s I = 1A.5s.3s Average Power = 17.3 17.4 Output Devices What do the following have in common? Servo motor that can rotate to any angle w/in 180 degrees with various power levels hey are controlled by Pulse Width Modulation (PWM) Usually a 3-pin interface: Power (Vcc), GND, PWM Signal Duty Cycle A pulse is just a short window of time when a signal is 'on' We could repeat the pulse at some regular period, We define the duty cycle as Duty Cycle = % Duty Cycle % = /2 Duty Cycle = % /4

17.5 17.6 Power & Duty Cycle In-Class Activity When we light up an LED we often just turn a PORxxoutput 'on' and leave it 'on' his supplies the power possible to the LED We could the output at some duty cycle (say 50%) at a fast rate Fast so that the human eye can't Average power would be ½ the original always 'on' power Result would be a PORXX uc PORxx 'on' constantly Vs /2 i + V1 - R1 + VLED - PORxx 'on' 50% of time Write a program with a loop that turns on the LED (POR B5) for x milliseconds and then turns it off for 100-x milliseconds Initially set x = 100 Now set x = 50 Now set x = 20 Now set x = 10 Now set x = 2 Notice result may be non-linear A similar tactic is used in your when you want to cook something at etc. power. 17.7 17.8 PWM Simple Digital-o-Analog Modulation refers to a value based on some (i.e. changing one signal based on another) Pulse width modulation refers to modifying the width of a pulse based on another signal It can be used to one signal into another Example below of sine wave represented as pulses w/ different widths Or it can just be used to alter average power as in the last activity Connecting a PWM output to a resistor-capacitor circuit as shown causes the voltage at Vcto "integrate" the digital PWM signal (charge the capacitor) Analogy: Imagine you have a leaky bucket (i.e. capacitor) and you want to produce a variable level (i.e. ) of water by only turning the hose ( output) on or off V PWM V c

Servo Motors 17.9 Standard Servo Motor 17.10 Many embedded systems use servo motors to move or rotate mechanical devices Most servo motors use some form of pulse width modulation to control the direction and speed of their rotation 2 Kinds servo motors: can only rotate through a certain (usually 180 degrees) : can keep spinning round and round while pulses are provided Pulse width determines of servo motor Must continue to give pulses for the duration of time it takes to No pulses = Full left Centered Full right 20 ms 20 ms Pulse width = 750us 20 ms 20 ms Pulse width = 1500us 20 ms 20 ms Pulse width = 2250us Do an Internet search for Standard Servo Motors & try to find the appropriate pulse width for each position Continuous Servo Motors Pulse width determines of rotation Controlled via PWM (Pulse Width Modulation) Short pulse = Rotate one direction Medium pulse = Stop Long pulse = Rotate other direction 20 ms 20 ms 20 ms 17.11 Implementing PWM Can use delays or timers to make your own pulse signals Most microcontrollers have hardware to automatically generate PWM signals based on the contents of some control registers Many microcontrollers use the imers to also serve as PWM signals Recall the timer module gave us a counter that would increment until it hit some 'modulus' (MAX) count which would cause it to restart and also generate an interrupt 17.12 Pulse Width = us = Full Speed Clockwise Pulse Width = us = Stopped Pulse Width = us = Full Speed Counter- Clockwise

Using imers for PWM For PWM we can use that counter to just count 0 to some MAX count making the: PWM output = '1' while the count < threshold (OCRxx) and PWM output = '0' when the count >= modulus (OCRxx) MAX (255) OCRxA 0 time MAX (255) OCRxB 0 time 17.13 PWM Control Registers In this slide packet we will use the 8-bit imer/counter0 rather than the 16-bit imer/counter1 Refer to imer Slides w/ following additions Set WGM0[2:0] bits for Fast PWM mode as opposed to CC imer/counter0 can produce two PWM outputs on Arduino pins D5 and D6, each with its own threshold value, so you need to pick which one you want to use Bits A[1:0] and threshold register OCRA control operation of output D6 (PORD6) Bits B[1:0] and threshold register OCRB control operation of output D5 (PORD5) 17.14 PWM Output 1 PWM Output 2 See datasheet, textbook or other documentation for further explanation PWM Control Registers 17.15 Exercise 17.16 Set WGM bits for PWM mode [usually Fast PWM mode] as opposed to CC Pick?[1:0] for desired waveform Still need to pick a prescalerto slow down the clock Set OCRA or OCRB to the desired threshold which will effectively control the duty cycle of the PWM output A1 FOC 0A A0 CCR0A Reg. imer/counter0 Control Register FOC 0B B1 B0 - - WGM 02 - - WGM WGM 01 00 CS02 CS01 CCR0B Reg. imer/counter0 Control Register CS00 ry to use PWM to make your LED glow at various brightness levels similar to what you did earlier with normal digital I/O CS0 [2:0] Prescaler 010 Clk/ 8 011 Clk/ 64 100 Clk/ 256 101 Clk/ 1024?1,?0 Output Compare pin (assume WGM02=0) 00 Don't use Pin 01 Don't use Pin 10 SetPin on CR=0x00, Clear pin on match=ocr? 11 Clear Pin on CR=0x00, Set pin on match=ocr? WGM01, WGM00 WGM02=0 00 Normal (Counter) 01 Phase Correct PWM WGM02=1 (Ignore ) Unused Phase Correct PWM (op=ocra) 10 CC (imer) Unused 11 Fast PWM (op=255) Fast PWM (op=ocra)

17.17 A Few Big Ideas 1 17.18 Review of some key concepts from the first half of the semester and revisit what CECS prepares you to do in the future. A BRIEF SUMMARY bits in a register tells the hardware what do and when (this is SW interacting with HW) matters Your software is executing compared to how fast a human can do something You can use that to your advantage: blinking an LED at a fast rate can give the illusion it's always on but just more dim Or it can work to your disadvantage: One button press may look like because a loop may see one press on multiple iterations. We must write our software with this in mind A Few Big Ideas 2 Clocking or enables are necessary to say Digital signals are always 1's and 0's so just looking at the bits doesn't tell us how many we have We usually need (pulses) to tell the hardware when we want it to grab the data 17.19 Just looking at this set of digital values, are we sending 0101 once, twice, three times, how many? Once because we use the clock/enable to indicate that. But without the clock we'd have no clue how many times we are trying to write 0101 A Few Big Ideas 3 External events happen with your software (don't know "when" something has happened) Your software program is the brains for how to process information but it doesn't magically know "when" something has happened? We have to keep checking it (polling) or Hardware designers built "interrupt" mechanisms to help Many tasks can be done in ; SW may be easier to code/use but HW provides parallelism A 0.1 second timer can be done in SW using delays but then software can't do much else Or in HW using timers allowing SW to do other tasks 17.20

Remember Day 1 Computer engineering prepares you for a broad set of fields You could work in the SW industry You could work in the HW industry You will be most qualified for jobs that combine that knowledge We've been focused on the software/hardware interaction embodied in embedded systems 17.21 Cloud & Distributed Computing (CyberPhysical, Databases, Data Mining,etc.) Applications (AI, Robotics, Graphics, Mobile) Systems & Networking (Embedded Systems, Networks) You Can Do hat What we've been focusing on thus far Architecture (Processor & Embedded HW) Devices & Integrated Circuits (Semiconductors & Fabrication) HW SW Scripting & Interfaces C / C++ / Java Assembly / Machine Code Logic Gates ransistors Networked Applications Applications OS Processor / Memory / I/O 17.22 Libraries Functional Units (Registers, Adders, Muxes) http://www.cmu.edu/news/image-archive/boss.jpg http://prisonerofclass-5933.zippykid.netdna-cdn.com/wp-content/uploads/2013/05/iphone.jpg http://firstcallappliance.com/wp-content/uploads/image/microwave.jpg http://www.amazon.com/fisher-price--m-x-ickle-me-elmo/dp/b000ere0q http://oeatech.net/wp-content/uploads/2011/03/radarsa2-satellite.jpg Voltage / Currents Dive Into a SmartPhone 17.23 What's Inside Your SmartPhone 17.24 Here's a picture of what's inside the iphone M 6 Both sides of the circuit board are populated with chips 2-sided Circuit Board Battery https://d3nevzfk7ii3be.cloudfront.net/igi/6mazk5cee2tm1ucj.huge What's inside an iphone 6? Microcontrollers/microprocessors Apple A8 APL1011 SoC+ Elpida1 GB LPDDR3 RAM SoC= Not just a processor but a processor with custom hardware to do specialized tasks onboard graphics processor in this case NXP LPC18B1UK ARM Cortex-M3 Microcontrollers Similar on-board I/O modules as the. ake a look http://www.nxp.com/products/microcontrollers/cortex_m3/ Modem + Amplifiers + ransceivers for wireless communication Qualcomm MDM9625M LE Modem + many others http://www.techinsights.com/teardown.com/apple-iphone-6/ http://www.techinsights.com/teardown.com/apple-iphone-6/

What's Inside? 17.25 Computer Engineering & HW 17.26 A gyroscope, accelerometer, and touchscreen InvenSenseMP67B 6-axis gyroscope and accelerometer combo Broadcom BCM5976 ouchscreen Controller Both use some form of to sense motion or touch Memory Storage SK Hynix H2JDG8UD1BMS 128 Gb (16 GB) NAND Flash Other specialized HW I/O modules Murata 339S0228 Wi-Fi Module Qualcomm PM8019 power management IC Cirrus Logic 338S1201 audio codec http://www.techinsights.com/teardown.com/apple-iphone-6/ Computer engineering prepares you to work in jobs that design these kinds of systems by: Learning how to design digital circuits using logic gates [AND, OR, NO] (EE 154 and EE 254 Digital System Design) Learning how to optimize processors to execute software as efficiently as possible (EE 457 Computer Architecture) Learn how to assemble many HW pieces (processor cores, RAM, specialized HW) to form systems-on-chip (EE 454L SoCDesign) Learn some of the physics and science of fabricating these designs on silicon (EE 277L and EE 477L VLSI Design) Die Photo of the Apple A8 SoC Processor http://www.anandtech.com/show/8562/chipworks-a8