Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Stepper Motor Controller only working on a particular power suppy?

  1. Jul 14, 2009 #1
    I'm making a circuit around the stepper motor controller L297 on a breadboard, and I've got it working so far. I haven't connected it to the H-bridge and so obviously not to the motor either. But I'm checking the logic levels using 4 LEDs connected to the outputs and they corrospond with the L297's data-sheet.

    Here's the really quirky bit, I'm running the circuit using a 9V battery wired to a 5V Regulato which feeds the L297. This circuit is only working off this particular battery. I've got another, fresh, battery that does nothing. The IC remains in its initial stage and no matter how many pulses are applied, refuses to change its state.

    I've also wired a cheap wall-wart and I get the same problem.

    I've just spent hours and hours on this thing and I'm pretty frustrated because it just doesn't make any sense.

    I know its impossible for anyone here to analyze the circuit, but any tips/advice on how to solve the power problem would be MUCH appreciated!
  2. jcsd
  3. Jul 14, 2009 #2


    User Avatar

    Staff: Mentor

    You're going to need more than a 9V battery to run a stepper motor. Do you have an oscilloscope that you can use to trace the circuit operation?
  4. Jul 14, 2009 #3
    Yes, I know I need more than 9V to run the motor. I'm just using it for testing purposes right now, with the micro-controller.

    Unfortunately, I do not have an oscilloscope.
  5. Jul 15, 2009 #4


    User Avatar

    Staff: Mentor

    You do not need more than 9V -- that's not what I said.

    Quiz Question -- if you don't have a 'scope, how can you use your DVM to debug this problem?
  6. Jul 15, 2009 #5
    Yes, I'm sorry, its not the voltage. Its the current. Very new with this stuff so I don't really know what I'm doing.

    Do I measure the voltage at different points? If so what points? My meter can also measure the frequency.

    EDIT: I've also soldered the circuit now, incase I was messing up the wires or something before. Unfortunately, the problem persists.

    EDIT 2: It seems if I leave the other battery connected for a while and come back to it, the circuit works. So it seems to be a voltage related problem. I know the battery that works all the time wasn't new. It still doesn't make any sense though.

    Any advice?
    Last edited: Jul 15, 2009
  7. Jul 15, 2009 #6


    User Avatar
    Science Advisor

    From the data sheet, it looks like the stepper motor controller L297 has to have 5 volts on pin 12. So if you are putting 9 volts there, it probably won't work and may damage the chip.

    This is possibly why your old 9 volt battery works but a new one doesn't.

    If the chip is OK, you may be able to get it working properly by getting a 5 volt regulator and supplying a genuine 5 volts to pin 12. A typical 5 volt regulator is a LM7805.

    The 297 does not appear to drive a motor directly either. It needs another driver chip to do that.

    I suggest you get the data sheet and read it carefully. This is a complex chip and the voltages and settings need to be correct.
  8. Jul 15, 2009 #7
    Mate, if you had read my post you would have seen I said I am using a 5V regulator. Infact, I am using 7805.

    I know about the driver, I have it. I haven't hooked it up yet because I'm taking it step by step.

    I got a brand new battery just now and same problem, the IC just doesn't change state with the clock applied. Its frozen in its initial state i.e 0101.

    For what its worth, I have grounded the Sense inputs (as per the application note), I have connected Vref to Vs - as I don't intend to use the chopper feature. Controller pin is not connected anywhere.

    Its just baffling that it works on its beloved battery, but not on any other supply! 9V or otherwise!!

    EDIT: One more thing, I haven't added a capacitor in parallel with the Regulator. I've seen it done often on power supply, but since i've connected a DC source anyway, I assumed it was unnecessary. Do you suppose this is the culprit?
    Last edited: Jul 15, 2009
  9. Jul 15, 2009 #8


    User Avatar
    Science Advisor

    Have you measured 5 volts on pin 12 of the chip?
    If that is there, it shouldn't matter what power source you are using.
  10. Jul 15, 2009 #9
    Yep, its 5.002V.
  11. Jul 15, 2009 #10


    User Avatar
    Science Advisor

    So, it has nothing to do with the battery. It is something else you are doing.
  12. Jul 15, 2009 #11
    The circuit itself does not change at all, I've soldered it. I switch the batteries, it works.

    If I leave it alone for 30 mins, it'll start working on the battery it doesn't like.
  13. Jul 15, 2009 #12


    User Avatar
    Science Advisor

    If you measure the 5 volts on pin 12 under the different conditions, you might see when it isn't there, the chip doesn't work, and when it is there, the chip does work.

    The battery voltage will drop if you run it for a while and the regulator could cut off if it gets too hot. These are two things that could be happening.

    If you can relate the voltage on pin 12 to the chip working or not working, it should be easy from there. All that chip cares about is getting 5 volts on pin 12. If that comes from a wall wart, it will be cheaper in the long run, but the wall wart has to be free of hum ripple.

    There should be a capacitor from pin 12 to ground. 0.1 uF would be a good choice. But that isn't likely to cause this sort of go-no_go behaviour.
  14. Jul 15, 2009 #13
    Okay, I did some measurements. The regulator is outputting about 5.02V on a fresh battery. The circuit does not work with this battery.

    If I connect the old battery, it gives out about 4.85V, sometimes 4.93V (the battery's voltage is around 7.72V). It works on this battery.

    If I leave the circuit on with the fresh battery, after a while it starts working again. The regulator is still giving out 5.02V with this battery.

    The 7805 has a heatsink attached to it and does not get hot, at all.

  15. Jul 15, 2009 #14


    User Avatar

    Staff: Mentor

    Do you have any floating logic inputs? Any control inputs that you are not tying off?
  16. Jul 15, 2009 #15
    I had the Controller pin floating. I tied it low and it had no effect.

    One more thing, if I use the wallwart, and I manually apply a pulse (that is I take the Clock pin to high and low myself using a wire), the LEDs I've attached to the outputs of the IC flicker.
  17. Jul 15, 2009 #16


    User Avatar
    Science Advisor

    It seems that the current sense pins 13 and 14 should be grounded or the chip will think the motor is drawing too much current.

    Also, it seems the reset pin, pin 20 should be held high by connecting a resistor to pin 12 from pin 20. About 4.7 K would be OK.

    Also, pin 15 should be given about 2.5 volts by putting 2 resistors in series across the power supply and connecting pin 15 to the middle of them.
  18. Jul 15, 2009 #17
    Pins 13 and 14 are grounded.

    I tied pin 20 directly, without any resistor. Would a resistor make a difference? If so, how?

    The application note states the following:

    I connected VREF (pin 15) to Vs, directly.

    Last edited by a moderator: Apr 24, 2017
  19. Jul 15, 2009 #18


    User Avatar
    Science Advisor

    I tied pin 20 directly, without any resistor. Would a resistor make a difference? If so, how?

    The resistor would let you do a reset by grounding the pin. If it is connected directly, you can't short out the power supply to do a reset

    It looks like the batteries are not the problem and you have something else wrongly set up.
    So, you will need to work through the pins to find out how each one of them should be treated.

    How are you applying pulses to the chip?
  20. Jul 16, 2009 #19
  21. Jul 16, 2009 #20


    User Avatar
    Science Advisor

    I looked back at the measurements you did earlier.
    The time it worked was when the regulator stopped working and you got less than 5 volts on the chip.

    Normal 555s (ie not the CMOS ones) give less than 5 volts p-p square wave output with a 5 volt supply. Sometimes, I have seen it as low as 3.5 volts.

    This is a bit of a guess, but maybe the output is not enough to drive the L297 if it is getting the full 5 volts, but enough to drive it if it is getting less voltage.

    You could try putting a Silicon diode in series with the L297 after the regulator, but not in series with the 555 so the 555 gets more voltage than the L297.

    Alternatively, a CMOS 555 will give the proper 5 volts out if it is getting 5 volts supply itself.

    Or, you could run the 555 off 6 volts.
  22. Jul 16, 2009 #21
    I'll try your suggestion!

    However, even if I disconnect the CLK from the 555 and apply it 'manually' i.e by taking the pin high and then back low, it doesn't work. It does work with the other battery.

    But I'll try your suggestion and report back.

    thanks a lot for your help so far.
  23. Jul 16, 2009 #22
    Powered the 555 chip directly off the battery. Had no effect on the operation of the circuit. It works on the one battery and not on the other one. The freq. and duty cycle of the clock is the same on both batteries.

    The capacitor and resistor values on my circuit are different than the ones on the data-sheet. Do those matter? They just define the chopper rate. The datasheet specifies the resistor should be higher than 10K (if i remember correctly). Mine is 14K or so.

    It is possible that the chip is damaged? Its probably unlikely since it does work under certain conditions.

    Also, should I connect the floating pins somewhere? The datasheet doesn't specify if I don't intend to use the chopper feature.
    Last edited: Jul 16, 2009
  24. Jul 16, 2009 #23


    User Avatar
    Science Advisor

    Maybe get some more data.
    Floating pins are deadly but in case they are outputs, you shouldn't just ground them. Put 10 K resistors or similar from each unknown floating pin to ground.

    If you have a silicon diode, try putting it between the regulator and the L297 chip's pin 12.
    It seemed to work better when the supply was low. This will drop 0.6 volts and give you a 4.4 volt supply, purely as a test.

    However, maybe it is time to assume the chip is OK and wire it up to drive a motor. At least you will have proper circuits for doing this.
    The chip is probably OK if it works sometimes, so it is probably just the test setup that is wrong.
  25. Jul 16, 2009 #24
    It sounds to me like the chip is pulling spikes of current periodically, which drops the supply voltage and scrambles the chip. the reason i suspect this is that a cold 9V battery and a wall wart don't work, but anohter 9V does work--that sure sounds like there are current spikes that some supplies can handle and others can't (and after the one 9V gets hotter it can handle it because a hotter battery has a bit lower internal resistance). Solution: put both an electrolytic cap and a .01uF cap between 9V (before the regulator) and ground. Watch the polarity on the electrolytic of course( I know you probably know this but thought I'd say it just in case). That should handle the current spikes, if there are any.
  26. Jul 17, 2009 #25
    Wow, fleem, it worked! I added two capacitors and its working on all batteries (I tried 4) and the wall-wart.

    You absolutely rule!

    One more question though!

    The stepper motor I have is rated 12V with a impedance of 2 ohm per winding. I'm guessing its a bi-polar motor because its got 4 wires coming out of it.

    My question is, do I feed this motor 12V? If so, its going to pull 6A, isn't it? Thats a lot and I dunno how the L298 driver is going to handle that since its rated at 2A or so.

    Can I feed it less than 12V? If not, what do I do? Get a different motor?

    I'm making this circuit to make a barn door tracker, for astrophotography, so its going to be out in the field. The best source that I can get is probably a 12V battery from the car.

    Any advice?
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook