TB6612FNG Dual Motor Driver Carrier - no output

Hey again,

I’d like to bring up this topic, because my issue involves the same circuit/robot.

Anyways, I’ve been having trouble powering my 4wd with the two 9vs I’ve been using. While I’ve read the post about 9v batteries, I find it odd that all four motors can be driven perfectly fine using just ONE 9v when I plug them directly to the battery, but with the motor controller, they stall like crazy…they won’t even start.

Is there any way to fix this? One of the people I talked with said that when he used this particular controller, he never got much torque out of his motors.

Can you measure the battery voltage while you are having problems? I suspect the voltage is dropping below the controller’s minimum voltage. Really you should be using better batteries.

- Ryan

Ok, so I did a little more chatting, and I was told I should isolate my motor power from my logic power, using the following circuit:

wa4dsy.net/robot/uploads/images/scan005.jpg

The problem is, how do I do that with the Baby-Orangutan? It doesn’t have a Vmotor pin.

Hello.

That circuit does not isolate the two power supplies, it just helps decouple them. The Baby Orangutan has this decoupling built-in. Did you try what Ryan suggested? Specifically, can you connect your battery directly to the motor and hold it stalled while you measure the battery voltage? When you try to draw a lot of current from a 9V battery (e.g. as happens when you first apply power to a motor at rest), the voltage can drop very significantly. If it is dropping below the minimum input voltage of the driver you are using, then that would explain the behavior you are seeing:

  1. You apply power to the motor and the inrush current (effectively the motor’s stall current) is more than the battery can deliver, so the battery voltage drops.
  2. The battery voltage falls below the driver’s minimum voltage before the motor can start moving (or before it can start moving very quickly), and the driver turns off.
  3. There is no longer a heavy load on the battery, so it’s voltage rises back to nominal, and the process repeats all over.

The reason why you don’t see this behavior with the battery connected directly to the motor is that even when the battery voltage drops significantly, it is still enough to get the motor started rotating, and once the motor is turning, the current it is trying to draw drops off significantly (the stall current/inrush current can be an order of magnitude greater than the free-run current), which allows the battery voltage to rise again closer to its nominal voltage.

It really doesn’t make sense to continue trouble shooting this problem while there is a known problem (i.e. an inadequate power supply). If you change to a more suitable power supply and still have issues, then we can look into it further.

- Ben

I was told I need to decouple them or isolate them, either by putting capacitors across the motor leads or making the circuit that I posted above.
Yes, when I do that test, the voltage does drop below the controller’s threshold, this brownout behavior happens even when I use AA’s in series, and I still get it when I only tell my controller to turn the motors controlled by the Orangutan…

Also, to quote one of the people I was talking to:

"Just now I measured a fresh 9V under a 770 MA load (a 10 ohm resistor). Voltage dropped from 9.6 (no load) to 7.7. I computed the battery impedance to be 2.5 ohms. If you parallel two that number is cut in half and the available current is doubled. Seems reasonable to run a mini sumo.

And while I was messing around I tried 4 AA in series. I got 1 ohm series impedance for all 4 or 0.25 ohms per cell so 6 of them would be 1.5 ohms. Compare to paralleling two 9V batteries where the series impedance would be 1.25 ohms. Bottom line: paralleling two 9V batteries is better than series connecting 6 1.5V AA cells. Who knew?"

I’m pretty sure this result is wrong. Across almost all battery chemistries, the discharge rate is proportional to the capacity, and some typical numbers for NiMH batteries might be 2500 mAh for AA cells and 200 mAh for 9V batteries, which is more than a 10-to-1 ratio. Even if you put two 9V batteries in parallel, you have a fifth the capacity of AA cells, and probably somewhere close to a fifth the available discharge rate. By the way, I generally recommend you avoid putting batteries in parallel unless you really know what you’re doing.

I think you should simplify your system as much as possible until one of two things happens: 1) the problem goes away or 2) you have the simplest possible setup that demonstrates the problem.

Can you disconnect your external motor driver and just try using a single motor connected to one of the channels on your Baby Orangutan? How many AA batteries are you using to power the Orangutan, and what chemistry battery are you using? Are they new/freshly charged (what open-circuit voltage do you measure on them)? What is the stall current of the motors you are using?

As I said in my previous post, the Baby Orangutan already decouples the logic voltage from the motor power through its 5V regulator and various power caps. Adding a larger capacitor across power and ground could help, but that would just help with quick voltage transients, not prolonged drops in battery voltage.

