Shop OBEX P1 Docs P2 Docs Learn Events
Steppers and the Propeller (stupid newbe Question) — Parallax Forums

Steppers and the Propeller (stupid newbe Question)

$WMc%$WMc% Posts: 1,884
edited 2009-04-12 22:49 in Propeller 1
Hello All

I would like to run 3 stepper motors with the Propeller at the same time. My biggest problem is writing a driver or OBJECT code, for a stepper motor. I'm new to this SPIN/SPIN ASM code, and its a lot to take in at one time.

I feel if I had a simple generic stepper code that·I could study, I would be able to figure out the rest!

If anyone has a simple little code that they would share with Me.· It would be greatly appreciated.


__Thanks in Advance_____________$WMc%___________

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············································ BoogerWoods, FL. USA

Comments

  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-04-07 02:41
    WMc, how "high level" do you want the driver to be? I've accumulated quite a few L298 and L297 chips. Using these in concert allows for VERY easy control of a bipolar stepper motor. The inputs would be simply "direction", and "step", i.e. two pins for each stepper motor. It could also be configured for either Half or Full step with a single jumper.

    So, basically, you could write some very simple code that makes a pin go low for "forward" stepping direction, and a second pin that goes from high to low, for to initiate a step. No pin sequencing needed. The "step" pin functions basically like a clock, so the faster you pulse that pin, the more steps per second are performed.

    This would be a good excuse to finally build this thing. Would you be interested? I've got enough chips to build enough for about 15 steppers, 2A/phase(4A per motor).
  • JonnyMacJonnyMac Posts: 9,194
    edited 2009-04-07 03:18
    I wrote a stepper motor object (all Spin) back in 2006 for my column -- should be available under Resources \ Nuts & Volts.
  • SRLMSRLM Posts: 5,045
    edited 2009-04-07 03:20
    The title of the N&V article is "Stepping Out with Spin", and it does have some nice sample code to drive a stepper.
  • $WMc%$WMc% Posts: 1,884
    edited 2009-04-07 11:43
    Thanks for the "Stepping Out wth Spin".I'll have to check this code out.

    Pilldapill I am interested,How much will they cost?

    ____Thanks Again_________$WMc%_____

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············································ BoogerWoods, FL. USA
  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-04-07 18:29
    WMc, the controllers would be about $15 each for a single stepper controller. I could make one with 3 controllers on one board though for $30. The pin format would be 2 power pins for the steppers, 1 GND pin for the logic, and 6 input pins for the clock/direction for each stepper.

    I could also make a alternate version where all inputs are opto-isolated with high-speed isolators. This would take one extra 3.3V or 5V pin.
  • StefanL38StefanL38 Posts: 2,292
    edited 2009-04-07 18:53
    Hello Phil,

    What type of high-speed-opto-isolators are you using ? Can you post a part-Nr. of the manufacturer ?

    What is the typical rise/fall-time for the signal from input goes high/low until output reaches high/low ?

    What is the border-frequency to drive it ?

    best regards

    Stefan
  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-04-07 21:52
    I'm not sure of all that, Stefan, but these are "150mbps" isolators. The part number is ISO722M from TI. That is the single input version, but there are other versions such as a dual input, dual output(4 isolators in one package).

    Here is the product page for the ISO722M:
    http://focus.ti.com/docs/prod/folders/print/iso722m.html
  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-04-07 22:32
    Oh, by the way, I was wrong - the maximum supply voltage will only be 35V, even though the L298 can handle 46V. This is because the voltage regulators for the logic supply can't stand more than 35V maximum. You COULD supply your own external 5V. I could always design in a jumper to either use the regulator voltage, or an external supply... WMc, tell me, what voltage do you plan on running these steppers at? The control board regulates the current through the windings automatically using a form of Pulse width modulation, so no external resistors are needed.
  • $WMc%$WMc% Posts: 1,884
    edited 2009-04-08 01:26
    Philldapill

    I really don't need voltage Reg.s as I have some Beefy 3.3v,5v, and 13.8v supply's made that are highly regulated. I also planed on running the steppers on their own 15 to 50volt variable power supply's, For obvious reasons.

    My plan is to build a small model, with small steppers. Work out all the Bugs and then build a larger vers. using some high current transistors driving from the L298 or L293 for the larger steppers.

    I like the price on the 3 stepper motor board, could You replace the voltage reg. for some 150watt or larger drivers and keep the cost down. I am willing to take care of the heatsink for the drivers if their placed on the edge of the PCB.


    _______________$WMc%____________

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············································ BoogerWoods, FL. USA
  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-04-08 05:10
    WMc, what do you mean "replace the reg's for some 150watt or larger drivers? The voltage regulators would be there to simplify your design somewhat. Instead of having to provide your own regulated 5V supply, the regulators would take power from the same line as the power for the steppers. The logic circuits for the controller need 5V, so it just seemed practical to supply the whole board with up to 35V(maximum voltage for the regulators and a safe voltage for the drivers). This way, the 35V could power the stepper drivers, AND power the logic, thus making your end a little simplier.

    As for "larger drivers", that could be done. I've been wanting to build a HIGH power H-bridge for a while. I'm talking up to 35V input, and 20A per phase... You know, BEEFY drivers. These would be a bit more complicated, and would probably be around $50 for a three motor board.
  • $WMc%$WMc% Posts: 1,884
    edited 2009-04-09 03:36
    Philldapill

    I see Your point about the lack of regulators. Its My old school approach that led Me to this. I build all of My own reg. power supply's to ensure accuracy and quality. I realize its not practical for You to make a PCB in this fashion.


    A voltage reg. TO220 case costs about $1.00.... A 150watt FET/MOSFET/NPN transistor costs about $1.00 (this is where I came up with the trade off in $$ for the regulators)

    While Your PCB may not fit what I'm after, I'm sure there are others that would love to have one of Your PCB.s (stepper driver)


    ________$WMc%_______

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············································ BoogerWoods, FL. USA
  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-04-09 05:16
    WMc, don't get me wrong - I love a challenge. I enjoy designing/building electronics as a hobby. If you want a custom built board for whatever - whether it's a beefy high power driver, or a small 2A bipolar stepper driver - I'd love to help. Whatever you wan designed, just give me some general spec's and I'll see what I can do. I'll just charge for parts. I'm in school for my B.S. in EE, and I love this stuff. It's a hobby after all, so please, let ME have some fun... [noparse]:)[/noparse]
  • $WMc%$WMc% Posts: 1,884
    edited 2009-04-10 02:57
    OK

    I have the" stepper_demo.spin" program running in the Propeler editor. I keep getting an error ( can't find OBJ stepper.spin) when I try to RUN the download program to the Propeller. ?

    Whats up with this!!!!!!!!!!


    Philldapill

    I Will get back with You on the desired stepper board.!!!!!

    ____________$WMc%____________

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············································ BoogerWoods, FL. USA

    Post Edited ($WMc%) : 4/10/2009 3:52:17 AM GMT
  • StefanL38StefanL38 Posts: 2,292
    edited 2009-04-10 06:26
    Hello WMc,

    the bunch of attentionmarks "!" looks a little bit unpolite like saying "hurry up !"

    What does the error-message-window report for DETAILS ?

    From this question I guess - hm got his propeller only one hour ago
    and did not take time yet to start read the manual

    If you see file the "stepper_demo.spin" in the Propeller-Editor there is nothing "running" the editor just SHOWS you the SPIN-sourcecode
    If you press F10 compile and download to RAM or F11 compile and download to EEPROM
    the sourcecode gets compiled, donwloaded to the propeller and then the DOWNLOADED file runs INSIDE the propeller.

    In the file stepper_demo.spin there is a section called "OBJ"

    in this section "OBJ" there are listet and defined the objects that you want to use with your top-object-file (here stepper_demo.spin)

    objects are simply *.SPIN-file similar like stepper_demo.spin

    in your top-object-file you have to define an objectNAME which is then used as a reference for the methods inside the object


    OBJ
      motor : "stepper"
    
    



    explanation:

    "OBJ" 'begin of the section object-DEFINITIONS

    "motor" 'NAME of the object

    ""stepper"" NAME of the *.SPIN-file where the code of this object is stored on harddisk

    This means in the SAME subdirectory as where your file stepper_demo.spin is stored on your harddisk
    there must exist a file stepper.spin

    This file is part of the mjc_stepper_demo.ZIP-archive from where you have the file stepper_demo.SPIN from


    So now I would like to say something general:
    First thought from me was just post "read about objects in the manual" - end of post

    I gave you a direct explanation in this case because I really like to explain.
    In the todays grown-up world everybody expects from you that you can collect BASIC information YOURSELF
    So it would be a good thing start to learn this as soon as possible.

    In this case this means:

    reading carefully the error-message "can't find stepper.spin" with ALL details

    Take the propeller-manual and do a research of 10 minutes on YOUR OWN.
    If you can not solve the problem by this post a CONCRETE question here in the forum

    The question can be as simple as hell (to me there are NO "stupid" questions) if the forum members can see
    from your question that you made some effort on YOUR OWN they will like to answer your question

    For more information about objects read Chapter 3: Propeller Programming Tutorial from page 85 until exercise 6 until page 116

    best regards

    Stefan

    Post Edited (StefanL38) : 4/10/2009 6:38:32 AM GMT
  • $WMc%$WMc% Posts: 1,884
    edited 2009-04-12 07:00
    Stefan
    I really appreciate Your response to My post

    I apologize to You and all of the other forum members about the "!"marks in My posts, I didn't realize this was taken so adversely.

    I am struggling with the SPIN lingo.

    I have the "stepper" OBJ code, but it has some errors

    I have Attached the code I'm trying to use.

    Any help would be appreciated

    ______________$WMc%_______

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············································ BoogerWoods, FL. USA

    Post Edited ($WMc%) : 4/12/2009 7:28:26 AM GMT
  • Gerry KeelyGerry Keely Posts: 75
    edited 2009-04-12 09:53
    The following errors are in your code

    1.spelling of SetDir --- typed as steDir
    2. DATA at end of stepper should be DAT
    3.M_Rev has 2 underscores instead of one.
    4.dira[noparse][[/noparse]m4..m1]· --- in runStepper· action required eg dira[noparse][[/noparse]m4..m1]~~

    Gerry

    Post Edited (Gerry Keely) : 4/12/2009 10:01:09 AM GMT
  • StefanL38StefanL38 Posts: 2,292
    edited 2009-04-12 13:50
    Hello WMc,

    OK you seem to have made a program on your own. That is OK.
    As it has very basic typing-errors I recommend starting with smaller programs

    Maybe I'm wrong with my impression. But to clear this I want to explain how your way
    of programming and asking for help seems to be by using an analogon:

    Imagine somebody goes to a store and buys an airbrushing set with everything you need
    for artistic airbrushing. You go home plug the aircompressor to the socket. Connect
    the airbrush via a rubbertube with the compressor. Fill in some color into the airbrush.

    Then press the button on the airbrush and color is poured onto the object you want to paint.
    But oops much to much color went onto the surface.

    And in this situation you call for help: "can somebody correct my painting ?"

    In the airbrush-case I think it is really clear that this would be strange and unpolite to ask for THAT kind of help
    Almost everybody would think about this

    "ey what's that ??! Give me a paid order and I paint for you or leave me alone!"

    As YOU want to do the painting you have to practice and do exercise-paintings to learn it.

    If you give a DETAILED discription of what went wrong and ask an airbrush-artist:
    like "I always put too much color onto it. Can you come to me and take a look what I'm doing wrong ?
    I use this type of airbrush and I'm painting that way. What do I have to change that much less color
    comes out ?

    THIS would be a question where almost everybody would LIKE to help you
    OK let me see... pressure is a little bit low. Size of the Airbrush is OK but the valve is completely opened

    almost close the valve and increase the pressure to ... bar
    (By the way I have no skills in airbrushing at all that's just an analogon to explain)

    Now back to the propeller.
    The code you have posted has some very basic bugs. Did you write it on your own ?
    I guess so. I assume that you know only very less about programming
    that's REALLY OK you just have to change the style of asking for help

    If your code simple_stepper.spin is tried to compile there comes an errormessage

    minimum what we - as the other forum-members - can expect from you is,
    that you give a detailed description of the errormessage

    Errormessage "invalid binary number"

    DATA
       Steps     byte     %0011, %0110, %1100, % 1001
                                               !
                                     cursor is here (above the "h" of here)        
    
    



    what am I doing wrong ?

    This is a very basic question but this is GOOD. This question makes other newbies proud of finding a question they can answer to !

    So ask that way

    best regards

    Stefan

    Post Edited (StefanL38) : 4/12/2009 1:56:58 PM GMT
  • $WMc%$WMc% Posts: 1,884
    edited 2009-04-12 22:49
    Mr. Keely

    I Thank You for Your Reply
    I read, reread, read over, read though, read back, and read again, the code I had and I still missed the typos.I think its because it looked right to Me. I am an old school BASIC programmer.I know I have to learn some new programing lingo, So here I am.

    I thank You vary much for Your time.

    Its members like You that makes this Forum so great!

    _______Thanks Again_______$WMc%_________

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············································ BoogerWoods, FL. USA
Sign In or Register to comment.