H-Bridge Motor Control Problems

Discussion in 'The Projects Forum' started by G.Willikers, Feb 26, 2011.

  1. G.Willikers

    Thread Starter New Member

    Feb 26, 2011
    3
    0
    I'm working on a robot and am encountering problems with the H-Bridge motor control Independently each side of the H-Bridge will control the motors correctly but when both motors are plugged in at the same time they go crazy. On the breadboard design this is not an issue - it's only a problem on the PCB.

    Background of the circuit: it consists of an accelerometer for angle control, an ATmega328 MCU (programmed in Arduino) and an SN754410 H-Bridge.

    Any suggestions for fixing this would be greatly appreciated.

    Thanks,

    Gianna
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    No schematic or board layout?

    What would you like for us to do, make wild guesses and still not get the problem fixed?

    Sorry, no time for that. Post your schematic, board layout, and most preferably well-focused photos of both sides of the board, taken outside in the shade. Flash photos are useless.

    Specifications of the motors will also be helpful.
     
  3. wayneh

    Expert

    Sep 9, 2010
    12,127
    3,049
    +1

    But, I'll offer one wild guess FWIW. Once currents flow, ground is no longer ground. By that I mean, check your current paths for any loop that carries more than, say, 0.25A. Think hard about any differences between the breadboard and PCB (wire length and gauge?), with careful attention to those currents.

    As Wookie suggests, this wild guess may not solve your problem but it's good practice anyway.
     
  4. G.Willikers

    Thread Starter New Member

    Feb 26, 2011
    3
    0
    Sorry, I knew I'd get flak for not posting the circuit but this is for a class so I wanted to ensure that posting online was allowed first and in the meantime ask for suggestions. Attached are the schematic and board layout. Suggestions that don't involve getting a new PCB made would be ideal since we don't have much time left. I know that some of the board connections are winding and jagged and hope this isn't causing the issue.

    Thanks
     
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Well, you have a very long, winding and thin ground trace, and the motors are between the off-board supply and the microcontroller. This is probably going to make your uC go bonkers.

    You have 22pF caps for C6 through C9. You might increase them to 220pF to 330pF.
    Add a 0.1uF and a 100uF to 1,000uF cap in parallel across the L293's GND and Vcc2 pins. Add a 0.1uF cap across the L293's GND and Vcc1 pins.

    The L293 has four ground pins in the center. They're supposed to have a nice big "copper pour" area to act as a heat sink to keep the IC cool. Unfortunately, you just ran a skinny trace between them all, so unless you are running really small motors, the IC is going to get hot.

    I'm kind of surprised your clock works. The caps and crystal should be right next to the uC, as close as possible. Having those long traces in between the caps and crystal adds a lot of parasitic inductance and capacitance.

    Your board has an awful lot of empty space on it. Would've been a lot better if you could move all the parts closer together, and used much wider traces. The biggest problem is likely that long, winding ground trace. See if you can add on some jumper wires to make the ground path better.
     
  6. G.Willikers

    Thread Starter New Member

    Feb 26, 2011
    3
    0
    Thank you very much! Placing a 1000uF capacitor across GND and VCC2 made both sides of the H-Bridge respond correctly.
     
  7. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Glad you got it working.

    Keep the other suggestions in mind for the next time you have a project like this.
    Smaller board = less cost.
    Short, wide traces are much better than long, skinny ones - wherever you can use them, particularly for power/ground.
    Use bypass caps between the power rail(s) and ground. See the Decoupling/Bypass capacitor "sticky" thread in the General Electronics Discussion forum.
    Using a "copper pour" helps a great deal with power/ground distribution. The Eagle polygon tool is what you use to create copper pour areas. You can use the Name tool to give a particular polygon the name of Vcc, GND, etc. Make sure the trace width of the polygon is not zero (10 mils is good), use 16 or 24 mils for isolation.

    Try not run traces at odd angles (freehand). I keep the trace angle selected at 45° most of the time, and the grid set to either 0.1" or 0.05" (100 mils and 50 mils respectively).
     
Loading...