- Ben

1. Can you disconnect your external motor driver and just try using a single motor connected to one of the channels on your Baby Orangutan?

I connected the motor channels together, as shown in my circuit, so I can’t really do a single motor, though I still get the brownout when I control the motors connected to the Orangutan.

2. How many AA batteries are you using to power the Orangutan, and what chemistry battery are you using?

I used two 6v alkaline battery packs in parallel, so I get 6v total, with a doubled current. 8 AA’s in total.

3. Are they new/freshly charged (what open-circuit voltage do you measure on them)?

Yes, they’re new. They each have 1.5 volts.

4. What is the stall current of the motors you are using?

1.6 A stall.

As I said, let’s simplify things. Paralleling motor driver outputs and batteries can introduce all sorts of problems. Can you just connect a single motor to one of the Baby Orangutan’s motor channels and power the Baby Orangutan from a single 6V battery pack? With that setup, can you post the simplest program that demonstrates the problem along with a description of the behavior you are observing?

- Ben

I don’t get the problem when just powering one motor, but the thing is, I’m powering 4! The whole system has brownout whenever I try to start my motors. The way I know, is I just tell the orangutan to blink its LED for a second before executing the rest of the program. I end up with a very still, but very blinky robot.

Also, in terms of decoupling, isn’t there just a 1 uf across VBAT, and a 4.7 uf across the 5v processor supply? That isn’t enough if I want to power my controller in low voltage settings…

Sorry if this isn’t really going anywhere. :confused:

As I said before:

Can you please do this? For example, if you don’t get the problem when powering a single motor, do you get the problem when powering one motor with each channel (no paralleling!)? Do you get the problem when powering a single motor connected to paralleled outputs?

You can put a large cap across power and ground near the controller, but I don’t expect that to do much in this case.

- Ben

Unparalleling my outputs would mean completely rewiring my board. Let me try to cap idea, and I’ll get back to this thread.

Well, I tried tying the 9v inputs to a 1000uf capacitor. However, it didn’t seem to do much, as you correctly predicted. The really troubling thing, is that the Orangutan resets even WITHOUT any motors plugged in. It seems like simply sending outputs makes it get brownout. I measured the voltage across my batteries, and they held at a steady 8.5 volts. Using one battery had the same result. Same thing with a 6v battery pack with 4 AA’s.

N.B. When I send a signal without motors to my external motor controller, everything is fine. However, I get all these problems when I send a signal to the controller inside the Orangutan (without motors).

Well, I tried tying the 9v inputs to a 1000uf capacitor. However, it didn’t seem to do much, as you correctly predicted. The really troubling thing, is that the Orangutan resets even WITHOUT any motors plugged in. It seems like simply sending outputs makes it get brownout. I measured the voltage across my batteries, and they held at a steady 8.5 volts. Using one battery had the same result. Same thing with a 6v battery pack with 4 AA’s.

N.B. When I send a signal without motors to my external motor controller, everything is fine. However, I get all these problems when I send a signal to the controller inside the Orangutan (without motors).
Here’s the simplest code (I left out the part that was commented out for the other side, which is why back() is the same as left(), also, this is a sketch using the arduino environment):

int rightir = A0;   
int leftir = A1; 
int ledPin = 1;      
int rsensor = 0; 
int lsensor = 0;
int rmotorsAA = (3,5); 
int rmotorsBB = (6,11);
int counter = 0;
int pause = 200;
int lcounter = 0;
int rcounter = 0;

void setup() {
  pinMode(ledPin, OUTPUT);  
  pinMode(leftir, INPUT);
  pinMode(rightir, INPUT);
  pinMode(rmotorsAA, OUTPUT);
  pinMode(rmotorsBB, OUTPUT);
  brownout();
}

void brownout() {
digitalWrite(ledPin, HIGH);
delay(100);
digitalWrite(ledPin, LOW);
}

void loop() {
  rsensor = analogRead(rightir); 
  lsensor = analogRead(leftir);
  
  if (lsensor > 50)  {
    lcounter +=1;
    delay(1);
    if (lcounter > 5) {
      digitalWrite(ledPin, LOW);
      right();
      lcounter = 0;
      rcounter = 0;
    }
  }
  else if (rsensor > 50)  {  
    rcounter +=1;
    delay(1);
    if (rcounter > 5) {
      left();
      lcounter = 0;
      rcounter = 0;
    }
  }
  else {
    forward();
  }
}

