Laboration: Frequency measurements and PWM DC motor. Embedded Electronics IE1206

Similar documents
Laboration: AD-conversion and the Thevenin theorem.

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

About LC Meter This is one of the most accurate and simplest LC inductance / capacitance Meters that one can find, yet one that you can easily build y

2. Circuit diagram The overall functional diagram is:

Laboratory 11. Pulse-Width-Modulation Motor Speed Control with a PIC

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

IE1206 Embedded Electronics

νµθωερτψυιοπασδφγηϕκλζξχϖβνµθωερτ ψυιοπασδφγηϕκλζξχϖβνµθωερτψυιοπα σδφγηϕκλζξχϖβνµθωερτψυιοπασδφγηϕκ χϖβνµθωερτψυιοπασδφγηϕκλζξχϖβνµθ

Project: Electromagnetic Ring Launcher

Lab Exercise 9: Stepper and Servo Motors

Direct Current Waveforms

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

PIC ADC to PWM and Mosfet Low-Side Driver

EXPERIMENT #2 CARRIER OSCILLATOR

When you have completed this exercise, you will be able to relate the gain and bandwidth of an op amp

Introduction to Using the PIC16F877 Justin Rice IMDL Spring 2002

DE1.3 Electronics 1. Tips on Team Projects

RC Filters and Basic Timer Functionality

Lab Exercise 6: Digital/Analog conversion

Laboratory Exercise 1 Microcontroller Board with Driver Board

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

QUICK START GUIDE FOR DEMONSTRATION CIRCUIT BIT, 250KSPS ADC

EE283 Electrical Measurement Laboratory Laboratory Exercise #7: Digital Counter

ANALOG TO DIGITAL CONVERTER

MFJ-249B HF/VHF SWR ANALYZER

Experiment 5: Basic Digital Logic Circuits

I hope you have completed Part 2 of the Experiment and is ready for Part 3.

Custom Integrated Circuit (MSM9520RS) Replacement Module

ELEC3106 Electronics. Lab 3: PCB EMI measurements. Objective. Components. Set-up

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

DEMO CIRCUIT 1004 ADC DRIVER AND 7X7MM HIGH-PERFORMANCE ADC QUICK START GUIDE ADC Driver and 7x7mm High-Performance ADC DESCRIPTION

Multi-Stage Power Conversion Proposal

Introduction. Inductors in AC Circuits.

ESE 350 Microcontroller Laboratory Lab 5: Sensor-Actuator Lab

IMPLEMENTATION OF QALU BASED SPWM CONTROLLER THROUGH FPGA. This Chapter presents an implementation of area efficient SPWM

Power Pulse Modulator A High Performance Versatile Square Pulse Generator

Electronics Design Laboratory Lecture #10. ECEN 2270 Electronics Design Laboratory

Homebrew and Experimenters Group HF Inductance Bridge (Compiled by VK2TOX)

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

Homework Assignment 03

DATA SHEET. HEF4541B MSI Programmable timer. For a complete data sheet, please also download: INTEGRATED CIRCUITS

Dedan Kimathi University of technology. Department of Electrical and Electronic Engineering. EEE2406: Instrumentation. Lab 2

Frequency Synthesizer Project ECE145B Winter 2011

STUDENT NUMBER Letter VCE VET ELECTRONICS. Written examination. Monday 31 October 2005

CHAPTER 6 PHASE LOCKED LOOP ARCHITECTURE FOR ADC

Assembly Manual for VFO Board 2 August 2018

QUASAR PROJECT KIT # /24 HOUR GIANT CLOCK

CV Arpeggiator Rev 1. Last updated

Sensors and Sensing Motors, Encoders and Motor Control

Filters And Waveform Shaping

t w = Continue to the next page, where you will draw a diagram of your design.

Sensors and Sensing Motors, Encoders and Motor Control

Designing with a Microcontroller (v6)

JUMA-TRX2 DDS / Control Board description OH2NLT

ENGINEERING TRIPOS PART II A ELECTRICAL AND INFORMATION ENGINEERING TEACHING LABORATORY EXPERIMENT 3B2-B DIGITAL INTEGRATED CIRCUITS

EE2304 Implementation of a Stepper Motor using CMOS Devices Fall 2004 WEEK -2-

Hydra: A Three Stage Power Converter

Voltage Dividers a learn.sparkfun.com tutorial

Part (A) Using the Potentiometer and the ADC* Part (B) LEDs and Stepper Motors with Interrupts* Part (D) Breadboard PIC Running a Stepper Motor

Once the DS1821 comes up as a thermostat it will not return to 1-wire mode until it receives a special signal sequence, as follows:

AERO2705 Space Engineering 1 Week 7 The University of Sydney

High Voltage Waveform Sensor

