Arduino & TB6612FNG - Grounding & other issues

As an initial test of the TB6612FNG Dual Motor controller I would like to connect it to a 12V motor and a 12V car battery and control it using an Arduino Uno powered via a USB cable from my computer.

My concern is that since the GND pins on the motor controller are connected internally this would connect the GND of my USB cable to the GND of my 12V car battery. Could this potentially damage my USB port or computer?

Also, when I wish to turn the devices off should I power down the Arduino then disconnect the motor controller from the battery or the other way around?

Thank you and apologies for such basic questions.

Hello, Bob.

It’s possible in the sense that the motor driver logic connections are not electrically isolated from the motor power, but it is not very likely (our carrier has reverse-voltage protection, so something would have to go very wrong). I am worried about other aspects of your setup. A 12V battery can exceed the 13.5V maximum recommended operating voltage when fully charged; motor noise/LC spikes could cause the motor voltage to go above the absolute maximum of 15V. By the way, your use of a car battery has me concerned that you might be using a motor that requires more power than this driver can deliver. Do you know the stall current of your motor?

For the order of power disconnection, I recommend first disconnecting battery power, then the USB cable. When connecting power, I recommend first connecting the USB cable then the battery power. These connection orders would avoid the situation where the Arduino’s AVR might become powered through the TB6612FNG.

- Ryan

Apologies for such a long delay before responding. Life got very busy and I did not have much chance to continue with my new electronics hobby :frowning: .

Firstly, thank you very much Ryan for your help.

You were correct that this set up does not (apparently) damage a usb port.

Unfortunately, you were also right to be concerned about my use of a car battery and the power draw of the motors! This choice was made as the project will be used on a motor home, and will be powered by the vehicle’s car battery.

The motors were salvaged from somebody else’s previous project. They appear to be some sort of heavily geared wiper motors (they turn very slowly, maybe 10 RPM when directly connected to the battery). Without load they draw a maximum of 0.6A @ 12.5V. I did not measure the stall current as I am concerned stopping the motors will chew the gearing. I’m also a reckless fool :unamused: .

Before starting my tests I checked the voltage of the car battery. It was a ‘safe’ 12.5V.

I hooked up the Arduino to the motor controller as outlined in the MeanPC guide ( … otors.html) to set STBY to HIGH and AIN1 to HIGH and AIN2 to LOW then applied various duty cycles to PWMA. All worked flawlessly, the motor spun at different speeds corresponding to the duty cycle. I hooked up a second motor and both motors behaved perfectly, even when simultaneously driven. After 20 seconds of operating the motor controller was cool to the touch. Very easy to set up and very pleased with the motor controller… until…

I then decided to try the motors in reverse. I spun the motors to full speed forward one at a time, braked them (AIN1/BIN1 = HIGH, AIN2/BIN2 = HIGH) one at a time until they stopped spinning then applied full reverse one at a time. The motors stopped but would not spin in reverse (they can do this fine when attached across a battery). The motor controller let out its usual high pitch whine but nothing else happened. I disconnected the battery.

I have now tried to get the motors to spin forward and everything appears to be completely dead. I have tried hard wiring AIN1 to 5V, AIN2 to 0V, STBY to 5V and then feeding PWMA with a 50% or 100% duty cycle and everything else I can think of. All connections seem good (checked with multi-meter) the motors are working when connected directly across the battery, the Arduino appears to be functioning correctly.

I suspect the spinning down of the motors and trying to reverse them may have stalled them and caused them to draw far more current than the TB6612FNG can handle. Any thoughts? Is there anything else I can test or is it time to invest in a slightly more hardcore motor controller, start taking LC spikes seriously and chalk one up to experience?

If you are worried about breaking the gears, you can stall it at a low voltage and extrapolate the stall current at your operating voltage. Stall current is proportional to voltage.

I am sorry to hear your driver stopped working. It is most likely broken beyond repair. You might have been able to avoid breaking it by slowly ramping up the PWM duty cycle, but I think it is time to measure your stall current and buy a motor driver/controller that has a continuous current rating well above your stall current.

- Ryan

