Git Product home page Git Product logo

matlab-sip-mc-dspic33cdvl64mc106-foc-smo's Introduction

Microchip Logo.

MATLAB SIP dsPIC33CDVL64MC106 FOC with SMO and Field Weakening

1. INTRODUCTION

This document describes the setup requirements for running the Sensorless FOC with field weakening algorithm and a Sliding Mode Observer (SMO), using MATLAB/Simulink and dsPIC33CDVL64MC106 Motor Control Development Board.

The SMO implementation is referenced from AN1078 “Sensorless Field Oriented Control of a PMSM”.

2. SUGGESTED DEMONSTRATION REQUIREMENTS

2.1 MATLAB Model Required for the Demonstration

  • MATLAB model can be cloned or downloaded as zip file from the Github repository (link).

2.2 Software Tools Used for Testing the MATLAB/Simulink Model

  1. MPLAB X IDE and IPE (v6.20)
  2. XC-DSC compiler (v3.00)
  3. MATLAB R2023b
  4. Required MATLAB add-on packages
    • Simulink (v23.2)
    • Simulink Coder (v23.2)
    • Stateflow (v23.2)
    • MATLAB Coder (v23.2)
    • Embedded Coder (v23.2)
    • MPLAB Device blocks for Simulink (v3.54)
    • Motor Control Blockset (v23.2)

NOTE: The software used for testing the model during release is listed above. It is recommended to use the version listed above or later versions for building the model.

2.3 Hardware Tools Required for the Demonstration

  • dsPIC33CDVL64MC106 Motor Control Development Board (EV04R09A)
  • 24V Power Supply (AC002013)
  • 24V, 3-Phase Brushless DC Permanent Magnet Hurst Motor (AC300022)

NOTE: All items listed under this section Hardware Tools Required for the Demonstration are available at microchip DIRECT.

3. HARDWARE SETUP

This section describes hardware setup required for the demonstration.

  1. The blue color power-on LED (LD4) indicates the device dsPIC33CDVL64MC106 is populated on the development board

  2. Connect the 3-phase wires from the motor to PHC, PHB, and PHA of the connector J10(no specific order), provided on the dsPIC33CDVL64MC106 Motor Control Development Board.

  3. Plug the 24V power supply to connector J1 on the dsPIC33CDVL64MC106 Motor Control Development Board. Alternatively, the development board can also be powered through connector J2.

  4. The board has an onboard programmer PICkit™ On Board (PKoBv4) , which can be used for programming or debugging the microcontroller or dsPIC DSC on the development board. To use the onboard programmer, connect a micro-USB cable between the Host PC and connector J12 on the dsPIC33CDVL64MC106 Motor Control Development Board.

  5. Alternatively, connect the Microchip programmer/debugger MPLAB® PICkit™ 4 In-Circuit Debugger between the Host PC used for programming the device and the ICSP header J6 on the dsPIC33CDVL64MC106 Motor Control Development Board (as shown). Ensure that PICkit 4 is oriented correctly before proceeding.


4. BASIC DEMONSTRATION

Follow the below instructions step-by-step, to set up and run the motor control demo application:

  1. Launch MATLAB (refer the section “2.2 Sofware Tools Used for Testing the MATLAB/Simulink Model").

  2. Open the folder downloaded from the repository, in which MATLAB files are saved (refer the section "2.1 MATLAB Model Required for the Demonstration").

  3. Double click and open the .m file. This .m file contains the configuration parameter for the motor and board. By default, the .m file is configured to run Hurst 300 motor and LVMC board. Run the file by clicking the “Run” icon and wait till all variables gets loaded on the ‘Workspace’ tab.

  4. Double click on the Sensorless FOC Simulink model.

  5. This opens the Simulink model as shown below. Click on the "Run" icon to start the simulation.

  6. To plot the simulation result, Data Inspector is used (refer to figure below). To observe the additional signals, log them as required. Alternatively, normal Simulink Scope can be used to plot the signals.

  7. From this Simulink model an MPLAB X project can be generated, and it can be used to run the PMSM motor using LVMC board.

    To generate the code from the Simulink model, go to the "MICROCHIP" tab, and enable the tabs shown in the figure below.

  8. To generate the code and run the motor, click on ‘Build Model’ or ‘Clean Build Model’ option under the “Microchip” tab. This will generate the MPLAB X project from the Simulink model and program the dsPIC33CK256MP508 device.

  9. After completing the process, the ‘Operation Succeeded’ message will be displayed on the ‘Diagnostics Viewer’.

  10. If the device is successfully programmed, LED1 - LD1 will be blinking and the LED2 - LD2 will be OFF.

  11. To Run the motor, press the push button SW1.

  12. The motor speed can be varied using the potentiometer (labeled “POT1”). Approximately, after 70% of the full potentiometer value (approximately at 3000 RPM), the motor enters into field weakening region.

  13. Press the push button SW1 to stop the motor. Make sure motor is reduced minimum potentimeter value before stopping the motor.

NOTE: The LED2 is connected to the Fault pin of the Gate Driver of the dsPIC33CDVL64MC106 device. If any gate driver fault occurs this LED will be turned ON. To reset this fault, the pushbutton SW3 has to be pressed. Once fault is reset, the LED2 will be turned OFF.

5. DATA VISUALIZATION USING MOTOR CONTROL BLOCKSET (MCB) HOST MODEL

The Sensorless FOC model comes with the initialization required for data visualization using Motor Control Blockset Host Model (MCB Host Model). The MCB Host Model is a Simulink model which facilitates data visualization through the UART Serial Interface.

  1. To establish serial communication with the host PC, connect a micro-USB cable between the host PC and the dsPIC33CDVL64MC106 Motor Control Development Board (J12 connector). This interface is used for programming as well.

  2. Ensure the sensorless FOC model is programmed and running as described under section "4. Basic Demonstration" by following steps 1 through 13.

  3. Open the MCB Host model and double click on the “Serial Setup” block. Then select the appropriate COM port connected to the hardware from the drop-down menu and set the baud rate as 460829. Please note that the same baud rate is required to be chosen in the Sensorless FOC model (the baud rate can be viewed on the “UART Configuration” block inside “MOTOR CONTROL DEVLOPMENT BOARD Template”).

  4. Open the “UART_Rx” subsystem to configure the COM port. This can be done by configuring the “Host Serial Receive” block of the “UART_Rx” subsystem. Ensure to select the same COM port configured in step 3.

  5. Click the run icon of the MCB Host model to open the scope window and monitor the signals.

  6. In the figure below, one example is shown where two signals (estimated and reference speeds) have been plotted.

REFERENCES:

For more information, refer to the following documents or links.

  1. AN1078 Application Note “Sensorless Field Oriented Control of a PMSM”.
  2. dsPIC33CDVL64MC106 and dsPIC33CDV64MC106 Motor Control Development Boards User’s Guide (DS50003060)
  3. MPLAB® X IDE installation
  4. MPLAB® XC-DSC Compiler installation
  5. Motor Control Blockset
  6. MPLAB Device Blocks for Simulink :dsPIC, PIC32 and SAM mcu

matlab-sip-mc-dspic33cdvl64mc106-foc-smo's People

Contributors

harishagari avatar hitheshcn avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.