Shop Learn
Microstepping a motor with the Propeller and PWM — Parallax Forums

Microstepping a motor with the Propeller and PWM

ElectricAyeElectricAye Posts: 4,561
edited 2011-01-20 12:45 in Propeller 1
For the past few months I've been using an L6208 chip to drive some of my stepper motors in full step mode, and the chip seems to work just fine for most applications. But with a stepper motor that moves at 200 steps/rev going at low speeds, running in the full step mode gets pretty noisy, mechanically speaking. I'm guessing half step mode isn't much better, so I've started looking at the possibility of using this same L6208 chip to perform some microstepping miracles. Or at least try to.

I found some sane-looking articles on performing microstepping with the L6208, and I think I understand what they're talking about, but I hate to dive into it without asking you brainiacs on the forum what you think.

I think I understand the general concept of using PWM to alter the Vref levels, but I'm guessing the devilish details will involve getting the timing of the clock signal and those PWM signals all working in concert, so I was wondering if anyone knows of any SPIN-based microstepping code examples that I might use for inspiration and enlightenment.

Of course, any other comments or suggestions would also be appreciated.

many thanks,
:)

L6208 data sheet:
http://www.st.com/stonline/books/pdf/docs/7514.pdf

Articles on microstepping with this chip:
http://www.st.com/mcu/modules/Splatt_Forums/downloadtemp/AN1613_Microstepping%20with%20ST52.pdf

http://www.st.com/stonline/books/pdf/docs/8700.pdf
«1

