PICDEM™ MC LV Development Board User’s Guide © 2006 Microchip Technology Inc. DS51554B Note the following details of the code protection feature on Microchip devices: • Microchip products meet the specification contained in their particular Microchip Data Sheet. • Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions. • There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property. • Microchip is willing to work with the customer who is concerned about the integrity of their code. • Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as “unbreakable.” Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act. Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer’s risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights. Trademarks The Microchip name and logo, the Microchip logo, Accuron, dsPIC, KEELOQ, microID, MPLAB, PIC, PICmicro, PICSTART, PRO MATE, PowerSmart, rfPIC and SmartShunt are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. AmpLab, FilterLab, Migratable Memory, MXDEV, MXLAB, PICMASTER, SEEVAL, SmartSensor and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A. Analog-for-the-Digital Age, Application Maestro, dsPICDEM, dsPICDEM.net, dsPICworks, ECAN, ECONOMONITOR, FanSense, FlexROM, fuzzyLAB, In-Circuit Serial Programming, ICSP, ICEPIC, Linear Active Thermistor, MPASM, MPLIB, MPLINK, MPSIM, PICkit, PICDEM, PICDEM.net, PICLAB, PICtail, PowerCal, PowerInfo, PowerMate, PowerTool, Real ICE, rfLAB, rfPICDEM, Select Mode, Smart Serial, SmartTel, Total Endurance, UNI/O, WiperLock and Zena are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. All other trademarks mentioned herein are property of their respective companies. © 2006, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved. Printed on recycled paper. Microchip received ISO/TS-16949:2002 quality system certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona and Mountain View, California in October 2003. The Company’s quality system processes and procedures are for its PICmicro® 8-bit MCUs, KEELOQ® code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified. DS51554B-page ii © 2006 Microchip Technology Inc. PICDEM™ MC LV DEVELOPMENT BOARD Table of Contents Preface ........................................................................................................................... 1 Chapter 1. Introduction to the PICDEM MC LV Development Board 1.1 Introduction ..................................................................................................... 7 1.2 Highlights ........................................................................................................ 7 1.3 Motor Control Kit ............................................................................................ 7 1.4 Overview of the PICDEM MC LV Development Board ................................... 7 1.5 Board Connectors .......................................................................................... 8 Chapter 2. System Level Architecture of the Board 2.1 Highlights ...................................................................................................... 11 2.2 Board Block Diagram ................................................................................... 11 2.3 Control Section ............................................................................................. 12 2.4 Power Inverter Section ................................................................................. 13 2.5 Power Supply ............................................................................................... 14 Chapter 3. Getting Started with PIC18FXX31 MCUs 3.1 Introduction ................................................................................................... 15 3.2 Highlights ...................................................................................................... 15 3.3 PICDEM MC LV Development Board Setup ................................................ 15 Chapter 4. Using the Microchip Motor Control GUI 4.1 Highlights ...................................................................................................... 17 4.2 Software Overview ....................................................................................... 17 4.3 Starting the Program .................................................................................... 17 4.4 The Main Window (Control Panel) ............................................................... 18 4.5 The Setup Window ....................................................................................... 20 Chapter 5. Creating Motor Control Firmware Projects 5.1 Highlights ...................................................................................................... 23 5.2 Included Applications ................................................................................... 23 5.3 Beyond the Included Applications: Creating New Projects .......................... 23 Chapter 6. Getting Started with dsPIC Digital Signal Controllers 6.1 Highlights ...................................................................................................... 25 6.2 Initial Setup ................................................................................................... 25 © 2006 Microchip Technology Inc. DS51554B-page iii PICDEM™ MC LV Development Board Chapter 7. Using dsPIC DSCs to Run a Sensorless BLDC Motor 7.1 Introduction ................................................................................................... 27 7.2 Highlights ...................................................................................................... 27 7.3 Sensorless Control of a BLDC Motor ........................................................... 27 7.4 Using the PICDEM MC LV Development Board for Higher Motor Voltage .............................................................................. 29 7.5 Using the PICDEM MC LV Development Board for Lower Motor Voltage .............................................................................. 29 Chapter 8. Troubleshooting 8.1 Highlights ...................................................................................................... 31 8.2 Common Problems ....................................................................................... 31 Appendix A. Circuit Schematics of the Board ..........................................................33 Appendix B. Electrical Specifications .......................................................................35 Appendix C. Jumper Settings ....................................................................................37 Index .............................................................................................................................39 Worldwide Sales and Service .....................................................................................42 DS51554B-page iv © 2006 Microchip Technology Inc. PICDEM™ MC LV DEVELOPMENT BOARD Preface NOTICE TO CUSTOMERS All documentation becomes dated, and this manual is no exception. Microchip tools and documentation are constantly evolving to meet customer needs, so some actual dialogs and/or tool descriptions may differ from those in this document. Please refer to our web site (www.microchip.com) to obtain the latest documentation available. Documents are identified with a “DS” number. This number is located on the bottom of each page, in front of the page number. The numbering convention for the DS number is “DSXXXXXA”, where “XXXXX” is the document number and “A” is the revision level of the document. For the most up-to-date information on development tools, see the MPLAB® IDE on-line help. Select the Help menu, and then Topics to open a list of available on-line help files. INTRODUCTION This chapter contains general information that will be useful to know before using the PICDEM™ MC LV Development Board. Items discussed in this chapter include: • • • • • • • • Document Layout Conventions Used in this Guide The Microchip Web Site Recommended Reading Development Systems Customer Change Notification Service Warranty Registration Customer Support Document Revision History © 2006 Microchip Technology Inc. DS51554B-page 1 PICDEM™ MC LV Development Board DOCUMENT LAYOUT This document describes how to use the PICDEM MC LV Development Board as a development system for Microchip Technology’s PIC18F2331/2431 Microcontrollers (MCUs) and dsPIC30F2010/3010 Digital Signal Controllers (DSCs). The manual layout is as follows: • Chapter 1. Introduction to the PICDEM MC LV Development Board – What the PICDEM MC LV Development Board is, what makes it a desirable development tool for motor control and what features are available. This chapter also includes instructions on how to connect and begin to use the PICDEM MC LV Development Board. • Chapter 2. System Level Architecture of the Board – Provides a block diagram of the board and description of each section. • Chapter 3. Getting Started with PIC18FXX31 MCUs – Provides instructions on how to set up the PICDEM MC LV Development Board using the PIC18FXX31 family devices. • Chapter 4. Using the Microchip Motor Control GUI – Provides a detailed description of PC-based Motor Control GUI and how to use its programmable features. • Chapter 5. Creating Motor Control Firmware Projects – Discusses the basic steps for creating custom applications or modifying existing applications. • Chapter 6. Getting Started with dsPIC Digital Signal Controllers – Describes how to set up and use the PICDEM MC LV Development Board using the dsPIC® family. • Chapter 7. Using dsPIC DSCs to Run a Sensorless BLDC Motor – Describes how to run a BLDC motor, without a Hall effect sensor, using dsPIC devices. • Chapter 8. Troubleshooting – Provides information on solving common problems. • Appendix A. Circuit Schematics of the Board – Provides detailed circuit schematics of the PICDEM MC LV Development Board. • Appendix B. Electrical Specifications – Lists the DC input and output ratings for the PICDEM MC LV Development Board. • Appendix C. Jumper Settings – Provides a detailed list of sensored and sensorless jumper settings for PIC18F MCUs and dsPIC30F DSCs. DS51554B-page 2 © 2006 Microchip Technology Inc. Preface CONVENTIONS USED IN THIS GUIDE This manual uses the following documentation conventions: DOCUMENTATION CONVENTIONS Description Represents Examples Arial font: Italic characters and quotes Initial caps Referenced books “MPLAB® IDE User’s Guide” Emphasized text ...is the only compiler... A window the Output window A dialog the Settings dialog A menu selection select Enable Programmer Quotes A field name in a window or dialog “Save project before build” Underlined, italic text with right angle bracket A menu path File>Save Bold characters A dialog button Click OK A tab Click the Power tab Text in angle brackets < > A key on the keyboard Press <Enter>, <F1> Sample source code #define START Filenames autoexec.bat File paths c:\autoexec.bat Keywords _asm, _endasm, static Command-line options -Opa+, -Opa- Bit values 0, 1 Constants 0xFF, ‘A’ A variable argument file.o, where file can be any valid filename Square brackets [ ] Optional arguments MPASMWIN [main.asm] Curly brackets and pipe character { | } Choice of mutually exclusive arguments; an OR selection errorlevel {0|1} 0xnnn A hexidecimal number where ‘n’ is a hexidecimal digit 0xFFF Ellipses... Replaces repeated text var_name [, var_name...] Represents code supplied by user void main (void) { ... } Courier font: Plain Courier Italic Courier © 2006 Microchip Technology Inc. DS51554B-page 3 PICDEM™ MC LV Development Board THE MICROCHIP WEB SITE Microchip provides online support via our web site at www.microchip.com. This web site is used as a means to make files and information easily available to customers. Accessible by using your favorite Internet browser, the web site contains the following information: • Product Support – Data sheets and errata, application notes and sample programs, design resources, user’s guides and hardware support documents, latest software releases and archived software • General Technical Support – Frequently Asked Questions (FAQs), technical support requests, online discussion groups, Microchip consultant program member listing • Business of Microchip – Product selector and ordering guides, latest Microchip press releases, listing of seminars and events, listings of Microchip sales offices, distributors and factory representatives RECOMMENDED READING This user’s guide describes how to use the PICDEM MC LV Development Board. The device-specific data sheets contain current information on programming the specific microcontroller or digital signal controller devices. Other useful documents are listed below. The following Microchip documents are available and recommended as supplemental reference resources. MPLAB® IDE Simulator, Editor User’s Guide (DS51025) Comprehensive guide that describes installation and features of Microchip’s MPLAB Integrated Development Environment (IDE), as well as the editor and simulator functions in the MPLAB IDE environment. Readme for PICDEM MC LV Development Board For the latest information on using the PICDEM MC LV Development Board, read the Readme for PICDEM MC LV.txt file (an ASCII text file) in the Readme subdirectory of the MPLAB IDE installation directory. The Readme file contains update information and known issues that may not be included in this user’s guide. Readme Files For the latest information on using other tools, read the tool-specific Readme files in the Readme subdirectory of the MPLAB IDE installation directory. The Readme files contain updated information and known issues that may not be included in this user’s guide. MPASM™ Assembler, MPLINK™ Object Linker, MPLIB™ Object Librarian User’s Guide (DS33014) This user’s guide describes how to use the Microchip MPASM Assembler, the MPLINK Object Linker and the MPLIB Object Librarian. Microchip Technical Library CD-ROM (DS00161) This CD-ROM contains comprehensive application notes, data sheets and technical briefs for all Microchip products. To obtain this CD, or to download individual documents, visit the Microchip web site (www.microchip.com). Embedded Control Handbook Update 2000 (DS00711) This handbook consists of several documents that contain information about microcontroller applications. To obtain these documents, visit the Microchip web site (www.microchip.com). DS51554B-page 4 © 2006 Microchip Technology Inc. Preface PICmicro® Mid-Range MCU Family Reference Manual (DS33023) and PICmicro® 18C MCU Family Reference Manual (DS39500) These manuals explain the general details and operation of the mid-range and advanced MCU family architecture and peripheral modules. They are designed to complement the device data sheets. PIC18F2331/2431/4331/4431 Data Sheet (DS39616) This is the definitive reference for Microchip’s 28/40/44-pin enhanced Flash microcontrollers with nanoWatt technology, high-performance PWM and A/D, that are at the heart of the PICDEM MC LV Development Board. dsPIC30F2010 Data Sheet (DS70118) This is the definitive reference for Microchip’s 28-pin, high-performance digital signal controllers. DEVELOPMENT SYSTEMS CUSTOMER CHANGE NOTIFICATION SERVICE Microchip’s customer notification service helps keep customers current on Microchip products. Subscribers will receive e-mail notification whenever there are changes, updates, revisions or errata related to a specified product family or development tool of interest. To register, access the Microchip web site at www.microchip.com, click on Customer Change Notification and follow the registration instructions. The Development Systems product group categories are: • Compilers – The latest information on Microchip C compilers and other language tools. These include the MPLAB C18 and MPLAB C30 C Compilers; MPASM™ and MPLAB ASM30 Assemblers; MPLINK™ and MPLAB LINK30 Object Linkers; and MPLIB™ and MPLAB LIB30 Object Librarians. • Emulators – The latest information on Microchip in-circuit emulators.This includes the MPLAB ICE 2000 and MPLAB ICE 4000. • In-Circuit Debuggers – The latest information on the Microchip in-circuit debugger, MPLAB ICD 2. • MPLAB® IDE – The latest information on Microchip MPLAB IDE, the Windows® Integrated Development Environment for development systems tools. This list is focused on the MPLAB IDE, MPLAB SIM Simulator, MPLAB IDE Project Manager and general editing and debugging features. • Programmers – The latest information on Microchip programmers. These include the MPLAB PM3 and PRO MATE® II Device Programmers and the PICSTART® Plus and PICkit™ 1 Development Programmers. WARRANTY REGISTRATION Please complete the enclosed Warranty Registration Card and mail it promptly. Sending in the Warranty Registration Card entitles users to receive new product updates. Interim software releases are available at the Microchip web site. © 2006 Microchip Technology Inc. DS51554B-page 5 PICDEM™ MC LV Development Board CUSTOMER SUPPORT Users of Microchip products can receive assistance through several channels: • • • • • Distributor or Representative Local Sales Office Field Application Engineer (FAE) Technical Support Development Systems Information Line Customers should contact their distributor, representative or field application engineer (FAE) for support. Local sales offices are also available to help customers. A listing of sales offices and locations is included in the back of this document. Technical support is available through the web site at: http://support.microchip.com In addition, there is a Development Systems Information Line which lists the latest versions of Microchip’s development systems software products. This line also provides information on how customers can receive currently available upgrade kits. The Development Systems Information Line numbers are: 1-800-755-2345 – United States and most of Canada 1-480-792-7302 – Other International Locations DOCUMENT REVISION HISTORY Revision A (May 2005) • Initial Release of this Document. DS51554B-page 6 © 2006 Microchip Technology Inc. PICDEM™ MC LV DEVELOPMENT BOARD Chapter 1. Introduction to the PICDEM MC LV Development Board 1.1 INTRODUCTION The PICDEM MC LV Development Board is targeted to control Brushless DC (BLDC) motors in sensor or in sensorless operation. This flexible and low-cost board can be configured in different ways to use with Microchip’s specialized motor control microcontrollers and digital signal controllers. This low-cost board has the facility to use either the PIC18F2331/2431 or the dsPIC30F2010/3010 devices for control. Low pin count motor control parts, such as the PIC18F1230/1330, can also be configured with daughter boards. The PICDEM MC LV Development Board is a compact board containing a 3-phase voltage source inverter bridge and control circuitry around the microcontroller. The board comes with a free, ready to use MC-GUI (Motor Control – Graphical User Interface) from Microchip. Using the MC-GUI, the user can easily set and/or change motor parameters. This greatly helps the user in developing customized drive solutions. 1.2 HIGHLIGHTS This items discussed in this chapter are: • Motor Control Kit • Overview of the PICDEM MC LV Development Board • Board Connectors 1.3 MOTOR CONTROL KIT The PICDEM MC LV Development Board contains the following items. Before proceeding, make sure that you have each of these items: • PICDEM MC LV Development Board • The PICDEM MC LV Development Board CD-ROM with the following applications: - PICDEM MC LV Graphical User Interface (MC-GUI) - “PICDEM MC LV Development Board User’s Guide” (this document) - Firmware examples using the PIC18F MCUs and dsPIC30F DSCs 1.4 OVERVIEW OF THE PICDEM MC LV DEVELOPMENT BOARD Brushless DC motors are becoming more popular due to their advantages over other types of motors traditionally used. To learn more about the basics, working principles and control of BLDC motors, refer to Microchip’s Application Note AN885, “Brushless DC (BLDC) Motor Fundamentals” (DS00885) on Microchip’s website (www.microchip.com). You can also visit the specialized web page, www.microchip.com/motor, for technical details on different types of motors and their controls using PIC® microcontrollers and dsPIC® digital signal controllers. The PICDEM MC LV Development Board supports motors with terminal voltage up to 48V and current up to 4A. Refer to Appendix B. “Electrical Specifications” for complete electrical specifications. © 2006 Microchip Technology Inc. DS51554B-page 7 PICDEM™ MC LV Development Board 1.5 BOARD CONNECTORS The PICDEM MC LV Development Board has a PIC18FXX31/dsPIC30F device-based control section and 3-phase power inverters. The board has a power connector (J20), motor connector (J9), ICD 2 connector (J6) and serial interface connector (J1), as shown in Figure 1-1. FIGURE 1-1: BOARD LAYOUT J9 Motor Connection IMOTOR Test Points MPLAB® ICD 2 Connector (J6) J20 Power Supply Connector PIC® MCU dsPIC® DSC Speed Reference Potentiometer DS51554B-page 8 Switches J1 Serial Interface Connector Status LEDs © 2006 Microchip Technology Inc. Introduction to the PICDEM MC LV Development Board 1.5.1 Power Connector (J20) The power connector (J20) has the facility to connect 3 different types of connectors. A barrel connector is mounted on the board when it is shipped. If necessary, the user can replace it with a standard DIN connector or a screw terminal with a 5 mm pitch. A 24V DC power supply is connected to J20. Use the recommended power supply listed as an accessory (Part Number AC002013) on the Microchip web site (www.microchip.com), or equivalent power supply of your own. 1.5.2 Motor Connector (J9) The motor connector (J9) has 11 terminals. Table 1-1 shows the functionality of each terminal. TABLE 1-1: Terminal TERMINAL FUNCTIONALITY Function M1 Motor Winding 1 Connection M2 Motor Winding 2 Connection M3 Motor Winding 3 Connection G Special Comments Motor Ground Hall Sensor 1 Connection NOT used for sensorless control HB Hall Sensor 2 Connection NOT used for sensorless control HC Hall Sensor 3 Connection NOT used for sensorless control +5V Hall Sensor Power NOT used for sensorless control GND Hall Sensor Power Return NOT used for sensorless control HA + Positive DC Bus See Section 2.3.1 “Controller Sockets” – Negative DC Bus See Section 2.3.1 “Controller Sockets” 1.5.3 ICD 2 Connector (J6) This RJ11 connector is used for programming the part or debugging the firmware using MPLAB® ICD 2. Application-specific functionalities can be added to the existing firmware that is supplied with the board. 1.5.4 Serial Interface (RS-232) Connector (J1) This connector is used for serial communication, based on the RS-232 protocol, with the external world. When using the PC-based MC-GUI, this connector is used to connect the PC and the board through the RS-232 cable. © 2006 Microchip Technology Inc. DS51554B-page 9 PICDEM™ MC LV Development Board NOTES: DS51554B-page 10 © 2006 Microchip Technology Inc. PICDEM™ MC LV DEVELOPMENT BOARD Chapter 2. System Level Architecture of the Board 2.1 HIGHLIGHTS This items discussed in this chapter are: • • • • 2.2 Board Block Diagram Control Section Power Inverter Section Power Supply BOARD BLOCK DIAGRAM Figure 2-1 gives a system level architecture of the PICDEM MC LV Development Board. The board has three sections: control, power inverter and power supply. FIGURE 2-1: BLOCK DIAGRAM 115/230V 50/60 Hz AC Input J20 24V Power Supply J3 +5V Regulator +15V Regulator +5V IC1 IC2 IC3 S2 S3 J6 J1 – AN0 AN1 RA2 RA3 RA4 RC5 RC4 MPLAB® ICD 2 RS-232 PWM5 PWM5 PWM4 PWM4 PWM3 PWM3 PWM2 PWM2 PWM1 PWM1 PWM0 PWM0 M3 3-Phase Inverter Bridge M2 M M1 G +5V FLTA IMOTOR FaultA U10:A U7:D Comparator R26 IC1 0.1R, IC2 2W IC3 HA HB HC Amplifier R60 IC1 IC2 IC3 © 2006 Microchip Technology Inc. + +24V Driver REF R14 +15V PIC18FXX31/dsPIC30F2010 IMOTOR J9 BEMF Signal Conditioning M1 M2 M3 DS51554B-page 11 PICDEM™ MC LV Development Board 2.3 CONTROL SECTION Microchip’s PIC18F2431/2331 and many versions of the dsPIC30F DSCs have specialized hardware peripherals, like the power control PWM, high-speed ADC, motion control feedback, integrated EEPROM and the power supervisory function, that are required for efficient motor control. The CD supplied along with the PICDEM MC LV Development Board has a variety of programs using both PIC18F and dsPIC30F devices, working in open loop and closed loop, using Hall sensors and in sensorless operation. Chapter 3. “Getting Started with PIC18FXX31 MCUs” explains the control algorithm using PIC18F parts and Chapter 6. “Getting Started with dsPIC Digital Signal Controllers” explains the control algorithm for dsPIC30F parts. 2.3.1 Controller Sockets The PICDEM MC LV Development Board has two 28-pin DIP sockets, one each for the PIC18F2331/2431 MCUs and dsPIC30F2010/3010 DSCs. They are offset to each other and marked as the “PIC” and “dsPIC” sockets, respectively. When shipped, a preprogrammed PIC18F2431 is mounted on the “PIC” side of U1. To use the dsPIC device, the user has to remove the PIC18F from the socket and mount the dsPIC DSC on the “dsPIC” side of U3. Apart from the main controller, the control section has protection circuitry, user interface, Hall sensor interface and Back EMF (BEMF) signal conditioning for sensorless control. 2.3.2 Overcurrent Protection Circuit A shunt resistor (R26 = 0.1Ω) connected in the DC return path converts the combined three-phase motor current into voltage. This voltage is passed through a low-pass filter and amplified using an op amp circuit with a gain of 11. This amplified voltage is connected to one of the Analog-to-Digital Converter channels (AN0). In addition to this, the amplified voltage is compared to a voltage reference using an op amp comparator. The voltage reference is set using potentiometer R60. Turning the potentiometer clockwise increases the reference and counterclockwise reduces the reference. The range of voltage reference varies from 0V to 3.3V. Based on the motor rated current, the reference can be set. A test point “MOTOR” is given to monitor the motor current on an oscilloscope. 2.3.3 User Interface On the PICDEM MC LV Development Board, there are switches, LEDs and a potentiometer to use with the GUI interface. Table 2-1 describes each function. TABLE 2-1: USER INTERFACE Board Function Description Comments Switch S1 Used for resetting the system S2 and S3 Various functions See Chapter 3. “Getting Started with PIC18FXX31 MCUs” and Chapter 6. “Getting Started with dsPIC Digital Signal Controllers”. D1, D2, D3 Display status See Chapter 6. “Getting Started with dsPIC Digital Signal Controllers” and Chapter 3. “Getting Started with PIC18FXX31 MCUs”. PWM0-PWM5 Display status of PWM0-PWM5 Potentiometer R14 Motor speed control LED DS51554B-page 12 Turning the potentiometer clockwise increases the speed and vice versa. © 2006 Microchip Technology Inc. System Level Architecture of the Board 2.3.4 Hall Sensor Interface Hall sensors on the motor are open-collector outputs. Individual pull-up resistors are provided on the board for each Hall sensor. The Hall sensor signals, HA, HB and HC, are connected to the input capture pins, IC1, IC2 and IC3, respectively. 2.3.5 Back EMF Signal Conditioning When a sensorless algorithm is used to control the BLDC motor speed, Back EMF (BEMF) signals are used. Based on zero crossing of BEMF signals, motor commutation is decided in the firmware. The signal conditioning circuit has mainly two blocks: the first is a low-pass filter for each phase voltage and the second is a comparator circuit for determining the zero crosspoint. When using the PIC18F MCU, the jumpers are set to use both of these blocks. The output is connected to the input capture pins, IC1, IC2 and IC3. When a dsPIC30F DSC is used, the low-pass filters are used in the circuit. Using the on-chip Analog-to-Digital Converters, the BEMF zero crosspoint is determined. In order to configure this, the board has 8 jumpers. Refer to Chapter 3. “Getting Started with PIC18FXX31 MCUs” and Chapter 6. “Getting Started with dsPIC Digital Signal Controllers” for jumper settings for the PIC18F and dsPIC30F, respectively. Also, refer to Appendix C. “Jumper Settings” for the complete list of jumper settings. In addition, the silk screen on the non-component side of the board has the jumper settings printed for quick reference. 2.3.6 Temperature Measurement Circuit A temperature sensor is placed next to the PCB heat sink near Q5. The sensor, Microchip’s TC74, has an I2C™ interface. It measures the temperature and converts it to a digital value. This value can be read using the I2C protocol. The code on the CD does not include the temperature reading routines. The routines for the Master mode I2C, using the SSP module, can be found on Microchip’s web site. Note: 2.4 When using the temperature sensor, jumpers J16 and J17 should be open. When the temperature sensor is used, LEDs D2 and D3 are not available. POWER INVERTER SECTION The inverter section consists of three half-bridge gate drivers and three phase inverter bridges using MOSFETs. Figure 2-2 shows a half-bridge gate driver and half-bridge inverter. This circuit is repeated for each motor phase winding. PWM pairs, PWM0-PWM1, PWM2-PWM3 and PWM4-PWM5, control three half-bridge inverters. The DC bus is either derived from the 24V power supply connected to the input connector J20, or from the ‘+’ and ‘–’ terminals on connector J9. FIGURE 2-2: HALF-BRIDGE GATE DRIVER AND INVERTER DC+ PIC®/dsPIC® Device Q1 PWM1 PWM1 Driver IR2101 PWM0 M1 Q0 PWM0 DC- © 2006 Microchip Technology Inc. DS51554B-page 13 PICDEM™ MC LV Development Board 2.5 POWER SUPPLY A 24V DC block power supply connected to J20 serves as the main power supply to the board. A +15V power supply is generated for the gate drivers using a 15V regulator (VR2). This 15V regulator is passed through a 5V regulator to drive a +5V power supply to the MCU and the control circuit around the MCU. 2.5.1 Connecting an Alternate Power Supply The board can support the motors up to the rated voltage of 48V. However, the input power supply that can be connected on J20 is limited to 24V. In such cases, a provision is made to connect a different power supply that powers the DC bus using ‘+’ and ‘–’ terminals on J9. The power jumper J3 that is next to the connector J9 should be opened when a second power supply is connected to J9. This arrangement can also be used if the motor has a lower rated voltage, for example, 12V. CAUTION When using a second power supply on ‘+’ and ‘–’ terminals on J9, make sure that jumper J3 is removed. Failure to do this may cause the board to fail or the power supply to fail. DS51554B-page 14 © 2006 Microchip Technology Inc. PICDEM™ MC LV DEVELOPMENT BOARD Chapter 3. Getting Started with PIC18FXX31 MCUs 3.1 INTRODUCTION This chapter provides instructions on how to set up the PICDEM MC LV Development Board using the PIC18FXX31 devices. WARNING The PICDEM MC LV Development Board is intended to drive 3-phase BLDC motors. Before connecting the motor, make sure that the power rating of the motor is equal or less than the power rating of the board, as given in Appendix B. “Electrical Specifications”. Also, make sure that the jumper settings are correct for the firmware programmed into the target PIC® MCU mounted on the socket. Failure to comply with this warning could lead to malfunction of the board and/or the motor and could possibly be hazardous to the development staff. Before beginning the start-up procedure, do a visual check of the board and the motor to be connected for any mechanical damage. If damage is found, DO NOT power-up the board. Otherwise, you may further damage the equipment. Immediately contact Microchip’s local office or distributor for information. 3.2 HIGHLIGHTS This item discussed in this chapter is: • PICDEM MC LV Development Board Setup 3.3 PICDEM MC LV DEVELOPMENT BOARD SETUP The following procedure describes how to set up the PICDEM MC LV Development Board to run with a PIC18FXX31 device. 1. Place the PICDEM MC LV Development Board on a sturdy platform. 2. Make sure the PIC18F2331 or the PIC18F2431 is mounted in the “PIC” socket on U1. 3. Connect the 24V power supply to J20. Note: DO NOT connect the motor wires to the board. LED D7 (red) should turn on. If it does not turn on, check the polarity of the power supply connector. If it is correct and the LED D7 still does not turn on, disconnect power to the board and contact Microchip’s local office or distributor. 4. Determine the algorithm you want to run the motor. The following two options are available: • Speed control using Hall sensors • Sensorless control 5. Program the part with the desired algorithm. For generating a project and programming using MPLAB® ICD 2, refer to the “MPLAB® ICD 2 In-Circuit Debugger User’s Guide” (DS51331). 6. Disconnect the power supply and complete jumper settings and motor connections as given in the following table. The wire colors mentioned in the brackets are for the Hurst NT Dynamo motor, available from Microchip as an accessory, part number AC300020. © 2006 Microchip Technology Inc. DS51554B-page 15 PICDEM™ MC LV Development Board TABLE 3-1: JUMPER SETTINGS Jumper Sensored Control J7, J11, J13 Short between 1-2 Sensorless Control Short between 1-2 J15 Short between 2-3 Short between 2-3 J8, J12, J14 Open Short J10, J16, J17, J19 Short Short TABLE 3-2: MOTOR CONNECTIONS Label on Connector J9 Sensored Control Sensorless Control M1 Phase C (red) Phase C (red) M2 Phase B (black) Phase A (white) M3 Phase A (white) Phase B (black) G Ground (green) Ground (green) +5V Power-on Hall Sensor (red) No Connection GND Power Return for Hall Sensors (black) No Connection HA Hall S1 (white) No Connection HB Hall S2 (brown) No Connection HC Hall S3 (green) No Connection 7. Keep the potentiometer “REF” turned counterclockwise. 8. Connect the 24V power supply to the board on J20. Note: 9. 10. 11. 12. 13. DS51554B-page 16 Follow procedures 9 through 13 for manual operation or Stand-Alone mode of the board. For PC operation, or operating the board using the Graphical User Interface, skip to Chapter 4. “Using the Microchip Motor Control GUI”. Press and release switch S3 once. Turn the potentiometer “REF” clockwise, the motor should rotate. Each press of S3 toggles the control between Run and Stop conditions. To change the direction of rotation, press S2. If the motor stops and LED D1 blinks, it indicates that there was an overcurrent Fault. Reduce the speed “REF” and press either S2 or S3 to clear the Fault and resume operation. © 2006 Microchip Technology Inc. PICDEM™ MC LV DEVELOPMENT BOARD Chapter 4. Using the Microchip Motor Control GUI 4.1 HIGHLIGHTS The items discussed in this chapter are: • • • • 4.2 Software Overview Starting the Program The Main Window (Control Panel) The Setup Window SOFTWARE OVERVIEW The Microchip Motor Control GUI provides a convenient computer-based interface for most PICmicro® device-based motor control applications. It is designed to work with a number of electrical designs and motor control paradigms, and provides a wide range of control functions for motor operations. Not only can users set speed and rotation direction, but also program acceleration, deceleration and variable run patterns. The Motor Control GUI has been designed to communicate with a range of currents and planned Microchip motor control kits and applications. A feature of its design is to poll the on-board control firmware on initial communication and automatically configure its options accordingly. As such, some features discussed here may not be available in certain situations. They are presented here for the sake of completeness. 4.3 STARTING THE PROGRAM To run the program, select Programs>Microchip Motor Control Solutions> Motor Control Demo from the Start menu. Alternatively, double click on the Motor Control GUI shortcut on your desktop. This launches the Main window of the GUI (Figure 4-1). In this version of the Motor Control GUI, all of the operations are controlled through two windows: the Main window (control panel) and the Setup window. Their operation is described in the following sections. © 2006 Microchip Technology Inc. DS51554B-page 17 PICDEM™ MC LV Development Board FIGURE 4-1: 4.4 THE CONTROL PANEL VIEW THE MAIN WINDOW (CONTROL PANEL) The control panel allows the user to control motor speed and rotation direction in a way that is similar to Stand-Alone mode. It also allows users to access the Setup and Pattern programming displays. The control panel’s features include: • Motor and Control Method Display – When the motor control firmware is appropriately configured (such as the demonstration applications included with the development kit), the scrolling display indicates the type of motor and control firmware that has been programmed to the PICDEM MC LV Development Board. • Speed/Direction Display – Displays the actual speed of the motor as determined either by sensors, or Back EMF approximation, in both tachometer and digital (text) formats. Below the tachometer is a direction indicator, showing the direction of motor revolution relative to the default direction with an arrow and text. Speed for all applications in Open-Loop mode is shown in RPM. The full-scale value of the tachometer and the colored zones reflect average safe and hazardous values for the type of motor selected, based on the rated and maximum safe speeds. The full-scale value is determined by the speed limit defined in the Setup window, plus an additional margin. The upper boundary of the green range represents the motor’s rated speed. The upper blue boundary is set to scale the maximum safe speed well into the red area; generally, this boundary is halfway between the rated and full-scale speeds. The values may be changed in the Setup window to reflect the actual performance limitations of the motor. • Fault Display – A scrolling text display indicates the state of the Fault conditions monitored by the PICDEM MC LV Development Board. Under normal conditions, it will display a scrolling “No Fault” message and a green indicator. Should a Fault condition occur, the indicator will change to blinking red; the text will also change to red and the message will indicate the specific Fault event(s). DS51554B-page 18 © 2006 Microchip Technology Inc. Using the Microchip Motor Control GUI • Speed Set Control – The user can set the target run speed for the motor with this spin box by either direct entry or using the up/down controls. The input is specified in RPM for all applications. Left clicking on the control, or pressing the <Enter> or <Tab> keys after entering a speed, starts the motor running. • Phase Current Display – Displays the current draw for the indicated motor windings in amperes. Information is given in analog gauge and digital (text) format. The number of gauges that are used at any time reflect the motor type and current sensing configuration; for example, using one current transducer will result in one active gauge. The example shown in Figure 4-1 is typical for 3-phase current sensing. As with the speed display, the different color zones represent average safe and hazardous operating ranges based on the capabilities of the development board being used. For the PICDEM MC LV Development Board, the safe operating limit is 6A. The actual safe operating range should be determined from the motor’s name plate and data sheet. • Temperature Display – This gives the approximate temperature of the inverter power module in degrees Celsius, as both an analog thermometer and a text value. The arrow at the left of the thermometer indicates the event temperature for overtemperature Faults set in the controller firmware. This display is not implemented in the current version. • Control Buttons – A total of four active motor controls are provided. The first two start and stop the motor, respectively. The motor’s current status disables the corresponding button; that is, the Run is disabled and the Stop button is enabled once the motor is running. Starting the motor by left clicking on the control, or pressing the <Enter> or <Tab> keys on the Set Speed control also disables the Run button. The third button, Direction, toggles the direction of rotation. The Setup button at the extreme right launches the Setup window display (described in Section 4.5 “The Setup Window”). Two additional buttons, Pattern and History, are not implemented in this version of the Motor Control GUI. They will appear shaded. • Communication Control – This area provides user controls for the serial communication link to the board, as well as a real-time status indicator. Clicking COM Setup launches the COM Port Setting window; this allows the user to select the serial port and baud rate settings for communicating with the board. By clicking on Auto Connect, the Motor Control GUI will automatically attempt to communicate with the board each time the GUI is launched, using the most recently entered COM parameters. Once connected, COM Setup becomes unavailable. The Connect/Abort button is used to establish or break a serial link with the board. When a link is established, the Connect label changes to Abort and COM Setup becomes unavailable. When the link is broken by clicking on Abort, COM Setup becomes available for configuration. The indicator at the extreme left shows the status of the serial link. When a link is established, the indicator is solid green. When a connection is being established, the indicator flashes green. Should the link fail, the indicator changes to solid red. Located to the right is a scrolling message display; this shows the current connection status, the device being controlled and the current version of the motor control firmware. A real-time clock based on system clock time is provided at the extreme right of the display. Note: © 2006 Microchip Technology Inc. Identification of the microcontroller and firmware happens when the Motor Control GUI is launched and the serial link is first established. If the controller and/or firmware is changed, the application may not always see this when the serial link is re-established. Always close and restart the Motor Control GUI when changing the microcontroller or firmware. DS51554B-page 19 PICDEM™ MC LV Development Board 4.5 THE SETUP WINDOW FIGURE 4-2: TYPICAL SETUP WINDOW Clicking on the Setup button in the control panel launches a second window, the Setup window (Figure 4-2). From here, users can define the individual settings for the motor being used. If the appropriate information is included in the firmware, most of the values will auto-populate, or at least be limited to a smaller subset of choices. Features or parameters that are not used will be masked or greyed out. There are three categories that the user can modify: • Motor Parameters, which define the actual motor and sensor hardware that are used. • System Parameters (control), which define the control variables. • System Limits, which define the hardware maximum ratings. Controls are also provided to save or recall parameters for later use or restore default settings. Users can download settings to the connected board. 4.5.1 Motor Parameters These parameters are generally self-explanatory. Information on the motor hardware itself (items 1 through 6) can be found either on the motor’s nameplate or in its data sheet. The Motor Type field is auto-populated with the motor type identified upon connection. DS51554B-page 20 © 2006 Microchip Technology Inc. Using the Microchip Motor Control GUI The configuration for motion feedback sensors is selectively enabled by selecting the appropriate check boxes in Feedback Device. When Hall effect sensors alone are used, the Hall Sensor Phase Angle and MFM Filter Prescaler (Motion Feedback Module) may be configured; the other options are disabled. When optical encoders are enabled, the Encoder PPR (Pulses Per Revolution), QEI update mode and MFM Filter Prescaler may be configured; Hall effect configuration is unavailable. (The use of the QEI update mode and MFM Filter Prescaler options is discussed in detail in Section 16 “Motion Feedback Module” of the “PIC18F2331/2431/4331/4431 Data Sheet” (DS39616). Note: The Hall effect and optical sensors are mutually exclusive; it is not possible for some control methods to use both types at once. In these cases, checking the appropriate box enables all configuration options. Of course, selecting the None option in Feedback Device disables all sensor configuration options. For motors with integrated motion feedback sensors, information on the sensor type and arrangement is also found in the motor data sheet. External shaft mounted encoders should also have the required information in their data sheets. 4.5.2 System Parameters The System Parameters options will vary, depending on the motor control principle being used by the firmware. Proportional-Integral-Derivative (PID) systems are most often employed in closed-loop operation, where constant speed or constant torque is required. Options 1 through 6 will only be available when a PID control algorithm is used. Acceleration and deceleration are defined as RPS/s for most applications. For induction motors running in open-loop applications, they are defined as Hz/s. The Input Voltage is the actual supply voltage to the board. With the drive voltage level established under Motor Parameters, it is used to calculate the limits on the PCPWM duty cycle necessary to generate the drive voltage from the input voltage. The PWM Frequency determines the resolution of the control firmware. The drop-down combo box presents a fixed range of values depending on the firmware application and microcontroller. Note: 4.5.3 The V/F Curve control is not available in the current version of the Motor Control GUI. System Limits The System Limits reflect the maximums of both the motor and the board being used. Voltage Limit, or the maximum voltage delivered to the motor, is limited at the input DC voltage level. Current Limit is set at the lesser of the maximum current rating for the motor or the maximum capacity of the board. For the PICDEM MC LV Development Board, this is 4.0A. Speed Limit is set at the value given in the motor’s data sheet, or at a predetermined speed set by the particular motor data file. CAUTION Not all motors may be able to run at the maximum speed defined by the Speed Limit parameter. It should be regarded as an upper limit and not the motor’s expected maximum speed. © 2006 Microchip Technology Inc. DS51554B-page 21 PICDEM™ MC LV Development Board 4.5.4 Storing and Using Setting Profiles Once the parameters for a particular motor are established, it would be nice to preserve them for future use. Users have several options from the Setup window display to do just that. Clicking on the Save button allows the current settings to be stored in a file, while clicking on Load selects and loads a file with saved settings. Both commands use the conventional Windows® dialogs for opening and saving files. Setting profiles are saved as motor data files (.mcd extension). Neither of these affects the parameters currently in effect in the on-board firmware. The Default button replaces all of the current settings with the default settings associated with the current motor type. This may be useful for quickly starting over when a set of parameters has been extensively modified and isn’t working. The Download button transfers the currently displayed parameters to the on-board firmware. It only changes the parameters and not the control firmware itself. DS51554B-page 22 Note 1: Attempting to load a motor data file that does not match the currently loaded motor and/or control method type will generate an error message. 2: Remember that downloading a profile to the PICDEM MC LV Development Board only downloads variable values; it does not download new firmware. Similarly, loading and saving profiles only loads or saves the motor data file to the computer, but does not load or save the file to the on-board firmware. © 2006 Microchip Technology Inc. PICDEM™ MC LV DEVELOPMENT BOARD Chapter 5. Creating Motor Control Firmware Projects 5.1 HIGHLIGHTS The items discussed in this chapter are: • Included Applications • Beyond the Included Applications: Creating New Projects 5.2 INCLUDED APPLICATIONS The PICDEM MC LV Development Board comes with two complete firmware solutions. One of these is the BLDC control application (installed on the board). It assumes a 3-phase BLDC motor using Hall effect sensors at 120-degree spacing application. It is possible that this preprogrammed application will not meet the project requirements. If so, there are additional motor control applications provided with the PICDEM MC LV Development Board CD. The additional motor control applications include the sensorless BLDC control (open-loop) and Proportional-Integral-Derivative (PID) control algorithms. The applications are provided as ready-to-program HEX files, and as assembler files, with all the necessary support files to create custom projects. 5.3 BEYOND THE INCLUDED APPLICATIONS: CREATING NEW PROJECTS Even with the provided applications, project requirements may differ. It may be necessary to integrate motor control into your existing code, or you may have a new approach for motor control. In either event, the PICDEM MC LV Development Board can be used to prototype the application. The first step is to create code in a development environment, such as Microchip’s MPLAB® IDE. Add any necessary .inc or .asm files to the project and set the system and control parameters specific to the application. The best place to get this information is to review the existing firmware applications included on the software CD. Motor-specific information can be found in the Readme files for the Microchip Motor Control GUI included on the CD. Once the necessary information is gathered, build the project and create the HEX file. Using a device programmer, such as PRO MATE® II, load your firmware into the supplied PIC18F2431 microcontroller. Alternately, load your firmware directly into the microcontroller installed on the board through the ICD interface. Note: © 2006 Microchip Technology Inc. The operation of the Stand-Alone and PC modes, as described in previous chapters, is an integral part of the motor control firmware. If the program logic differs significantly from the firmware included with the board, it is possible that the modes cannot be used as described. The “self-test” blinking of the monitor LEDs on power-up may also be disabled. DS51554B-page 23 PICDEM™ MC LV Development Board NOTES: DS51554B-page 24 © 2006 Microchip Technology Inc. PICDEM™ MC LV DEVELOPMENT BOARD Chapter 6. Getting Started with dsPIC Digital Signal Controllers 6.1 HIGHLIGHTS This item discussed in this chapter is: • Initial Setup 6.2 INITIAL SETUP The following procedure describes how to set up the PICDEM MC LV Development Board to run with a dsPIC® device. WARNING Note 1: The PICDEM MC LV Development Board is intended to drive the 3-phase BLDC motor. Before connecting the motor, make sure that the power rating of the motor is equal or less than the power rating of the board, as shown in Appendix B. “Electrical Specifications”. Also, make sure the jumper settings are correct for the firmware programmed into the target dsPIC device mounted on the socket. Failure to comply with this warning could lead to malfunction of the board, the motor and could be hazardous to the development staff. 2: Before beginning the start-up procedure, complete a visual check of the board and the motor for connectivity and mechanical damage. If damage is found, DO NOT power-up the board. Otherwise, you may further damage the equipment. Contact Microchip’s local office or distributor immediately. 1. Place the PICDEM MC LV Development Board on a sturdy platform/surface. 2. Confirm that a dsPIC30F2010, dsPIC30F3010 or dsPIC30F4012 is mounted in the “dsPIC” marked U3 socket. 3. Connect the 24V power supply to J5. DO NOT connect the motor wires to the board. LED D7 (red) should turn on. If it does not turn on, check the polarity of the power supply connector. If it is correct and LED D7 does not turn on, disconnect the power to the board and contact Microchip’s local office or distributor. 4. Two Application Notes are available for information on running BLDC Motors using dsPIC devices: AN957, “Sensored BLDC Motor Control Using dsPIC30F2010” (DS00957) AN992, “Sensorless BLDC Motor Control Using dsPIC30F2010” (DS00992) AN957 and AN992 have been developed using the PICDEM MC LV Development Board. The code available with these Application Notes can be downloaded from the Microchip web site (www.microchip.com) and will work with the BLDC motor provided in the application kit. To generate a project and program using MPLAB® ICD 2 In-Circuit Debugger, refer to the “MPLAB® ICD 2 In-Circuit Debugger User’s Guide” (DS51331). © 2006 Microchip Technology Inc. DS51554B-page 25 PICDEM™ MC LV Development Board WARNING Note 1: When programming the dsPIC device on the PICDEM MC LV Development Board, the two DIP switches must be in the PRGM position. This will ensure the programming pins are connected to the programmer. If the user has generated independent code, the user must select EMUC2/EMUD2 pins for emulation in the MPLAB Configuration menu. These alternate pins will then be programmed and will be used for the debugging or run phase. 2: After programming the dsPIC device, the user can disconnect the programmer from the ICD 2 plug J6 and run the device in Stand-Alone mode. Alternatively, if the ICD 2 is being used in the Emulator mode, then the DIP switches have to be switched to the DEBUG position. Then, the EMUC2/EMUD2 pins will be connected to the ICD 2, and assuming the configuration was done as described above, the user will be able to run the firmware using the ICD 2 as an emulator. 5. Disconnect the power supply and ensure that the jumper settings and motor connection match Table 6-1 and Table 6-2 respectively. TABLE 6-1: JUMPER SETTINGS Jumper Sensored Control J7, J11, J13 Open Sensorless Control Short between 2-3 J15 Don’t care Don’t care J8, J10, J12, J14 Open Open J19 Short Open J16, J17 Short Short TABLE 6-2: MOTOR CONNECTIONS Label on Connector J9 Sensored Control Sensorless Control M1 Phase C (red) Phase C (red) M2 Phase B (black) Phase A (white) M3 Phase A (white) Phase B (black) G Ground (green) Ground (green) +5V Power-on Hall Sensor (red) No Connection Return (symbol) Power Return for Hall Sensor (black) No Connection HA Hall S1 (white) No Connection HB Hall S2 (brown) No Connection HC Hall S3 (green) No Connection 6. Keep the potentiometer “REF” on the 50% or center position. Turn the pot marked “R60” to the full clockwise position. 7. Connect the 24V power supply to the board. The red LED D7 will turn on. 8. To start the motor, press S2. 9. To increase the speed of the motor, turn the potentiometer marked “REF” clockwise. 10. If the motor stops, press S2 once to reset the process and repeat steps 9-11. 11. The debug information will be relayed via the serial port. Connect Hyperterminal at 19200 baud to view the speed of the motor, or any Fault which occurs during the execution of the code. DS51554B-page 26 © 2006 Microchip Technology Inc. PICDEM™ MC LV DEVELOPMENT BOARD Chapter 7. Using dsPIC DSCs to Run a Sensorless BLDC Motor 7.1 INTRODUCTION The PICDEM MC LV Development Board can be used to run a BLDC motor without a Hall effect sensor. To find out more and get a full description of the application, refer to Application Note AN992, “Sensorless BLDC Motor Control Using dsPIC30F2010” (DS00992). For jumper settings and details on how to connect the motor, refer to Chapter 6. “Getting Started with dsPIC Digital Signal Controllers”. In this chapter, we will briefly explain how a sensorless BLDC motor application is run using a dsPIC device and describe how to adjust some of the parameters in order to make specific BLDC motors run. For more details on the hardware and firmware specifications, refer to Application Notes AN901, “Using the dsPIC30F for Sensorless BLDC Control” (DS00901) and AN992, “Sensorless BLDC Motor Control Using dsPIC30F2010” (DS00992). These Application Notes can be found on the Microchip web site (www.microchip.com). 7.2 HIGHLIGHTS This items discussed in this chapter are: • Sensorless Control of a BLDC Motor • Using the PICDEM MC LV Development Board for Higher Motor Voltage • Using the PICDEM MC LV Development Board for Lower Motor Voltage 7.3 SENSORLESS CONTROL OF A BLDC MOTOR To run a BLDC motor without sensors, it is important to sense the rotor magnet position with reference to the windings on the stator. In order to do this properly, the Back EMF on the unexcited winding is monitored. As the motor is spun, the voltage waveform on the three winding phases will be seen, as shown in an idealized manner in Figure 7-1. FIGURE 7-1: ZERO-CROSSING DETECTION 30° 0 0 0 Sector 5 0 1 2 3 4 5 0 1 = BEMF Zero Crossing © 2006 Microchip Technology Inc. DS51554B-page 27 PICDEM™ MC LV Development Board There are 6 sectors, each 60 degrees wide, which accumulate to give one 360 degree electrical revolution of the motor. In each sector, two windings are excited: one with a high voltage and the other with a low voltage. The third winding is not excited. As the rotor rotates from one sector to another, a new set of windings is excited. The sequence of excitation in each sector is provided by the motor manufacturer. The winding in each sector that is not excited will be influenced by the Back EMF voltage. This voltage is not high or low, but a falling or rising voltage level, going symmetrically from a high-to-low or a low-to-high. It crosses the center, or star point voltage, at about 30 degrees before the next commutation point of the rotor. This center, or star point voltage, is also referred to as the zero-crossing voltage. Its value is exactly half the voltage applied to the excited windings of the motor. The dsPIC device uses its fast ADC to sense the zero-cross point. Having sensed the zero-cross point, it can predict the time required for the next commutation phase. The zero-cross sensing and drive of the motor is shown in Figure 7-2. FIGURE 7-2: HARDWARE BLOCK DIAGRAM dsPIC30F2010 BLDC PWM3H PWM3L PWM2H PWM2L PWM1H PWM1L FLTA AN0 AN1 AN2 3-Phase Inverter R49 Fault VDC R41 R34 R36 IBUS R44 R52 Demand VBUS R63 AN3 AN4 VDC R64 AN5 Phase Terminal Voltage Feedback The PWM signals drive three MOSFET drivers (IR2101s), which in turn, drive the 3-phase bridge inverter connected to the 3 motor windings (see Appendix A. “Circuit Schematics of the Board”). The motor windings are driven with 24V. This voltage is scaled down to about 1.8V full scale when sensed by the ADC inputs of the dsPIC device. The scaling for each winding is done by resistor pairs, R34/R36, R41/R44 and R49/R52 (see Appendix A. “Circuit Schematics of the Board”). The bus voltage is sensed and scaled down by resistor pair, R63/R64. Note: DS51554B-page 28 All the resistor pairs should have the same value for a given motor voltage. The resistor pairs used on the PICDEM MC LV Development Board give a full-scale value of about 2.4V and so, the zero-cross voltage is about 1.2V. This is based on a motor voltage of 24V. © 2006 Microchip Technology Inc. Using dsPIC DSCs to Run a Sensorless BLDC Motor 7.4 USING THE PICDEM MC LV DEVELOPMENT BOARD FOR HIGHER MOTOR VOLTAGE The PICDEM MC LV Development Board can be used to drive a motor at a voltage higher than 24V, but not exceeding 36V. The new high voltage can be supplied to the system at the Plus (+) and Minus (–) terminals on J9. For the sensorless algorithm to work, the user will have to modify the resistor pairs to drive the same full-scale (2.4V) and zero-cross (1.2V) voltages (see Section 7.3 “Sensorless Control of a BLDC Motor”). Do not exceed the input voltage of the 15V regulator (VR2), which is typically about 36V. Since the voltage drop across VR2 will increase substantially, make sure to provide additional heat sinking for VR2. 7.5 USING THE PICDEM MC LV DEVELOPMENT BOARD FOR LOWER MOTOR VOLTAGE The PICDEM MC LV Development Board can be used to drive a motor at a voltage lower than 24V, but not below 10V. This voltage can be supplied to the system at the Plus (+) and Minus (–) terminals on J9. Since the 15V regulator will no longer be used to drive the MOSFET drivers, J18 should be provided with a shorting jumper. This jumper connects the Plus (+) voltage directly to the MOSFET drivers. For the sensorless algorithm to work, the user will have to modify the resistor pairs to derive the same full-scale (2.4V) and zero-crossing (1.2V) voltages (see Section 7.3 “Sensorless Control of a BLDC Motor”). Make sure not to exceed the maximum input voltage of the MOSFET drivers, U6, U8 and U9. This voltage is typically 20V. © 2006 Microchip Technology Inc. DS51554B-page 29 PICDEM™ MC LV Development Board NOTES: DS51554B-page 30 © 2006 Microchip Technology Inc. PICDEM™ MC LV DEVELOPMENT BOARD Chapter 8. Troubleshooting 8.1 HIGHLIGHTS This item discussed in this chapter is: • Common Problems 8.2 COMMON PROBLEMS 8.2.1 The Power LED D7 is Not Lit Check the PICDEM MC LV Development Board for power: • • • • Check the power supply and make sure it is connected to the board. Check the power cable and make sure it is plugged into the outlet. Check and verify that the power source is working properly. If using a power supply other than the one supplied by Microchip, check the power supply polarity. • Disconnect the power to the board. Using an ohmmeter, check for any short circuits between the power (VDD) and return path (VSS). If a short exists, do not proceed any further. Contact Microchip’s local office or distributor. • Disconnect power and motor connections from the board. Using an ohmmeter, check for any short circuits between the motor terminals, M1-M2, M1-M3 and M2-M3. If a short does exist, do not proceed any further. Contact Microchip’s local office or distributor. 8.2.2 The Motor Control GUI Cannot Communicate with the Board • Check the PICDEM MC LV Development Board and make sure it is receiving power. • Check the serial cable for proper connections to the board and the computer. • Verify the cable is connected to the correct serial port on the computer. If necessary, check the serial cable by swapping in another cable that is known to be good. • Verify, through Windows® Device Manager (accessed through the system applet in the Control Panel), that the selected COM port is recognized by the operating system and is working. • Confirm that the correct serial port is being used. Check that the COM port selected in the terminal software is actually the physical port the serial cable is connected to. • Verify the baud rate; try choosing a lower rate. • Check the monitor LEDs flash briefly on Reset or power-up of the board. • If all other settings and connections are correct, try resetting the board and restarting the Motor Control GUI. © 2006 Microchip Technology Inc. DS51554B-page 31 PICDEM™ MC LV Development Board 8.2.3 The Motor Does Not Start When S2 or S3 is Pressed Verify the power supply and motor connections: • Verify that the power supply is connected to the board and is in working condition. • Verify that the controller is in the correct socket; PIC18F on the “PIC” socket and DSC on the “dsPIC” socket. • Make sure the jumper settings are correct for the type of control selected. • Verify that the motor connections on J9 are making proper contact. • Check that the speed reference potentiometer (R14) has a sufficient level. Turn the potentiometer clockwise slowly and check for motor rotation. • Check for overcurrent condition. If the motor has overloaded or the Fault detection circuit detects overcurrent, check LED D1. If it is blinking continuously, reset the system by pressing S1. Also, check for potentiometer R60 for correct current threshold level for the selected motor type. Rotate counterclockwise to increase the current threshold level. 8.2.4 A Fault Condition Occurs While Accelerating the Motor Try using a lower acceleration rate: • If the motor still causes a Fault condition, check the motor power rating. It should be within the board power rating specified. • Check the potentiometer R60 level. Set R60 for the correct current threshold level for the selected motor type. Rotate counterclockwise to increase the current threshold level. • Check for correct socket selection and jumper selections for the type of control used. • If using an alternative power supply for the motor, from the control power supply, check for its current rating. The power supply should have equal or more current capability than the motor used. 8.2.5 A Fault Condition Occurs When the Motor is Loaded Check the motor power rating: • The motor power rating should be within the board power rating specified. • Check the potentiometer R60 level. Set R60 for the correct current threshold level for the selected motor type. Rotate counterclockwise to increase the current threshold level. • If using an alternative power supply for the motor, from the control power supply, check for its current rating. The power supply should have equal or more current capability than the motor used. DS51554B-page 32 © 2006 Microchip Technology Inc. 0.1 μF © 2006 Microchip Technology Inc. VBUS 33 pF 33 pF 5 MHz VREF IMOTOR 0.1 μF PIC18F2431 AVSS VSS AVDD VDD 0.1 μF 47 μF 0.1 μF VIN GND VDD VSS AVDD AVSS VOUT 47 μF VIN GND 47 μF 0.1 μF VOUT MC7815CD2T/R4 100 μF dsPIC30F3010 VDD AVSS MC7805CD2T/R4 IMOTOR VBUS TC74 NC GND 0.1 μF 0.1 μF 1 μF 0.1 μF VBUS 1 μF 1 μF VCC 1 μF 1 μF FIGURE A-1: SDA SCLK VDD PICDEM™ MC LV DEVELOPMENT BOARD Appendix A. Circuit Schematics of the Board CIRCUIT SCHEMATIC (SHEET 1 OF 2) DS51554B-page 33 DS51554B-page 34 VCC LO COM VB HO VS VCC LO COM VB HO VS 1 5 4 8 7 6 VCC LO COM VB HO VS 1 5 4 8 7 6 1 5 4 8 7 6 3.3 μF 3.3 μF 47 nF 47 nF MCP6002 47 nF 47 nF 47 nF 0.1 μF 33 pF IMOTOR 33 pF MCP6544 MCP6544 MCP6544 MCP6544 MCP6002 0.1 μF FIGURE A-2: 2 3 HIN LIN 2 HIN 3 LIN 2 HIN 3 LIN 3.3 μF PICDEM™ MC LV Development Board CIRCUIT SCHEMATIC (SHEET 2 OF 2) © 2006 Microchip Technology Inc. PICDEM™ MC LV DEVELOPMENT BOARD Appendix B. Electrical Specifications TABLE B-1: Parameter DC INPUT RATING Min Typical Supply Voltage 15 Supply Voltage 12 Standby Current Standby Power TABLE B-2: Parameter Max Unit Note 24 — V DC input on J5 — 48 V DC input between ‘+’ and ‘–’ on J9 (open jumper J3) — 30 — mA With 24V DC supply — 0.72 — Watts With 24V DC supply OUTPUT RATING Min Typical Max Unit Note Voltage — 24 48 VDC Voltage is based on the DC bus voltage Current — 2.5 4 A Power Rating — 60 120 Watt © 2006 Microchip Technology Inc. DS51554B-page 35 PICDEM™ MC LV Development Board NOTES: DS51554B-page 36 © 2006 Microchip Technology Inc. PICDEM™ MC LV DEVELOPMENT BOARD Appendix C. Jumper Settings TABLE C-1: Jumper J7 (3 pin) JUMPER SETTINGS Sensored Control Using PIC18F MCU Sensorless Control Using PIC18F MCU Short between 1-2 Short between 1-2 Sensored Control Using dsPIC30F DSC Sensorless Control Using dsPIC30F DSC All Open Short between 2-3 J8 (2 pin) Open Short Open Open J10 (2 pin) Short Short Open Open All Open Short between 2-3 Open Open All Open Short between 2-3 Open Open J11 (3 pin) J12 (2 pin) J13 (3 pin) J14 (2 pin) J15 (3 pin) Short between 1-2 Short between 1-2 Open Short Short between 1-2 Short between 1-2 Open Short Don’t care Don’t care Short Short Short Short J17 (2 pin) Short Short Short Short J19 (2 pin) Short Short Short Open J16 (2 pin) © 2006 Microchip Technology Inc. Short between 2-3 Short between 2-3 DS51554B-page 37 PICDEM™ MC LV Development Board NOTES: DS51554B-page 38 © 2006 Microchip Technology Inc. PICDEM™ MC LV DEVELOPMENT BOARD Index B J Block Diagrams Hardware .......................................................... 28 Board Connectors ...................................................... 8 ICD 2 (J6) ........................................................... 9 Motor (J9) ........................................................... 9 Power (J20) ........................................................ 9 RS-232 Serial Interface (J1) ............................... 9 Board Layout (figure) ................................................. 8 Jumper Settings ....................................................... 37 M Documentation Conventions ........................................................ 3 Layout ................................................................. 2 Numbering Convention ....................................... 1 Updates .............................................................. 1 Microchip Web Site .................................................... 4 Motor Control Applications ....................................... 23 BLDC ................................................................ 23 Proportional-Integral-Derivative (PID)............... 23 Sensorless BLDC.............................................. 23 Motor Control Graphical User Interface (MC-GUI) ...................................... 17 Motor Control GUI Control Panel .................................................... 18 Communication Control ............................. 19 Control Buttons .......................................... 19 Fault Display .............................................. 18 Motor and Control Method Display......................................... 18 Phase Current Display............................... 19 Speed Set Control ..................................... 19 Speed/Direction Display ............................ 18 Temperature Display ................................. 19 Setup Window................................................... 20 Motor Parameters ...................................... 20 Setting Profiles........................................... 22 System Limits ............................................ 21 System Parameters ................................... 21 Starting the Program ......................................... 17 Motor Control Kit ........................................................ 7 E P Electrical Specifications ........................................... 35 DC Input Rating ................................................ 35 Output Rating.................................................... 35 PICDEM MC LV Development Board Block Diagram................................................... 11 Overview ............................................................. 7 Terminal Functionality......................................... 9 Power Control PWM (PCPWM) ............................... 21 Power Inverter Section............................................. 13 Power Supply ........................................................... 14 Connecting an Alternative Power Supply ..................................... 14 C Circuit Schematics ............................................. 33–34 Control Section ........................................................ 12 Controller Section Back EMF Signal Conditioning ......................... 13 Controller Sockets ............................................ 12 Hall Sensor Interface ........................................ 13 Overcurrent Protection Circuit........................... 12 Temperature Measurement Circuit ................... 13 User Interface ................................................... 12 Customer Change Notification Service ...................... 5 Customer Support ...................................................... 6 D G Getting Started with dsPIC DSCs ............................ 25 Initial Setup ....................................................... 25 Jumper Settings ................................................ 26 Motor Connections............................................ 26 Getting Started with PIC18FXX31 MCUs................. 15 Jumper Settings ................................................ 16 Motor Connections............................................ 16 Setup ................................................................ 15 H Hall Effect Sensors .................................................. 23 © 2006 Microchip Technology Inc. R Recommended Reading ............................................ 4 Readme for PICDEM MC LV Development Board.............................. 4 Revision History ......................................................... 6 DS51554B-page 39 PICDEM™ MC LV Development Board S T Sensorless Control of a BLDC Motor ....................... 27 Higher Motor Voltage ........................................ 29 Lower Motor Voltage ......................................... 29 Serial Port ................................................................ 19 Software Overview ................................................... 17 Stand-Alone Mode ................................................... 18 Troubleshooting Common Problems ........................................... 31 W Warranty Registration................................................. 5 Z Zero-Crossing Detection (figure) .............................. 27 DS51554B-page 40 © 2006 Microchip Technology Inc. Index NOTES: © 2006 Microchip Technology Inc. DS51554B-page 41 WORLDWIDE SALES AND SERVICE AMERICAS ASIA/PACIFIC ASIA/PACIFIC EUROPE Corporate Office 2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-792-7200 Fax: 480-792-7277 Technical Support: http://support.microchip.com Web Address: www.microchip.com Australia - Sydney Tel: 61-2-9868-6733 Fax: 61-2-9868-6755 India - Bangalore Tel: 91-80-2229-0061 Fax: 91-80-2229-0062 China - Beijing Tel: 86-10-8528-2100 Fax: 86-10-8528-2104 India - New Delhi Tel: 91-11-5160-8631 Fax: 91-11-5160-8632 Austria - Wels Tel: 43-7242-2244-399 Fax: 43-7242-2244-393 Denmark - Copenhagen Tel: 45-4450-2828 Fax: 45-4485-2829 China - Chengdu Tel: 86-28-8676-6200 Fax: 86-28-8676-6599 India - Pune Tel: 91-20-2566-1512 Fax: 91-20-2566-1513 France - Paris Tel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79 China - Fuzhou Tel: 86-591-8750-3506 Fax: 86-591-8750-3521 Japan - Yokohama Tel: 81-45-471- 6166 Fax: 81-45-471-6122 Germany - Munich Tel: 49-89-627-144-0 Fax: 49-89-627-144-44 China - Hong Kong SAR Tel: 852-2401-1200 Fax: 852-2401-3431 Korea - Gumi Tel: 82-54-473-4301 Fax: 82-54-473-4302 China - Qingdao Tel: 86-532-8502-7355 Fax: 86-532-8502-7205 Korea - Seoul Tel: 82-2-554-7200 Fax: 82-2-558-5932 or 82-2-558-5934 Atlanta Alpharetta, GA Tel: 770-640-0034 Fax: 770-640-0307 Boston Westborough, MA Tel: 774-760-0087 Fax: 774-760-0088 Chicago Itasca, IL Tel: 630-285-0071 Fax: 630-285-0075 Dallas Addison, TX Tel: 972-818-7423 Fax: 972-818-2924 Detroit Farmington Hills, MI Tel: 248-538-2250 Fax: 248-538-2260 Kokomo Kokomo, IN Tel: 765-864-8360 Fax: 765-864-8387 Los Angeles Mission Viejo, CA Tel: 949-462-9523 Fax: 949-462-9608 San Jose Mountain View, CA Tel: 650-215-1444 Fax: 650-961-0286 China - Shanghai Tel: 86-21-5407-5533 Fax: 86-21-5407-5066 China - Shenyang Tel: 86-24-2334-2829 Fax: 86-24-2334-2393 China - Shenzhen Tel: 86-755-8203-2660 Fax: 86-755-8203-1760 China - Shunde Tel: 86-757-2839-5507 Fax: 86-757-2839-5571 China - Wuhan Tel: 86-27-5980-5300 Fax: 86-27-5980-5118 China - Xian Tel: 86-29-8833-7250 Fax: 86-29-8833-7256 Malaysia - Penang Tel: 60-4-646-8870 Fax: 60-4-646-5086 Philippines - Manila Tel: 63-2-634-9065 Fax: 63-2-634-9069 Italy - Milan Tel: 39-0331-742611 Fax: 39-0331-466781 Netherlands - Drunen Tel: 31-416-690399 Fax: 31-416-690340 Spain - Madrid Tel: 34-91-708-08-90 Fax: 34-91-708-08-91 UK - Wokingham Tel: 44-118-921-5869 Fax: 44-118-921-5820 Singapore Tel: 65-6334-8870 Fax: 65-6334-8850 Taiwan - Hsin Chu Tel: 886-3-572-9526 Fax: 886-3-572-6459 Taiwan - Kaohsiung Tel: 886-7-536-4818 Fax: 886-7-536-4803 Taiwan - Taipei Tel: 886-2-2500-6610 Fax: 886-2-2508-0102 Thailand - Bangkok Tel: 66-2-694-1351 Fax: 66-2-694-1350 Toronto Mississauga, Ontario, Canada Tel: 905-673-0699 Fax: 905-673-6509 10/31/05 DS51554B-page 42 © 2006 Microchip Technology Inc.