Brushed DC Motor Microcontroller PWM Speed Control with Optical Encoder and H-Bridge

Similar documents
Brushed DC Motor PWM Speed Control with the NI myrio, Optical Encoder, and H-Bridge

Brushed DC Motor System

2.017 DESIGN OF ELECTROMECHANICAL ROBOTIC SYSTEMS Fall 2009 Lab 4: Motor Control. October 5, 2009 Dr. Harrison H. Chin

L E C T U R E R, E L E C T R I C A L A N D M I C R O E L E C T R O N I C E N G I N E E R I N G

UNIT 2: DC MOTOR POSITION CONTROL

User Guide IRMCS3041 System Overview/Guide. Aengus Murray. Table of Contents. Introduction

Administrative Notes. DC Motors; Torque and Gearing; Encoders; Motor Control. Today. Early DC Motors. Friday 1pm: Communications lecture

Stepper Motor Drive Circuit

Magnetic Levitation System

INTEGRATED CIRCUITS. AN1221 Switched-mode drives for DC motors. Author: Lester J. Hadley, Jr.

Tarocco Closed Loop Motor Controller

MEM01: DC-Motor Servomechanism

Ocean Controls KT-5198 Dual Bidirectional DC Motor Speed Controller

Actuators. EECS461, Lecture 5, updated September 16,

User Guide Introduction. IRMCS3043 System Overview/Guide. International Rectifier s imotion Team. Table of Contents

Where: (J LM ) is the load inertia referred to the motor shaft. 8.0 CONSIDERATIONS FOR THE CONTROL OF DC MICROMOTORS. 8.

DC SERVO MOTOR CONTROL SYSTEM

Understanding RC Servos and DC Motors

DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING BANGLADESH UNIVERSITY OF ENGINEERING & TECHNOLOGY EEE 402 : CONTROL SYSTEMS SESSIONAL

DUAL STEPPER MOTOR DRIVER

Step vs. Servo Selecting the Best

Sensors and Sensing Motors, Encoders and Motor Control

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

Sensors and Sensing Motors, Encoders and Motor Control

Robot Actuators. Motors and Control. Stepper Motor Basics. Increased Resolution. Stepper motors. DC motors AC motors. Physics review: Nature is lazy.

PART 2 - ACTUATORS. 6.0 Stepper Motors. 6.1 Principle of Operation

The motors are described by the following numbering system: D 500 ppr encoder 1 E 1,000 ppr encoder 1 H Hall-effect only R resolver

DC motor control using arduino

BLuAC5 Brushless Universal Servo Amplifier

CHAPTER 4 CONTROL ALGORITHM FOR PROPOSED H-BRIDGE MULTILEVEL INVERTER

CHAPTER-5 DESIGN OF DIRECT TORQUE CONTROLLED INDUCTION MOTOR DRIVE

CHAPTER 2 PID CONTROLLER BASED CLOSED LOOP CONTROL OF DC DRIVE

Effective Teaching Learning Process for PID Controller Based on Experimental Setup with LabVIEW

A COMPARISON STUDY OF THE COMMUTATION METHODS FOR THE THREE-PHASE PERMANENT MAGNET BRUSHLESS DC MOTOR

Detect stepper motor stall with back EMF technique (Part 1)

LSI/CSI LS8292 LS8293. PRELIMINARY MICRO-STEPPING MOTOR CONTROLLER June 2013

Control Design for Servomechanisms July 2005, Glasgow Detailed Training Course Agenda

SilverMax Datasheet. QuickSilver Controls, Inc. NEMA 23 Servomotors.

ME375 Lab Project. Bradley Boane & Jeremy Bourque April 25, 2018

Speed Control of Three Phase Induction Motor Using Fuzzy-PID Controller

CHAPTER-III MODELING AND IMPLEMENTATION OF PMBLDC MOTOR DRIVE

BLuAC5 Brushless Universal Servo Amplifier

Jaguar Motor Controller (Stellaris Brushed DC Motor Control Module with CAN)

NJM3777 DUAL STEPPER MOTOR DRIVER NJM3777E3(SOP24)

Open Loop Frequency Response

International Journal of Science, Engineering and Management (IJSEM) Vol 3, Issue 12, December 2018 Self-Tuned PID Based Speed Control of BLDC Motor

CHAPTER 3 WAVELET TRANSFORM BASED CONTROLLER FOR INDUCTION MOTOR DRIVES

Volume 1, Number 1, 2015 Pages Jordan Journal of Electrical Engineering ISSN (Print): , ISSN (Online):

dspace DS1103 Control Workstation Tutorial and DC Motor Speed Control Project Report

V&T Technologies Co., Ltd. Vectorque TM V6-H-M1 SERIES INVERTER ADDITIVE MANUAL (M1) V6-H Series ADDITIVE MANUAL V& T

Using CME 2 with AccelNet

Single-phase or three phase AC220V (-15% ~ +10%) 50 ~ 60Hz

815-BR SERVO AMPLIFIER FOR BRUSH SERVOMOTORS

Logosol AC/DC Intelligent Servo Drive for Coordinated Control LS-174WP

Comparative Study of PID and Fuzzy Controllers for Speed Control of DC Motor

CHAPTER 4 FUZZY BASED DYNAMIC PWM CONTROL

MDM5253 DC Motor Driver Module with Position and Current Feedback User Manual

POLOLU DUAL MC33926 MOTOR DRIVER FOR RASPBERRY PI (ASSEMBLED) USER S GUIDE

ELG2336 Introduction to Electric Machines

POLOLU MAX14870 SINGLE BRUSHED DC MOTOR DRIVER CARRIER USER S GUIDE

Implementation of Brushless DC motor speed control on STM32F407 Cortex M4

10 AMP, 75V, 3 PHASE MOSFET BRUSHLESS MOTOR CONTROLLER

Penn State Erie, The Behrend College School of Engineering

CHAPTER 2 CURRENT SOURCE INVERTER FOR IM CONTROL

PHASE BRUSHLESS DC MOTOR CONTROLLER/DRIVER FEATURES

Pololu Dual G2 High-Power Motor Driver for Raspberry Pi

Type of loads Active load torque: - Passive load torque :-

Project Proposal. Low-Cost Motor Speed Controller for Bradley ECE Department Robots L.C.M.S.C. By Ben Lorentzen

Analog Devices: High Efficiency, Low Cost, Sensorless Motor Control.

Designated client product

Glossary. Glossary Engineering Reference. 35

3Specifications CHAPTER THREE IN THIS CHAPTER

Simulation Study of MOSFET Based Drive Circuit Design of Sensorless BLDC Motor for Space Vehicle

Lab 5: Inverted Pendulum PID Control

RX23T inverter ref. kit

ECE 5670/6670 Project. Brushless DC Motor Control with 6-Step Commutation. Objectives

Nicolò Antonante Kristian Bergaplass Mumba Collins

SV2Dx Servo Drives SV200 Servo Drives for DC-Powered Applications

Analog Servo Drive 25A20DD

Parallel Configuration of H-Bridges

Logosol Intelligent Hall-Servo Drive LS-173U Doc # / Rev. C, 02/12/2008

BLOCK DIAGRAM OF THE UC3625

CL86T. 24~80VDC, 8.2A Peak, Closed-loop, No Tuning. Descriptions. Closed-loop. Stepper. Applications. Datasheet of the Closed-loop Stepper CL86T

Page ENSC387 - Introduction to Electro-Mechanical Sensors and Actuators: Simon Fraser University Engineering Science

Observer-based Engine Cooling Control System (OBCOOL) Project Proposal. Students: Andrew Fouts & Kurtis Liggett. Advisor: Dr.

CHAPTER 3 EQUIVALENT CIRCUIT AND TWO AXIS MODEL OF DOUBLE WINDING INDUCTION MOTOR

Experiment#6: Speaker Control

Pololu Jrk USB Motor Controller

ECE 5670/ Lab 6. Parameter Estimation of a Brushless DC Motor. Objectives

CHAPTER 3 H BRIDGE BASED DVR SYSTEM

International Journal of Advance Engineering and Research Development. PI Controller for Switched Reluctance Motor

MICROCONTROLLERS Stepper motor control with Sequential Logic Circuits

Design and Implementation of PID Controller for a two Quadrant Chopper Fed DC Motor Drive

combine regular DC-motors with a gear-box and an encoder/potentiometer to form a position control loop can only assume a limited range of angular

Lab 1: Steady State Error and Step Response MAE 433, Spring 2012

EE152 Final Project Report

Half stepping techniques

Figure 1: Motor model

Fundamentals of Microelectronics

A Practical Primer On Motor Drives (Part 13): Motor Drive Control Architectures And Algorithms

Transcription:

Brushed DC Motor Microcontroller PWM Speed Control with Optical Encoder and H-Bridge L298 Full H-Bridge HEF4071B OR Gate Brushed DC Motor with Optical Encoder & Load Inertia Flyback Diodes Arduino Microcontroller for Encoder Decoding & Velocity Output Arduino Microcontroller for Speed Control Implementation Brushed DC Motor / Encoder System A. da Silva & K. Craig 1

Brushed DC Motor / Encoder System A. da Silva & K. Craig 2

Brushed DC Motor / Encoder System A. da Silva & K. Craig 3

Brushed DC Motor / Encoder System A. da Silva & K. Craig 4

Pittman DC Servo Motor 8322S001 Brushed DC Motor / Encoder System A. da Silva & K. Craig 5

Pittman DC Servo Motor 8322S001 Encoder 500 counts/rev Wire Function Color Pins 1 GND Black GND 2 Index Green - 3 CH A Yellow 4 Vcc Red 5V 5 CH B Blue Brushed DC Motor / Encoder System A. da Silva & K. Craig 6

L298 Dual Full Bridge Driver Brushed DC Motor / Encoder System A. da Silva & K. Craig 7

Brushed DC Motor / Encoder System A. da Silva & K. Craig 8

Topics Brushed DC Motor Physical & Mathematical Models, Hardware Parameters H-Bridge Operation Feedback Control Design MatLab / Simulink Design and Auto-Code Generation Brushed DC Motor / Encoder System A. da Silva & K. Craig 9

Brushed DC Motor Pittman DC Servo Motor Schematic Brushed DC Motor Brushed DC Motor / Encoder System A. da Silva & K. Craig 10

For a permanent-magnet DC motor i f = constant. Physical Modeling Brushed DC Motor / Encoder System A. da Silva & K. Craig 11

Physical Modeling Assumptions The copper armature windings in the motor are treated as a resistance and inductance in series. The distributed inductance and resistance is lumped into two characteristic quantities, L and R. The commutation of the motor is neglected. The system is treated as a single electrical network which is continuously energized. The compliance of the shaft connecting the load to the motor is negligible. The shaft is treated as a rigid member. The total inertia J is a single lumped inertia, equal to the sum of the inertias of the rotor and the driven load. Brushed DC Motor / Encoder System A. da Silva & K. Craig 12

There exists motion only about the axis of rotation of the motor, i.e., a one-degree-of-freedom system. The parameters of the system are constant, i.e., they do not change over time. The damping in the mechanical system is modeled as viscous damping B, i.e., all stiction and dry friction are initially neglected. The optical encoder output is decoded in software. Position and velocity are calculated and made available as analog signals for control calculations. The motor is driven with a PWM control signal to a H- Bridge. The time delay associated with this, as well as computation for control, is lumped into a single system time delay. Brushed DC Motor / Encoder System A. da Silva & K. Craig 13

Mathematical Modeling Steps Define System, System Boundary, System Inputs and Outputs Define Through and Across Variables Write Physical Relations for Each Element Write System Relations of Equilibrium and/or Compatibility Combine System Relations and Physical Relations to Generate the Mathematical Model for the System Brushed DC Motor / Encoder System A. da Silva & K. Craig 14

Physical Relations Tm K ti m Vb Kb P T K i P V i K i Pout Kt P K Pout Pin K K K out m t m in b m b m t b m dil VL L VR Ri R TB B dt T J J J J J J motor load t in t Brushed DC Motor / Encoder System A. da Silva & K. Craig 15 b K (oz in / A) 1.3524K (V / krpm) b 3 9.5493 10 K b(v / krpm) K t(nm / A) K(Nm/A) K(V s/rad) b

System Relations + Equations of Motion KVL Vin VR VL Vb 0 Tm TB TJ 0 ir il im i di d Vin Ri L Kb 0 J B K ti 0 dt dt d B K t dt J J 0 1 V di K b R i L dt L L Newton s Law Brushed DC Motor / Encoder System A. da Silva & K. Craig 16 in

Steady-State Conditions di Vin Ri L Kb 0 dt T Vin R Kb 0 K t Kt KtKb T Vin R R K t Ts V Stall Torque in R Vin 0 No-Load Speed K b Brushed DC Motor / Encoder System A. da Silva & K. Craig 17

Transfer Functions di d Vin Ri L Kb 0 J B K ti 0 dt dt V s (Ls R)I(s) K (s) 0 Js B (s) K I(s) 0 in b t (s) Kt Kt V (s) Js B Ls R KK JLs BL JR s BR KK 2 in t b t b s K t JL B R BR KK s J L JL JL 2 t b Brushed DC Motor / Encoder System A. da Silva & K. Craig 18

Block Diagram Vin 1 Ls R i K t T m 1 Js B K b Brushed DC Motor / Encoder System A. da Silva & K. Craig 19

Simplification J L m >> e B R d Vin Ri Kb 0 J B K ti 0 dt d 1 K t J B Kti Kt Vin Kb Vin Kb dt R R d 1 dt d KK t b B Kt V dt RJ J RJ d 1 1 dt motor m K t V in since m motor motor RJ Brushed DC Motor / Encoder System A. da Silva & K. Craig 20 K t RJ V in in

Brushed DC Motor / Encoder System A. da Silva & K. Craig 21

Brushed DC Motor / Encoder System A. da Silva & K. Craig 22

Brushed DC Motor / Encoder System A. da Silva & K. Craig 23

Brushed DC Motor / Encoder System A. da Silva & K. Craig 24

Brushed DC Motor / Encoder System A. da Silva & K. Craig 25

Brushed DC Motor / Encoder System A. da Silva & K. Craig 26

Brushed DC Motor / Encoder System A. da Silva & K. Craig 27

Brushed DC Motor / Encoder System A. da Silva & K. Craig 28

MatLab M-File Brushed DC Motor / Encoder System A. da Silva & K. Craig 29

H-Bridge Operation For DC electric motors, a power device configuration called H-Bridge is used to control the direction and magnitude of the voltage applied to the load. The H- Bridge consists of four electronic power components arranged in an H-shape in which two or none of the power devices are turned on simultaneously. A typical technique to control the power components is via PWM (Pulse Width Modulation) signal. A PWM signal has a constant frequency called carrier frequency. Although the frequency of a PWM signal is constant, the width of the pulses (the duty cycle) varies to obtain the desired voltage to be applied to the load. Brushed DC Motor / Encoder System A. da Silva & K. Craig 30

The H-Bridge can be in one of the four states: coasting, moving forward, moving backward, or braking, as shown on the next slide. In the coasting mode, all four devices are turned off and since no energy is applied to the motor, it will coast. In the forward direction, two power components are turned on, one connected to the power supply and one connected to ground. In reverse direction, only the opposite power components are turned on supplying voltage in the opposite direction and allowing the motor to reverse direction. In braking, only the two devices connected to ground are tuned on. This allows the energy of the motor to quickly dissipate, which will take the motor to a stop. Brushed DC Motor / Encoder System A. da Silva & K. Craig 31

Brushed DC Motor / Encoder System A. da Silva & K. Craig 32

The four diodes shown in anti-parallel to the transistors are for back-emf current decay when all transistors are turned off. These diodes protect the transistors from the voltage spike on the motor leads due the back-emf when all four transistors are turned off. This could could yield excessive voltage on the transistor terminals and potentially damage them. They must be sized to a current higher than the motor current and for the lowest forward voltage to reduce junction temperature and the time to dissipate the motor energy. Brushed DC Motor / Encoder System A. da Silva & K. Craig 33

