TB6560 stepping motor driver

Nema17 – Frequency – Temperature issue

Ask Question

Asked today

Active today

Viewed 27 times


Hi i am trying to use MCPWM to move a nema 17 motor with esp32.

I am using a TB6560 stepper motor driver and it setup is limmiting current to 1.5A and i am using 1/8 Microsteps. Motors is classic one 1.8degrees per step and 200steps per revolution.

I am using the mcpwm_unit_0 and timer_0 and at mcpwm0A i am sending a 50% duty pulse and also i use the mcpwm0B to control direction with duty of 0 and 100. For a non esp32 discussion this means that i am using 2 pwms one for the direction where i am setting it always from 0% to 100% duty and a second for the steps which is always 50%

I have understood that in order to move the motor in several different speeds i have to use the set the frequency of the pwm, that it is initially set in the config_t

I have used several different frequencies in some of them >10000Hz the motor was not moving at all and in <1000 it was also not a good movement. From 2000 – 10000 the motor was moving good but not smoothly in every case. Also i have notices that motor’s temperature increased, not too much but higher than it should normally work i think.

[*] how do i know which frequencies should be used for smoothed movement. The motor should be able to move slowly and fast ( i was thinking to control the frequency with a pid controller)? I assume that temperature issue is really an out of range frequency problem but what is the range , where it is defined and how to calculate it

Config settings:

void Nema::init(){


    mcpwm_config_t mcpwmConfig={
        .frequency = 2000,
        .cmpr_a = 0,
        .cmpr_b = 0,
        .duty_mode = MCPWM_DUTY_MODE_0,
        .counter_mode = MCPWM_UP_COUNTER






edited 1 hour ago

asked 5 hours ago


13933 bronze badges

  • (1) I usually start with 1kHz and increase to 10kHz. 5kHz moves the motor smoothly. (2) You don’t need any PID controller, which is for another purpose. (3) You might consider higher microstepping resolution for smooth movement. (4) Let me know you config setting. (5) Are you using this kind of cheap AliEx module with a huge heat sink? TB6560 3A Stepper Motor Driver Module – US$6. fr.aliexpress.com/item/… – tlfong01 3 hours ago   
  • (5) Are you reading this app note? TB6560AHQ 2-phase stepping motor driver App Note- Toshiba toshiba.semicon-storage.com/info/…. (6) And have you read the friendly datasheet at least 3 times? TB6560AHQ 2-phase stepping motor driver App Note- Toshiba toshiba.semicon-storage.com/info/… – tlfong01 3 hours ago   
  • TB6560AHQ 3.5A 40V 2-phase stepping motor driver Datasheet – Toshiba toshiba.semicon-storage.com/info/… – tlfong01 3 hours ago  
  • What do you mean by “temperature not too much higher than normally should”? Usually it is OK to heat up to 80C. Datasheet says, temperature shutdown is 170C. – tlfong01 3 hours ago  
  • By MCPWM, do you mean this?docs.espressif.com/projects/esp-idf/en/latest/esp32/… – tlfong01 3 hours ago  
  • 1i have edited the post to add the code for the config. I will go with 1/16 then microsteps. Yes the module is this with the juge heat sink. Yes the component of esp32 is this what you send. About the temp is about the motor temp. It is not 80C i suppose it is around 35 cause it is touchable. What should i check in the documents that you have send to me. – kyrpav 2 hours ago
  • 1i want to attach a cable on the motor and measure the tension on it. So i was going to use a pid controller in order to achieve tension. I was going to control frequency somehow. – kyrpav 2 hours ago
  • (6) I don’t understand what you meant by “to attach a cable on the motor and measure the tension on it” Do you mean you want to measure the “torque”? (7) BAD NEWS and WARNING – I have the feeling that you are a stepper motor newbie and you have chosen a bad driver TB6560 to start learning. For newbies I usually recommend to start with A4988 or DRV8833. Your might to search this or other forums on how to use A4988 or DRV8833*** – tlfong01 1 min ago  Edit  
  • References: (1) A4988 Stepper Motor Driver – MakerFabs makerfabs.com/a4988-stepper-motor-driver.html (2) DRV8833 2 Channel DC Motor Driver Module – MakerFebs makerfabs.com/dvr8833-2-channel-dc-motor-driver-module.html – tlfong01 45 secs ago  Edit  

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.