2x1.2A DC Motor Driver (TB6612FNG) (DRI0044)

This is a placeholder topic for “2x1.2A DC Motor Driver (TB6612FNG)” comments.

This DFRobot micro dual way DC motor driver is design based on TB6612FNG motor driver IC. It inherits DFRobot L298N motor control logic, which only need four pins…

Read more

Hi. Have you heard of any issues when switching from fwd to rev, without stopping?

Hi Peter
That will be an issue whatever driver you are using. I think some of the more exotic ones take steps to prevent this happening, don’t know about this one.

Even if you don’t get the magic smoke you would probably get mechanical damage. I have seen 10mm steel shafts bent when a motor is allowed to coast past a limit switch without some form of electrical braking. And that is just motor inertia.
Best not to do it. NOT recommended.
Cheers Bob

Hi Robert. Yes the magic smoke got out! :smiley:
I looked at the data sheet and theoretically there is a delay between commands built in, but in theory practice works , but in practice theory does not! :slight_smile:
I will add code to the program to go through the stop sequence first before the change in direcion is given. This is for model trains, so mechanical damage is possible, but more likely the reverse field current would spike.
Appreciate the reply.
Kind regards

Hi Peter
There should be a 'braking" situation available on the controller where both ends of the motor are at the same potential, ie; the motor is effectively shorted. This stops it dead. If you are doing this with a sketch take the controller through this phase briefly before changing direction.

Back in the day, before H bridges when direction change was done with relays a small circuit was used consisting of a bridge rectifier connected across the motor to detect the presence of voltage either driving or generated which indicated motor movement. This voltage was part of an interlocking circuit which prevented the relay changing state until the motor was stationary. Ingenious and it worked.

The same thing could still be done and any voltage fed back to the controlling system to inhibit change over until the motor has stopped. Lots of ways to do it.
Cheers Bob

That delay could be a bit of “dead time” introduced between PWM state changes. This is to ensue you cannot have a short circuit across the power supply by having all “H” switches momentarily on at the same time. Nothing to do with direction change.

1 Like

Hi again Peter
Just had a look at the schematic and chip data sheet for that motor driver.

It would appear that motor braking has been provided. It appears a braking condition occurs with 2 conditions.

  1. Both IN1 and IN2 both high.
    This cannot happen as one IN pin is driven by the DIR signal and the other pin is driven by the inverse of this via an inverting Schmidt trigger so both pins cannot ever be the same.

  2. Whenever the PWM signal is LOW, after time t2 (t3). So by stopping the PWM the motor should be in a braked situation.

The braking situation can be checked easily by-- Leave everything on and connected. Stop the PWM. Try to turn the motor manually by hand. If electrician braking is on you should find considerable resistance to this attempt to turn. This by the way is a quick and cheerful way to check any brushed motor, short the connections together and try to turn by hand. There should be a great difference between shorted and un-shorted situation (the motor is acting as a generator)

My suggestion if you want to change direction would be.
Assume PWM and motor is running.
Detect direction change request.
Stop PWM “digitalWrite(PWM pin,LOW)”.
A short delay, motor should stop quickly so “delay(5)” 5mSec should be plenty but you may need more.
Apply direction change signal
Restart PWM. “analogWrite(PWM pin,PWM value)”.

I think this should work. The message here is DO NOT change direction while the PWM or other motor drive is active. If necessary you may have to interlock this in software so this can’t happen. Personally I would prefer any interlocks to be in hardware but at the moment I can’t see any easy way to achieve this at the moment.

Keep us posted on progress. I would like to know if I am wrong as I have not got the bits to experiment.
Cheers Bob

1 Like

Hi Bob.
Much appreciated for your reply.
I will tidy up the garage to attempt to find the spare modules I do have.
What better way to spend the additional hours gained for the cease of daylight savings!:joy:
Shall keep you posted.

1 Like

Hi Peter,

Did you end up getting anywhere on this one? I had a look to see if I could add anything to Bob’s response, but it’s spot on.

Keen to see how you go!