Motor Stepper Example


Closed Thread
Page 1 of 4 1234 LastLast
Results 1 to 40 of 135
  1. #1
    Join Date
    Jul 2003
    Posts
    2,358

    Default Motor Stepper Example

    Whilst this was written some time ago, the subject crops up every now and again, so may be useful to some folks. Written for a 4-wire Stepper Motor...

    Melanie
    Attached Files Attached Files

  2. #2
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257


    Did you find this post helpful? Yes | No

    Cool

    Fantastic Mel.. I shall give this a go. You wouldn't happen to have a schematic of the circuit at all?

  3. #3
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I did this about a year ago on request from another piclist member. In the code you will see where the each individual windings are connected. The actual arrangement will depend on your stepper... naturally you will have to use a driver circuit suitable for your stepper's demand. If you want a test and a light-show, connect LED's (with series Resistors) to represent each winding.

  4. #4
    DougB's Avatar
    DougB Guest


    Did you find this post helpful? Yes | No

    Cool Zzstepper.bas

    Mel,

    I see in your program you go to half step.
    How difficult would it be to increase it 1/256th step?

    I am trying to configure o stepper drive system
    that would allow this. I am not sure about the coding tho.

    DougB

  5. #5
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    oooohhhh.... let's think about this...

    Do you really mean 1/256th of a single step... or do you mean there are 256 steps in a revolution and you mean 1/256th of a Revolution?

    Most (though not all) stepper motors have four coils. We'll call them A, B, C and D. A step is when we rotate the shaft from one set of coils to the next... Let's also say that coil A is our starting sequence (it doesn't have to be, but for our example it is)...

    A to B = A is energised, then de-energise A and energise B = 1st step
    B to C = B is energised, then de-energise B and energise C = 2nd step
    C to D = C is energised, then de-energise C and energise D = 3rd step
    D to A = D is energised, then de-energise D and energise A = 4th step
    the cycle now repeats from the top.

    This is the conventional way a Stepper Motor rotates. Now the number of steps you have per revolution depends on your actual stepper motor. There's dozens and dozens of variants. Steppers are usually specified in a step angle (eg 1.8 Degrees per Step, or 7.5 Degrees per step), usually a figure divisible evenly into 360 (one rotation). So the 1.8 Degree stepper needs 200 steps for a revolution.

    You can drive most Steppers in half-steps... like so...
    A only is energised = 1st step
    A to AB = B is additionally energised (A+B energised) = 1.5 step
    B only is energised = 2nd step
    B to BC = C is additionally energised (B+C energised) = 2.5th step
    C only is energised = 3rd step
    C to CD = D is additionally energised (C+D energised) = 3.5th step
    D only is energised = 4th step
    D to DA = A is additionally energised (D+A energised) = 4.5th step
    the cycle repeats from the top

    With this 'half-step' arrangement you now double the steps of your stepper making it twice as accurate. So if you had a Stepper that needed 200 steps per revolution (our 1.8 Degree Stepper above), you now can give it 400 half-steps to achieve the same result (which means we've an achieved an accuracy of 0.9 Degrees with our 1.8 Degree Stepper)

    Naturally you can reverse the sequence from any point to drive backwards.

    Now, can we take that 1.8 Degree step and achieve an accuracy of 1/256th of our 1.8 Degrees? - in other words 0.007 Degree micro-steps?... the answer is No. I've not seen a Stepper with such a complex coil phasing arrangement that it allows 256 micro-steps per individual step. But point me to a Datasheet if you know of one. Trust me, if it exists, we can drive it.

  6. #6
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

  7. #7
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Very clever... using a standard four coil stepper too... must find out more how they've achieved this.

  8. #8
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    A tutorial.

    By Douglas W. Jones
    THE UNIVERSITY OF IOWA
    Department of Computer Science

    Control of Stepping Motors

    http://www.cs.uiowa.edu/~jones/step/index.html


    Chapter 5:

    Microstepping of Stepping Motors

    http://www.cs.uiowa.edu/~jones/step/micro.html

    * * *

    Luciano

  9. #9
    hansknec's Avatar
    hansknec Guest


    Did you find this post helpful? Yes | No

    Default John

    You are trying to compare apples to oranges. Melanies code (or anybodys code) will only be able to get you to half step mode. That's the digital limit. Anybody who talks about microstepping is in reality using a stepper motor as a magnetic voice coil between steps. By varying the amount of current to one energized coil vs the other energized coil you can get the N-S poles of the rotor to line up anywhere between the two energized poles of the stator. This is analog circuitry which is often programmed using an 8-bit DAC and thats where the 256 number fits into the equation as a step size.

  10. #10
    magand's Avatar
    magand Guest


    Did you find this post helpful? Yes | No

    Default

    I agree with hansknec.
    I apologize for my english but..... is the stepper driver that give to the motor the right sequence for microsteps.
    Trickle is to reproduce a sine wave using a current sensor on the motor phase and an AtoD converter (high number of bit = high number of microsteps).
    Usually these devices are inside dedicated drivers for microsteps.
    See ALLEGRO A3972 for 1/16 steps.
    regards
    andrea

  11. #11
    mslaney's Avatar
    mslaney Guest


    Did you find this post helpful? Yes | No

    Default On and Off topic - Stepper Motor

    Get it?
    On and off.... :-)

    I'm having a problem...
    In it's simplest form, would the following be a brute force method of driving a bi-polar motor?

    (PIC 16F876)
    (defines, includes, and OSC set....)
    (tris a, b, and c set to 0)

    speed var word
    speed = 100 'just an arbitrary number - will eventually ramp up to max

    Spin:
    porta = %00000001
    pause speed
    porta = %00000100
    pause speed
    porta = %00000010
    pause speed
    porta = %00001000
    pause speed
    goto Spin


    When testing this with LEDs, this seems to work fine - the LEDs flash separately. However, when I attach the motor, nothing moves and the LED's flash in pairs.

    Pinout:
    porta.0 -> IRL510 -> LED/CoilA
    porta.1 -> IRL510 -> LED/CoilB
    porta.2 -> IRL510 -> LED/CoilC
    porta.3 -> IRL510 -> LED/CoilD

    If it matters, it's a work project that is behind schedule. A quick answer would be truly appreciated. I might even send you a check for $5 USD!!! :-)
    Is there a single IC like the UCN5804 but for bi-polar motors instead of unipolar?

  12. #12
    mslaney's Avatar
    mslaney Guest


    Did you find this post helpful? Yes | No

    Default

    I guess what I 'm asking is....Do I need an H bridge or is it a function of the program?

  13. #13
    hansknec's Avatar
    hansknec Guest


    Did you find this post helpful? Yes | No

    Default

    If you are driving a bipolar motor you will need a dual H-bridge circuit. (2 coils each need dual driving polarity). The code presented earlier in the thread appears to me to be for driving a unipolar motor. Since you appear to be familiar with the allegro driver chips you should see that they would only require two outputs from a PIC to drive the motor. One is a direction bit and the other is toggled the amount of steps you want. I prefer using unipolar motors myself because they are easier to build a drive circuit using only 4 FETs.

    John

  14. #14
    DougB's Avatar
    DougB Guest


    Did you find this post helpful? Yes | No

    Default Stepper Motor Continued Question

    I am using a microstepper from allmotion that microsteps at 1/256th step per step input

    I plan to use a 16F676 to provide step & direction signals to the motor controller

    I have a -5v to +5v input siggnal to the pic a/d

    How do I configure the pic to apply the hightest resolution on the input
    and calculate the steps & direction for the output.

    I am stumped right now.

    0v means the motor doesn't move.

    the input signal is derived from an electrolytic tilt sensor condtioning board

  15. #15
    hansknec's Avatar
    hansknec Guest


    Did you find this post helpful? Yes | No

    Default John

    Well first of all you need to get that - 5V off the PIC before you burn it up. I'm surprised you haven't seen smoke yet. The voltage references need to stay between the range of 0 to Vcc. You are going to have to get yourself an op-amp and offset that -5V up to a zero volt potential and then divide your signal down. The resolution is what it is. You will get 10 bit resolution as the signal at the input pin varies between vref- and vref+ potential. If you want higher resolution or the ability to use your -5V to +5V signal directly then you will need a separate ADC. Funny... I don't see PIC16F676 as a device offered by Microchip.

  16. #16
    mslaney's Avatar
    mslaney Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks for the help.
    I decided to get an L297 and L298 from ST. It'll drive a bipolar with a pulse from the PIC. However, there is WAY too much wiring to interface and use the L298. It works but it takes too much time.
    Is there a single chip solution for a bi-polar motor?

    I think DougB meant PIC16F876.

  17. #17
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by hansknec
    Funny... I don't see PIC16F676 as a device offered by Microchip.
    Funny...
    http://www.microchip.com/stellent/id...cName=en010213
    and worldwide available from Digikey and others
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  18. #18
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Bipolar Stepper Motor Driver with Translator

    * * *
    L6228 (1.4 Arms)
    http://www.st.com/stonline/books/pdf/docs/9454.pdf

    * * *
    L6208 (2.8 Arms)
    http://www.st.com/stonline/books/pdf/docs/7514.pdf

    * * *
    APPLICATION NOTE AN1451
    L6208 FULLY INTEGRATED TWO PHASE STEPPER MOTOR DRIVER
    http://www.st.com/stonline/books/pdf/docs/8607.pdf

    Modern motion control applications need more flexibility that can be addressed only with specialized IC products. The L6208 is a fully integrated stepper motor driver IC specifically developed to drive a wide range of two phase (bipolar) stepper motors. This IC is a one-chip cost effective solution that includes several unique circuit design features. These features, including a decoding logic that can generate three different stepping sequences, allow the device to be used in many applications including microstepping. The principal aim of this development project was to produce an easy to use, fully protected power IC. In addition several key functions such as protection circuit and PWM current control drastically reduce external components count to meet requirements for many different applications.

    * * *
    APPLICATION NOTE AN1495
    MICROSTEPPING STEPPER MOTOR DRIVE USING PEAK DETECTING CURRENT CONTROL
    http://www.st.com/stonline/books/pdf/docs/8700.pdf

    * * *
    One project with L6208
    http://www.otocoup.com/CarteL6208_e.htm#Specif

    * * *

    Regards,

    Luciano
    Last edited by Luciano; - 22nd July 2005 at 11:24.

  19. #19
    DougB's Avatar
    DougB Guest


    Did you find this post helpful? Yes | No

    Red face 16f676

    Quote Originally Posted by mister_e
    Funny...
    http://www.microchip.com/stellent/id...cName=en010213
    and worldwide available from Digikey and others

    There is a 16F676 PIC, I have one on my desk.
    ww1.microchip.com/downloads/en/DeviceDoc/40039c.pdf

  20. #20
    mslaney's Avatar
    mslaney Guest


    Did you find this post helpful? Yes | No

    Default

    Hey Mister E!!!
    Thanks for the tips on the chips!

  21. #21
    mslaney's Avatar
    mslaney Guest


    Did you find this post helpful? Yes | No

    Default

    And you too Luciano. The drivers look like the right thing. I may continue hacking printer motors for my project.

    I truly hate the L297/298 arrangement!

  22. #22
    mslaney's Avatar
    mslaney Guest


    Did you find this post helpful? Yes | No

    Default

    How do I cycle through an array in reverse order?

    Ok, I ditched the bi-polar and I'm using a pic and mosfets to drive a uni motor. No translator.
    I can spin the motor both ways with the following code but there has to be a more elegant way....I'm thinking I could cut the code in half.

    Here's a clip of the program:

    'Array vars
    stepccw VAR BYTE(4) 'coils
    stepcw var byte(4)
    'Load Arrays
    stepcw[0] = %10100000
    stepcw[1] = %01100000
    stepcw[2] = %01010000
    stepcw[3] = %10010000

    stepccw[0] = %10010000
    stepccw[1] = %01010000
    stepccw[2] = %01100000
    stepccw[3] = %10100000

    CW:
    steps = 0
    for delaytime = 1 to 27
    steps = steps + 1
    portb = stepccw[steps //4]
    pause 10
    next

    pause 1000
    steps = 0
    CCW:
    for delaytime = 27 to 1 step -1
    steps = steps + 1
    portb = stepcw[steps //4]
    pause 10
    next

    pause 1000
    goto cw

  23. #23
    hansknec's Avatar
    hansknec Guest


    Did you find this post helpful? Yes | No

    Default Master Code for a serial network of steppers

    It looks like this code could be valuable to quite a few users, so here you go. I originally developed this system about 15 years ago using basic stamps, but over the years it has had modifications as the hardware has changed and moved on to PICS. I work at a National Laboratory and wanted to save the Govt some money, so instead of buying commercial stepper systems I developed my own. The system began as a single stepper that needed to be moved remotely via RS-232. It eventually grew to a requirement to drive about 10 separate (UNIPOLAR) motors on a laser table to operate attenuators and X-Y linear stages. The theory behind the system is each stepper has its own PIC. All PICS are sitting on a single RS-232 bus in parallel. Each PIC "listens" for its name to be called and reponds only when called. This avoids any chance of a communication collision. The code will work for any number of PICS placed on the single RS-232 bus until you have loaded down the impedance of the bus so far that you cannot sustain communications. I have never needed more than 10 steppers on a single bus, but if you work out the math you could calculate the maximum. This code doesn't use the USART pin, so I have a 20K resistor on each PIC for the SerIn pin.
    Hardware: Each stepper motor is on an apparatus that has a limit switch for the "home" position. If a power failure occurs or if requested to reset via the RS-232, it will drive the stage home and reset its counter to zero position.
    I have found that the system is so reliable that I do not need to have additional encoders to sense the position. If you ensure that your motor is not overloaded and drive it with the proper current, it will never slip poles and the software count of current position will be quite accurate.

    Software: The code follows. This same software is loaded into each PIC on the system, but the name and travel limit settings are changed for each . I have another version of the code that allows one to input a new name and travel limit via the RS-232 into NVRAM, but I felt it was overly complicated for sharing.

    Command protocol: A terminal program (terraterm or equivalent) would send the name of the stepper followed by a space and then the new postion command or a special control code.
    Example 1. Send the stepper to reset position:
    ATTENB 65535<CR>

    Example 2. Move the stepper to position 415:
    ATTENB 415<CR>

    Example 3. Ask the stepper its current position:
    ATTENB 65534<CR>
    The PIC would then respond with "AttenB @ 415"

    Heres the PIC code:
    Code:
    '****************************************************************
    '*  Name    : StepNetwork.pbp        Target=PIC16F84 OR F628    *
    '*  Author  : John C. Hansknecht                                *
    '*  Notice  : Copyright (c) 2004                                *
    '*          : All Rights Reserved                               *
    '*  Date    : 10/14/04                                          *
    '*  Version : 1.0                                               *
    '*  Notes   :  
    '  Universal code for all stepper controllers in a serial network.
    '  Only the name and travel limit
    '  are changed for the specific device.
    '****************************************************************
    '_______ Declarations _____________________________________________________
    PAUSE 500
    include "modedefs.bas"
    '@ device INTRC_OSC_NOCLKOUT   'default to internal oscillator
    '@ device WDT_ON               'watchdog timer on
    '@ device PWRT_ON              'power on timer on
    '@ device MCLR_OFF             ' master clear option off
    '@ device BOD_OFF              ' brown out detect
    '@ device LVP_OFF              '  low voltage programming off
    '@ device PROTECT_OFF          ' program code protect off
    Steps    var word
    I        var word
    newval   var word
    oldval   var word
    resetbit var byte
    b0       var byte 
    pins     var portb
    endstop var portb.4
    define osc 4
    '_______ Initializations __________________________________________________
    TRISB = %10110000 
    pins = 0             ' Initialize output all output transistor OFF.
    oldval = 0
    input portb.5  'make serout a high impedence so all others can talk
    '________Main program______________________________________________________
    pause 500
    reset:  resetbit = 0
            if endstop = 0 then  del1   'take motor CCW to limit switch on pwrup.
    	    oldval = 0
    
    Cmd:resetbit = 1
        serin 7,N2400,["ATTENB"],#newval      ' Get orders from terminal.
    	if newval = 65534 then report         'just report current position
    	if newval = 65535 then reset          'send motor to limit switch
    	if newval > 600 then Cmd              ' My own software motion limit
    	if newval < oldval then delstep
    	if newval = oldval then Cmd
    	' else we will drop into addstep (inferred goto)
    addstep: 
        steps = newval - oldval
        for I = 1 to Steps      ' Number of steps.
    	for b0 = 0 to 7         'full step mode used here.  
    	LOOKUP b0,[9,1,3,2,6,4,12,8],PINS         'forward drive sequence
    	pause 1
    	next b0
       	NEXT I
    	oldval = newval         'make oldval reflect the current position.
     	goto Cmd
    	
    delstep:     
            steps = oldval - newval 
            FOR I = 1 TO steps
    del1:   for b0 = 0 to 7              'enters sub here if resetting motor
    	    LOOKUP b0,[12,4,6,2,3,1,9,8],PINS
        	pause 1
    	    next b0	
    	    if resetbit = 0 then reset   'exit this sub if resetting motor
      	    NEXT I
    	    oldval = newval
            goto Cmd
    
    report: serout 5, N2400, ["ATTENB @  ",#oldval,13]    
    	    input portb.5		'make serout pin an input so others can talk
            goto Cmd        
    
    '___ End of program ________________________________________________________
    Hope you find it useful. You should realize of course that this serial network is not limited to stepper motors. I also have the ability to remotely send values to DAC's, position Servos, Control and readback digital I/O and remotely read ADC's and via the same network using very similar code that has been modified for the application. I call the system PSUB. (polarized source universal bus)
    John

  24. #24
    pflex1's Avatar
    pflex1 Guest


    Did you find this post helpful? Yes | No

    Exclamation Programming Consultant

    Melanie,

    Are you interesed in developing PICBasic PRO source code on a consulting basis for new product development project?

    Thanks

    Tom

  25. #25
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Ohhh... a proposition! I just knew the ad in the back of the dodgy personals would pay off eventually! If you really want to wreck your Bank Managers day Tom, message me off list.

  26. #26
    DougB's Avatar
    DougB Guest


    Did you find this post helpful? Yes | No

    Unhappy Stepper pulser

    Hi all,

    I am still working on the stepper tilt project,
    I am looking to do the following:

    1) recieve an ascii string (similar to nmea) on a port pin serially from
    a signal conditioning board, the string loks loke this in hyperterminal:

    $ 0.00,16112.95,21.96,N6374

    2) I need to parse this string and keep only the 16112.95 value or whatever value it happens to be.

    3) I need to take this value and compare it to a stored value and if it is less
    it sends the appropriate count to a port pin as pulses to a stepper driver

    4) I also need it to determine the sign of the number and output a high for + and a low for -.

    Currently I am using a 16F627A, There are a few more things needed but this is the main parts.

    Help!!!!

  27. #27
    Join Date
    Aug 2005
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    Hi Doug

    Am in the middle of this myself but have NOT gone down to the level of energising each coil as per example.

    I opted for a dedicated controller board to run the motors so the controller box could be ran using popular software for CNC such as Kcam and Mach2 etc via the parallel port, but also so people could use the processor board for controlling the motor circuit direct.

    By using this method, all your Pic has to do, is supply 2 pins to control each motor.
    One for direction High/Low and the other for Pulses using PWM from the Pic or simple toggle high and low with a pauseus in between each step.

    On the CNC machine I have built, the motors along with the thread on the shaft work out at 533 pulses per 1 MM in eight step mode and decrease as you step up.

    If interested, please check out http://www.cncdudez.com and under the development link you will see the protocol I have gone with to control the motors via USB or Serial using a 18F4550 chip.

    The commands shown at the moment are for Jog mode, but am working on taking raw G-code and feeding it straight into the Pic, which is going well.

    The huge difference between using a Pic to control the pulses and using a PC Parallel port is incredible. There is too much going on in windows that disturbs the pulses and the motors run so noisey.
    Using a Pic lets you hit incredible speeds and hardly any noise of the motors.

    Regards

    Sean.

  28. #28
    hansknec's Avatar
    hansknec Guest


    Did you find this post helpful? Yes | No

    Smile Update - new microstepping chip

    I must first correct myself from an earlier comment. One can digitally microstep using a pic using fast comparator inputs triggering interrupts and such. There is an application note about this at the microchip website, but the code is assembly and rather complex.

    Now that I know better, I would also steer away from the simple code driving 4 FET's, because the resulting torque you get from your motor is poor. (unless you don't care about torque).

    There is a new DMOS Microstepping driver with translator chip available from Alegro MicroSystems that can perform up to 1/16th microstepping precision and drive up to 2.5Amps/phase right from the chip.

    The chip is the A3979.
    http://www.allegromicro.com/datafile/3979.pdf

    The chips are only about $5 ea in single quantity.

    Now you can write your pic code to simply count steps and give a direction bit. With the code space you save, you have more room available for cool things like trapazoidal acceleration/deceleration curves and speed control.

    Enjoy

  29. #29
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie
    Ohhh... a proposition! I just knew the ad in the back of the dodgy personals would pay off eventually! If you really want to wreck your Bank Managers day Tom, message me off list.

  30. #30
    Join Date
    May 2008
    Posts
    7


    Did you find this post helpful? Yes | No

    Smile About Maicrostepping

    Quote Originally Posted by Melanie View Post
    Whilst this was written some time ago, the subject crops up every now and again, so may be useful to some folks. Written for a 4-wire Stepper Motor...

    Melanie
    I live in Japan.
    I do not understand English.
    I write sentences with a translation machine.
    I arranged the circuit and the operation theory of Maicrostepping.
    It comparatively puts out the angle ratio by using a power element, detection resistance, and an analog comparator referring to the table.
    It ..program.. doesn't actually have the storage power though I hope for the assembly language because of operation speed.

    http://2.suk2.tok2.com/user/nonnno-p...08-02-16-0.JPG
    ttp://2.suk2.tok2.com/user/nonnno-protok2/img/2008-02-11-0.JPG
    ttp://2.suk2.tok2.com/user/nonnno-protok2/img/2008-02-03-1.JPG

    About the MICRO STEPPING STEPPER drive circuit.
    The image and the circuit chart that I displayed here are ,so to speak, informal signboards and an accurate appearance is not drawn.
    I can continuously write Sa and details of the circuit.
    I can show the table of the voltage ratio of two aspects and the table of the decrease rate of both aspects.
    No one showed the interest when this matter was shown in Japan, and it was not possible to develop into Maicrostepping.
    You can able to make an effort to someone's serious approach of this method, and the completion of the program and promise to open it to the public in the place of the lever?
    If it is so, it wants to announce everything I learnt, to catch everyone's opinion, to put, and to make a better device.
    I believe that this function can be composed of comparatively cheap PIC and AVR, etc.
    Even if I do not use special IC such as "Sunken" "ST" "NS", I can enjoy this function.
    In addition, I :. 「Pawa?Switch」Separates and it is possible to correspond also to the motor drive of "Super-Big".
    It believes if it is possible to change to the one, a damage repair, and a bigger power element easily.
    Kyoji
    There are a lot of "I" because "Translation machine" demands "Subject".

    There are "Switching type" and "Pawardoropp type" in the fixed current drive of "stepper", and "Switching type" doesn't generate extra heat, and be able to use the electric power effectively.
    To characterize, to detect the current, and to convert it into the voltage, the main current route is finished by a low voltage.

    "Unipolar" Maicrostepping is written in the starts most.
    Is this an easy circuit and Pawa of 70% of "Bipolar"?Can be demonstrated and it makes it to "Bipolar?" in an easy change.
    The feature of "Unipolar" is a current in the energizing period in which momentary increases by sink "Inductance of the rolling line" at the drive as for the current in a positive direction.
    This current is put for the interception period and changing momentary ..current sucked up.. decreases from ground in the opposite direction.
    I think about the constant current of 3A as an example and am seeing.
    It should be a voltage of "1.0V from 0.5" because it suppresses the electric power loss though the current of these positive and negative is converted into the voltage of the positive and negative by the detection resistance.
    In addition, it is rectified, it converts into the signal in a positive direction, and it transmits to the following circuits by the current of 10 considerable mA.
    A positive direction obtains the absolute value current comparatively easily by "Level shift" and the direction of negative using "Level shift" and "Break out" in this circuit.
    An integrated current can be controlled by easily adding the mean value of these both aspects to a smooth comparator.
    In addition, driving power smooth at all circumference angle can be generated by tempering with the decrease rate according to driving angle.
    Last edited by apollo21; - 17th May 2008 at 03:00.

  31. #31
    Join Date
    May 2008
    Posts
    7


    Did you find this post helpful? Yes | No

    Default About the ability of this code.

    Quote Originally Posted by Melanie View Post
    Whilst this was written some time ago, the subject crops up every now and again, so may be useful to some folks. Written for a 4-wire Stepper Motor...

    Melanie
    I might be doing an impolite way to come.
    Please forgive me if it is so.

    Does this code have the ability to output the frequency pulse of
    which place?
    Do its deflecting have the ability to enable Maicrostepping?

    I am looking for the PWM code of PIC16F648A to enable Maicrostepping.

    Please show if there is something that becomes some references.

  32. #32
    Join Date
    May 2008
    Posts
    7


    Did you find this post helpful? Yes | No

    Wink Attempt of Maicrostepping

    hi.

    The following image is a connection of two aspect Yuniporrasteppingmortarmaicrostepping to
    LED.
    It tries to build the fixed current circuit into following.
    It was named Raundorimittoscear.



  33. #33
    Join Date
    Jun 2009
    Posts
    5


    Did you find this post helpful? Yes | No

    Default more info

    i came accros this thread by accident but looks like it maybe what i need.
    i have a bipolar stepper motor, plus a driver chip. will this code work on a pic16f84a ?? also i need an imput pin for step pulses and a direction pin, trying to see in the code if this exists

  34. #34
    Join Date
    Jan 2010
    Posts
    37


    Did you find this post helpful? Yes | No

    Default Schematic

    I tried to figure a schematic for Melanie code.
    Both motors seem to work in the same way.
    The second motor has a ULN2003 driver (ULN 2803). My question is if I choose the right schematic for driver configuration.
    Thank you
    Attached Images Attached Images  

  35. #35
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    My question is if I choose the right schematic for driver configuration.
    The answer is no!

    First of all never connect directly to the pic port any motor ( max current you can supply is 25 milliAmps) but use a current driver as the ULN2803.

    ULN2803 is an array of 8 NPN darlington transitors, that you can connect directly to the port pin without any other passive components (no resistors needed) so with one ULN2803 you can drive two unipolar stepper motor with 350 milliAmps per coil.

    From the schematic the motor appears to be bipolar, and if they have only 4 wires there is no way to connect them as unipolar.

    Google for unipolar stepper motor to understand the difference.

    Al.
    Last edited by aratti; - 25th March 2010 at 12:08.
    All progress began with an idea

  36. #36
    Join Date
    Jan 2011
    Posts
    3


    Did you find this post helpful? Yes | No

    Question

    Quote Originally Posted by Melanie View Post
    Whilst this was written some time ago, the subject crops up every now and again, so may be useful to some folks. Written for a 4-wire Stepper Motor...

    Melanie
    Hello Mel, Everyone,

    I`d like to know how to get the code into the chip, (might sound silly), but it doesn`t seem to want to compile in any of the software.

    I`ll more than likely be using a 6 wire stepper motor, but shouldn`t matter, as there`s still only 4 to drive the coils, the other two are power wires.

    Have tried a few things, like using PortC outputs on pin 5,6,7,8 instead, that`s just by changing the portB to portC, no go either.

    Other items would be,
    9&10 for LED output, 11 for step, 12 for Direction, 13 for Enable, pins 1&2 to pull hi / low, via jumpers or 2 switch DIL component. (1on/2on, 1off/2on, 2on/1off, 1off/2off)

    Any assistance at all would be appreciated immensley.

    Thank you.

  37. #37
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Nozapo View Post
    Hello Mel, Everyone,

    I`d like to know how to get the code into the chip, (might sound silly), but it doesn`t seem to want to compile in any of the software.
    What version of PicBasic Pro do you have? Melanie's example from post#1 seems to compile fine over here. I tried the 16F877.

    You might also be interested in this microstepping example http://www.picbasic.co.uk/forum/cont...per-controller

    and these: http://www.picbasic.co.uk/forum/content.php?r=39
    http://www.scalerobotics.com

  38. #38
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Nozapo View Post
    Hello Mel, Everyone,

    Other items would be,
    9&10 for LED output, 11 for step, 12 for Direction, 13 for Enable, pins 1&2 to pull hi / low, via jumpers or 2 switch DIL component. (1on/2on, 1off/2on, 2on/1off, 1off/2off) MS1, MS2 ???

    Thank you.
    May I understand you use a dedicated driver circuit, Allegro 3967 i.e. ??? perhaps some existing satellite Module ???

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  39. #39
    Join Date
    May 2008
    Posts
    7


    Did you find this post helpful? Yes | No

    Wink 6bit_pwm_?

    [QUOTE=apollo21;68104]hi.
    Greetings
    Since I posted the previous post, that many more experienced.
    Allegro One solution would be achieved at IC.
    Another, however, set a vector of phase 2 D / A converter in the conduct,
    Sorted by comparing the current signal value and the output switching element is a way to drive.
    The current regulation requires the ability to fit the criteria.
    Vector miracle two-phase partitioning error occurs from an angle and draw a circle, the intermediate value of 0.7 instead of 0.57 has been announced to be correct.
    D / A converters to simplify the PWM can be used.
    1bit PDM is called conversion ways, by number, because repetition is undefined, and is not suitable for such use.
    MPU is a 2ch analog 2ch and needs of the PWM output.
    If you seek to maintain the accuracy of the angular speed 8bit pulse repetition frequency should not be limited to around 6bit.
    Thus repetition frequency 6bit seeking 8bit accuracy,
    If you use a decentralized approach four times, without sacrificing the angle, fast response can be obtained.
    (Many more bit of resolution can be given)
    I did a mathematical analysis of Open Office Calc functions.
    http://den-nekonoko.blog.so-net.ne.j...o/WS000539.JPG
    Can stay if you need more, "6bit_pwm.ods" We attached.
    Yours sincerely

  40. #40
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    Hello all, after lots of posts with some other members here, and lots of digging on my own, I came to the conclusion for anything over 500mA drive capacity, it really is less expensive to go with a dedicated chip solution. This is when you figure in board space, manufacturing cost, ...

    Just my 2 cents FWIW
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts