Shop OBEX P1 Docs P2 Docs Learn Events
Minimum current of Steppermotordriver-chips L297 L298 — Parallax Forums

Minimum current of Steppermotordriver-chips L297 L298

StefanL38StefanL38 Posts: 2,292
edited 2010-08-13 06:33 in General Discussion
HI,

I would like to know what is the minimum current that can be adjusted on the L297 Steppermotor controller IC?

The L298 has maximum current of 2A. I would like to do some tests with steppermotors that are small and have a current of only 100mA
Can the Vref-Pin of the L297 be adjusted to such a small current-value?

Thank in advance

Stefan
«1

Comments

  • FranklinFranklin Posts: 4,747
    edited 2010-08-05 05:39
    I think you would adjust the current external to the chips using current limiting resistors like you do on the inpute and outputs of a bs2.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-08-05 06:40
    Minimum current? It would have to be zero - think about it.

    It sounds as if Franklin is guessing a bit. But using external current limiting resistors on chips are always an option to safe guard important components.
    It is always helpful to read the PDF and documents. And some take quite a bit of study.

    I know it can be difficult to get started with them, and so I am trying to read the PDFs for you as I write. But in this case, you will have to read both the L297 and L298 PDFs and look around for circuit examples of both chips being used together.

    Anyway, you generally only need to limit the current, if the power supply can provide more current than the stepper motors and all the related circuitry can handle. In that case, the motor coils would burn up. And maybe other components.

    Having a device that will supply 2amps and a motor that will consume substantially less is usually no real problem. The excess current won't be consumed because the internal resistance of the motor is high enough to limit the current (at the right voltage - if go to a higher voltage, things change).

    Now, about that Vref pin. I am not sure what to say.
    The L297 is a bit more complex that the average device. Can you just forget using current regulation on the 'chopper' circuit? I don't really know. And do you want to or not? If not, you have to do some electrical engineering to get the current sense and the Vref to work together. And you have to provide the oscillator circuit anyway.

    Looking at the L297 PDF.....
    There is an internal 'chopper' feature that requires an external oscillator. This does the stepping.

    Vef and the two current limiting pins are part of that chopper feature - a safety shut down. Vref will only take a maximum of 3V, so if you want to power theVref pin with a higher REGULATED VOLTAGE source, you will have to use a voltage divider to create an Vref input that is proportional to REGULATED voltage. The two current limiting pins require you insert current limiting resistors in series with the coils. They too create a voltage drop that is compared with Vref and need to be SOMEWHERE in the range of 0 to 3 Volts.

    There are two comparators on the chip that have control power to the coils with a plus and a minus input on each one: on one input (-), they mention current sense and the other input (+) the mention Vref. I seems to me that you have to provide something to the Vref to get the coils activated at all, but that the current sense might or might not be used. If the current sense pins aren't used, they may have to be tied to a ground with a pull down resistor while the Vref needs to be tied to a voltage of less than 3 volts (that means a voltage divider).

    Looking at the L298 PDF.....
    There is a complete schematic of the two devices combined including current sense inputs, and the input to Vref is just shown, not discussed.
    If you can get your current limiting resistors right, know the operating voltage drop, and hook them up to the current sense pins, I would just try to figure an appropriate Vref and then create a voltage divider that bring this down to something lower than 3 volts AND a bit more positive that the output from voltage drop across the current sensing resistors in normal use.

    If the voltage across the current sensing resistors is equal to more positive than this value, the power to the coil will be restricted. This is why I guess that means that the current sense pin is restricted to a maximum of +3 volts as well.

    ~~~~~~~~~~~~~~~~~~~~~~~~

    Go back and read the L297 PDF sections on Description and Circuit Operations. Eventually it will make sense. (I hope.)

    Think long and hard about the following excerpt:

    "When the current in a winding reaches the programmed peak value the voltage across the sense resistor (connected to one of the sense inputs SENS1 or SENS2) equals Vref and the corresponding comparator resets its lip flop, interrupting the drive current until the next oscillator pulse arrives."

    IN SUM, it looks this way.
    If you want to use current sensing, you need to figure out what voltage less than 3 volts will be provided by what values you use for the current sense resistors.
    If you don't want this protection, tie the current sense inputs to ground via a pull down resistor and put a regulated positive voltage of less than +3 volts on to Vref.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ain't gadetry a wonderful thing?

    aka G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan

    Post Edited (Loopy Byteloose) : 8/5/2010 7:08:47 AM GMT
  • lardomlardom Posts: 1,659
    edited 2010-08-06 22:03
    @Loopy Byteloose I think I will look into the L297. I would like to find out more about current sensing. I tried to limit current by using a counter in 'duty mode'. To switch the current I first used a TIP3055 npn which got much too hot. Then I destroyed two darlingtons, I think they were TIP120's, within seconds of activating the circuit. I used those transistors to provide supply current to pulse four smaller npn's for a stepper. Bad idea.
    I have used a 555 timer chip to create pwm and I know the chip has flip flops. It sounds encouraging. A voltage divider would provide a parallel current path which I see as waste. PWM is the method that makes the most sense to me. I know it's off topic but I was close to giving in to something I would not be satisfied with and I think you may have answered my question.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-08-07 11:14
    Current limiting is a bit exotic for me, but by recently trying to clarify the L297 and to build a new battery charger for my gel cells (my old one went up in flames a few nights a go - a nasty Taiwanese fire trap of a product) - my attention to this subject has been gotten.

    Many, many steppers just use a passive approach with a big current limiting resistor in series with the coils. In many cases, that is all you need.

    In the L297, they simply use a pair of comparators to create a digital high or low. When the digital output goes high, the rest of the logic apparently stops the chopper from clocking until there is a low. On one input of the comparator is a reference voltage and on the other is the voltage drop across the current measuring resistor. Some engineering calculations need to be done to figure out what value of resistor, what wattage of resistor, and whether to place it on the high side or the low side of the coil (In the L297 example the L298 shows them placed on the low side.) Between my bad math and typos, I won't go there. Figure it out and enjoy learning. Google 'current sensing'.

    In the analog world, my soon to be improved gel cell charger uses a 2n2222 transistor has it's emitter on one side of the resistor and its base on the other. The collector goes to controlling an LM317 that is also being held to 13.4VDC on a 12 volt gel cell. The current sensor does a fast charge with current (also it limits the rate of fast charge to something one the 1amp of LM317), then when it shuts down, the 13.4VDC regulated does a steady safe trickle charge. This charger is intended to be left on forever. (No more late night wake ups to smoking battery chargers.) The is a bit more complex to explain without a schematic, but as the battery gets closer to charging, the voltage difference drops and shut off the transistor.

    Actually, it is not too important here to explore the analog solution here, but it is nice to know. The digital one is really useful with BasicStamps, Propellers, SXes and whatever. They require a comparator chip -see the LM339.

    Using a comparator, one can easily set up a stepper with a BasicStamp and some large Darlingtons or MOSfets. Actually you need two comparators if you are using a bi-polar stepper - maybe more for other schemes. But the LM339 has four in one DIP>

    I do wonder about setting the reference voltage. Ideally, a regulated supply and a couple of resistors in a voltage divider would do nicely. But if you are unsure what voltage drop you are getting across your current sensing resistor, you might use a little pot instead - so you can tweak the reference. Measure the actual voltage drop across your current sensing resistor and resize if it is not in the ball park (say 2-3 volts) I even considered using zeners for a reference voltage, but then you might not have the ability to tweak. The current sensing resistors can get to be high watt if the coils are high amp in some cases and your choices may be very limited. You might not find a zener that fits the bill to get spot on control.

    So now I am thinking and wondering. Do I want to try to build a BasicStamp stepper controller with current control? I don't know.

    What I really, really, DISLIKE about the L297 and L298 chip set is that one apparently will have to make a board especially to wire them. Take a good look at the L298 chip package. It might just be easier to use MOSfets or TIP1xx's and to work with perf board.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-08-07 12:18
    Iardom,
    Exactly how many amps are you trying to control? That TIP120 handles 5-8amps, the 2n3055 handles up to 15amps.

    Of course you are going to have heat. But if the transistors don't go beyond 125*C, they can operate. Up in the 150*C to 175*C, they burn up. At least that is what I've read. (It is silicon, just think of how much heat it takes to melt a beer bottle.)
  • lardomlardom Posts: 1,659
    edited 2010-08-07 22:40
    I have a Soyo 12V unipolar that is supposed to draw 400ma. I'm using a 5ah 12V lead acid battery. I first tried a 1/2w 33ohm series resistor that heated up. I was going to try a ceramic resistor but then I thought PWM would be the most efficient method and it would conserve battery power. I studied how to use the counters and tested the 'duty mode' on a small 12V light bulb using the TIP3055 to switch current. I made sure the bulb was dim. There were no problems so I connected my stepper coils to 4 npn collectors and then I connected the stepper center taps to the TIP 3055 collector. The 3055 became too hot. I have to expect a bit of smoke. Well..., now I want to learn to build a PWM chopper circuit. I will study the LM339. I'd like to know if anybody thinks a chopper circuit is worth the effort or should I just go with resistors?
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-08-08 04:58
    If everything is too hot, it seems obvious to check wiring first. I am in the habit of using fuses. If I expect less than 5 amps, I use a 5 amp fuse on a gel cell as they can unexpectedly destroy something in a microsecond.

    In your case, having a .4 amp rated motor draw 5 or more amps at the proper voltage is rather scary. I would have used a 1 amp fuse to verify a good build

    Current limiting is obviously a good idea. I like to design and build things from scratch with discrete components to confirm I do (or do not) understand the math, the PDF, and the theory. And that is what I am considering now.

    I looked back in your previous thread and you said you were using a ULN2803 to drive the stepper at 12 volts. What happened? I though the PWM was an additional feature to try and get the stepper to run smoothly through changes in speed.

    One possibility is that the 555 was providing excessive voltage to the transistor base. The TIP120 is rated at 5 volt max when the collector is open. But without a schematic, I can't really evaluate what went wrong.

    I am attaching something to hopefully get you started thinking about BOTH current limiting and current sensing. The two are different, but related topics. With passive current limiting, you waste a lot of power, but protect the circuit. With current sensing, you waste much less power to intelligently decide how to protect the circuit. A comparator and a microprocessor provide the intelligence.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-08-08 05:24
    You might rethink how you size parts.

    A 33 ohm resistor will limit the current to less that 400ma

    12volts/33 = .364 amps or 364 milliamps.

    But 12 volts x .364 amps = 4.36 watts. You did mention a 1/2 watt resistor, didn't you?

    This is very common mistake. People think that all they need to check is ohms law. But you need to right size components for all the heat that resistance includes.

    ~~~~~~~~~~~~~
    There is another issue to consider as well. What does that 33 ohm resistor do when inserted into a 12v circuit with a 400ma motor.

    Let's roughly figure the motor's internal resistance.

    12 volts / .400 amps = 30 ohms.

    Hmmm,
    If you put 33 ohms in series with the motor, you are causing a voltage drop of over 50%. Effectively, you have a voltage divider. 30ohm / (30 ohms + 33 ohm) * 12 volts = 5.45 volts to the motor and the remaining 6.55 volts is going through the resistor.

    So the real power consumption of that resistor is 6.55 volts x .364 milliamps = 2.38 watts. Better, but no where near that 1/2 watt resistor you tossed in.

    If you are going to use passive current limiting, you have to provide a raised voltage supply to compensate for all the waste in the current limiting resistor.

    ~~~~~~~~~~~~~~~~~~

    Let's just see what it would take to limit to .400 amps at 6 volts. You will see why in a minute. (Clue 12 volts+6volts in series =18 volts)

    6 volts /.400 amps = 15 ohms and that would be 6 x .400 = 2.4 watts.

    So if we had an 18 volt supply connected to the 12 volt .400 amp motor in series with a 15 ohm 3 watt resistor, things look pretty good.

    The 12 volt motor is getting .400amps at 12 volts, and...
    The 15 ohm resistor is getting .400amps at 6 volts.

    The voltage divider is working well.

    Later I will get into current sensing. Of course the advantage there is that the resistors in series is not using tons of power to regulate.
  • lardomlardom Posts: 1,659
    edited 2010-08-08 08:08
    When I switched from the ULN2803 to transistors there was an increase in motor speed. I have been using 4AA's without any problems. I'm wondering if the motor specs are wrong? I've relied on RadioShack too much. They don't sell a 5w resistor.
    The machine I'm working on is my third version. My first machine used a 555 and a modified servo. In 2009 I saw a Basic Stamp in Radioshack which enabled me to build a digital machine with a keypad and an LCD. The Prop version was a BIG jump and I wondered if I had hit my personal ceiling but the thrill of my first two accomplishments didn't last long. I'm hooked. The battery current is the final hurdle. I'm thinking of my next project.
    (StefanL38, I didn't want to hijack your thread. I think the answers I'm looking for are similar to yours.)
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-08-08 08:30
    You think the motor specs are wrong? Measure the coils with an ohm meter. You should get something around 30 ohms, right? But I find it very odd that it runs nicely on a ULN2804 and burns up TIP120s.

    After all 12 volts/ .400 amps = 30 ohms.

    The ULN2804 is rated for no more than 500 ma, while the TIP can go easily to 5000 ma and maybe 8000 ma. I suspect the flaw is in your circuit design, not the motor. That 33 ohm resistor might have been put in the wrong place.

    If you need higher watt resistors, but can't afford to buy them - try doing some math and putting several lower watt rated resistors in parallel. I was doing this with the TIP120 running at 4.66 amps. At a goal of 15 volts, I had 4 20 watt resistors in parallel to dump the heat from around 70 watts. Sure, I could of paid big bucks for a 100 watt resistor, but I might never use it again. So I used three 12 ohm 20 watt resistors and one 8 ohm 20 watt resistors and 12 volt auto lamp. I was worried about the 8 ohms failing though.

    Fortunately, the TIP120 had a 1 volt drop across it. My batteries were quite up to full charge, say 13.5 volts. So my real test came in at 12.5 volts across the load and the battery voltage quickly dropped as due the heavy load on the gel cells.

    If you look at the circuit board in the L298 PDF, they used lower watt resistors in parallel on the current sensing. Instead of just one 1 watt resistor, they used 4 1/4 watt ones. It pays to think mathimatically.
    ~~~~~~~~~~~~~~~~~~~

    Let's take this current regulation one step further. Let's say that you don't want to use an 18 volt supply, but you have a 15 volt one. The idea here is to economize power and reduce the size of needed parts.

    In that case, a 12 volt motor and a 3 volt add on for the current limiting resistor.

    3 volts / .400 amps = 7.5 ohms 3 volts x .400 amps = 1.2 watts

    That's interesting. We save on power because we don't have to dump so much from a higher voltage. We also reduced the wattage of the resistor required.

    If the supply goes down more, we might just get to a 1/2 watt resistor without trouble.

    ~~~~~~~~~~~~~

    Lets try a 12 volt motor and a 1 volt current limiting resistor.

    1 volt/ .400 amps = .4 ohms 1 volt x .400 amps = 0.4 watts.

    So it you have a 13 volt supply, you can use a 0.4 ohm resistor 1/2 resistor to get your current limiting.

    And we have an added bonus. That 1 volt is good for current sensing with the L297. The current sense wants a range between 0 and 2 volts.

    Hmmm... but wait. The Vref said 3 volts maximum while the current sense says 2 volt maximum. To be on the safe side, Vref better stay at 2 volts or less.

    Details, details, details.

    ~~~~~~~~~~~~~~~~~

    You mention 'choppers', but I have no clear idea what you think you are doing with them. The stepper motor needs to run through the steps. Is that driven by a 'chopper' or are you thinking of something different and additional to the circuit?

    Let me know and we can explore that.
  • lardomlardom Posts: 1,659
    edited 2010-08-08 10:43
    I put a schematic together to show current flow. The coil ohms are about right. I don't remember anything unusual. I use a meter to find the center taps and a 9V cell to find the order. (If you find a flaw in my wiring I'll be dancing in the streets!)
    917 x 381 - 59K
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-08-08 11:31
    Looks very odd to me, and maybe destructive.

    I have to consider the design of the 2n3055 current limiter separately and do some checking.
    I am having to guess that is what you mean by a TIP3035. Some resistors and transistors are not marked. That does not help. I am also guessing that the P20-23 & 26 are Propeller outputs.

    Take a good look at the schematic in the Motor Tips n' Tricks for unipolar stepper. That is right, very right.

    But the 3.3 ohms between the base and emitters of the other four transistors seems a disaster about to happen. Generally in transistor switches, a high value might be placed there to prevent the base from being pulled below 0 volts. Something like 10k ohms.

    Let me think about this and draw up something that I think should work.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-08-08 13:13
    Here you go. I can't begin to wonder what your design is doing.
    1. The power supply seems to be backwards.
    2. Those 3.3 ohm resistors seem quite dangerous to the I/O pins
    And there is much more.

    The attached design should work. Very, very heavy duty. Diodes should be 1n4002 or so. These are across the coils. The Darlingtons have their own inside.

    Darlingtons could be TIP100 for the NPN; TIP105 for the PNP.

    For 500ma, you probably could us 2n2222 resistors for the NPN and 2n2907 for the PNP. But you would have to add more protective diodes.

    I think I got everything right, but it is late here.
    470 x 600 - 65K
  • pjvpjv Posts: 1,903
    edited 2010-08-08 14:36
    Loopy;

    I see you suggest a PWM switching circuit in the motor + supply line. Why not just PWM the low side phase transistors, ANDed with the phase signals instead? Saves a switch and heat as well. Only a slight increase in software complexity.

    Cheers,

    Peter (pjv)
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-08-08 21:35
    PJV, has a good point. By using some logic chips one can eliminate that PNP Darlington or transistor. Eliminating one power transistor is an excellent idea as it is both expensive and wastes more power. I'll try to revise m drawing.

    I see that I have a pair of 12volt 340ma steppers similar to yours in my junk. So I may build a circuit using the 2n2222 NPN (no need for the 2n2907 PNP now). I will have to locate an appropriate GATE logic chip though.

    I took a look at your original schematic after a night' sleep and if that battery is indeed in backwards, you have all for coils on all the time. The flyback diodes would take over and keep everything on.

    Other than that.
    The resistors create some odd problems that might cause odd behavior when the battery is properly inserted.

    And I used a PNP for the PWM on the high side. Generally using an NPN on the high side is considered wrong. Again I am not sure what might occur.
  • lardomlardom Posts: 1,659
    edited 2010-08-09 07:02
    I will buy the parts, build the circuit and report back. I was pretty unclear on my schematic. The 3.3 was logic ground @ 3.3V but the 100 ohm pull-down resistors I used were just as bad. I used 470 ohm base resistors. I still have an awful lot to learn.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-08-09 07:50
    We are both learning a lot.

    Those resistors ARE NOT mainly pull down resistors (10K at the Base to Emitter). The other ones (1K) are limiting the current demands from the micro-controller. 1000 ohms may be too high with 3.3 volts, 470 ohms are better and won't hurt anything.

    Transistor switches are a bit odd. The 10K are there to make sure the NPN bases never go below ground (and burn up) and that the PNP bases never go above V+ (an burn up.

    The TIP120s have them internally, so my drawing really is showing an unnecessary duplication. But it is better safe that sorry as some Darlingtons don't and BJTs certainly do not.

    ~~~~
    It looks like I misled you on suggesting a TIP120 for PWM and I changed to a TIP125 in this circuit because it is 'high side' control. The NPNs are 'low side' and the PNPs are 'high side'.

    The good news is that you can use cheap transistors - 2n2222 and 2n2907 for 400ma.
  • lardomlardom Posts: 1,659
    edited 2010-08-09 09:31
    I thought I read somewhere that you are a teacher who had gotten an award. Your writing style suggests to me that you might be. At any rate this 'under-construction' forum is still an amazing resource. I own several electronics books that don't cover what I want to know. I'll be working on that circuit.
  • pjvpjv Posts: 1,903
    edited 2010-08-09 09:56
    Loopy;

    You are incorrect on your reason for the 10K resistors. They typically exiist to dump the base charge current when the base drive goes away. Where they are presently connected they are not required because the micro you are going to drive the transistors with, will pull high or pull low, and when it pulls low, will do the dumping for you. Instead, the resistors should be connected from the second base in the darlington to ground. Because as the first transistor of the darlington turns off, there is no dump path to get rid of the charge in the second base.

    Darlingtons are a very poor choice for your drive circuits. They are extremely slow to switch and have crappy saturation.... 0.8 or 0.7 volts at best. This means a lot of heat, and you WILL be causing smoke.

    I'm not sure what the coil resistance is of the motors you are using, but if they are less than a 10 to 20 ohms, you will also toast your motors. A significant series resistor will be required in the phase drive circuit to prevent that. And that causes poor voltage to be applied while stepping.... alltogether a most unsatisfactory arrangement as stepping speed will be severely impaired, causing even more heating. This is a path leading to a dead end.

    Instead, get yourselves some logic-level mosfet switches that can drive the current you need. They will switch very fast and are suitable for PWM operation which is the most important thing for you to create first of all, as it will become the basis of limiting the current in your steppers. Once you have the micro doing PWM suitably, add the logic to step the phases ANDed with the PWM signal, and there will be smiley faces all round!

    Shout if I can help further.

    Cheers,

    Peter (pjv)
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-08-09 10:34
    Thanks. We really need some good advice.

    Too some, it may seem absurd to explore building with discrete components, but I really have needed to do so in order to get theory and calculations working right. Returning to mistakes made by others doesn't hurt. One begins to see exactly why everyone says to use MOSfets, but one also sees where the other devices still might work well. Even Parallax is still using BJTs in the BasicStamp as they avoid static problems that are well known to MOSfets.

    I chose to explore Darlingtons because the ULN2803 has made them very popular for steppers. But when you get small enough, you can do a lot of sloppy things that are forgiven in circuitry. One might say that such circuits are nearly impossible to smoke.

    Trying to up-size has brought a lot of comment. It seems one has to use a Darlington that is way over capacity, or expect a lot of heat (and as you say smoke). I have dismissed the idea that high amp, solid-state relays are useful for DC, though there are some being cataloged at Mouser. In this case, steppers need a solid-state switch and cannot exploit mechanical relays.

    I was about to switch the circuit designs to MOSfets because you mentioned using logic, such as AND gates. The AND gates don't provide much power, maybe 1 ma at +5Volts in a 78HS08.

    So it seems I should have them driving MOSfets, not Darlingtons or BJTs.

    To that end, I spent the day trying to figure out a readily available MOSfets for this project - something between 500ma and 1 amp. (since the requirements are 12 Volts at 400ma). The 2n7000 might work, if you never use them for holding a step (they seem limited to 200ma under that condition, maybe closer to 125ma). I finally found a BT170 which is rated at 500ma solid for a steady state.

    In the end, it finally occurred to me that MOSfets can safely be used in parallel (unlike Darlingtons and BJTs). So two 2N7000s can handle 400ma (just barely); and 3 of them in parallel or one of the BS170s alone should do the trick nicely. I suspect that three 2n7000 devices will run cooler just because of more surface area to dump heat.

    So right now, I am in a redesign and thinking about what else I might of missed. And of course, re-read the MOSfet PDFs.

    Nobody seem to listen to this, but I have said that I use fuses on these projects. In this case, I would start with a 1 amp to prevent major mistakes from damaging too much. Eventually, I think the 400ma motor could run well on 1/2amp or 3/4amp as on-going protection.
  • pjvpjv Posts: 1,903
    edited 2010-08-09 13:49
    Loopy;

    Get yourself some logic level power mosfets that can dissipate a few watts and have a current capbility of 5 or 10 amps. They are cheap. The 2n7000 you suggest has an ON resistance of 5 ohms = SMOKE. Get something that is well lower than 0.1 ohms...... at 1 amp (I don't know what current you will be operating at) that is still 100mW, and will need a heat sink. They are available in the 10 to 20 milliohm range, and that will work.

    As far as the ANDing I'm referring to, I believe you mis-understand. I don't mean to drive the mosfet with logic AND gates, but directly (perhaps through a 100 ohm resistor) from the micro I/O pins, but ANDing the PWM signal with the phase drive sequences in software. No other chips are required. And the contemplated mosfets usually draw a trivial amount of power, so no driver chips are required.

    Furthermore the type with built-in source to drain diode (most) eliminates the need for your external fly-back diode when the motor is center-tap positive connected as per your diagram.

    Also do yourself a favour, and get an adjustable current limiting power supply.... fuses will blow well after the smoke appears.

    Cheers,

    Peter (pjv)
  • lardomlardom Posts: 1,659
    edited 2010-08-09 17:11
    @PJV, How do you 'AND' PWM with the phase drive signal?? Can it be done using the counters? Can it be done in Spin?
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-08-09 20:02
    I think I understand. Operating current seems to be 0.500amps at 12VDC. Does that really require a 5 amp rated device?

    So it seems I should be looking for something like an IRF510 power MOSfet (rated at 5 amps) and not these smaller ones. And I should rely on micro-controller code to mix PWM and stepping.

    I did locate better logic chips with 20ma power output and a range from 2-6VDC, the 74ACxx series. But that is moot. We won't be using them.

    All this makes the circuit design much simpler. But the software code will be a bit more complex.

    I must confess it is much easier to buy TIP120s over-the-counter here than it is to buy power MOSfets. Retail electronic component inventories are not very diverse. I'll see what I can get.

    And we are back to using devices rated at 5 amps to drive 1/10th the current demand. It does seem a bit of brute force. ( I only suggested the TIP120s because an Arduino schematic suggested one in a PWM tutorial (artist you know!) he... he... )

    ~~~~~~~~~~~~~~~~~~~~
    For combining the PWM and PHASE, it seems you would have to have a very fast Loop that looks at PWM output state (HIGH or LOW) and then repeats the phase that is currently ready to send. So would that have to be 1/16th of the PWM speed or 1/256th or what?

    Output to the stepper would alternate between the PHASE data of 4 bits and having the four bits all off.
  • pjvpjv Posts: 1,903
    edited 2010-08-09 21:32
    @Lardom; The ANDing is simply done in software. I personally don't use SPIN as I find assembler to be easier to write, much faster execution, and deterministic.

    @Loopy; Forget those TIP's.... they just are not suitable for high speed switching and will not saturate as low as a mosfet. Nevermind the difference in drive current. The reason for "oversizing" the current capability of the switch, is really more to do with lower saturation at the rated current, and power dissipation capability during the switching transient.

    I suggest again you get some logic level drive low RdsON mosfets and start experimenting. You can use either the SX or Propeller processors. First WRITE a PWM routine. I suggest you write one from scratch by looking at what others have done rather than just copying one. The latter approach will not teach you much, and you will forever be asking questions rather than learning to figure this all out on your own by experimenting and observing.

    At first, keep it simple. Two input buttons to raise/lower the duty cycle of the PWM on a single mosfet. Use a cycle repeat time of 50 uSec, so 20 kHz, and select the raise/lower buttons to give a range of 1 to 255 to represent 0.5 to 100%. Then connect a stepper winding's center tap to the positive of a variable power supply set to 1 volt and a current of 1 amp. That way you can't let out much smoke. Put a very small resistance such as 0.1 ohm resistor in series with the winding end and the drain of the mosfet, and the source to common. Put a second mosfet on the other end of the coil to common, but no need for the gate just yet, so tie that to common through a 1K resistor. We are simply using the diode in that mosfet for catching the back emf when the primary mosfet switches off.

    Turn the micro on, and use the buttons to select a 10% duty on cycle. Turn on the power supply, and observe the voltage on the upper side of the small resistor with an oscilloscope.

    Vary the duty cycle with the buttons, and observe what happens. Watch what happens when you increase the voltage of the power supply.

    Once you understand what is going on, then complicate the software some by adding two more buttons to raise/lower the cycle time of the duty. Again observe what happens.

    Next mod the software to give four non overlapping phase outputs again with speed raise/lower buttons, and connect up four mosfets, one to each winding end, and both center taps to the power supply plus. You can leave the one resistor to continue to monitor the voltage repesentation of winding current.

    Select the speed of the software to switch the phases at 1 kHz (speed is not critical) so that no winding builds up much current. Slowly, while observing the current monitoring resistor, bring the voltage up to 10 or 12 volts. Next, slowly slow the speed down with the buttons, and at some slower speed the motor will start to turn provided it has been phased properly.

    This is all a very large subject with much more instruction and learning to be done, and I'm prepared to help you with the next issues of combining PWM and phase drive, accelleration etc., provided you help yourselves, and you have the requisite equipment and components. It will be a large waste of time for me to explain things if you don't have an appropriate power supply or oscilloscope.

    I will guide you with the code, but you MUST be involved in the discoveries otherwise you are not learning, and I'm not prepared to do this on your behalf.

    Study the SX RTOS or the Propeller multitasking kernels I have provided as appropriate.

    Till next time,

    Cheers,

    Peter (pjv)
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-08-10 01:44
    The Propeller is 3.3volt. So far, the "Logic Level" devices I am finding are good for 5.0 volts.

    I do follow that your scheme is a vast improvement over my efforts as MOSfets have changed available performance. So, we have changed to explore something different.

    I did find a logic-level N-type MOSfet series with an "On Source Resistance" of 0.10 ohm or better, but that is specified for +5 volts.

    They are the NTE 2984, NTE 2985, and NTE 2986.

    Are these a good fit? And if they are, do we have to use a 2n7000 to turn them on from 3.3 volts?

    "but you MUST be involved in the discoveries otherwise you are not learning I do very much understand what you are saying, it take a serious commitment to thinking and seeing. I've never really mastered full comprehension your RTOS for the SX and it has been sitting on my computer's desktop for some time. So I fear that you may find me starting farther back than you expect.

    On the one hand, I've got to get the MOSfets built for the stepper, on the other I've got to revisit SX assembly code. I am interested (deeply so), but a bit unsure of myself.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-08-10 02:30
    One more question.
    Are we talking about starting with your RTOS in the Propeller or in the SX? I now see you have do this for both.

    I suppose that Assembly language in the Propeller might be a bit easier as there is no use of ISRs (interrupt service routines).
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-08-10 07:21
    I have been thinking over what you offered.

    First, it seems like we should start another thread with your goals defining its task. We have pretty much reached a dead end here as inserting 0.10 On Source Resistance Power MOSfet certainly resolves the heat problems that occur with Darlingtons and BJTs and can be easily driven by +5 logic. Without PWM circuitry, the schematic is very simple to implement.

    At 12 volts and 400ma, a 0.10 ohm resistance in series is almost nothing at full on. 0.4amps x 0.10 ohms = .04 voltage drop across the MOSfet.
    And 0.4amps x .04 volts = .016 watts Nothing is going to get very warm in the MOSfet at roughly 1/8th of a watt being shed in heat. (I do see the idea behind this and love it.)

    Second, you assume that I have an oscilloscope and a adjustable voltage with current limiting bench supply. I own neither. But I do indeed see why you are asking for them. (I could work around the oscilloscope at I have a setup that uses the audio card in my computer and 20Khz is within audio range.)

    And third, are there more people than myself that want to participate?

    I certainly welcome doing this as a group, but the prerequisites might be a bit daunting to some. I may just go out and buy a 'scope' and 'bench supply' as I've been ignoring these purchases for quite some time.
  • lardomlardom Posts: 1,659
    edited 2010-08-10 10:48
    @PJV, You have shown me a way to analyze mosfets and BJT's and not rely on guesswork so much . Even though I only have a usb scope, that information alone is worth the price of admission. I have made good progress in regard to my education but your prerequisites have placed the bar out of my reach. I get the sense it may be possible to use a counter to generate pwm, mix it with the phase sequence and eliminate a 5th transistor/mosfet.
    I cannot learn any of this from scratch. I can tweak and modify it. I have some great insights which makes this the most exciting hobby I have ever had. One of the insights I've had is that if I read a book I could learn in a short time what may have taken the author of that book an entire lifetime to learn. If you were to spell things out for me I promise I would study and learn what it teaches.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-08-10 12:38
    We need to agree on a platform for assembly code if we are going to work on this together.

    I am willing to consider any of the following:

    1. An SX28
    2. An SX48 or 52 (pretty much the same)
    3. The Propeller

    From there, I can begin to think, share, and compare code.
  • pjvpjv Posts: 1,903
    edited 2010-08-10 19:55
    @Lardom & Loopy;

    I'm happy to help you, but without an oscilloscope (USB scope should be fine) and an adjustable current limiting power supply things will be more awkward.

    It would be good also if you had a Parallax Prof. Dev. Board, but an SX/Propeller Demo board, or even a Prototype board would do in a pinch.

    I can go either way on processors, SX or Propeller as I am set up for both. SX would be a slight preference as the code will be simpler, and the SX-Key debugging feature is superior to what is available on the propeller. Performance will also be better, but eventual integration into a bigger system (think CNC) will later be easier with the Propeller and SPIN.

    Name your processor, and I'll start a new Stepper Motor Tutorial thread when you have the tools ready. This will consume a considerable amount of time on my part, but if you two are commited, I'll put forth the effort as I can sequester the time.

    Cheers,

    Peter (pjv)
Sign In or Register to comment.