This document describes the hardware and software setup requirements and step-by-by instructions to run the firmware code referenced in the AN5419 Application Note.
1. Introduction
2. Table of Contents
3. Requirements
4. Demonstration Set up for MCLV2
4.1. Hardware Set up for MCLV2
4.2. Software Set up for MCLV2
5. Demonstration Set up for MCHV3
5.1. Hardware Set up for MCHV3
5.2. Software Set up for MCHV3
6. References
dspic33ck-mchv3-sensorless-singlephase-bldc-drive.X
dspic33ck-mclv2-sensorless-singlephase-bldc-drive.X
- Navigate MPLAB Discover page of AN5419 and download the ZIP file for firmware dspic33ck-mclv2-sensorless-singlephase-bldc-drive.X or dspic33ck-mchv3-sensorless-singlephase-bldc-drive.X
- Navigate GitHub page of AN5419 and go to <> Code and download the ZIP file for firmware dspic33ck-mclv2-sensorless-singlephase-bldc-drive.X or dspic33ck-mchv3-sensorless-singlephase-bldc-drive.X
- MPLAB® X IDE v6.15
- dsPIC33CK-MP_DFP v1.12.354
- MPLAB® XC16 Compiler v2.10
- MPLAB® X IDE Plugin X2Cscope v1.6.6
Development Board | Power Supply |
---|---|
DSPICDEM™ MCHV3 Development Board (DM3300233) | 220V AC |
DSPICDEM™ MCLV2 Development Board (DM330021 - 2) | 24V DC |
This section describes hardware setup required to drive the motor using MCLV2 Development Board.
-
Mount the dsPIC33CK256MP508 External Op Amp Motor Control PIM (MA330041 - 1) on U9 and the External Op Amp Configuration Board on J14.
-
Connect the Phase windings of the motor to the J7 terminals labeled M1 and M2, which are located on the right side of the board.
Motor Wire | MCLV2 Board |
---|---|
Motor Pin A | M1 (White) |
Motor Pin B | M2 (Black) |
-
To power the board, plug in the 24V DC power supply to connector J2. J6 connects the bus voltage to the supply but it may be disconnected to use other voltages ranging from 0-48V. Please see MCLV2 User's Guide (Section 2.3) for more information on the power supply options for the development board.
MCLV2 Board | |
---|---|
Supply | 24V DC |
Terminal | J2 |
-
The MPLAB® PICkit™ 5 in-circuit debugger/programmer is used for programming or debugging the dsPIC33CK DSC. Connect the programmer on the J12 terminal of the board and use a mini USB cable to the user PC. Make sure the arrow indicated on the board is aligned with the arrow on the Pickit 5.
Connection | MCLV2 |
---|---|
Programmer | J12 |
- X2CScope can be used for real time diagnostics via USB. Short the USB jumper pair in the JP4 and JP5 designator group. Back EMF monitoring can be enabled by shorting the Voltage jumper pair in JP1 and JP2. The current sensing for overcurrent detection can be enabled by shorting the Current jumper pair in JP3.
Jumper Pairs | Position | Label | Description |
---|---|---|---|
JP1 | 3-4 | Volt | Connects voltage sense phase 1 to MONITOR_1 |
JP2 | 3-4 | Volt | Connects voltage sense phase 2 to MONITOR_2 |
JP3 | 1-2 | Curr | Connects current sense DC Bus to MONITOR_3 |
JP4 | 1-2 | USB | Connects USB receive line to Rx |
JP5 | 1-2 | USB | Connects USB transmit line to Tx |
This firmware is implemented on Microchip’s 16-bit Digital signal controller (dsPIC® DSC) dsPIC33CK256MP508. It uses peripherals such as the PWM, ADC, TIMER, CMP, UART etc. For more information, see the dsPIC33CK256MP508 Family datasheet (DS70005349).
This motor control demonstration uses the MCLV2 Development board user interface elements such as the push button to start or stop the motor. It uses the MPLAB X IDE plug in X2Cscope to change the speed of the motor.
Follow the step by step instructions below to setup and run the motor control demo application:
-
Start MPLAB X IDE and open (File > Open Project) the project dspic33ck-mclv2-sensorless-singlephase-bldc-drive.X
-
Set the project dspic33ck-mclv2-sensorless-singlephase-bldc-drive.X as main project by right clicking on the project name and selecting 'Set as Main Project' in the drop down menu. The project 'dspic33ck-mclv2-sensorless-singlephase-bldc-drive.X' will then appear in boldface.
-
Open userparams.h (under dspic33ck-mclv2-sensorless-singlephase-bldc-drive.X > headerfiles) in the project dspic33ck-mclv2-sensorless-singlephase-bldc-drive.X
-
Enter the bus voltage used for the board. In this case, 24V DC is used.
-
Uncomment the defined OVERCURRENT_DETECTION to enable overcurrent detection.
-
Right click on the project dspic33ck-mclv2-sensorless-singlephase-bldc-drive.X and select 'Properties' to open the Project Properties Dialog. In the category window:
- Select the dsPIC33CK DFP Pack and Compiler Toolchain from the available list of compilers. Please ensure MPLAB® XC16 Compiler supports the device dsPIC33CK256MP508. In this case, "v1.12.354" and “XC16(v2.10)” are selected.
- Select the Hardware Tool to be used for programming and debugging.
- After selecting Hardware Tool and Compiler Toolchain, click button Apply
-
Ensure that the checkbox 'Load symbols when programming or building for production (slows process)' is checked, which is under the 'Loading' category of the Project Properties window. This is used for X2Cscope.
-
To build the project and program the device dsPIC33CK256MP508, click 'Make and Program Device Main project' on the toolbar.
-
When the device is programmed successfully, run or stop the motor by pressing the push button S3. The LED D2 should light up to indicate the board is powered and D17 indicates the ON/OFF state of the drive.
Push Button | Description |
---|---|
S1 | RESET |
S2 | No Function |
S3 | ON/OFF |
-
When the drive is started, the motor runs at the default speed of 500RPM. The variable 'TargetSpeed' can be changed to desired speed within range using X2Cscope, which can be set up by going to Tools > Embedded > X2CScope. For Connection Setup, follow as shown in the image below and select the appropriate Serial Port where the USB cable to J8 is connected. Click Disconnected and wait for the label to become Connected.
-
Once connection is successful, proceed to the Data Views tab and select Open Watch View. This brings you a tab which can monitor and change the variables that X2CScope watches. Click the '+' and Select 'Target Speed' as shown below to change the speed of the motor from the user PC.
-
Press S3 push button again to stop the motor. LED D17 should switch off to indicate drive is off.
This section describes hardware setup required to drive the motor using MCHV3 Development Board.
NOTE: Before making any connection on the MCHV3 Board, verify that the system is not powered and it is fully discharged. The system is completed discharged when the red D13 LED is off.
-
Mount the dsPIC33CK256MP508 External Op Amp Motor Control PIM (MA330041 - 1) on U11 and the External Op Amp Configuration Board on J4.
-
Short the appropriate jumper pairs in J12 and J13 for Voltage Feedback and J14 for DC Bus Shunt Current Feedback. J11 is set to POT Voltage as default.
Jumper Pairs | Position | Description |
---|---|---|
J11 | 5-6 | Connects the POT Voltage to VACZX_VAC_POT |
J12 | 3-4 | Connects Phase M1 Voltage Feedback to MONITOR_1 |
J13 | 3-4 | Connects Phase M2 Voltage Feedback to MONITOR_2 |
J14 | 1-2 | Connects DC Bus Shunt Current Feedback to MONITOR_3 |
-
Connect the phase windings of the motor to the appropriate terminals of the MCHV3 development board, as shown below.
Motor Wire | MCHV3 Board |
---|---|
Motor Pin A | M1 (J17) |
Motor Pin B | M2 (J17) |
-
On the MCHV3 Development Board, use the appropriate AC supply voltage (e.g. 220V AC source) and connect a power adapter to the input socket (J1 Terminal on the board). The table below is provided to summarize the supply and terminal as well.
MCHV3 Board | |
---|---|
Supply | 220V |
Terminal | J1 |
-
The onboard programmer ‘PICkit™ On Board (PKoB4)’, is used for programming or debugging the dsPIC33CK DSC. As shown in the picture of the MCHV3 front panel, use the programmer/debug USB interface to program the board. Use the Connect a connector J13. To enable communication using X2CScope, use a similar cable and connect to J6.
Connection | MCHV3 Board | Front Panel Label |
---|---|---|
PKoB4 Programmer | J19 | PROGRAM/DEBUG |
USB | J6 | USB |
This firmware is implemented on Microchip’s 16-bit Digital signal controller (dsPIC® DSC) dsPIC33CK256MP508. For more information, see the dsPIC33CK256MP508 Family datasheet (DS70005349).
The Motor Control Demo application uses push button to start or stop the motor and potentiometer to vary speed of the motor. This Motor Control Demo Application configures and uses peripherals like PWM, ADC, SCCP, UART etc.
Follow below instructions step by step to setup and run the motor control demo application:
-
Start MPLAB X IDE and open (File>Open Project) the project SensoredSPBLDC_MCHV3.X
-
Set the project SensoredSPBLDC_MCHV3.X as main project by right clicking on the project name and selecting 'Set as Main Project' as shown. The project 'SensoredSPBLDC_MCHV3' will then appear in bold.
-
Open userparams.h (under dspic33ck-mchv3-sensorless-singlephase-bldc-drive.X > headerfiles) in the project dspic33ck-mchv3-sensorless-singlephase-bldc-drive.X
- Enter the bus voltage used for the board. In this case, 300V DC is used.
- Uncomment the defined OVERCURRENT_DETECTION_ENABLE to enable overcurrent detection.
-
Right click on the project SensoredSPBLDC_MCHV3.X. In the category window:
- Select the dsPIC33CK DFP Pack and Compiler Toolchain from the available list of compilers. Please ensure MPLAB® XC16 Compiler supports the device dsPIC33CK256MP508. In this case, "v1.12.354" and “XC16(v2.10)” are selected.
- Select the Hardware Tool to be used for programming and debugging.
- After selecting Hardware Tool and Compiler Toolchain, click button Apply
-
Ensure that the checkbox 'Load symbols when programming or building for production (slows process)' is checked, which is under the 'Loading' category of the Project Properties window.
-
To build the project (in this case Sensored_SPBLDC_MCHV3_LVMC.X) and program the device dsPIC33CK256MP508, click 'Make and Program Device Main project' on the toolbar.
-
When the device is programmed successfully, start or stop the motor drive by pressing the push button.
MCHV3 Board | |
---|---|
Push Button | PUSH BUTTON - ON/OFF |
-
When the drive is started, the motor runs at the default speed of 500RPM. The variable 'TargetSpeed' can be changed to desired speed within range using X2Cscope, which can be set up by going to Tools > Embedded > X2CScope. For Connection Setup, follow as shown in the image below and select the appropriate Serial Port where the USB cable to J8 is connected. Click Disconnected and wait for the label to become Connected.
-
Once connection is successful, proceed to the Data Views tab and select Open Watch View. This brings you a tab which can monitor and change the variables that X2CScope watches. Click the '+' and Select 'Target Speed' as shown below to change the speed of the motor from the user PC.
-
Press the PUSH BUTTON again to stop the motor.
For additional information, refer to the following documents or links.
-
AN5419 Application Note "Sensorless Single Phase BLDC Motor Control using dsPIC33CK"
-
MPLAB® X IDE User’s Guide (DS50002027) or MPLAB® X IDE help