This document describes the hardware and software setup requirements and step-by-step instructions to do Sensored drive on the Single Phase Brushless DC (BLDC) Motor, as referenced in the AN5423.
1. Introduction
2. Table of Contents
3. Requirements
4. Demonstration Set up for LVMC
4.1. Hardware Set up for LVMC
4.2. Software Set up for LVMC
5. Demonstration Set up for MCHV3
5.1. Hardware Set up for MCHV3
5.2. Software Set up for MCHV3
6. References
SensoredSPBLDC_LVMC.X or SensoredSPBLDC_MCHV3.X
- Navigate MPLAB Discover page of AN5423 and download the ZIP file for firmware Sensored_SPBLDC.X
- Navigate GitHub page of AN5423 and go to <> Code and download the ZIP file for firmware Sensored_SPBLDC.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) | 250V AC |
dsPIC33CK Low Voltage Motor Control (LVMC) Development Board (DM330031) | 12V DC |
This section describes hardware setup required to drive the motor using LVMC Development Board.
-
Connect the wires for the Hall Effect sensor and Phase windings of the motor to the appropriate terminals of the development board, as listed in the table below.
Motor Wire | LVMC Board |
---|---|
Motor Pin A | Phase A (J14) |
Motor Pin B | Phase B (J14) |
Hall Supply | 3.3V (J7) |
Hall Ground | GND (J7) |
Hall Signal | HALL A (J7) |
LVMC Board | |
---|---|
Motor Phases | |
Hall Connectors |
-
On the LVMC Development Board, plug in the 12V power supply to connector J1. Please see LVMC User's Guide for set-up using higher than 12V if desired.
LVMC Board | |
---|---|
Supply | 12V DC |
Terminal | J1 |
-
The onboard programmer ‘PICkit™ On Board (PKoB4)’ , is used for programming or debugging the dsPIC33CK256MP508. To use the on-board programmer, connect a micro-USB cable between Host PC. To enable communication using X2CScope between the board and the host PC, refer to USB row in the table below.
Connection | LVMC |
---|---|
PKoB4 programmer | J13 |
UART-USB for X2CScope | J6 |
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 LVMC Development board user interface elements such as the push button (to start or stop the motor) and potentiometer (to vary speed of the motor).
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_LVMC.X
-
Set the project SensoredSPBLDC_LVMC as main project by right clicking on the project name and selecting 'Set as Main Project' in the drop down menu. The project 'SensoredSPBLDC_LVMC' will then appear in boldface.
-
Open userparams.h (under SensoredSPBLDC_LVMC > headerfiles) in the project SensoredSPBLDC_LVMC
- Ensure either CLOSEDLOOP or OPENLOOP are defined in the LOOP CONTROLLER section.
- Uncomment the defined OVERTEMPERATURE_DETECTION, OVERCURRENT_DETECTION and/or STALL_DETECTION in the MOTOR FAULT DETECTION section to enable the motor fault detections.
- Right click on the project SensoredSPBLDC_LVMC and select “Properties” to open its 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 SW1. The LED LD11 and LD1O should turn on and the motor should start spinning in one direction in the speed range set by the potentiometer.
LVMC Board | |
---|---|
Push Button | SW1 - ON/OFF SW2 - REVERSE direction |
-
The motor speed can be varied using the potentiometer POT1 of the LVMC board as shown below.
-
Press SW2 to change the rotational direction of the motor. Motor runs CLOCKWISE by DEFAULT and this is indicated by LD11 in ON. Motor runs COUNTERCLOCKWISE when SW2 is pressed and the LD11 is OFF. Press the SW1 push button again to stop the motor. LD10 indicates ON or OFF state of drive.
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.
-
Connect the wires for Hall Effect sensor and phase windings of the motor to the appropriate terminals of the development board, as listed in the table below.
Motor Wire | MCHV3 Board |
---|---|
Motor Pin A | M1 (J17) |
Motor Pin B | M2 (J17) |
Hall Supply | 5V (J9) |
Hall Ground | GROUND (J9) |
Hall Signal | HALL A(J9) |
MCHV3 Board | |
---|---|
Motor Phases | |
Hall Connectors |
-
On the MCHV3 Development Board, use the appropriate AC supply voltage (e.g. 250V 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 | 250V |
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 | LVMC | |
---|---|---|
PKoB4 | J19 (PROGRAM/DEBUG on the front panel) | J13 |
USB | J6 (USB on the front panel) | J6 |
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 SensoredSPBLDC_MCHV3.X -> headerfiles) in the project SensoredSPBLDC_MCHV3.X
- Ensure either CLOSEDLOOP or OPENLOOP are defined in the LOOP CONTROLLER section.
- Uncomment the defined OVERCURRENT_DETECTION and/or STALL_DETECTION in the MOTOR FAULT DETECTION section to enable the motor fault detections.
- 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, run or stop the motor by pressing the push button. The appropriate LEDs should turn on and the motor should start spinning smoothly in one direction in the range indicated by the potentiometer. Ensure that the motor is spinning smoothly without any vibration.
MCHV3 Board | |
---|---|
Push Button | PUSH BUTTON - ON/OFF |
-
The motor speed can be varied using the potentiometer of the respective development board as indicated below.
-
Press the appropriate push button to stop the motor.
For additional information, refer to the following documents or links.
-
AN5423 Application Note "Sensored Single Phase BLDC Motor Driver using dsPIC33CK"
-
MPLAB® X IDE User’s Guide (DS50002027) or MPLAB® X IDE help