Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: blackheart on March 21, 2009, 01:24:18 AM

Title: MotorDriverDual TB6612FNG Problems. Only one motor works in only one direction.
Post by: blackheart on March 21, 2009, 01:24:18 AM
Hello!

I just finished soldering everything, mounting them on the chassis and I was testing the motor circuit.

And I have many problems with it!


First of all, are the motors represented by A and B, or by 1 and 2? I thought they were represented by A and B. I am talking about the corresponding pins on the driver. http://www.pololu.com/picture/view/0J927 (http://www.pololu.com/picture/view/0J927)  If however, I should have plugged motor one in AO1 and BO1...then I know what the problem is.

I plugged in Motor 1 to AO1 and AO2, and motor B to BO1 and BO2.


PWM control works.

ONLY ONE DIRECTION WORKS.

1) If AIN1 is LOW, and AIN2 is HIGH, motor A spins forward and I can still choose the speed.
2) If AIN1 is HIGH and AIN2 is LOW, motor does not spin at all!
3) If BOTH AIN1 and AIN2 are HIGH, motor does not spin at all!
4) If BOTH AIN1 and AIN2 are LOW, motot works exactly as it does in case 1. I can control the speed.

If I send output to BIN, instead of AIN, the same motor starts spinning. The second motor never spins, although it works and it is soldered properly. The same cases apply for BIN1/BIN2, however, it's the same thing, same motor!


Here is the data sheet. I don't know how to read it properly. Those dots confuse me!
http://www.robotop.ro/Datasheets/TB6612FNG.pdf (http://www.robotop.ro/Datasheets/TB6612FNG.pdf)


What can be wrong?




Title: Re: MotorDriverDual TB6612FNG Problems. Only one motor works in only one direction.
Post by: Ro-Bot-X on March 21, 2009, 06:38:49 AM
Usually it's motor 1 and 2 with A and B wires. That's why your logic is not working. You also should have E1 and E2 that is Enable motor 1 and Enable motor 2...
Title: Re: MotorDriverDual TB6612FNG Problems. Only one motor works in only one directi
Post by: blackheart on March 21, 2009, 07:05:36 AM
Are you sure? Is there any possible threat to the motor driver if I try to solder them as you told me?
Title: Re: MotorDriverDual TB6612FNG Problems. Only one motor works in only one directi
Post by: blackheart on March 21, 2009, 08:24:07 AM
Ok, I just tried soldering them as you told me, and it now activates the second motor, but only in one direction.

Exactly as the first time, but it works on the second motor only instead of 1st only!


What could be wrong with it? I double checked the wiring and pin assignment on the arduino.

Title: Re: MotorDriverDual TB6612FNG Problems. Only one motor works in only one directi
Post by: chelmi on March 21, 2009, 08:47:22 AM
Are you sure? Is there any possible threat to the motor driver if I try to solder them as you told me?

The dots in the datasheet are the pins of the chip.

As you can see on the "Typical Application Diagram", one motor is connected to AO and the other to BO and you control the speed with PWMA and PWMB, respectively. So your connexion is ok.

Maybe its a problem with your code then? Did you check with a multimeter that the inputs of the motor driver are at the expected values ?

Chelmi.
Title: Re: MotorDriverDual TB6612FNG Problems. Only one motor works in only one directi
Post by: blackheart on March 21, 2009, 12:01:23 PM
So my connection was fine, I will just re-do it the way it was. The code is fine.

I don't have a multimeter, I will get one on monday if I need it.


Anybody experienced anything like this? Is there any possibility of the motor driver being burnt when soldering? I maybe over heated it when I soldered it and it fried some of it.


UPDATE!

I redid the connections to the way they were, and now I reversed the polarity.

Its the first engine that works again, the second doesn't work, but the first engine switched it's direction. It's now going clock-wise, so I guess I just switched the wires.

Many combinations of HIGH and LOW on AIN1 and BIN2(weird) work, but in the same direction and on the same motor. It's either clockwise, or off.

The problem is not in the code. I don't see anything wrong with the arduino, so the problem must be in the driver...again, COULD a PART of it be fried? When it fries, doesn't it affect the whole IC?
Title: Re: MotorDriverDual TB6612FNG Problems. Only one motor works in only one directi
Post by: blackheart on March 22, 2009, 04:35:15 PM
I didn't fix it yet. I found out something that just made me think WTF? The motor can be controlled without power on the vcc. I just unplugged the VCC wire and ground from the arduino and the motor driver still spins the one motor.

I am trying with a battery pack now. Maybe usb gives arduino enough power for everything else? I am simply amazed at the fact that I can control the driver without powering it.
Title: Re: MotorDriverDual TB6612FNG Problems. Only one motor works in only one direction.
Post by: Razor Concepts on March 22, 2009, 04:46:52 PM
One thing is make sure there is a ground connection between the Arduino and the motor controller.
Title: Re: MotorDriverDual TB6612FNG Problems. Only one motor works in only one directi
Post by: chelmi on March 22, 2009, 05:41:03 PM
I didn't fix it yet. I found out something that just made me think WTF? The motor can be controlled without power on the vcc. I just unplugged the VCC wire and ground from the arduino and the motor driver still spins the one motor.

I am trying with a battery pack now. Maybe usb gives arduino enough power for everything else? I am simply amazed at the fact that I can control the driver without powering it.

maybe the breakout board is bad ? check for bridges between solder points
Title: Re: MotorDriverDual TB6612FNG Problems. Only one motor works in only one direction.
Post by: blackheart on March 23, 2009, 11:11:40 AM
The breakout board? The arduino? Nah!