Ah, that is useful. I will try to measure the stall current at a lower voltage this evening and see if it looks likely that this is what killed the motor driver.

I experimented with ramping the PWM successfully before trying the motors in reverse, the pololu motor driver is an excellent bit of kit. In any case I doubt it is a good idea to rely on slow ramping of the PWM to avoid the motor controller dying while in usage out on the road. I’d feel much happier knowing however rough the Arduino treated the motors the kit would be within spec.

As you say, it’s probably better to measure the stall current and ensure I buy a motor driver well capable of exceeding it.

Will update soon.

Thanks again.

Ok, I had a bit of trouble finding something that could jam my motor without damaging the nylon thread but have finally succeeded! :smiley:

I stalled the motor with it connected to a bench power supply and read 2(+/-0.5)A @ 3(+/-0.5)V. Worst case scenario then 2.5A @ 2.5V so the stall current when attached to a fully charged battery is around 14A @ 14V. Take that, mathematics! I think this neatly explains why I had trouble with the previous motor driver, lesson learned.

I have 2 of these motors so I’m looking for either:

  • Arduino compatible dual motor driver rated at ~15A/channel:
    Dual VNH2SP30 Motor Driver Carrier MD03A / Dual VNH3SP30 Motor Driver Carrier MD03A
  • Arduino compatible single motor driver rated at ~15A:
    VNH2SP30 Motor Driver Carrier MD01B / Pololu High-Power Motor Driver 18v15

I am ok with spending the little extra money to over-spec. I am really most concerned about not blowing another controller. Very happy if the unit has some sort of damage limitation built into it… what I intend to do at my bench and what actually happens tend to be two different things :blush:

  1. Any suggestions about the best unit to purchase?
  2. Can I inline a fuse from the battery to the motor controller so I blow fuses instead of kit?



My recommendation is to use our dual VNH5019 motor driver shield. I think the VNH5019 would be better than the VNH2SP30 in your application (it has a higher maximum operating voltage but similar current ratings) and our shield should be easier for you to use with an Arduino than our carriers.

ST’s VNH drivers are quite robust, so you probably don’t need any external protections for them, but yes, you can put a fuse between the battery and the driver to help protect it.

- Ben


The motors will be situated roughly 1-2m away from the Arduino in the actual application. Is it OK to connect a motor to this shield with such a long cable?

I had originally planned to connect the driver to the Arduino with the long cable then to the motors with a much shorter cable.

If you can have the motor driver, motors, and motor power supply all close to each other (and the Arduino far away), that would probably be best, assuming the Arduino signal lines don’t pick up too much noise. If you have to decide between having short motor leads or short power leads, then I recommend you go with the setup that allows for short power leads. Note that our dual VHN5019 motor driver shield does not actually have to be used as an Arduino shield. All of the driver pins are broken out along the left side of the board, which means you can use it just like you would our VNH2SP30 motor driver carriers. In the following diagram, the boxes labeled “microcontroller” and “logic power” would effectively be your Arduino:

The user’s guide has more information about using this board as a general-purpose motor driver. Note that our Arduino library should work for you as long as your connections match those that are made when the board is plugged into an Arduino as a shield.

- Ben

The whole lot will be used as part of a homebrew solar tracker on a motorhome (RV). The Arduino will be situated inside the vehicle and the motors will be mounted in a special enclosure with a solar panel attached outside the vehicle. It will all be powered by the leisure batteries which can not realistically be moved.

Using this as a sheild would allow for marginally shorter power leads at the expense of longer motor leads, so, following your advice I will take that route. Of course, it will then be inside a small enclosure along with the Arduino inside the vehicle so I will have to watch the heat.

Thanks for pointing out it’s broken out! If I run into trouble I can always set it up as I had initially intended with the motor driver inside the unit with the motors, outside the vehicle.

Will purchase shortly.

Thanks again.

You might need to play around with your setup to determine what works best for you, or at least think about the trade-offs a bit. For example, 2’ of power wires and 2’ of motor wires could very well be worse than 2.5’ of power wires and a few inches of motor wires, even though the former case has the shorter power leads.

- Ben