DEMO CIRCUIT 1057 LT6411 AND LTC2249 ADC QUICK START GUIDE LT6411 High-Speed ADC Driver Combo Board DESCRIPTION QUICK START PROCEDURE

Lab Experiments. Boost converter (Experiment 2) Control circuit (Experiment 1) Power diode. + V g. C Power MOSFET. Load.

Experiment 5.A. Basic Wireless Control. ECEN 2270 Electronics Design Laboratory 1

University of Jordan School of Engineering Electrical Engineering Department. EE 219 Electrical Circuits Lab

ELECTROMAGNETIC INDUCTION AND ALTERNATING CURRENT (Assignment)

6. HARDWARE PROTOTYPE AND EXPERIMENTAL RESULTS

Module -18 Flip flops

PAK-Vb/c PWM Coprocessor Data Sheet by AWC

Fig.1. A basic inductance and capacitance. (CR) oscillator.

+15 V 10k. !15 V Op amp as a simple comparator.

o What happens if S1 and S2 or S3 and S4 are closed simultaneously? o Perform Motor Control, H-Bridges LAB 2 H-Bridges with SPST Switches

PAK-VIIIa Pulse Coprocessor Data Sheet by AWC

are equally illuminated, the lamp I 1

Laboratory 2 More Resistor Networks and Potentiometers.

BEST BMET CBET STUDY GUIDE MODULE ONE

Low Cost Motor Control Family

Polyphase network kit

The G4EGQ RAE Course Lesson 4A AC theory

AN-1164 Cycle Stealing Control

Quantizer step: volts Input Voltage [V]

Embedded Systems and Software

STATION NUMBER: LAB SECTION: RC Oscillators. LAB 5: RC Oscillators ELECTRICAL ENGINEERING 43/100. University Of California, Berkeley


Design of Low Cost Embedded Power Plant Relay Testing Unit

Laboratory Assignment Number 3 for Mech 143. Pre-Lab: Part 1 Interfacing to a DC Motor and Potentiometer

Power Pulse Modulator A High Performance Versatile Square Pulse Generator

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

IE1206 Embedded Electronics

Training Schedule. Robotic System Design using Arduino Platform

4/30/2012. General Class Element 3 Course Presentation. Practical Circuits. Practical Circuits. Subelement G7. 2 Exam Questions, 2 Groups

UNIVERSITY OF NORTH CAROLINA AT CHARLOTTE Department of Electrical and Computer Engineering

EE 314 Spring 2003 Microprocessor Systems

Lab 2.2 Custom slave programmable interface

EE12: Laboratory Project (Part-2) AM Transmitter

1. Each group will get one aluminum BUD chassis (also called BUD box ).

Mechatronics Laboratory Assignment 3 Introduction to I/O with the F28335 Motor Control Processor

Exercise 1: RF Stage, Mixer, and IF Filter

List of Items Available in the Laboratory the Lab

Transcription:

Laboration: Frequency measurements and PWM DC motor. Embedded Electronics IE1206 Attention! To access the laboratory experiment you must have: booked a lab time in the reservation system (Daisy). completed your personal knowledge control on the Web (Web-quiz). done all preparation tasks mentioned in the lab booklet. During the lab you work in groups of two, but both students are responsible individually for their preparation and implementation. Booth students should bring their lab booklets. This frontpage is used as your receipt that the lab is completed. Save the receipt until you have received the full course registered in the database (Ladok). 1

Introduction Measuring digital pulses, number, period, frequency, pulse width, etc. is one of the most common tasks of an embedded system. Many sensors has output value in form of digital pulses - You've already met resistive sensors included in an RC oscillator having variable frequency as output. Frequency is a quantity that can be measured very accurately, but different frequency ranges high/low demands different measuring methods. PIC proccessorerna has a self-running CCP device that can be used to offload processor the work of following the signals during the measurement. At the lab, you will measure the period time and frequency. You will try an LC oscillator, and use it as a non-contact proximity sensor for different metals. PIC processor CCP device may alternatively be used to generate PWM signals. A common use is then controlling a motor. Enhenced CCP, ECCP, as with PIC16F690 is meant to "directly" be able to drive a DC motor with variable speed and direction. The goal of the lab Show some different methods for frequency measurement. Orienting yourself about IO devices for the measurement of digital pulses. Show how these can be used with sensors. Orient yourself on oscillators and phase-shifting network. Orienting yourself about IO devices for motor control. Show how to control a DC motor speed and direction. Attention! Your lab time may be prior all course elements that may be needed for the lab has been lectured. You would then have to read the course material for yourself in advance - there are links to all slides for the lectures and exercises. 2

Frequency Measurement and period time measurement Read Microchip PIC16F690-manual about how the ECCP-unit is to be configured for capture mode. frequency.c Preparation task 1 (done before the lab) 74HC4040.pdf An easy way to obtain test frequencies to measure, is to use a 12-step frequency divider chip (type 4040, at the price of 10 SEK). PIC processor can be configured so that the internal system clock fosc/4, 1 MHz, is available at one of the pins. All in all, you get twelve different frequencies to measure! 3