There must be something wrong with the microcontroller!
Title: Re: MotorDriverDual TB6612FNG Problems. Only one motor works in only one directi
Post by: blackheart on March 24, 2009, 01:29:30 AM
Ok, I just learned something new today. A multimeter is a fantastic device that one must have in order to build robots. My problem was with pin 0, which weirdly on my board always supplies 5V. I just took the ain1 wire out of pin 0 on arduino and plugged it into pin 12. It now works. Both engines, both directions.p


I have another question. On the arduino, can any digital pin be used as a 5v power supply?

I tested them individually and when set to high, they all output 5V. Is there any danger if I use those as a 5v power supply for sharp IR?
Title: Re: MotorDriverDual TB6612FNG Problems. Only one motor works in only one direction.
Post by: SmAsH on March 24, 2009, 01:43:23 AM
i wouldnt use the digital outputs for power supplys. make your own bus with a regulator. eg
Title: Re: MotorDriverDual TB6612FNG Problems. Only one motor works in only one direction.
Post by: blackheart on March 24, 2009, 05:09:18 AM
I don't know how to use a voltage regulator. I cand find any documentation for it and I don't know which pins to use and what for. your drawing confuses me because you make it seem like the ground goes through all 3 pins.  :P

I made a bus without a regulator and it's not good for sharp ir. I get weird readings.


And that wouldn't be a problem, but I don't want to have 3 separate sources. I want a source for the motor and a source for the arduino...and from arduino, getting power for all the other electronics.

Title: Re: MotorDriverDual TB6612FNG Problems. Only one motor works in only one direction.
Post by: SmAsH on March 24, 2009, 05:19:31 AM
a voltage regulator has 3 pins if you get the lm7805 (+5V 1A regulator) from the side with writing.(black side)
input---gnd---output
simple as all hell :) the sharp ir would be giving werid readings because you arent giving it a steady voltage.
batteries never give out a steady voltage, it fluctuates. thats why we use a regulator for mcu's and most sensors.
if you cant find any documentation find the name of a common one eg. lm7805 google "lm7805 datasheet" and it should give you some results. if the drawing confuses you that much i can draw a better one soon but i will try to explain it best now.
the blue wire plugs into the port on the arduino and onto the board which had 3X(how ever many signals you need) then has a +5V line and then a gnd line. so pretty much it is an extension to the arduino that gives it a power bus. like the roboduino has :D
if you have anymore questions feel free to ask!
Title: Re: MotorDriverDual TB6612FNG Problems. Only one motor works in only one direction.
Post by: Ro-Bot-X on March 24, 2009, 05:54:44 AM
Arduino has power pins on the side there are the analog pins, in a row of six pins that are labeled as follows:
(from left to right, analog pins being to the right of this 6 pins header)
- Reset, 3.3V, 5V, GND, GND, Vin.

The 3.3V and 5V are regulated on the Arduino board so you don't need any other regulators. Vin is whatever your battery outputs.

You can make a board (shield) using a veroboard, 3 pin headers and some wire to be able to plug in servos and sensors. For the servos, for each 3 pin header you will connect one pin to the microcontroller, middle pin to Vin, third pin to GND. For sensors, you will connect first pin to the microcontroller, middle pin to 5V, third pin to GND, just like SmAsH showed you in his schematic.
Title: Re: MotorDriverDual TB6612FNG Problems. Only one motor works in only one directi
Post by: blackheart on March 24, 2009, 07:52:44 AM
I was kidding about the drawing. I already understood it when you explained it to me in the other thread. I already made the power bus without the regulator, and adding one would take me only 2 minutes, but I don't want 3 separate power sources. I would like to use one battery for my motors and one battery for the arduino. I would like to power the sensors(sharp IR rangefinders) from the arduino.

So my questions are:

1) Can I use the digital pins on the arduino as a 5v power supply? Especially pin 0 and 1 which are always 5V. I measured them with a multimeter.

2) Can I multiply(that sounds kinky) the 5v power pin ? Basically just take a wire and solder 2-3 other wires on it. this way, I can provide the sensors with power from the dedicated pin. Is it possible? I don't think that 2 sensors would draw too much current from it.

Thank you!
Title: Re: MotorDriverDual TB6612FNG Problems. Only one motor works in only one direction.
Post by: Ro-Bot-X on March 24, 2009, 11:53:50 AM
1. The digital pins 0 and 1 are Tx and Rx for the hardware serial port. If you plan on using the serial to see sensor values on the screen, do not use these pins for anything else.

Any microcontroler pin will suply (or sink) only 40mA current, that may be less than some sensors will need. You can directly power a LED... If you use a transistor you can interface anything that needs lots pf power. But to actually use the pin as power pin not as signal pin, it's a waste. I am using the pins carefully and I allready used all of them. For future expansion I need to use I2C parts.

2. Yes, you can tie several power wires to one header pin and plug that one into the dedicated 5V pin on Arduino board. Everybody does that. The only thing to consider is not going over 1 A with current consumption, but most sensors use a lot less, so I think you probably are fine to use 6 to 8 sensors powered from that pin.

Title: Re: MotorDriverDual TB6612FNG Problems. Only one motor works in only one direction.
Post by: SmAsH on March 24, 2009, 12:49:33 PM
i would not suggest using digital pins on your microcontroller. it would be just as easy to use the regulators 5V output.