Results 1 to 7 of 7

Thread: Arduino AlienCNC C control

  1. #1
    Registered
    Join Date
    Nov 2007
    Location
    United Kingdom
    Posts
    9
    Downloads
    0
    Uploads
    0

    Lightbulb Arduino AlienCNC C control

    Just wondering how to control stepper motors through the dir and step line on a 1 axis microstepping driver. AlienCNC.com doesn't seem to be working at the moment (perhaps they've closed?) so i couldn't think of where else to ask. Also would it be really complicated to convert g-code to stepper movement, i want to try and control my cnc router from my mac using a USB.

    Cheers for any help, but i've got a feeling i've posted this in the wrong place, sorry if your moving it, i couldn't work out where to put it.


    http://www.chatzones.co.uk/discus/me...1axis-6045.pdf
    thats the driver datasheet


  2. #2
    Registered
    Join Date
    Aug 2007
    Location
    USA
    Posts
    3
    Downloads
    0
    Uploads
    0
    I can't say I know anything about AlienCNC but you might want to look at these links for the Arduino Motor Shield which can control stepper motors. I just picked one up myself but have not had time to do anything with it yet.

    Arduino Motor Shield
    http://www.ladyada.net/make/mshield/index.html
    http://www.adafruit.com/index.php?ma...431704984583ac
    http://www.arduino.cc/en/Main/ArduinoShields

    Interfacing Forum
    http://www.arduino.cc/cgi-bin/yabb2/...board=hardware
    http://www.arduino.cc/cgi-bin/yabb2/...num=1189887306


  3. #3
    Registered
    Join Date
    May 2007
    Location
    USA
    Posts
    728
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by gremilRoute View Post
    Also would it be really complicated to convert g-code to stepper movement, i want to try and control my cnc router from my mac using a USB.
    The Arduino board can drive a very small stepper directly, but for anything bigger than your thumb you need a separate driver that can handle the amount of current. If you google around for stepper motor basics, you should find many tutorials on the basic electromechanics of steppers, which will help you to get your bearings.

    As for using an Arduino as a controller.... Well it's really easy actually, so long as you only move one axis at a time. For that, you just need to send out a nice stream of exactly X pulses.

    From there, things get very complicated very fast. For a simple diagonal line, you need to move two axes simultaneously and timing is critical in order to ensure that you get a nice clean cut and not a staircase. For an arc, the math gets more involved. My gut says that you would need to code in AVR directly and get into things like registers and latching in order to get the timing anywhere close to correct. Needless to say this is way out of my league.


  4. #4
    Registered
    Join Date
    Nov 2007
    Location
    United Kingdom
    Posts
    9
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by sansbury View Post
    Needless to say this is way out of my league.
    Lol, sounds like a challenge for a newb like me, my dad's a computer programmer so i might get his help
    , i just don't understand the types of pulses sent to the STEP of my stepper controller, would pwm work? and at what kind of speed or does it vary from board to board?


  • #5
    Registered
    Join Date
    May 2007
    Location
    USA
    Posts
    728
    Downloads
    0
    Uploads
    0
    You're getting warmer. Most stepper controllers take two signals: STEP and DIR(ection). The DIR is pulled to logic HI or LO and held there to set which way the motor spins. You just write the pin and leave it there.

    The STEP signal will send one logic pulse per step or microstep. Basically you set up a loop with a timer interval and turn the pin on and off. My first guess is that your drive will step on the transition from logic HI to LO, i.e., on the falling edge of the signal as it would look on a scope, but some will work the opposite way. The values for how many MS the signal is HI or LO isn't critical per se, that is, you could have it HI for 5 ms and LO for 1 or LO for 5 and HI for 1; either way you get one step every 6ms.


  • #6
    Registered
    Join Date
    Nov 2007
    Location
    United Kingdom
    Posts
    9
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by sansbury View Post
    For a simple diagonal line, you need to move two axes simultaneously and timing is critical in order to ensure that you get a nice clean cut and not a staircase. For an arc, the math gets more involved.
    If you step it slowly and have a precise stepper motor then surely you wouldnt notice a staircase, also a fraction of a circle is quite simple, it's just
    y=±√(r^2 - x^2 + z) where r is the radius and z is an x axis strech of the circle
    to make it a fraction of it you vary the range of x.

    i dont know how complicated the gcode arcs are, what parameters do they use?


  • #7
    Registered
    Join Date
    May 2007
    Location
    USA
    Posts
    728
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by gremilRoute View Post
    If you step it slowly and have a precise stepper motor then surely you wouldnt notice a staircase, also a fraction of a circle is quite simple, it's just y=±√(r^2 - x^2 + z) where r is the radius and z is an x axis strech of the circle to make it a fraction of it you vary the range of x.
    That's the right start, but you're still a long way from cutting metal.

    Imagine that you want to move the cutting point from X0 Y0 to X1 Y1. For each step sent to either the X or Y axis you will move that axis by let's say .001". So, you start by stepping both the X and Y once at the exact same instant, which will move you to X.001 Y.001. Repeat a thousand times and you're there.

    Now imagine that you want to move from X0 Y0 to X2 Y1. You can't step both axes at the exact same moment because that would result in moving at a 45deg angle towards X1Y1 not X2Y1. Instead, what you might do is to calculate the number of steps needed to get each axis to the right place, and then start blipping them out, only you blip the X axis twice as fast as the Y. Bear in mind that "real" controllers will also take acceleration into account since you can't go from standstill to top speed and back instantly, though at slower speeds you might be able to ignore this. This is what most controllers call "trajectory planning" IIRC and it gets progressively more complicated as the machine gets more sophisticated and is adjusted on the fly to obtain maximum performance.

    With an arc you do the same thing except that the rate is constantly increasing or decreasing. If you watch a CNC positioning system trace a circle you will see how one axis goes from minimum to maximum speed and back while the other axis does just the opposite. Synch the two properly and you get a nice circle. Look on Youtube if you haven't seen one in person.

    If you enjoy staring at breadboards and computer screens, are not easily frustrated, and have a lot of spare time on your hands, then this will keep you occupied for some time.

    Alternatively, I see that the www.reprap.org project recently switched to using the Arduino as the basis for their 3-axis positioning robot which is a Java/OSS system. While that does not use GCode it might be the best place to start as the basic principles are all the same.

    i dont know how complicated the gcode arcs are, what parameters do they use?
    There is this fantastic website called Google--you type in questions and it returns sites that help answer it. I'll bet the guys who thought of that will be rich someday!


  • Similar Threads

    1. HELP! Need datasheet for aliencnc 4axis stepperboard
      By glenngb in forum Linear and Rotary Motion
      Replies: 2
      Last Post: 06-17-2008, 12:38 PM
    2. Need some help please, datasheet Aliencnc 4axis board
      By glenngb in forum Controller Cards
      Replies: 3
      Last Post: 03-25-2008, 03:23 PM
    3. mach3 and aliencnc Help!
      By glenngb in forum Mach Software (ArtSoft software)
      Replies: 0
      Last Post: 03-07-2008, 09:38 AM
    4. Replies: 2
      Last Post: 12-28-2007, 10:57 AM
    5. Replies: 0
      Last Post: 10-15-2007, 10:46 PM

    Tags for this Thread

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.