Connect with us

DC motor spikes mess up chip

Discussion in 'Sensors and Actuators' started by codeeater, May 23, 2013.

Scroll to continue with content
  1. codeeater

    codeeater

    12
    0
    May 10, 2013
    Hey!
    I am controlling a relatively high RPM DC motor (not quite sure the exact RPM) with an SN754410 Hbridge at 12v connected to an Atmega 644p.
    I can control the Atmega 644p over a serial line from my pc and tell it to turn the motor on/off.
    My problem is, 8/10 times when the motor turns on the Atmega stops responding and the motor stays on and just acts plain weird until I reset the chip.

    I'm pretty certain this is down to voltage spikes in from the motor, but I just cant seem to get rid of them. The important parts of my circuit are:

    12v -> 5v Regulator -> Atmega -> Hbridge -> dc motor

    5v Regulator -> L293d (power it)

    12v -> Hbridge (motor runs off this)

    12v -> 10uF Cap -> 0v

    5v -> 10uF Cap -> 0v

    I tried adding snubber diodes:
    Each pole of motor -> Snubber diode (1N5817) -> GND
    Each pole of motor -> Snubber diode (1N5817) -> 12V

    But that doesn't affect it at all.

    Has anyone got any ideas?

    Thanks :)
     
  2. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,361
    2,757
    Jan 21, 2010
    Ensure that no part of the wiring for the Microcontroller carries current from the motors. (i.e. have separate wires leading to the power source.)

    Ensure you have capacitors at the input and output of your regulator. You may even want to consider an inductor in series with the 12V leading to the 5V regulator -- sometimes you can use a low value resistor too.

    Place a capacitor across the 12V to the motor as close as possible to the H bridge. a 10uF, 1uF and 0.1uF capacitors in parallel would be good. An 0.1uF capacitor directly across the motor is not a bad idea either.
     
  3. edman222

    edman222

    3
    0
    May 23, 2013
    Most likely the motor is drawing lots of current at start-up thus it drains the cap on the 12V line and the system, so the regulator cant maintain a good 5V if the 12V is unstable...

    simplest fix... get a BIG capacitor, a few hundred uF (470uf+ or 1000uf if its a bigger motor) on the 12v side, and also try steve's suggestions.
     
  4. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,361
    2,757
    Jan 21, 2010
    Isolating the 5V regulator with a diode (and it having its own input cap) will also go a long way to prevent this.
     
  5. codeeater

    codeeater

    12
    0
    May 10, 2013
    I have a 2200uF capacitor which I will try it out with :)

    Sorry just to be clear, you mean these capacitors from the 12v rail to each pole of the motor?
     
  6. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,361
    2,757
    Jan 21, 2010
    No, across the power supply rails, close to the H Bridge.

    These will provide a low impedance path for spikes that get generated and should help eliminate them. Another 0.1uF capacitor should be placed across the motor.
     
  7. codeeater

    codeeater

    12
    0
    May 10, 2013
    Alright, thanks for all your help guys!
    I tried all these things and couldnt get it to work, so in the end what ive done is just use a different motor which works absolutely fine. It seems a bit of a cop-out but it turns out this motor is better for the task in hand anyway.

    If anyone got a chance it could be useful if someone could supply a standard motor control circuit to use for future projects but no real need.

    Thanks alot for your help!

    :)
     
  8. Lord_grezington

    Lord_grezington

    117
    2
    May 3, 2013
    Hello

    With brushed dc motors, some have a varistor ring build in and some don't. A varistor ring will suppress the voltage spikes caused the brushes on the commutator.

    Check if your motor has a varistor ring, if not you should be able to fit a varistor between the motor terminals (value dependent on voltage and Current).

    A capacitor will work well to reduce EMC, however may cause issues if you are depending on the current for feedback.

    Graham
     
  9. codeeater

    codeeater

    12
    0
    May 10, 2013
    How do I choose a suitable varistor? There doesn't seem to be much about them online. Looking at varistors online: http://www.digikey.com/product-detail/en/VAR-18080115M3P-XK/VAR-18080115M3P-XK-ND/970267

    My motor is 12v and around 3A current.

    I am really starting to loose my will to live. The motor works fine with an LMD18200 if I control all the voltages by connecting wires but when I try to drive the LMD18200 with my uC nothing happens (if I use a different motor it works, but I need this motor).
    Is a varistor pretty certain to fix my issue?
     
  10. Lord_grezington

    Lord_grezington

    117
    2
    May 3, 2013
    I am no expert, I would try one of the varistors on the link below. (capable of withstanding current over 16.5A, Clamping voltage should be a couple volts above driving voltage)

    Check you current sense resistor, on 12V during start up you will be drawing around 16.5A. Your uC may be seeing a high current then stopping. Try accelerating the motor from a low PWM duty cycle up to speed.

    Graham

    http://uk.farnell.com/jsp/search/br...arametricAttributeId=&prevNValues=2031+202851
     
    Last edited: Jun 3, 2013
  11. codeeater

    codeeater

    12
    0
    May 10, 2013
    I'm still looking into varistors, but I've discovered something odd:

    If I connect the motor through the H-bridge and run it, it "crashes" the chip. But if I connect it directly to the power supply, with the electronics in parallel, everything is fine, ie the motor runs (but obviously I can't control it).
    Now surely this suggests it isn't spikes? Otherwise it would cause spikes even when connected directly to the power supply and the electronics would fail!

    This is really confusing me!
     
  12. Lord_grezington

    Lord_grezington

    117
    2
    May 3, 2013
    When a DC motor starts up it draws the stall current for a few ms. If you are driving the motor through the chip perhaps the current is going too high that the chip can not cope and going into the fail safe mode. An acceleration will get over this issue.

    Running the motor in parallel does not mean much apart from saying that the PSU can supply enough current to drive both motor and drive chip.

    I would put a scope on pin 9 to see if you get a flag for the current.
     
  13. codeeater

    codeeater

    12
    0
    May 10, 2013
    Hmm ok, another odd thing i've noticed is when I run the dc motor parallel to the electronics (ie directly connected to 12v and 0v), the voltage regulator gets hot.
    To me this implies there is a large current being drawn through the 5v line? Or does it make sense that the VR gets hot when the 12v line has a large current through it?
     
  14. Lord_grezington

    Lord_grezington

    117
    2
    May 3, 2013
    Can you send a schematic? Running the motor in parallel should not affect the electronics, so you VR is getting hot even if the motor is not connected. This may be a fault in the electronics.
     
  15. codeeater

    codeeater

    12
    0
    May 10, 2013
    Hey! Sorry to have been a while. Since I last posted I've started redesigning the PCB since the old one could do with some improvement.
    I've decided to have 2 separate boards: the control one, and the motor one.
    The control board has the main uC, the rs232 interface and the inputs.
    The motor board has all the H-bridges and motor connections.
    Today I've finished the control board so I was hoping someone could review it and offer opinions. I've attached a JPEG of the image, it is annotated with numbers so here I will explain what is going on:

    7 - 12V supply connected to here to voltage regulator
    4 - 5v out of voltage regulator
    2 - 0.1uF Capacitor from 5v - GND
    8 - 0.33uF Capacitor from 12v - GND
    3 - Diodes on 5v and 12v lines between voltage regulator and components/motors to help isolate the power supplies
    1 - 100uF capacitors to help supply power for both 5v and 12v when large current is drawn
    5 - 100nF capacitors right next to the VCC pins of the uC
    6 - these will be connected by wires to the control pins of the motor board

    Currently the motor board will have connections to the control board power supply so they can run off the one power supply. However, I intend on making room for another voltage regulator on the motor board so I can have completely separate power supplies and will use optoisolators to control the h-bridge.

    Does this look like it should be able to support a few motors and suppress spikes well?

    Thanks :D
     

    Attached Files:

    • PCB.JPG
      PCB.JPG
      File size:
      113.2 KB
      Views:
      126
  16. Lord_grezington

    Lord_grezington

    117
    2
    May 3, 2013
    Hi

    I have had a look at the layout however its hard to distinguish what is happening.

    I find if you use Design Spark, it takes a while to get the components you need but its very good ate putting schematics together and also very useful when you need to create the gerbers from the schematics (if you need them).
     
  17. codeeater

    codeeater

    12
    0
    May 10, 2013
    Ok sorry about that!

    Here is a simplified schematic. I've left out the programming and serial stuff because I'm sure that stuff is ok. What I've included is all the power stuff.

    Just to explain: -12V supply to Voltage regulator.
    -Small capacitors across each side of the voltage regulator.
    -Diode on both 12v and 5v lines to help isolate each from the other
    -100uF capacitor after each diode to supply power when high current is used (could make bigger if that's better?)
    -100nF across power supply to uC.
    - LED controlled by uC
    - LED which indicates power

    [Edit] Please note that the uC symbol isn't the correct one for the chip I am using, ignore all pins that aren't connected as I only corrected the labels of the ones I am using [/Edit]

    Can you see any improvements/problems?

    Thanks! :)
     

    Attached Files:

  18. Lord_grezington

    Lord_grezington

    117
    2
    May 3, 2013
    It all looks to be ok, apart from the first diode on the 12V input being the wrong way around.
     
  19. codeeater

    codeeater

    12
    0
    May 10, 2013
    That's great! The diode looks ok to me? The power is coming from the rail labelled 12V. The current then flows from that rail through the diode on the left to the H-bridges.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...
Electronics Point Logo
Continue to site
Quote of the day

-