esp-idf/examples/peripherals/mcpwm/mcpwm_brushed_dc_control
Kewal M Shah 2008f4d88c feature: add Motor Control PWM(mcpwm) driver
1. Name change from chopper to carrier, block diagram update, minor changes to example codes
2. mcpwm_reg.h changed, brought uniformity in comments, worked on suggestions, duty to accept float. Some name changes!
3. Minor readme changes and Indetation
4. Minor change:  move mcpwm_reg.h and mcpwm_struct.h to new path
5. Minor change: addition of BLDC example code and Readme
6. Name changed from epwm to mcpwm
7. Improve the reg name in mcpwm_struct.h
8. Name change chopper>carrier, deadband>deadtime
2017-05-12 15:47:59 +08:00
..
main feature: add Motor Control PWM(mcpwm) driver 2017-05-12 15:47:59 +08:00
Makefile feature: add Motor Control PWM(mcpwm) driver 2017-05-12 15:47:59 +08:00
README.md feature: add Motor Control PWM(mcpwm) driver 2017-05-12 15:47:59 +08:00

MCPWM brushed dc motor control Example

This example will show you how to use MCPWM module to control brushed dc motor, you need to make connection between ESP32 and motor driver

This code is tested with L298 motor driver, user needs to make changes according to the driver they use

Motor first moves forward, then backward and then stops for 2 Secs each countinuously

Step 1: Pin assignment

  • GPIO15 is assigned as the enable/input 1 for motor driver
  • GPIO16 is assigned as the enable/input 2 for motor driver

Step 2: Connection

  • connect GPIO15 with input 1 of motor driver
  • connect GPIO16 with input 2 of motor driver

Step 3: Initialize MCPWM

  • You need to set the frequency and duty cycle of MCPWM timer
  • You need to set the MCPWM channel you want to use, and bind the channel with one of the timers