Let's Make Robots!

Cannot get quad 1/2 h-bridge to run...

Below is my arduino shield. I have everything working so far exept the SN754410 IC that runs the two motors. What am I doing wrong? Did I wire it wrong? Is my code below wrong? I can get the motor outputs to go to +volts, but not ground. Thanks!

 

 

 

//adapted from blink led tutorial


int ledPin = 6;                 // LED connected to digital pin 13
int ledPin2 = 10;
int ledPin3 = 2;
int ledPin4 = 3;
int ledPin5 = 5;

void setup()
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
}

void loop()
{
  digitalWrite(ledPin, HIGH);
  digitalWrite(ledPin3, HIGH);  // sets the LED on
  digitalWrite(ledPin2, HIGH);  // sets the LED on
    digitalWrite(ledPin4, LOW);  // sets the LED on
       digitalWrite(ledPin5, HIGH);  // sets the LED on
}

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Your code is fine as it sits. Can we see the code you are using to change direction?

I agree almost entirely with what CtC says, with one major exception.  I could be totally wrong since Arduino isn't my cup of tea, but it appears only one digital output is being set as an output (ledpin  6).  I think all the ones with a digital write statement need to be set as outputs as well.  Also, as a rule of thumb, a schematic is much more useful for finding problems in a circuit than a pcb layout.

Thanks for checking! The code will be basically an adaptation from here: http://www.uduino.com/tutorials/11 I found that the IC was not connected at all points on the board (trying to test before I solder). I'll do that then get it running! Yes, it's my first PCB =)

I've noticed a couple/few post go by of your's where you are using a modified blink tutorial. As noted, a few pinMode's were left out --easy thing to fix. I just noticed you mentioned a link and that you "will be using" it as an example. Is there any reason you are not doing that now? The example you show is a good one --probably as good as any, is there any reason you are still sticking with the modified blink? 

At the end of the day, all you really need here is 4 output pins (6 if enables are used) and to set them either high or low. It might be a good idea to start from scratch and write a basic sketch. Here's your outline:

#define thePinsBeingUsedAsOuputs

setup()
set your pinMode(s)
set all your outputs to low

loop()
goto one of the various direction routines

doForward()
set the highs and lows (for each motor) to make both motors go forward

doReverse()
set highs and lows for reverse

doRightSpin()
etc etc

 

It would be a really good idea to do this sketch in a very tidy, neat way. If you do everything properly, and all of your direction routines (fwd, rev, R/L spin, R/L slide, allStop, etc) are correct, then you can use this sketch as a cut-and-paste baseline for all your sketches from here on out. Everytime you change code etc. you can now cut and past all of your pinout numbers, setup info and all the basic "moves" for your bot into your new sketch.

If you want to get even fancier, I would open a new tab in your sketch and put all of these "direction routines" there. Now you don't even have to look at them, or scroll past them in your main sketch. 

I don't mean to be harsh, and I am going to try not to, but it is not so much what is wrong, but more that very very little is correct.

I would not have this board fabricated. It will not work, there are an incredible number of problems. Ok, lets start with some majors:

  • Your traces are kinda all over the place. They are sort of a mess visually, but also from a electrical noise standpoint, all the hard 90's, the zig-zags, etc are all not good. These should all be straightened out with all the corners clipped off at a 45.
  • Some of your traces hit the edges of the board and/or pads
  • Your trace width varies greatly with no rhyme or reason --I.e. one of your main motor traces is down to what, .008?
  • There is a HUGE amount of unused space on the board. You are going to pay for all this unused space when the board is fabricated. I would snug everything up a bit to physically make the board smaller
  • There are a lot of polarity issues --The LED's are in backward for example
  • I don't know what the 4 rectangular components are on the left edge
  • I don't know why these particular I/O pins were chosen, but I think your pinout selections could be more tidy

 

 

Yes, I think this whole design may need a teardown/ rebuild.