Diodes for back-emf protection are shown. The solid line is the current flow when the transistors on the upper left corner and on the right lower corner are turned on. The dashed line shows the motor current when all transistors are turned off. Brushed DC Motor / Encoder System A. da Silva & K. Craig 34

The approach shown next to generate the PWM command for an H-Bridge was developed for the Dual Full Bridge Driver L298 from STMicroelectronics Each bridge contains two inputs (IN1 and IN2 for the bridge A and IN3 and IN4 for bridge B) and an enable for each bridge (ENA for one bridge and ENB for the other bridge). The operation of this bridge is shown in the table below for bridge A. The operation for bridge B is identical. Enable Inputs Function EN = 1 IN1 = 1, IN2 = 0 Forward Move IN1 = 0, IN2 = 1 IN1 = IN2 Reverse Move Motor Fast Stop EN = 0 IN1 = X, IN2 = X Motor Coast 1 = High, 0 = Low, X = Don t care Brushed DC Motor / Encoder System A. da Silva & K. Craig 35

Block diagram of L298 (Dual Full Bridge Driver) Brushed DC Motor / Encoder System A. da Silva & K. Craig 36

This approach to generate the PWM command for the L298 consists of three steps: Split the analog torque command to the motor into two PWM signals (one for each input of one of the bridges of the L298) Logics to control inputs and enable the L298 Motor connection and protection of the bridge Brushed DC Motor / Encoder System A. da Silva & K. Craig 37

Step A The torque command from the control system can be split into two PWM signals for an Arduino board as shown below. Torque Command > 0.1 255/8 Pin 3 Control System DeadBand Product Analog to 8 bits PWM FWD Direction < -0.1-255/8 Pin 6 DeadBand Product Analog to 8 bits PWM REV Direction Dead Zone Control Splitting Command to H-Bridge A dead-band control is used to avoid short circuits on the bridge with inductive loads while switching direction, as the transistor that is commanded to turn off stays conducting for a short period of time due the motor back- EMF when the other transistor on the same branch may be commanded to turn on for the switching in direction. Brushed DC Motor / Encoder System A. da Silva & K. Craig 38

Thus, if the torque command is within the dead-band, all four transistors are turned off. If the torque command is positive and higher than the dead-band threshold, a signal is applied to the PWM FWD Direction output as shown. Similarly, if the torque command is negative and lower than the dead-band threshold, signal is applied to the PWM REV Direction output. The gains 255/8 converts the torque command of a maximum of 8 Nm in this example into a digital signal of 8 bits (2 8 = 256) which is the resolution of an analog output on Arduino boards. The analog output on the Arduino is actually a PWM signal of approximately 490 Hz. Thus, there is no need for generating PWM signal from the analog torque command using Arduino because the analog output is PWM. Brushed DC Motor / Encoder System A. da Silva & K. Craig 39

If the torque command is a symmetric sinusoid with amplitude of 8 Nm, the outputs PWM FWD Direction and PWM REV Direction would be as shown below. Torque Command 10 0-10 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 PWM FWD Direction PWM REV Direction 6 4 2 0 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 6 4 2 0 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 Time (sec) Brushed DC Motor / Encoder System A. da Silva & K. Craig 40

Step B The logic to control inputs and enable the L298 consists of a single OR gate that allows disabling all transistors of the H-Bridge when the command PWM signals are at zero. This logic located between the Arduino board and the H-Bridge is shown below. Brushed DC Motor / Encoder System A. da Silva & K. Craig 41

Step C The motor is connected to the outputs of the bridge. Depending on the type of H-Bridge used, internal protection to the transistor of the bridge may not exist. In this case, external protection circuitry needs to be provided. This protection consists of diodes connected in anti-parallel to the transistors. Shottky diodes are preferred for inductive loads. The motor rated voltage needs to be supplied to the bridge in order to allow the motor to develop rated torque. If the bridge is supplied with voltage higher than the motor rated voltage, damage may occur to the motor. A sensing resistor (R s ) can be used to monitor the motor current and shutdown the transistors if the motor rated current or the bridge maximum current is exceeded. The connection of the motor to the bridge and the diodes to protect the transistors are shown on the next slide. Brushed DC Motor / Encoder System A. da Silva & K. Craig 42