Assume that the frequency dividing chip is clocked by 1MHz. Calculate, and write down the values of the twelve measurement frequencies in Table 1. Table 1 measurement frequencies Laboratory task 1 Connect pin 3 CLKOUT to the frequency divider input CLK. Now there are twelve frequencies from 244 Hz to 500 khz available for measurement with f_in (CCP1 pin 5). Now measure the 12 frequencies with the program frequency.c and read the values with the UART Tool. Fill in the frequency and period in Table 1. 4

To get an accurate periodic time you need to collect many TIMER1-tick over the period of the unknown measurement frequency, but less than 16-bit maximum value of 65535 because in the program we does not take into account if TIMER1 "turn around". (This would occur at about 15 Hz, but we have no access to such low frequencies). An accurate frequency value then builds on that the integer division will provide a sufficient number of digits. Any decimals are "thrown away" by the program. Higher frequencies than 65535 Hz could not be held in 16-bit variable f so for these the readings become "wrong". Mark in the column labeled? which of the measurements that give good, and which of them that results in poor accuracy. Then discuss with lab assistant. Most readings will be "incredible" good, hove does that come? How would the readings change if the PIC processor's internal oscillator was even better tuned? (the internal clock can be trimmed)? Preparation task 2 (done before the lab) Problems with high frequencies The high frequencies easily get error because TIMER1 only counts a few clock pulses. The solution is to instead configure the CCP unit to count clock pulses between every 16th rising edge of the measuring signal. It then will present the measured value "multiplied" by 16. If the frequency then is tto be indicated by prefix khz one must also divide by 1000. This should be done by changing the constant in the program (calculation done at compilation time), it is unnecessary to introduce more arithmetic operations for the PIC processor (calculations done at run-time)! khz-scale. Save program frequency.c as frequency_high.c and change CCP1 mode from each edge to each 16:th edge. Change the division constant "1000000" to a value that suits this new khz-measurement. The program printout should look like ( if the measurement signal is 500 khz ): Frequency f is [khz] 00500 Period T(*16) is [us] 00032 Laboratory task 2 Problems with high frequencies The high frequencies may get errors because TIMER1 counts to few clock pulses. Compile and run your khz programs from preparatory task 1. Measure and fill in values in Table 2. 5

Table 2 High test frequencies [khz] Now it went good to measure and print out the high frequencies? Preparation task 3 (done before the lab) cd4069ub.pdf From Digital Design course you may remember the ring oscillator? An odd number of inverters connected in a ring, form an unstable asynchronous sequential circuit, which starts to oscillate at high frequency. This connection can be used to "measure" a inverter gate delay - with simple means. Derive, and write down, an expression of how the gate delay can be calculated from Ring oscillator period time. t PD = Can you find any notification on gate delay in the circuit 4069's data sheets? Labuppgift 3 Lab inverter circuit 4069 was constructed in the 1980s, and thus slow compared to today's fast circuits. Connect 5 of the inverters to a ring oscillator as shown. The inverters are already connected to the breadboard as a group of two in series and another group of three. 6

Disconnect the lead CLKOUT from the PIC processor, instead connect the ring oscillator output Out to the frequency divider chip input CLK. You should now measure the ring oscillator period time with your program frequency_high.c. Select the appropriate output from the frequency divider to f_in so that the measurement is accurate. Then calculate the gate delay for a 4069-inverter gate. Use the formula from preparation task 3, taking into account how much you divided down the measurement frequency. t PD [ns] = Your inverter is mounted on a breadboard, where the access points have higher capacitance than is the case on a circuit board. The data is sheet is very "old" - perhaps the circuit he have been improved over the years? Preparation task 4 (done before the lab) LC-oscillator. The sixth inverter, the one that was not used in the ring oscillator, we use as a LC oscillator. A CMOS inverter with a resistor between it's output and input, is "trapped" in between "1" and "0" (2.5V) and becomes an "analogue" amplifier instead of a digital circuit. The inverting can now be seen as that the amplifier will phase shift 180 ("-" sign). In addition to the inverter/amplifier, we have an ac network with a resonant circuit. This circuit will phase shift further 180 - a total of 360 which is the same thing as "no phase shift at all." For a frequency close to the resonance frequency, that all this is true, it becomes an amplified "feedback" that starts the oscillator! Calculate the resonant frequency formula here in the lab booklet. L = 100 µh, C = 470 pf. f 0 [MHz] = 7

