Arduino Uno, Nema 23, and TB6600 controller

I’m hoping somebody can shed some like on this subject as I’m an old dog trying to learn new tricks. I’ve been using a few X controllers on my home build cncs. I’m not an electrical engineer or a programmer. I do know Basic and worked with Cobol, so that kind of puts things in perspective. Anyway, after one of my X controllers started smoking, I decided it was time to build my own rig.

Now I’ve successfully put together a system for Nema 17 motor with an Uno clone and a small power supply with a g shield using UGS. The Grlb was. .9 version and I flashed it with 1.1.

I decided to order some tb6600 drivers, a 24 volt power supply and hook up a new Uno clone to run Nema 23 motors rated at 2.8 amps.

Well to make a long story short I spent the last 3 days trying to get one motor to spin correctly. Using available wiring diagrams from various sources, I did manage to get the motor to jog. The problem is it only spinning one way when jogging in opposite directions. I tried swapping drivers, I tried swapping motors, I tried different wiring variations as shown in these diagrams. Some have EN utilized, some don’t.

I decided to start moving a few wires around and finally got the motor to spin correctly when I moved a wire from a non -pwm position to a pwm position.

My questions are this.

  1. Is there anything hazardous about running the motors like this? My two wires are in Pin 3 and pin 6 as opposed to what is shown in the screen shot below.

  2. Why wouldn’t the motors work correctly when wired like the examples?

  3. I don’t know enough about Arduinos to answer these myself, and videos kind of drive me nuts.

Thanks for any help you can provide.

Just Botond video screen shot:

You don’t show what examples you tried that didn’t work, or the code you are using to drive them. Which wire configuration you use depends on how the ports are configured on the Arduino. You have correctly wired it for common ground signal high, if the wires are connected as it looks like in the somewhat blurry screen shot.

Without the code and details of what didn’t work, we really can’t tell you why they didn’t work. But generally, sometimes you connect all the positives together and switch the negative side through the ports, and some examples show that. But then the code has to follow.

Here’s the Arduino Uno pinout for reference for those like me who can’t remember which pin is which. :smiling_face:

Thanks for responding. Grbl 1.1 is flashed on the Uno, I’m using UGS or Gsender to run the motor so there’s no code for me to write. When one googles the key variables, tb6600, Uno, nema 23, and wiring diagram, the results are you get a few videos or images with similar layout. I tried various diagrams, a couple use the En+ and En- pins, many do not. I swapped motors a couple times, changed current settings, step configurations between 16 and 32, etc. Wired up as the diagrams show, the motor spins in the same direction when jogged in Y + or Y- in either grbl controller software. In all those cases, the two wires were connected in the diagrams to adjacent pins, one of which was a pwm, the other non pwm. I finally got the correct movement when I went to two pwm pins.

Now I wonder if those wiring diagrams only work with certain arduino code and not necessarily Ugs/gsender? I did find a diagram using a gshield with the tb6600 drivers but haven’t hooked that up. I can’t believe that wiring for a cnc through a sender isn’t more commonly found if that is the case.

This is what finally worked with pins 3 and 6, both pwm.

Oh, I missed the mention of grbl, sorry.

Yes, I think that grbl configures for logic high, because that’s what “step sticks” use.

One thing I keep forgetting is that enable on these devices is usually enable-LOW meaning that when you supply current across EN+/EN- it disables the driver. You can leave it off if you want it always enabled when on. That’s why it is left out on a lot of diagrams.

Open drain might not be available on Arduino UNO. But it’s used often on 3.3V microcontrollers when the optocoupler wants 5V; you hook up +5V to all the + terminals, and then the microprocessor has to be configured for the gate to be a switch on the respective - terminals. That’s why you see it a lot; it makes these more compatible with modern microcontrollers that don’t supply 5V for logic-high.

1 Like

For anyone else in this situation, this fellow has it wired up in a similar manner. Too late for me, but maybe not for someone else.

Build a CNC Controller with Arduino, TB6600 and GRBL

So he grounded all the opto-couplers on the driver boards( the - signals ) and that’s OK with an old 5V Arduino which supplies upto 40mA on the outputs IIRC. But, any of the 3.3V Arduino’s or ESP32 boards that might be a problem as they generally source far less current on the IO pins.

In that case the 3.3V controller boards might have better at "sink"ing signals and therefore you’d connect all the driver + signals to a 5V supply and the - signals to your controller IO pins.

Also, I don’t think you have to create a common ground as he did in that video since the signals are NOT electrically triggered via common logic levels. Instead, all the control signals are activated with opto-couples which are LEDs and LEDs just need current flowing through them but you will need the same power supply connected. ie if you supply 5V to the + signals then your controller board needs to have the same ground as that power supply.

Just to be clear, you have to change the configuration on the microcontroller side to choose a configuration that enables open-drain / open-collector operation. With some firmware this can be done in configuration, with other firmware it may require a rebuild. Just one of those things that you have to check and can’t only wire it up.

1 Like