Robot gutless and slow

Ok, so I finally got him put together, and it turns out that he doesnt move worth a damn.... I cant figure out what I did wrong. The tamiya twin motor is set for low range, but it still shouldnt be THIS slow... turning is almost impossible for him... Even on smooth flooring.... I shot a quick video for you all to see and hopefully help me figure out what is going on...

 

This is the H bridge I am using... SN754410 from sparkfun. The data sheet said i could save pins by hooking the enable pins up to a 5v source, so I did that..... VCC1 is connected to the 5v on the arduino, Vcc2 is hooked up to the same power source as the motors/IC, with common ground. My arduino has its own power source. Ignore the wire coloring, I only had 2 colors and the ones i used here were for my reference, not to indicate hot and ground.

Power for the board is 4xAA alkaline batteries. Power for arduino is 1 9v battery.

 

IMG_0608.jpg


I have no idea what to do here....
Can anyone help? Thanks in advance.

https://www.youtube.com/watch?v=T6pecdSfl6E

Hmmm

There seems to be something wrong here:

VCC1 is connected to the 5v on the arduino, Vcc2 is hooked up to the same power source as the motors/IC, with common ground.

VCC1 should be connected to 5V on the Arduino.

But I don’t get that VCC2 is hooked up to the same source as the motors/IC? The motors should not be hooked up directly to any powersource. They should be connected to the PWM outputs on the H-bridge.

VCC2 should be connected to the AA battery pack.

But I’m not even sure I understood you correctly? :confused:

Yes, I didnt explain

Yes, I didnt explain correctly. VCC2 is hooked up to the power source that the h bridge is running off of. the motors are connected to the outputs on the chip. Sorry about that.

Now, about the PWM outputs…

the wires that go to the inputs on the h bridge are connected to 4,5,6,7 on my arduino… only two of those are PWM. I never really understood what PWM was for… Let me post the code i am using as well… It isn’t pretty, but i’m still new to coding…

 

#define leftDir1 7 // Left motor direction 1, to AIn1.

#define leftDir2 6 // Left motor direction 2, to AIn2.

#define rightDir1 5 // Right motor direction 1, to BIn1.

#define rightDir2 4 // Right motor direction 2, to BIn2.

 

 

void setup()

{

pinMode(leftDir1, OUTPUT); // Set motor direction pins as outputs.

pinMode(leftDir2, OUTPUT);

pinMode(rightDir1, OUTPUT);

pinMode(rightDir2, OUTPUT);

 

}

 

void loop()

{

 

drive_forward();

delay(8000);

motor_stop();

delay(2000);

turn_left();

delay(5000);

motor_stop();

delay(2000);

drive_forward();

delay(6000);

motor_stop();

delay(2000);

turn_left();

delay(5000);

motor_stop();

delay(2000);

drive_forward();

delay(8000);

motor_stop();

delay(2000);

turn_left();

delay(5000);

motor_stop();

delay(2000);

drive_forward();

delay(6000);

motor_stop();

delay(2000);

turn_left();

delay(4000);

 

}

 

// motor movements

 

void motor_stop(){

digitalWrite(leftDir1, HIGH);

digitalWrite(leftDir2, HIGH);

 

digitalWrite(rightDir1, HIGH);

digitalWrite(rightDir2, HIGH);

}

 

void drive_forward(){

 

digitalWrite(leftDir1, LOW);

digitalWrite(leftDir2, HIGH);

 

digitalWrite(rightDir1, HIGH);

digitalWrite(rightDir2, LOW);

}

 

void turn_left(){

digitalWrite(leftDir1, HIGH);

digitalWrite(leftDir2, LOW);

 

digitalWrite(rightDir1, HIGH);

digitalWrite(rightDir2, LOW);

}

 

void turn_right(){

digitalWrite(leftDir1, LOW);

digitalWrite(leftDir2, HIGH);

 

digitalWrite(rightDir1, LOW);

digitalWrite(rightDir2, HIGH);

}

Well

Sounds like you got it right but the fact that the motors are so slow could indicate that you’re trying to power them from the Arduino.

So double check your wiring:

* The 2 enable pins and VCC1 should be connected to the 5V Arduino output (this would probaly work hooked up to the battery too as long as it’s ~5V)

* VCC2 should be hooked up to the battery pack (this is important because the motors will draw the current from here)

* The motors should be hooked up to the terminal outputs on the H-bridge

* All the 4 grounds on the H-brigde should be connected to the Arduino ground

That should do it.

About PWM (pulse width modulation): In short it means that the power will be turned on and off very quickly. When we’re talking motor control this means that you can simulate different voltages (from 0V to 5V) and therefore control the SPEED of the motors.

To do this from the Arduino you use the analogWrite() function instead of the digitalWrite() function. And instead of writing HIGH/LOW you write a number between 0 and 225 which indicates how much the PWM signal will be on or off. 0 means it will be off all the time thus the output is 0V. 225 means it is on all the time thus the output is 5V. 127 for example means that it is off 50% of the time and on 50% of the time. This would be like feeding the motors 2.5V.

PS: You don’t (need to) use the pinMode() function when using analogWrite() unlike digitalWrite()…

My enable pins are wired in

My enable pins are wired in with the +5 on Vcc2, not the arduino. Could they be pulling current away from the motors? my grounds are all common and wired to the ground on the arduino already… Just to make sure before i do this (its going to take some doing to get at the driver board) I should wire both enables and the lead from VCC1 to the arduino’s 5v?

 

I really want to make sure of this before i tear into the board. Am I clear on your instructions?

ooh, and also… On the

ooh, and also…

 

On the arduino, there are 2 ground connections and only 1 5v connection. are the grounds common? can i use either one?

Did you double-check the

Did you double-check the 4xAA batteries are new and up to full voltage? It looks like a low battery supply.

Sorry if this is obvious and you’ve already checked. Some times even the most experienced people forget to check the basics.

looks right
based on your video, that looks about as fast as those motors are meant to go. the left turn is so slow because one motor is doing all the work. To turn, have one motor go forward, one backward.

So last night after my last

So last night after my last post, i rebuilt his gearbox for higher speed. He doesnt move at all now with the treads on. I dont know what the heck is going on…

 

@ aniss, i did the re-wiring of my enable pins and it seems like it did nothing.

 

@ignoblegnome, yes i checked the batteries

 

@calculon, I think both motors are turning in opposite directions when hanging a left already… check my code above.

 

I just woke up, and after some sleep, maybe i will be able to figure out what is going on… In the meantime, keep coming up with ideas for me to try. you guys are being very helpful. Thank you.

That chip needs flyback

That chip needs flyback diodes. It is not a direct replacement for the L293D as Sparkfun say because the L293D has the diodes internal. The output pin circuit diagram shows ESD protection diodes but flyback diodes should be added as shown in the schematic on page 6 of the datasheet.

This pic ishows the diode arrangement better and is easier to understand than the datasheet diagram. Any diodes at least 1A should be ok.

robot1.gif

Err… can you dumb that

Err… can you dumb that down for me? Do I need to put diodes in line between the the output pins and the motors? Ive never done anything this intricate before… Sorry for the ignorance…

Take me to diode school please?

Basically each output pin

Basically each output pin needs a diode "pointing" to V+ and a diode from GND "pointing" to the pin. 4 outputs with 2 diodes each means you need 8 total for that chip. That picture in my other post is probably the easiest way to understand how they should be wired.

It`s a little tricky to get your head around the way it works and can be hard to squeeze 8 diodes on the board. Try drawing on graph or dotted paper how you intend to fit them in before starting up the soldering iron and you should be right.

So let me get this right
So let me get this right here… each output pin is going to have 3 connections: 1 to common ground, 1 to the motor itself, and 1 to the same 5v source that ive tied into the enable pins? I’m thinking just buying a true l293 might be the better option here… ive already got WAY too much wiring, and WAY too much soldering into this part, and i’d rather take the easy route…

Just to be clear, the

Just to be clear, the connections from each output are:

 

  1. To the motor
  2. Through a diode pointed to your motor’s power supply (5V)
  3. Through a diode pointed to common ground
I’m not sure if this has anything to do with your problem, but the flyback diodes will protect your motor controller.

 

Well

It isn’t just a matter of increasing the VOLTAGE. It could also be that your batteries isn’t capable of supplying enough CURRENT. So you may wanna check out the (max) current draw of your motors as well as how much the battery is capable of supplying.

Wild goose chasing

The flyback diodes suggested have absolutely nothing to do with the performance of the motors with the current power source. Additionally, the 754410 does have diodes on the outputs, which are described as ESD diodes, but no one has been able to describe to me what the difference is between a diode that conducts ESD and a diode that conducts flyback spikes.

The main problem has somewhat been guessed at, a combination of batteries with low current capabilities, as well as the FA130 motors being somewhat current hogs and meant to run at 3 volts. Pololu has some documentation on the quality of the FA130 motors, as well as some better quality replacement motors that run reasonably well at 6 volts.

There could be some additional problems with crossed wiring, but it really appears that rechargeable batteries should be used, either NiCd or NiMh, that actually have better current characteristic than alkalines. Note that if increasing voltage it will correspondingly increase current (Ohms law) and have the possibility of popping the h-bridge and/or burning out the current motors.

Ok, I ordered the motors
Ok, I ordered the motors from pololu that have the higher rated voltage. Think this will solve my problem? I should be able to use a 7.2v battery pack with no issues, but will using the current 5v rechargeable battery pack i have work as well? I’d really like to get this thing moving fast with the motors i have right now… even if it burns them out. any thoughts?

This robot used the standard
This robot used the standard tamiya motors with 5 AAA rechargables and an L293NE (no diodes on chip) and ran fine. Your problem is not the motors.

I have one more 16 pin ic

I have one more 16 pin ic holder laying around somewhere… maybe i should rebuild my h-bridge and see what happens?

 

Its the only thing i havent thought of doing… aside from upping the voltage beyond 5v. 5 AAA’s would be around 6v for yours to run… right?

I’ve just finished charging 5 NIMH rechargables. I am going to go put my AA battery holder back on instead of my 5v psp battery pack i was using and see what happens. I tried this with normal AA’s before though and it didnt help at all. I’ve rebuilt his gearing to the higher ratio and re-did his tracks already… it really is starting to seem to me like there is something wrong with the H bridge…

 

 

**Configuration **

A wider stance allows an easier turn than a narrow stance for tracks. Think of the track contact in a turn. If they are close together, more of the “push” force vector of the track is wasted in scrubbing across the surface, perpendicular to the track. If the tracks are further apart, the radius of turn allows more of the track force to be used to move the robot rather than be wasted in skid.

The tightness of the tracks is something to definitely lessen, but not so much that the tracks are easily thrown.

Most motors will spin faster when presented with no load (ie : off the ground) so this isn’t really a good test. If spinning the same, it does sound possible that the tracks are too tight.