void forward() {
  counter = 240;
      analogWrite(rmotorsBB, counter); 
      analogWrite(rmotorsAA, -counter);
      delay(20);
  }


void back() {
  counter = 240;
      analogWrite(rmotorsBB, -counter); 
      analogWrite(rmotorsAA, counter);
      delay(20);
 }


void left() {
    counter = 240;
      analogWrite(rmotorsBB, -counter); 
      analogWrite(rmotorsAA, counter);
      delay(20);
}

void right() {
    counter = 240;
      analogWrite(rmotorsBB, counter); 
      analogWrite(rmotorsAA, -counter);
      delay(20);
}

I very strongly suspect the code you posted is not the simplest code that would demonstrate your problems. I bet you could remove all of the sensor code and just have a single line that tries to drive the motors.

The behavior you are describing is consistent with incorrectly paralleled outputs. You are driving the motor driver outputs to two different voltages while they are connected, which is repeatedly shorting out the battery and and causing the voltage to drop to a level that is below what the Baby Orangutan needs to run. You might be lucky in this regard, as using a better power supply in this case could easily burn out the motor drivers.

In general, you are trying to do something reasonably advanced by paralleling your batteries and motor drivers, and to pull it off you need to have a much better understanding of the details than you appear to. As an easy example, there are several problems with your program that make it clear you don’t have a firm understanding of what you’re doing:

int rmotorsAA = (3,5); 
int rmotorsBB = (6,11);

What are you trying to do here? The compiler is just reducing this to:

int rmotorsAA = 5; 
int rmotorsBB = 11;

Also, analogWrite() take an unsigned 8-bit value as its value argument. Have you looked at the command reference for it? Supplying it with a negative number doesn’t make any sense. What kind of output are you expecting from something like analogWrite(pin, -240)?

analogWrite(rmotorsBB, counter); 
analogWrite(rmotorsAA, -counter);

Aside from these relatively minor mistakes, you are making a huge assumption that the different motor driver outputs are doing the same things at the same times. Everything you are doing relies upon this very wrong assumption.

You have four motors and four motor drive outputs. Instead of paralleling everything in sight, I think you should just connect each motor to its own motor driver channel while using a more appropriate power supply and control them that way. If you haven’t broken anything, everything should work fine that way.

- Ben

I wanted to assign two values to int rmotorsAA and rmotorsBB

Well, I wanted the motors to reverse their direction, and since pwm is given through analogWrite, I assumed (wrongly so, it seems) that a pwm value of 0-255 will make it turn at a varying speed from zero to full, and 0 to -255 will rotate the motor in a same manner in the opposite direction.
What is the proper way of controlling speed and direction of the motors inside the Orangutan?

Ok, thanks for the clarification.

P.S. In my rewiring, can I still leave the inputs to the external motor driver paralleled?

You cannot assign two values to a single int; you need to use an int to store each value, or you can use an array.

Each motor driver channel has two control pins. To drive one direction, you supply a PWM signal to one control pin while holding the other low. To drive in the other direction, you swap that, holding the first pin low and supplying the second pin with a PWM signal. I haven’t tested the following code, but something like this should work:

void m2Forward(unsigned char speed)
{
  digitalWrite(5, LOW);
  analogWrite(6, speed);
}

void m2Reverse(unsigned char speed)
{
  digitalWrite(6, LOW);
  analogWrite(5, speed);
}

Note that you need to designate the driver control lines as outputs in your setup() routine.

Are you sure you need four motors? I strongly suggest you try to get something working with just two motors controlled by the Baby Orangutan and leave the external motor driver out of it for now until you are more comfortable with what you’re doing.

- Ben

well, just two 50:1 HP motors aren’t powerful enough for a minisumo, though I can swap them out for slower but more powerful ones relatively easily. The 4wd was basically the whole point of my design. Assuming that I do use 4 motors, how would you suggest I wire my motor driver inputs?

To get the external TB6612 carrier to behave the same way the Orangutan motor drivers do will be kind of complicated. Is it an option for you just to get a more powerful motor driver that can handle two motors in parallel per channel and leave the Baby Orangutan drivers unused? For example:

pololu.com/catalog/product/1213

or

pololu.com/catalog/product/2503

- Ben

I have one of these:
pololu.com/catalog/product/712

But didn’t you say it’s best to avoid paralleling?