TB6612FNG H-Bridge ...
 
Notifications
Clear all

TB6612FNG H-Bridge Motor Controller - Better than L298N?

5 Posts
3 Users
0 Reactions
2,559 Views
(@dronebot-workshop)
Workshop Guru Admin
Joined: 5 years ago
Posts: 1109
Topic starter  

Today we are going to work with the TB6612FNG, a MOSFET-based H-Bridge Motor Controller that has many advantages over the popular L298N.

Article with code and more information - https://dbot.ws/tb6612fng

When you want to control the speed and direction of a DC Motor an H-Bridge is what you need. And when working with low-voltage motors the go-to module has always been the L298N. It’s cheap, easy to use, and available from just about everywhere you buy electronic parts.

But the L298N is far from perfect. It drops the motor voltage by 1.4-volts and dissipates all of that lost power as heat, which is why it requires such a large heatsink. And it’s pretty large, mostly due to that big hunk of metal.

The problem with the L298N is that it uses bipolar junction transistors (BJTs). A better way to design an H-Bridge is to use MOSFETs.

Enter the TB6612FNG. This MOSFET-based H-Bridge can replace the L298N in most applications, and it is so efficient that it doesn’t even require a heatsink! It’s a few pennies more than the L298N, but as I’m sure you'll see, it’s well worth it.

This device is also much smaller than the L298N, it’s available on dedicated motor control modules, on Arduino shields, and HATs for the Raspberry Pi. And, perhaps best of all, you can wire it into your L298N circuit and use the same code with it!

Here is what we will be covering today in our look at this H-Bridge motor controller:

00:00 - Introduction
02:03 - Introduction to TB6612FNG
04:55 - Look at TB6612FNG
06:58- TB6612FNG vs L298N
09:50 - TB6612FNG Arduino Hookup
25:06 - Ugly Robot Car

Yes, the last one was an “ugly robot car”. I put the TB6612FNG onto one of those acrylic car bases and gave it a test using a versatile library from Sparkfun. I think you’ll agree, that’s one ugly car - but it does work!

"Never trust a computer you can’t throw out a window." — Steve Wozniak


   
Quote
Aubey
(@aubey)
Member
Joined: 4 years ago
Posts: 6
 

Hi Bill,

I have been struggling with the Adafruit version of the TB6612 breakout board and DC motors. I cannot for the life of me get it to turn the motors. The boards seem the same in terms of pinouts, the are just in different locations. I am using two Mini DC Electric Gearbox Dual Shaft Geared TT Motor (3-6V), the little yellow ones that are available everywhere. I wired it as per the pinout you provided (Adafruit support for this board is slim). The motors are powered by a 5 X AA battery pack (6.5-7.5) and the Arduino from my laptop USB. The board is getting power from both sources and have ground shared. I have tried both your layouts and sketches - nothing. I reviewed the Sparkfun header files and I don't see anything specific to their version of the TB6612 breakout board. It may be worth nothing that I was unable to get the Adafruit Motor shield V.2 working either. I have some L298N H-bridges, that I may go with, but I do like the idea of the lower power hit of the TB6612 H-bridge. Any help or suggestions would be greatly appreciated. Thanks.


   
ReplyQuote
Aubey
(@aubey)
Member
Joined: 4 years ago
Posts: 6
 

So, after a good night's sleep, I figured out that I need to solder the headers to the TB6612 breakout board. Did that this morning - my first time soldering anything more than battery pack lead - and I have one motor working. I need to check the solder on the A motor pins and retry. 

Just a note, for posterity, about how the pandemic is complicating this process. My wife was sent home from work last week to quarantine because she had been in (masked) contact with a co-worker who had tested positive. I have a rare neuroendocrine type of cancer and an autoimmune disease, so she has been quarantining in the basement, where my office/workshop happens to be located. She also shares the office part when she works from home of the large room (it was our son's large ensuite bedroom I built when he was a teenager), so I must wear a mask, try not to touch anything needlessly, and keep my time in the Q-zone to a minimum. So while I am struggling to solder tiny header pins, for the first time ever, she is worriedly telling me I am spending too much time in the basement. Crazy times.


   
ReplyQuote
(@dronebot-workshop)
Workshop Guru Admin
Joined: 5 years ago
Posts: 1109
Topic starter  

@aubey

Glad you have it figured out, and good luck with the soldering!

And I am so sorry to hear of your diagnosis, it must be even more difficult with your wife isolating.  I hope everything works out for you both.

😎

Bill

"Never trust a computer you can’t throw out a window." — Steve Wozniak


   
ReplyQuote
jBo
 jBo
(@jbo)
Member
Joined: 4 years ago
Posts: 105
 

I have been working through this demo from 2019. My theory is that if I can get the simpler case working, I'll have an easier time debugging why only one motor of my robot car is going.  😉   We'll see.

Anyway, I wired it up, checked the pinouts, and it works! I did notice one thing. Suppose I have one potentiometer (A) set to half speed or thereabouts. Motor A spins. The pot for motor B is set to nothing, no motion. Now, I gradually increase the value for B, and, as expected, motor B starts to turn. However, at the same time, motor A goes more slowly, and may even stop, without changing Pot A at all.

I think I understand what's going on. The two motors are sharing the battery voltage, and with some settings of the potentiometers it's possible that there's not enough to go around. This seems reasonable; however, my real question is, what do people generally do in situations like this? 

I mean, I can increase the batteries from the 4xAA I'm using now, to a 5- or 6-pack, but the real issue is that the two "channels" of Motors A and B are coupled, I guess, since one affects the other. Trying to think through this, if I use a joystick control the issue might resolve itself naturally, assuming the next theoretical application is to drive a robot car in a straight line. But right now, I don't have an application, just doing the demo and thinking on underlying issues.

So, have others encountered something like this, having one input (pot) affect both the intended motor, and also the other, not intended? Thank you.

In theory, theory and practice are the same.
In practice, they're different.


   
ReplyQuote