Shop OBEX P1 Docs P2 Docs Learn Events
Interfacing the Prop with a L298 — Parallax Forums

Interfacing the Prop with a L298

PhilldapillPhilldapill Posts: 1,283
edited 2008-03-18 22:55 in Propeller 1
From an earlier post, I said I was trying to make my own dual H-bridge circuits to drive some steppers for a CNC machine I'm making. Well, I made a test Hbridge and after 2 hours and probably 1/2 a pound of solder(kidding), it works great. It's a chopper circuit so nothing gets too hot. The only thing, is that it takes way to long to construct to be worth it. Many people had suggested using a L298 chip, so that's what I've decided to do.

Now, I'm not too sure on how to use it. Looking at the datasheet, I need to connected a couple of shunt resistors at the "sense" points, but from my understanding, if the IC is sensing the current(voltage across the shunts), then it needs to compare it to SOMETHIING to chop the circuit, right? I really don't want to have to buy the L297 IC's too since they are already about $4 a pop as it is. Can I only use the L298 by itself as it is?

The other thing, and main question, is how to interface this to the propeller. I'm assuming it's fairly easy and it's similiar to sending data to my H-bridge. All I need to do is send the inputs of the L298 the correct stepping sequence info and it's good to go, right? Please let me know if I'm wrong in any of this...

Comments

  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-03-17 21:37
    Actually, I've looked at the L298/L297 combo and I think I know what it's doing. The L297 is simply a chopper circuit that monitors the current through the shunts connected to L298. If that's the case, a $0.25 op-amp is a heck of a lot cheaper and can do the job with a some voltage dividers for the reference voltage. Eh?
  • grasshoppergrasshopper Posts: 438
    edited 2008-03-17 22:46
    I use a l298 and I just shorted the sense pins to ground. I loose the feedback, but gain pins on my microprocessor. You don't necessarily need the sense resistors.

    Are you going to use the IC for a stepper motor or a regular motor? Let me know and ill post a schematic for your needs.

    Also how much current are you going to be drawing from the IC? You can wire it up a few different ways depending things...
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2008-03-17 23:00
    The L298 is a bipolar fabricated IC (I don't mean a bipolar motor driver) so you will need eight 3A+ diodes externally. This plus a huge heatsink was always the big reason for not using this chip. There are other chips like the L6208 DMOS driver which handles 2.8A RMS in a small 24 pin package and includes all the 297 functions and charge pumps etc.

    Also, there are a couple of modes of chopping, one is called phase chopping and the other inhibit chopping, both of which affect the current recirculating path.

    If you are driving the H-bridge directly I would use an RC DAC to generate the voltage reference back into a comparator as this allows you to control the current which makes modes such as micro-stepping possible and even just reducing holding current to keep things cool. It may be possible to skip the comparator and just use the 2R2C ADC on the prop (it just a DAC self-balancing the input).

    ST have a couple of excellent appnotes on stepper motors and drivers.
    www.st.com/stonline/products/literature/an/1681.pdf
    www.st.com/stonline/products/literature/an/1734.pdf


    *Peter*
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-03-17 23:09
    grasshopper, I may be wrong in this, but if you aren't using any feedback from the shunt resistors, it seems you aren't getting the full advantage of these L298's. From what I gather, they act as a chopper circuit. I'm using a stepper motor, so with these, you can apply a much higher voltage at first to get the current moving in the windings. Once current is flowing, th L298 "chops" the current on and off to mantain a set level through the shunts. I've attached my original H bridge design I made a week or so back. I think it does the same thing. At most, I think I'll be pulling 1A in each winding. That is the peak, and the average is probably 500mA or less. These aren't huge motors. However, I want to increase the speed of them without sacrificing that much torque. Right now, I can get them going at about 1800steps/sec without much load. Any higher, and they stagnate and buzz.

    Now, if you'll look in the schematic, this is only a single H-bridge. Notice the op-amps and the shunt. The opamp is there to constantly compare the voltage dropped across the shunt(which is proportional to current, ohms law), with the signal voltage through the voltage divider. If there is a high signal at the voltage divider, the opamp adjusts it's output voltage so that the voltage across the shunt is equal to the signal. To increase the current, turn the pot up.

    I think this design with the opamp can be adapted almost identically to the L298. Instead of the output of the opamp going to the transistor base, it can go to the input of L298. In this arrangement, I don't think you're using anymore CPU pins than normal. I think in your arrangement without the sense resistors, your L298 is trying to push ALL the current it can through.
    653 x 709 - 46K
  • grasshoppergrasshopper Posts: 438
    edited 2008-03-18 01:13
    Philldapill,

    Yes I understand the need for the feedback, but couldn't you achieve the same results by "Ramping" the stepper motor with "code?" I use software to ramp up then ease back down to level off the current. This happens so fast to the naked eye and It has worked for me so far. This combined with an external optical sensor to find a HOME position, I can keep accuracy to a high level.

    I am sure you are correct about pushing all the current through with out using a sense resistor, but I control the current within the code.

    Hum ill have to do some more tinkering because i could be approaching this wrong. Lets keep discussing this.
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-03-18 01:25
    When you say "ramping up" the current, are you talking about doing PWM? That seems like the only way I can think of... increasing the duty cycle... I suppose that COULD work, but I'm using spin and I don't konw if that would be fast enough. After all, I'm trying to get 2000steps/second out of this, and there is a lot of code just to do that... Peter's idea about using an RC DAC from the prop to generate a precise reference voltage is interesting. I'll edit this later and add a schematic as to what I mean, but I'm thinking being able to control the current in software by adjusting the DAC value... I like this alot.

    What I'm thinking about doing, is generating a voltage reference using the DAC. This reference would be buffered with an op-amp as a voltage follower. From the ouput of the opamp, I would have 4 NPN transistors that I would switch on or off with the prop. The collectors would be connected together and to the output of the opamp. The emitters would all be seperate, and would be connected to a couple more opamps as shown in my schematic earlier. This way, instead of having a 0 or 3.3V signal going to the inputs of these op-amps and having to adjust the voltage with the pot/voltage divider, I could adjust the signal voltage with the DAC. I'm a beginner electronics nerd, so this may be simple, but it seems brilliant...

    FYI, schematic now attached and·Dual H-Bridge schematic revised.

    Post Edited (Philldapill) : 3/18/2008 3:04:16 AM GMT
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-03-18 22:55
    Grasshopper,
    Can you send me a schematic of how you are using the L298? I'm designing a PCB at the moment that will use the Prop to control multiple steppers. The prop will recieve commands from a printer port, which will act on those by moving steppers.
Sign In or Register to comment.