Brushed DC Motor / Encoder System A. da Silva & K. Craig 43

Feedback Control Design & Implementation Feedback speed control of the DC motor can be accomplished using several approaches. The Single-Output, Single-Input (SISO) MatLab tool is typically used to design classical feedback control systems. A combination of the root locus approach and the frequency response approach is most effective. Once a controller, e.g., PI or PID, is designed, the block diagram shown can then be used in Simulink with the Code Generation to create and download to the Arduino microcontroller the control code for the motor. Brushed DC Motor / Encoder System A. da Silva & K. Craig 44

DC-Motor - Closed Loop Velocity Control Control Implementation with Arduino and Simulink Code Generation Sine Wave rps PI(s) In1 10 Offset PID Controller Velocity Feedback (rev/sec) Velocity Saturation 12V to -12V H-Bridge Control SampleTime = 0.020 seconds for data monitoring In1 In2 Plot data 5V = 1023 = 50 rev/sec 2.5V = 512 = 0 rev/sec 0V = 0 = -50 rev/sec Pin 0 Motor Speed (1023=50rps 512 = 0rps 0=-50rps) 512 Constant 50/512 1 rps Velocity Digital to rps 10-bit A/D Brushed DC Motor / Encoder System A. da Silva & K. Craig 45

H-Bridge Control Subsystem 1 In1 > 0.1 DeadBand1 Product 255/12 Analog to 8 bits Pin 9 PWM FWD Direction < -0.1-255/12 Pin 10 DeadBand Product1 Analog to 8 bits PWM REV Direction Dead Zone Control Splitting Command to H-Bridge H-Bridge Control Block It contains a dead band control to avoid two transistors on the same side of the H-bridge turning on at the same time and damaging the H-bridge. It also contain the logic to split the signal from the PID controller into forward and reverse direction for the transistors of the H-bridge. Brushed DC Motor / Encoder System A. da Silva & K. Craig 46

Plot Data Subsystem uint8('a') 9600 baud rate Serial Config Header Serial Write 1 In1 10 Convert to int16 From Analog InTo Serial Convert int16 to uint8 Array Serial Write Launch host side 2 In2 10 Convert to int16 From Analog InTo Serial Convert int16 to uint8 Array1 These blocks show how you can send multiple bytes by combining different signals into a vector using the Mux block. In this case we are adding a Header and Terminator character to our message. uint8(0) Terminator We are also using the Convert block to take the int16 value we get from the Analog Input and convert it to a 2-element uint8 vector. Since the serial port only reads integers, this gain adds a decimal point to the readings. But the signal will be 10 times the actual value. Use the "Serial Configuration" block to make sure that the used serial port is the one to which the arduino is connected. A value coming from analog "In1" will also be received and displayed. COM19 Data Serial Receive Display Scope COM19 9600 8,none,1 Serial Configuration Launch target side Brushed DC Motor / Encoder System A. da Silva & K. Craig 47

Steps to Use the Plot Data Subsystem Plot Data: This block reads any data from the Simulink code and plots it on a Scope. The steps to use this feature are as follows: 1. Connect the Arduino board to the USB port of your computer 2. Run the command in the MatLab Command Window: comports=arduino.prefs.searchforcomport 3. This command will show the number of the COM port that the Arduino board is connected. 4. Open the block called Launch host side 5. Open the Serial Configuration block and set the Communication Port to the port number identified in Step 2. Brushed DC Motor / Encoder System A. da Silva & K. Craig 48

6. Open the block Serial Receive and set the Communication Port to the port number identified in Step 2. 7. Run the following command in the Command Window: SampleTime = 0.02. 8. Download the code to Arduino 9. Hit Play on the demo_arduino_serial_communication_host Brushed DC Motor / Encoder System A. da Silva & K. Craig 49

Double click on the Scope to start monitoring the data. The time to capture data on the Scope can be changed as shown. Brushed DC Motor / Encoder System A. da Silva & K. Craig 50