Example application for X-NUCLEO-IHM07M1 board connected to a 3-phase brushless motor with Hall sensors.
Dependencies: BLDCmotorDriver RateLimiter mbed
Fork of HelloWorld_IHM07M1 by
Getting Started with X-NUCLEO-IHM07M1
This example demonstrates how to use the X-NUCLEO-IHM07M1 component with one of the STM32 Nucleo-64 platforms and a three-phase brushless DC (BLDC) motor with Hall sensors.
HW Prerequisites
- X-NUCLEO-IHM07M1
- STM32 Nucleo-64 board
- external DC power supply
- low voltage three-phase BLDC motor with Hall sensors
X-NUCLEO-IHM07M1 Jumpers Configuration
Configure the jumpers of your X-NUCLEO-IHM07M1 board as shown below:
- JP1 open
- JP2 open
- JP3 closed
- J9 closed
- J5 closed on 2-3 (single shunt)
- J6 closed on 2-3 (single shunt)
- J7 open
For more details please refer to the X-NUCLEO-IHM07M1 user manual.
BLDCmotorDriver Library
This example is based on the BLDCmotorDriver motor control library by the TVZ Mechatronics Team, University of Applied Sciences Zagreb, Professional Study in Mechatronics. The BLDCmotorDriver library is a simple implementation of the six-step algorithm and needs Hall sensors to estimate the correct timing for commutation. If you want to use sensor-less BLDC motors with X-NUCLEO-IHM07M1 or if you want an optimized implementation, you must use a different software package like X-CUBE-SPN7, based on STM32Cube.
The HelloWorld_IHM07M1 application has been tested with the Nanotec DF45M024053-A2 motor, a 24V three-phase brushless motor with Hall sensors. This example implements a temperature check to prevent overheating.
If you use a different motor, please be advised that you may need to tweak the configuration parameters for the BLDCmotorDriver library.
Connecting the Motor
In the picture above you can see an example setup with the Nanotec DF45M024053-A2 motor and a 24V power supply.
If you use the same motor, please connect the brown, grey and yellow phases to the OUT1, OUT2 and OUT3 connectors of the X-NUCLEO-IHM07M1 board respectively. Then connect the blue, green, white, red and black wires for the Hall sensors to the A+/H1, B+/H2, Z+/H3, 5V, GND connectors as shown in the picture.
If your motor is different, you must pay attention to connect the motor phases and Hall sensors pins in the correct order otherwise the motor won't spin.
Spinning the Motor
Open a terminal window (baudrate 9600, 8N1) to display the user interface of the HelloWorld_IHM07M1 application.
Press the 'w' character to start spinning the motor and speed it up; press the 's' character to slow it down and turn it off.
Note
You need a terminal emulator installed on your PC to perform serial communications with your STM32 Nucleo platform. If you do not have it, please download and install one of the following terminal emulation programs:
X_NUCLEO_IHM07M1/SPN7Driver.h
- Committer:
- avilei
- Date:
- 2016-10-20
- Revision:
- 12:33614e1dc638
- Parent:
- 7:022c306baeb9
File content as of revision 12:33614e1dc638:
/* mbed Microcontroller Library * Copyright (c) 2006-2016 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** ****************************************************************************** * @file SPN7Driver.h * @author STMicroelectronics * @brief Header file for SPN7Driver based on BLDCmotorDriver class ****************************************************************************** * @copy * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>© COPYRIGHT 2016 STMicroelectronics</center></h2> */ // This example is based on the BLDCmotorDriver motor control library // by the TVZ Mechatronics Team, University of Applied Sciences Zagreb, // Professional Study in Mechatronics: // https://developer.mbed.org/teams/TVZ-Mechatronics-Team/code/BLDCmotorDriver/ #ifndef __SPN7DRIVER_H__ #define __SPN7DRIVER_H__ #include "mbed.h" #include "BLDCmotorDriver.h" class SPN7Driver : public BLDCmotorDriver { public: SPN7Driver(PinName pIN1, PinName pIN2, PinName pIN3, PinName pEN1, PinName pEN2, PinName pEN3, PinName pH1, PinName pH2, PinName pH3, PinName pFault); void setDutyCycle(float dutyCycle); protected: void commutation(); }; #endif // __SPN7DRIVER_H__