Comments

  • jmspaggijmspaggi Posts: 629
    edited 2010-11-08 15:17
    Hi,

    Have you make any progress with you microstepping?

    I need to control 3 step-motors and was on my way to build that:
    http://ustep.homecnc.fr/index.php?page=1
    (Same page in english: http://translate.google.ca/translate?u=http://ustep.homecnc.fr/index.php%3Fpage%3D1&sl=fr&tl=en&hl=&ie=UTF-8 )

    The card to power the motor is using a PIC and I would like to use a propeller instead. Ok, it's way more expensive, but I don't understand how it's working with the PIC ;)

    How are you driver your motor? Do you have any schema to share?

    Mine will require 3A with 32V.

    Thanks,

    JM
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-11-08 18:30
    jmspaggi wrote: »
    ...

    Have you make any progress with you microstepping?

    ...

    Yes, I got the L6208 chip to microstep with the Propeller this past weekend and the stepper motor movement now seems very smooth compared to "normal" stepping techniques. My code was written entirely in SPIN. It's a very crude code but it's able to run the motor smoothly up to at least 100 full steps per second, which is good enough for my application. I turned the Vref waveform into a sinusoid by using the duty cycle system suggested on page 9 of the AN1613 application note I mentioned above, which divides each step into 8 microsteps. (Of course, you can always divide each step into as many microsteps as you want or as is practical.)

    For a PWM low-pass filter I used the exact LC system described on pages 10-12 of AN1613.

    I've got a small PCB designed but it's done in the free software from expressPCB.com, so I'm not sure it works with anything else but expressPCB.

    If you want to see the code or anything else, let me know and I'll post it here. But do be aware that I'm a perpetual newbie and my amateur status is reflected in all my designs and code.
    jmspaggi wrote: »
    ...

    Mine will require 3A with 32V.

    ...

    Be sure to look over the L6208 data sheet. The L6208 can take above 2.8 amps for a little while but I don't know how long it could handle 3 amps at 32 volts.



    cheers,
    Mark
    :)
  • jmspaggijmspaggi Posts: 629
    edited 2010-11-09 05:07
    Hi Mark,

    Thanks for your feedback.

    Finally yesterday I look at the TB6560AHQ documentation and I think I will use that because it's doing everything for me ;) I just need to pulse the steps from the propeller and I will do the sin wave, etc.

    I will try that this week. And if it's not working, try the same way as you did.

    Thanks,

    JM
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-11-09 06:19
    jmspaggi wrote: »
    ...

    Finally yesterday I look at the TB6560AHQ documentation and I think I will use that....

    JM,

    That looks like a good chip - it's certainly cheaper!
    Be sure to pay close attention to its parameters, especially it's current load for what you're doing. Be sure to look at the usage suggestions if you haven't already done so:

    http://www.semicon.toshiba.co.jp/docs/application_note/en/TB6560AHQ-E_en_090324.pdf

    I'm not religiously attached to the L6208, so let us know how this chip works out for you. Maybe I'll switch to using it if it works just as well.

    Keep us posted!

    Thanks,
    Mark
    :)
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-11-21 22:10
    jmspaggi wrote: »
    ...
    Finally yesterday I look at the TB6560AHQ documentation and I think I will use that because it's doing everything for me....

    JM,
    did you ever get the TB6560AHQ chip to work with the Propeller? Did things turn out well?

    thanks,
    Mark
  • jmspaggijmspaggi Posts: 629
    edited 2010-11-22 05:01
    JM,
    did you ever get the TB6560AHQ chip to work with the Propeller? Did things turn out well?

    thanks,
    Mark

    I'm still waiting for the components :(

    They was backorder at DigiKey. They should be send on the 24th. So might be able to try them soon. But give me at least 2 weeks to complete the boards ;) I'm not very efficient ;)

    I'm confident I will be able to drive them with the Propeller. But not so confident regarding what I draw ;)

    I will post the gEDA schema and pictures today...

    JM
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-11-22 05:58
    There is a guy that has taken microstepping to extreme on a PIC and provided the code for study. http://www.piclist.com/techref/io/stepper/linistep/index.htm

    I think this is more than you could ever wish for. Simple operation of a stepper motor with out micro-stepping is a breeze in Assembler code, but trying to do so much more getting to be a real challenge.
  • jmspaggijmspaggi Posts: 629
    edited 2010-11-22 10:22
    Thanks for the link.

    The TB6560 is "only" 5$... Then you just need few other components. At the end, you can drive 1 axe with about 10$. And you can ask him to do microsteps (I think it's 1/32) without having do to one line of code. Veryuseful when you don't have what's required to program a PIC. Then just plug you card to a propeller, and with simple Spin code, you can do micro stepping using sin form signal.

    I will try to do at least one board for the next week-end, but I'm still waiting for my motors too :(

    JM
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-11-22 10:30
    jmspaggi wrote: »
    ...

    The TB6560 is "only" 5$... Then you just need few other components....

    Yes, that's what I find attractive about what you're doing. My L6208 design is more expensive, seems to require more external components, is probably slower, and might even be harder to solder than your TB6560. So I'm very interested to see what you think about the TB6560. :)

    Thanks for keeping me up to date with your progress,
    Mark
  • jmspaggijmspaggi Posts: 629
    edited 2010-11-25 07:22
    FYI, still waiting for my TB6560 :(

    It should have been this week, but look like it will not be before next week.

    In the meantine, I found that http://www.hwml.com/PUTB6560.pdf and that http://cgi.ebay.com/Stepper-Driver-Toshiba-TB6560AHQ-Blank-PCB-/330469323623#ht_500wt_1156

    It's the PCB. I designed mine, and look like there is only one difference between the 2 boards! He is including a 5V regulator and I'm not. I simply just not add it since I will use a external +5V source. So I just bought 3. That will save me some time.

    More to come soon.

    JM
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-11-25 08:10
    jmspaggi wrote: »
    ...

    In the meantine, I found that http://www.hwml.com/PUTB6560.pdf ....

    Thanks. I'll have a look at this. :)
  • jmspaggijmspaggi Posts: 629
    edited 2010-11-30 07:56
    What was the odds?

    I looked in eBay for those cards and saw the guys is from Canada, like me. Good. But looking deeper, I figured he is from Qu
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-11-30 08:06
    jmspaggi wrote: »
    ...So first tests will have to wait for next week. But so far, everything looks great.

    ...

    That's good news. Thanks for the update. Based on what I see on the PCBs, these chips look much simpler to set up than my L6208. But I'm going to use you for a guinea pig before I switch to using your type of chips. :D

    Mark
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-12-30 07:36
    idbruce wrote: »
    ...Did you try the G251DriverV4 object with these drives? If so, how did it work for you?

    ...

    idbruce,

    I can't say I've tried out your driver yet. It will probably be a couple more months before I'll need to re-evaluate my stepper motor needs and maybe try out new things to see what's optimal. I must confess that I originally picked the L6208 without really knowing what I was doing - I guess I just had to start somewhere. I'm grateful that you and others are providing inputs on this. I'm surprised there isn't more "traffic" concerning stepper motors here on the forum.

    thanks again!
    :-)
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-12-30 08:03
    idbruce wrote: »
    ...you could probably get 10rps=20,000 full steps per second using this object. ...

    Wow. That's impressive. And certainly worth trying out. My present needs are very slow, however, so that would be overkill for my system. My only complaint about the L6208 is that it's expensive and it's tricky (for me) to solder those middle pins so that they establish a good thick heat sink to the ground plane. But, as it turns out, my applications so far have been so wimpy that I've never detected any temperature rise on the chip to speak of. One thing I learned the hard way: you must make absolutely sure that those middle heat sink pins are very well electrically grounded otherwise the chip will blow up. So I first solder those pins for electrical connection, and only then make a blobby solder bridge to connect those pins thermally to the ground plane, a technique that usually requires some mild heat gun action to heat up the ground plane a little so the solder will flow onto the ground plane.
  • jmspaggijmspaggi Posts: 629
    edited 2011-01-04 18:05
    I received my motors yesterday!!!!

    And I burned my 3 TB6560 this evening :(

    So I will have to re-order all the required components, and try to find what I did wrong.

    More news soon. I hope to get the new boards and components by next week-end.

    JM
  • ElectricAyeElectricAye Posts: 4,561
    edited 2011-01-04 18:48
    jmspaggi wrote: »
    I received my motors yesterday!!!!

    And I burned my 3 TB6560 this evening :(

    ...

    I'm so sorry to hear that happened.
    You're not alone, though. My first L6208 went up in flames - all because I had a bad solder joint where one of the middle pins needs grounding + heat sinking. On mine I guess the charge pump must have built up some wicked voltage and for a moment or two it looked like a welder's arc.
    Let us know what you find - or post some questions if you get totally stuck.
  • jmspaggijmspaggi Posts: 629
    edited 2011-01-05 04:40
    I found many possibles issues on my board.

    First, I used Wirewound resistors when they said in the documentation to not use wirewound resistors. I don't know what that mean, but can be an issue.

    2nd, I will need help to understand it. The TB6560 is rated for max 40V (High output withstand voltage: VDSS = 40 V). But they also say Operating Voltage Range 4.5 to 34V.
    My power suply is a toroical transformer with a 24V output. Which mean it should provide a 33.94V output. I'm in the range. A chance. But when I mesure the output, I have 39V. There is no load on it, so it might be the reason. But does it also mean my power suply is to powerfull and I need to get it down a bit?

    I just ordered 3 new boards. I will have them today or tomorrow. So I will be able to burn some more soon ;)

    Thanks,

    JM
  • SapiehaSapieha Posts: 2,964
    edited 2011-01-05 06:45
    Hi jmspaggi.

    Wirewound = Resistive Wire turned on ceramic ---> That resistors Give You not only resistance BUT even magnetic load ... (R+L)



    jmspaggi wrote: »
    I found many possibles issues on my board.

    First, I used Wirewound resistors when they said in the documentation to not use wirewound resistors. I don't know what that mean, but can be an issue.

    2nd, I will need help to understand it. The TB6560 is rated for max 40V (High output withstand voltage: VDSS = 40 V). But they also say Operating Voltage Range 4.5 to 34V.
    My power suply is a toroical transformer with a 24V output. Which mean it should provide a 33.94V output. I'm in the range. A chance. But when I mesure the output, I have 39V. There is no load on it, so it might be the reason. But does it also mean my power suply is to powerfull and I need to get it down a bit?

    I just ordered 3 new boards. I will have them today or tomorrow. So I will be able to burn some more soon ;)

    Thanks,

    JM
  • ElectricAyeElectricAye Posts: 4,561
    edited 2011-01-05 07:52
    jmspaggi wrote: »
    ....

    First, I used Wirewound resistors when they said in the documentation to not use wirewound resistors. I don't know what that mean, but can be an issue.

    .....
    My power suply is a toroical transformer with a 24V output.....

    JM,

    just a few quick thoughts while my coffee starts to kick in...
    When the data sheet says "absolute rating" it means that is the chip's upper limit before you are in danger of killing the chip. You really want to avoid getting close to any absolute values.
    Just to double check: by saying "transformer" for your power supply, you are getting a DC voltage, not AC voltage out of this supply, true? The power going to the chip must be DC.
    Also, I agree with Saphieha: if the data sheet says not to use wirewound resistors, then do NOT use them. They are creating an inductance that will resist fast changes to electrical current. It will mess up the chip's ability to monitor how the current is changing. That might be your biggest problem. You will want to use some sort of non-inductive resistor. They tend to be more expensive, but they are essential to this kind of circuit.
    Also, make sure you read through the pdf file I linked in post #5 on this thread. It gives some tips on how to work with your chip. For example, it says "The absolute maximum rating is 3.5 A per phase, and the upper limit of operating current is 3.0 A per phase." As I recall, that is what your motors require, which is right on the very edge of what the chip can do, so you must be especially careful.

    I'm certainly no expert on stepper motors, etc. but please keep posting your questions here so we can all learn from those who might be able to answer your questions.
    In any case, don't rush into making and testing a new board. Take your time to understand what might have gone wrong with your first tests.

    good luck! :)
  • jmspaggijmspaggi Posts: 629
    edited 2011-01-05 08:24
    Sapieha wrote:
    Wirewound = Resistive Wire turned on ceramic ---> That resistors Give You not only resistance BUT even magnetic load ... (R+L)
    So I was really wrong there :(
    idbruce wrote: »
    I played that game way too long myself. I finally got to point to where I was worried about damaging my motors. So I made up my mind to get some good but decently priced stepper drivers. I settled on the G251's from Gecko Drive.....

    I looked at those drivers, but they are expensives :( It's $70+taxes per driver. When I can get the 3 TB6560 drivers for $45 including taxes. That's why I want to try first with the TB6560. When everything will be working fine, maybe I will upgrade to a Geko driver, but I want to be sure first that I can see my motor moving with something cheaper.

    Regarding the code you have on the other Thread, I can use it with the TB6560, right? I don't think it's specific to a driver?
    When the data sheet says "absolute rating" it means that is the chip's upper limit before you are in danger of killing the chip. You really want to avoid getting close to any absolute values.
    That's what I thought too. So I will have to figure if my power suply is to powerfull or not...
    Just to double check: by saying "transformer" for your power supply, you are getting a DC voltage, not AC voltage out of this supply, true? The power going to the chip must be DC.
    I have a toroidal transformer.
    Sorry, it's in French, but here is what it looks like. At the end, I have a close to DC signal.
    Also, I agree with Saphieha: if the data sheet says not to use wirewound resistors, then do NOT use them. They are creating an inductance that will resist fast changes to electrical current. It will mess up the chip's ability to monitor how the current is changing. That might be your biggest problem. You will want to use some sort of non-inductive resistor. They tend to be more expensive, but they are essential to this kind of circuit.
    I just did not figured they was the wrong one when I ordered them :( I will have some new soon.
    Also, make sure you read through the pdf file I linked in post #5 on this thread. It gives some tips on how to work with your chip. For example, it says "The absolute maximum rating is 3.5 A per phase, and the upper limit of operating current is 3.0 A per phase." As I recall, that is what your motors require, which is right on the very edge of what the chip can do, so you must be especially careful.
    Yep, I already read this PDF, and another one I found on Toshiba's web site. My motor require 2.8A, so I should be fine. That's one of the reasons why I choosed this driver.
    I'm certainly no expert on stepper motors, etc. but please keep posting your questions here so we can all learn from those who might be able to answer your questions.
    In any case, don't rush into making and testing a new board. Take your time to understand what might have gone wrong with your first tests.
    I asked the guy who is selling me the TBs and the boards to put all the components into it and to solder them for me, and he agreed on that. So the next I will have will be all made. I will just have to "plug" and "play"... I give him the values for my steppers (2.8A) and my power suply (24VAC to about 36VDC). Will see the result.

    If it's still not working, I will maybe fo like what idbruce is suggesting and move to a Geko drive :(
    good luck! :)

    Thanks. Look like I will need some ;) So next try probably tomorrow or Friday.

    JM
  • ElectricAyeElectricAye Posts: 4,561
    edited 2011-01-05 08:51
    JM,

    I'm curious: the application sheet shows a fuse located after the power supply. Did you happen to have a fuse in your system?
  • SapiehaSapieha Posts: 2,964
    edited 2011-01-05 09:11
    Hi jmspaggi.


    You can't use that transformer to directly drive Stepper Motors/Drivers.
    Betwen that transformer You need one DIODE-BRIDGE AND Relatively BIG BULK Capacitor to have stable DC Voltage to Stepper IC and Motors.


    jmspaggi wrote: »
    So I was really wrong there :(



    I looked at those drivers, but they are expensives :( It's $70+taxes per driver. When I can get the 3 TB6560 drivers for $45 including taxes. That's why I want to try first with the TB6560. When everything will be working fine, maybe I will upgrade to a Geko driver, but I want to be sure first that I can see my motor moving with something cheaper.

    Regarding the code you have on the other Thread, I can use it with the TB6560, right? I don't think it's specific to a driver?

    That's what I thought too. So I will have to figure if my power suply is to powerfull or not...


    I have a toroidal transformer.
    Sorry, it's in French, but here is what it looks like. At the end, I have a close to DC signal.


    I just did not figured they was the wrong one when I ordered them :( I will have some new soon.


    Yep, I already read this PDF, and another one I found on Toshiba's web site. My motor require 2.8A, so I should be fine. That's one of the reasons why I choosed this driver.


    I asked the guy who is selling me the TBs and the boards to put all the components into it and to solder them for me, and he agreed on that. So the next I will have will be all made. I will just have to "plug" and "play"... I give him the values for my steppers (2.8A) and my power suply (24VAC to about 36VDC). Will see the result.

    If it's still not working, I will maybe fo like what idbruce is suggesting and move to a Geko drive :(



    Thanks. Look like I will need some ;) So next try probably tomorrow or Friday.

    JM


    PS. DIODE-BRIDGE AND Relatively BIG BULK Capacitor NEED have possibility to handle at last DUAL CURRENT needed for that Circuity !!
  • jmspaggijmspaggi Posts: 629
    edited 2011-01-05 09:20
    Sapieha wrote: »
    Hi jmspaggi.


    You can't use that transformer to directly drive Stepper Motors/Drivers.
    Betwen that transformer You need one DIODE-BRIDGE AND Relatively BIG BULK Capacitor to have stable DC Voltage to Stepper IC and Motors.






    PS. DIODE-BRIDGE AND Relatively BIG BULK Capacitor NEED have possibility to handle at last DUAL CURRENT needed for that Circuity !!

    My message should have included this link:

    http://www.usinages.com/mes-cartes-pour-ma-cnc-t24379.html#287633

    That's where it's in French ;) In the picture you will see what I build. There is the Transfo, there is also a fuse per axe, and the big capacitors. All sized based on the current required for the steppers.

    JM
  • SapiehaSapieha Posts: 2,964
    edited 2011-01-05 09:28
    Hi jmspaggi.

    That one looks good.

    BUT as I said in previous post ---> For stability YOU need at last DUAL CURRENT Out from that AC/DC converter.
    Lets say it in other words --- If You need 3A ---- AC/DC converter need have possibility to give YOU 6A

    jmspaggi wrote: »
    My message should have included this link:

    http://www.usinages.com/mes-cartes-pour-ma-cnc-t24379.html#287633

    That's where it's in French ;) In the picture you will see what I build. There is the Transfo, there is also a fuse per axe, and the big capacitors. All sized based on the current required for the steppers.

    JM
  • jmspaggijmspaggi Posts: 629
    edited 2011-01-05 09:50
    Yes, this power supply is just for three steppers.

    The transfo is 300VA. Output is 24V. Which mean 12A. For 3 steppers, that mean 4.2A available per motor. Motors are asking for 2.8, so twice is 5.6. So I'm a bit under, but it should be fine, because all the steppers will not ask 200% of the current at the same time. So at the end, they will all be able to get 5.6A. I sized all the components in order to be able to provide about 10A per output.

    JM
  • SapiehaSapieha Posts: 2,964
    edited 2011-01-05 10:03
    Hi jmspaggi.

    If You use BIG enough BULK Capacitors that can hold momentary Current that are About 6A that will be OK.

    One problem to consider (as always with unstabilized AC/DC converters) are Stability of Yours AC Input -- (In some countries that can vary on 220V from 185V to 240V and that can give you some problems in stability of Output Voltage.

    jmspaggi wrote: »
    Yes, this power supply is just for three steppers.

    The transfo is 300VA. Output is 24V. Which mean 12A. For 3 steppers, that mean 4.2A available per motor. Motors are asking for 2.8, so twice is 5.6. So I'm a bit under, but it should be fine, because all the steppers will not ask 200% of the current at the same time. So at the end, they will all be able to get 5.6A. I sized all the components in order to be able to provide about 10A per output.

    JM
  • jmspaggijmspaggi Posts: 629
    edited 2011-01-05 10:07
    I used 63V 5600uF capacitors. So should be correct to provide the 6A.

    Regarding the AC input, I'm on 110V. Not 220V ;) Is a power bar enought to keep that more stable? Or should I consider another option?

    JM
  • SapiehaSapieha Posts: 2,964
    edited 2011-01-05 10:13
    Hi jmspaggi.

    On this question --- I can't help You. In Sweden we not have 110V --- So I can't theirs specifications.
    BUT if You have possibility to monitor Yours AC Line with some Measurement Tool that can give you Stablity over time Maybe You can answer That question by You self.



    jmspaggi wrote: »
    I used 63V 5600uF capacitors. So should be correct to provide the 6A.

    Regarding the AC input, I'm on 110V. Not 220V ;) Is a power bar enought to keep that more stable? Or should I consider another option?

    JM
  • jmspaggijmspaggi Posts: 629
    edited 2011-01-12 10:08
    New tries, new failures ;)

    I burned few other TB6560, and I still don't know why. I can see some movements on the shaft using 5V or 16V, but with 24V and 36V, the TB6560 is burning (See picture).
    IMG_20110108_161349.jpg


    So I just ordered a regulated power supply 0-30V, 0-3A to see step by step and slowly where the issue is without burning anything. I will start back with 12V 1A, and try to move up slowly.

    More news soon.

    JM
    1024 x 768 - 116K
Sign In or Register to comment.