Connect with us

Stepper motor control

Discussion in 'Sensors and Actuators' started by Deimantas, Nov 17, 2014.

Scroll to continue with content
  1. Deimantas

    Deimantas

    4
    0
    Nov 17, 2014
    Hi, I have already made CNC But I don't know how to control four (Nema 17) steppers from LPT. LPT send signal from -1;2;3;4;5;6;7;8;9;14;16;17 legs. So 12(LPT legs)/4(stepper need to control legs )=3(stepprs). Can any show my circuit how can I control 4 stepper per LPT?
     
  2. BobK

    BobK

    7,673
    1,684
    Jan 5, 2010
    Hi Deimantas, and welcome to the forum. I am a Lithuanian American, my paternal grandparents were born there, so how are things in the old country?

    I do not have much knowledge of CNC machines, but to control the stepper motors you will need a stepper motor controller board and some connection, typically serial or USB to a computer, usually a PC, and software on the PC to control the movement of the motors.

    Did you build this from plans or a kit? If so, they should tell you what to use for the controller and software.

    Bob
     
  3. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    As Bobk mentioned, you need a stepper controller.
    You have a couple options:
    Do It Yourself,
    Buy Pre-made.

    Depending on the value of the CNC machine, I do suggest buying something pre-made.
    A pre-made solution usually/commonly come with additional features that a basic Do-It-Yourself board do not have such as microstepping and setting a 'hold-current'.

    These features allow a couple of things. Mainly the microstepping is used to subdivide the steps on the existing stepper motor to gain you more positional accuracy. This slows down the total movement of the machine, and depends on the mechanical accuracy of the machine. Then you have your hold current. For a stepper motor to hold it's position, it must remain energized. If you leave a stepper energized at the same energy levels used to move it, they can get very hot and damage can be caused due to the current draw of the stationary motor.

    Of course, these solutions can be built into your own board if you take the time.

    As far as controller interface is concerned, I would like to recommend sticking to the Parallel port. The LinuxCNC project utilizes this port, as well as other programs like WinCNC. Using a USB-Parallel port introduces additional delay when dealing with the hardware which should be avoided.
    (Does your existing machine have emergency stop or overtravel/limit switches installed?)
     
  4. Fish4Fun

    Fish4Fun So long, and Thanks for all the Fish!

    453
    103
    Aug 27, 2013
    deimantas,

    Welcome to EP!

    I AssUMe you are attempting to use something like Mach3 or EMC to control the parallel port to drive your stepper drivers directly from a PC? Or are you planning to build/write your own controller? If you look @ the specs on a standard LPT port it is easy to determine the outputs.....what is NOT easy is gaining deterministic timing to those outputs from an operating system like Windows....If you are planning on using a DOS or LINUX based PC, then you can easily get low-level control of the LPT and/or serial ports and they will work fine to control your stepper drivers....If you are planning on using a Windows based PC then the best answer is to use a machine controller like the Easy-Stepper or K-Flop....the K-FLOP comes with a very good Windows Based machine controller front-end....Many people use Mach3 with older versions of Windows with fair success, but I have had too many bad experiences to ever go that route again....Another possibility is to use the software developed by the RepRap crowd that runs on a Arduino Mega2560.....There are other answers//approaches, but the above are the most common solutions....

    Fish
     
    Gryd3 likes this.
  5. Deimantas

    Deimantas

    4
    0
    Nov 17, 2014
    Bob, In Lithuania everything is great. From what district your paternal grandparents?
    I made this CNC without any plans. I konow that I need driver, but I' don't know how to make it. I can use Linux if I need. I want to make all myself, so I want to make driver myself to. But I don't know how. If I have conrect circuit I can make it. So, can any have circuit and can give me? :)

    Deimantas
     
  6. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    How are you with electronics?
    Are you familiar with how stepper motors are wired and how they function?
    Do you want the extra features that the pre-made ones have?
    What kind of motors do you have?
     
  7. Deimantas

    Deimantas

    4
    0
    Nov 17, 2014
    Whit electronic I'm really good. I know how to program microchips and other electronic things.
    Yes of course.
    Bipolar, 2-phase, 24v and 1.5A-1phase
     
  8. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    You should be able to manage just fine then!

    Typical command from the computer is a 2 bit signal per stepper motor. Direction and Step.
    Your controller will read this Direction/Step signal and drive the motor with it. It's a simple matter of cycling through the required outputs for the motor to operate
    The tricky part comes into play if you want to introduce PWM when a motor is 'holding' position or if you want to micro-step.
     
  9. BobK

    BobK

    7,673
    1,684
    Jan 5, 2010
    The basic driver is an H-bridge for each coil. On a two phase bipolar motor, you would need 2 H-bridges, one for each coil,
    You then drive them + for first coil + for second coil, - for first coil - for second coil. And that will go one direction or the other, reverse the steps to go the other direction.

    Using that sequence once will be one full step. Repeat it to keep the motor going.

    PS: I do not know what region my grandparents came from, by the time I was born, neither of them was living, and my father was their youngest child and did not speak a work of Lithuanian. I am told that my name means "one who does not see well", which is pretty accurate :)

    Bob
     
    Last edited: Nov 18, 2014
    Gryd3 likes this.
  10. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    Good call on the H-bridges, I had forgotten to mention that. Depending on the motor, you can build a different driver, but the H-Bridge design is pretty universal.
    Look up your specific motor to make sure.
    unipolar_ill_02.jpg
     
  11. Fish4Fun

    Fish4Fun So long, and Thanks for all the Fish!

    453
    103
    Aug 27, 2013
    Deimantas,

    I am a pretty serious DIYer, and i am all for building a stepper driver under the right circumstances, but building a stepper driver for a NEMA17 is REALLY re-inventing the wheel....I don't know how long it would take for one of these to get from China to You, but it would likely still be a lot faster than designing/building/debugging one....and almost certainly a lot less than the components would cost......

    http://www.ebay.com/itm/RepRap-Step...700?pt=LH_DefaultDomain_0&hash=item27e25c5224

    These little drivers are full of features and cheap as dirt, they are designed specifically for NEMA17's and ..... did I mention they are cheap as dirt?

    Fish
     
  12. Deimantas

    Deimantas

    4
    0
    Nov 17, 2014
  13. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    Get your hands on Linux CNC... its an Ubuntu alteration that will allow you to manipulate data in.out of the parallel port to deal with your Step/Direction for the stepper motors and limit switches. Please note that due to timing requirements, This OS comes preinstalled with the CNC software and a bench-testing program. The bench-test MUST be run to determine the maximum possible rate that you can reliably send step/direction signals and is determined by the computer it is running on. (This test must be run for a while...)
    This is only one part of the equation... your stepper driver... that you are going to make... will need to be able to cope with these speeds...
    If you are building it yourself, you are not likely to have the required specs to determine timing requirements of the hardware, so even if your computer can operate with good enough timing out/in the parallel port, the driver you make may force you to slow this signalling down which will slow your CNC down.

    The reason for this altered OS is due in part of the tight timing requirements for operating the CNC machine. Please do not use Windows unless you have purchased a program and dedicated hardware to do so... Stick to a Linux or DOS for your system to more accurately deal with the signalling... and even then, many Linux OSes will need to be tuned and tweaked if you plan to DIY for that as well.

    http://www.linuxcnc.org/
    https://www.buildyourcnc.com/item/control-SOFTWARE-linuxcnc

    You will need to configure the CNC software within the linux CNC software to tell it what pins you want to use for the step/direction.. there is a lot of documentation to read through.. Have fun ;)
     
  14. Fish4Fun

    Fish4Fun So long, and Thanks for all the Fish!

    453
    103
    Aug 27, 2013
    Deimantas,

    If you are using 1.5A NEMA17's then the ULN2004 driver you linked WILL NOT WORK....Furthermore, a pair of full-bridges will NOT replace a stepper driver in a typical CNC configuration. I have been where you are in the CNC learning curve; I know it seems confusing, but there are some very real reasons things are done they way they are done.....attempting to "DIY" a stepper driver for your first CNC build is a HUGE mistake, BUT, if that is the way you want to go, then following is a list of things you will need to design into the stepper driver in order to use a "standard CNC controller":

    1) Active Current Regulation
    2) Micro Stepping Translator
    3) Step and Direction Decoding
    4) Enable/Disable Logic
    5) Snubber Circuitry

    Stepper motors are constant current devices, they will NOT operate properly at less than rated current, over-current can permanently damage them....for optimum performance the supply voltage needs to be 32 * (Stepper Inductance)^1/2 ... read this ==> http://www.geckodrive.com/support/step-motor-basics/power-supply-basics.html To properly control a CNC machine there are several critical systems that need to interact, at the top of the list is the stepper driver, while a highly integrated very low cost solution like linked above will perform extremely well, attempting to build a stepper driver from scratch to be integrated into a CNC machine is an arduous task that requires in-depth knowledge and quite frankly is obviously not in your wheelhouse. I am not trying to be unkind, but there is no good reason to build a stepper driver for NEMA 17's from discrete components. If you MUST go that route then you will need to either synthesize a CPLD solution or use a micro controller to handle the requisite tasks....I would think 8 to 12 weeks would be a reasonable time estimate for designing/coding/prototyping/debugging/testing a stepper driver made from discrete components ready to put into a CNC machine if you have a firm grasp on what you are doing from the outset and have the requisite skills....If you simply want to make a stepper spin and you have some constant-current H-Bridges already built that can handle 1.5A continuously AND you have a micro-processor based dev board something like an Arduino then you MIGHT achieve that in a day or two, but that is a LONG WAY from being a suitable CNC stepper driver.

    If I were you I would order 10 of the drivers i linked above RIGHT NOW and then start working on building your own stepper driver. LONG before you get a suitable driver built the drivers will arrive from China. I am 100% certain you think I am wrong, and that's fine, but if you really want to achieve DIY CNC then you are going to have a lot of learning curves to overcome and getting bogged down by attempting to design/prototype/build/debug stepper drivers is ultimately going to slow the process way down. Like I said, I have been where you are in the process, but in those days there weren't any $2 solutions (or any internet for that matter, lol)....ultimately I spent close to 20 years trying to "save time and money by DIYing everything"....I didn't actually get my first machine "running" until I stopped trying to re-invent every part of the system.....I am just about finished with my third CNC router build, and I can promise you even if you buy very single piece of electronics and every single mechanical component there is still a lot of work and a tremendous learning curve to overcome....

    This is a picture of the build I am finishing up:

    [​IMG]

    Work envelope ~30in X x ~40in Y x ~9in Z with X/Y rapids ~600ipm ... so far I have done test cuts up to 200ipm...the spindle is 6,000rpm-24,000rpm 2.2kW....the steppers are NEMA23's. I am using a K-Flop as a machine controller ( http://dynomotion.com/KFLOP.html ) and the K-Step Stepper Driver ( http://dynomotion.com/KStep.html ) I use the "free" software developed for the K-Flop (K-Motion CNC) on the PC side and I use Vectric's Aspire for the CAD/CAM. I also have a desktop CNC router (~8in x ~12in x ~ 3in work envelope) The electronics/software are the same except the stepper driver which is a Gecko G540....Learning the CAD/CAM/Controller process takes some time....and these components of the system absolutely require industry standard stepper drivers to make the system functional..... My point here is that even a modest build like my desktop machine requires every single part of the system to function with the other parts or it simply doesn't work....the "teaser price" on my desktop machine was $400....that is what it took to build the machine .... by the time I was finished with the motors/drivers and spindle/spindle mount etc, etc I was up to $1100....and THEN things got expensive....I started off with Mach3 ($180), and I had nothing but problems with it....so then I got a K-Flop ($250 absolutely well-spent!)....then I started looking for a CAD/CAM program...started off with Vectric's Cut2D ($149) but ended up getting Vectric's Aspire ($$$$)....then I started buying carbide bits....and the list just keeps growing, lol.....my point is the cost/time of any given piece may SEEM like a big deal at the time, but having a part that doesn't function properly makes the entire system useless....there will be plenty of problems to overcome, don't build-in defeat by attempting to design/build something as cheap as a stepper driver...

    sorry, got a little carried away....

    Fish
     
    Gryd3 likes this.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-