Laboratory task 4 Remove the wires you connected the ring oscillator with. Connect instead the frequency divider CLK with LC oscillator LCosc. Measure LC oscillator frequency with your program frequency_high.c. Try out a suitable connection of f_in so that the measurement will be accurate. Compare with the calculated resonant frequency from preparation task 4. (About errors: Coil has 5% tolerance, capacitors 20% tolerance, the PIC processor's built-in oscillator is factory trimmed to 1% tolerance.) f 0 [MHz] = Preparation task 5 (done before the lab) For a parallel resonance circuit comes that the resonant frequency changes with both the coil inductance L, and the losses in the coil and in the magnetic field, that we symbolizes with the "resistance" r. Metal objects near the coil will affect the resonance frequency in several different ways. Prepare an addition/alteration to your program frequency_high.c Turn the red LED (RC0) if the period time is reduced a few percent, and lighting the green LED (RC1) if the period time increases a few percent. Otherwise, both LEDs should be off. Appropriate program name is metalsensor.c. NOTE! here there is a risk that one runs into PIC processor's RMW problem! 8

Laboratory task 5 Non-contact metal detector. The lab equipment includes a ferrite rod (magnetically influenced) and another common brass rod (which is magnetically uninfluenced). Both rods are influenced by eddy currents. Now select the connection of f_in so that you get a good measure of the time period with many digits. Write down the measured value. Modify the program frequency.c with LED lights to indicate increased and decreased cycle time, as in preparation 5. Show lab assistant that your metal detector can distinguish between iron and other metals! Commercial metal sensors that are sensitive over greater distances have coils that spreads the magnetic field in the probing direction - see principle figure! 9

PWM control of a DC motor Read Microchip PWM. speed.c PIC16F690-manual about how ECCP-unit can be configured for As soon as an embedded system need to affect ambient mechanics, it needs a motor. During the lab you are going to study how the PWM controller used to control a DC motor. Preparation task 6 (done before the lab) Study program speed.c. It takes an 8-bit value with the AD converter from the potentiometer, and transfer it to the PWM unit 8 bit Duty Cycle. With the potentiometer one can thus directly control the DC motor speed.. Your task is to modify the this program to control the motor speed and direction. The program is prepared for the changes. Figure out in advance how to do this. Laboratory task 6 Remove line f_in from the PIC processor. Connect the potentiometer center tap SpeedControl to ADC channel AN9. Connect P1D to PWM- and P1B to PWM+. Compile and download the program speed.c. It runs the motor in one direction at a speed that increases with clockwise rotation of the potentiometer. Your task now is to modify the program speed.c so that it controls the engine speed in the two directions of rotation, standing still in the middle position, and 10

with the maximum possible speed in the two end positions. Engine speed must not be "jerking" in any mode. Appropriate program name is dir_speed.c. Show for the lab assistant. The supply voltage to the motor from the USB connector are limited to 5V. LEGO engine is a 9V motor. The motor drive circuit (7667) can work with a separate voltage up to 15V. Maybe the lab assistant have a stronger, 9V, battery to plug in? - in that case we double the engine's speed range. (The assistant will first remove the jumper to 5V, and then connect a 9V battery) ATTENTION! 5V jumper must be removed when connecting external voltage to the motor drive circuit! Do you have time to spare? If you are well prepared for the lab, then you probably now have time for a "voluntary" task. CMOS inverter, ring-oscillator, LC-circuit, LC-oscillator, can be simulated with LT-spice. Simulate with LT-Spice Ready drawn schematic cmos_inv.asc cmos_model.txt Simulate the circuit. Ready drawn schematic inverter_ring.asc Simulate the circuit. Ready drawn schematic LC_resonance.asc Simulate the circuit. Ready drawn schematic LC_osc.asc Simulate the circuit. Good Luck! When you are finished. Restore the equipment before the next lab group. See the picture under "Frequency Measurement and periodic time". Clean lab location. 11

Bill of material Om If you ever need to build a similar experiment equipment, you can see here what components we used. Breadboard GL-23F ELFA 48-427-95 Microcontroller 8 Bit DIL-20, PIC16F690-I/P ELFA 73-793-58 Hex Inverter DIL-14, CD4069UBE ELFA 73-474-53 12-Bit Binary Count DIL-16, 74HCT4040N ELFA 73-550-84 Trimpot cermet 10 k Lin 500 mw, 72PTR10KLF ELFA 64-634-75 Resistor 1 st 10k. Resistors 1 st 8.2k, 1 st 4.8 M. Capacitors 2 st ceramic 470 p Inductance 1 st 100 uh 170 ma B82141-A1104-J ELFA 58-654-36 Resistors 2 st 500 k. 1 st Led with integrated resistor 5V red ELFA 75-012-59 1 st Led with integrated resistor 5V green ELFA 75-014-99 Jumpers: 13 orange, 9 yellow, 11 green, 1 red, 1 brown. 5 st metal. William Sandqvist william@kth.se 12