Stepper Motor Driver TB6600 and ESP32

Last updated on 19th December, 2020

I have read all sorts of information on the internet about the compatibility of the TB6600 and ESP32. Some suggested level shifting was needed, some said it just wouldn’t work, and others said it it fine. Well, I’ve tried it and here is what I found.

For those of you that don’t know, the TB6600 is a 4A rated stepper motor driver and the ESP32 is a popular microcontroller. At the heart of this post is the fact that the popular ESP32 microcontroller is 3.3v logic. This means that the GPIO pins read 3.3v when they are “ON” and 0v when they are “OFF”. However, the popular TB6600 stepper motor driver has a 5v logic input. So would a 3.3v “ON” from the ESP give a stable active “ON” on the TB6600?

Another concern I had was the current draw. The TB6600 datasheet suggests that a normal current draw is 10mA. Since the TB6600 has three inputs (Enable, Direction and Pulse), that should be 30mA. Let’s say 50mA to be on the say side. Checking the ESP32 datasheet, the maximum current is 1200mA across all GPIO pins. So 50mA for my driver should leave 1150mA on my ESP…all good!

Wiring it up

Wiring up is pretty straight forward on this one. I’ve put together the below diagram but I think this actually makes it look more complex and it is! All you need to do is connect:

  • ENA+, DIR+ and PUL+ on the TB6600 to 3 free GPIO pins on the ESP32 (I used GPIO pins 25, 26 and 27 in the diagram below)
  • ENA-, DIR- and PUL- on the TB6600 to the GND pin on the ESP32 AND the GND pin on the motor supply. More on this later….
  • the four stepper motor wires to A+, A-, B+ and B-. A little tip to check find the motor pairs on your stepper is to stick and LED across two wires. Turn the motor, if the LED flashes, you’ve found a pair!
  • motor power supply (12v in my case) to the VCC and GND on the TB6600
  • a USB cable to power your ESP32

Wait, is it ok to wiring the high voltage ground to the ESP32 ground?! Absolutely. It ensures that the signal from the ESP are correctly read by the stepper driver.

So do the TB6600 and ESP32 work together?

Yes! The TB6600 and ESP32 work perfectly together!

The TB6600 is a very powerful driver which I have hooked up to a 2.8A Nema 23. I am running 32microstepping and a T10x2 leadscrew. The result is a very smooth motion which is very power – I can’t stop it by hand even if I wanted too! I am using this set up to lift about 30kg over 600mm in about 1minute. I’ve been testing this system for about a month now and everything seems reliable! I’ve even managed to link this to my Alexa smart home system. This controls a secret bar which I have built into some industrial looking sideboards.

Anyway, short and sweet on this post. I hope it helps!

11 Responses

Add a Comment

Your email address will not be published. Required fields are marked *