Spindle speed and direction control using IBT2 (BTS7960)

Hello,

I've been checking the possibilities to control the RPM and direction of a 12V brushed DC motor, used as an engraver spindle. The engraver is controlled by a nano with grbl, so I have one pin for spindle direction and one for spindle PWM. The IBT 2 (dual half-bridge bts7960 board) looks like a good choice. I've read there are two ways people usually connect this board:

  1. by holding the L_EN and R_EN high, thus enabling both directions and using 2 PWM pins on arduino to to drive the motor, each direction = 1 PWM pin
  2. by connecting L_EN and R_EN to PWM pin on arduino to control RPM and connecting L_PWM and R_PWM to digital outputs, controlling the direction

I was wondering why is the second option done in this way... Wouldn't it be possible and more straightforward to:

  1. connect both L_PWM and R_PWM to arduino PWM to control the speed and control the direction by connecting the L_EN and R_EN to digital outputs?

The other thing I was pondering, since I only have one digital pin on arduino to control the direction, was to connect the "direction" arduino pin to, let's say L_EN and via a NOT gate to R_EN in which way I could control the direction using one digital pin on the arduino and send the PWM signal to both L_PWM and R_PWM. Since only one of the EN inputs on the IBT 2 is enabled at a time it would kind of make sense to me.

Of course one must be careful not to change the direction with PWM at a non zero value, but I think that applies also to the method number 2 if I'm not mistaken...

Your insights would be greatly appreciated!

Do you have a spare analog pin? They can be used as digital as well.

I'm limited by design of grbl. They say direction is controlled by a single pin. And I don't feel like editing the source code of it :slight_smile: