DESKTOP CNC Idea

Hi All,

I have this idea of using X3 5V 4-Phase 5-Wire Stepper Motor Each Driven by ULN2003 for a Desktop CNC (Mainly For making PCBs).

From the Example I have seen, this motor requires 4 Arduino pins to control each motor.

I have been looking at CNC Example that uses the stepper library.

Can anyone help me?

Thanks

You can not power a stepper motor from the Arduino pins. They are capable of supplying no more than 40mA, which will not even cause a stepper motor to twitch.

You need a stepper motor driver - typically one per stepper motor. The driver board then uses just two pins - one for direction, the other to cause the motor to step.

PaulS:
You can not power a stepper motor from the Arduino pins. They are capable of supplying no more than 40mA, which will not even cause a stepper motor to twitch.
Good point!

Thanks for Speedy Reply.

Although not mentioned I will powering all the Motors off a 5Amp BEC or possibly an NPN Transistor for Each.

Not sure which would be best!

PaulS:
You need a stepper motor driver - typically one per stepper motor. The driver board then uses just two pins - one for direction, the other to cause the motor to step.

OK, I was looking @ the stepper Example, looks like they are using X4 pins to control the Stepper

#include <Stepper.h>

const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution
// for your motor
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8,9,10,11);

Thanks

Although not mentioned I will powering all the Motors off a 5Amp BEC or possibly an NPN Transistor for Each.

Why do you need a driver board or transistors? The ULN family can source 500 mA at up to 50V, per pin and has EMF protection built in.

ULN2803 has 8 Darlington Arrays instead of 7, you could run 2 motors (that need 4 wires) off 1 chip (and heatsink, don't forget the heatsink!). It -is- a motor driver by design.

If you put a serial to parallel shift register between the driver and the Arduino then you could use 1 pin to control your ULN-whichever chip.

Here's the stepper library example I see: http://arduino.cc/en/Tutorial/MotorKnob

It seems pretty complete. Maybe you should try that first. The bipolar stepper uses 4 wires.

The motor & driver is from ebay: 5V stepper motor 28BYJ-48 with Drive Test Board ULN2003 Link:http://www.ebay.co.uk/itm/180713346023?ssPageName=STRK:MESINDXX:IT&_trksid=p3984.m1436.l2649

Basic Instructions:http://www.geeetech.com/DOCUMENTS/Arduino/arduino%20shield/5V%204-Phase%205-Wire%20Stepper%20Motor/Stepper%20Motor%20Natural%20Rotation%20And%20Inversion.pdf

I have not purchased them yet, im trying to figure out if these motors would be any good?

Before you size the stepper motors, you need to design the mechanism that is to be moved. Once that is done, you'll know how much torque the stepper motors must deliver, and how many steps per revolution are required to give you the positional accuracy required.

Until then, you're wasting your time.

For the motor and chip that's not a bad price but as Paul noted, is it going to be strong enough?

Part of that answer is "what kind of materials, thicknesses, cutting tools and feed rates do you expect?". We already know the material is PCBs and I'm guessing you only want to cut a hair deeper than the copper.

If the motor is turning a lead screw then it's probably more than strong enough to run reasonably slow. The only question left is how accurate you want to cut, how many degrees the stepper steps and what pitch your lead screws have. Oh yeah, and how close you need to cut. Do you even have an X-Y table?

The driver chip... you can breadboard that. But get the 2803 for the full set of 8 input and 8 driving pins.

Allelectronics has a full selection of steppers but not a lot of data on them and most are old stock. But... they don't cost much for what you get. EBay, I see if anything less data but low prices as well. OTOH if you know anyone with old junk floppy drives or printers, some of those have nice steppers inside.

Take a look as this excellent project by Grumpy_Mike. http://www.thebox.myzen.co.uk/Hardware/CNC_Conversion.html

Hi, For more info about those motors:

The motor & driver is from ebay: 5V stepper motor 28BYJ-48 with Drive Test Board ULN2003 Link:http://www.ebay.co.uk/itm/180713346023?ssPageName=STRK:MESINDXX:IT&_trksid=p3984.m1436.l2649

Take a look here: http://arduino-info.wikispaces.com/StepperMotors (General Stepper Info) and those motors, with hookup and example Arduino code: http://arduino-info.wikispaces.com/SmallSteppers

DISCLAIMER: Mentioned stuff from my own shop...

For your drivers, you could use a MotorShield if you only need 2 axes, throw in an EasyDriver from SFE if you need a third. EasyDriver MotorShield

I just built a desktop CNC! Actually had to build my G-Code builder and everything from scratch… fun project, but oh so many headaches. Here is some advice I wish I had from the start:

Buy this board http://www.sparkfun.com/products/10507 - it is $65 and can power up to 4 stepper motors to 2A a piece and 30V. I recommend using no more than 1.2 amps per channel though, because it gets hot and acts up over that. IMPORTANT If you do use this board, be sure to utilize the Enable pin, it will kill the power to the board, thus giving it time to cool down in between each step sequence.

You will run into some issues if you do the standard stepper library, as you will only be able to drive 1 stepper motor at a time, thus preventing you from doing nice rounded edges. What you will want to do is similar to the example “blink without delays”; and focus instead on stepping all around time. My code is super long, and might not make sense as there are a whole mess of other things I had to incorporate into my machine, but here is a taste with how it works:

if(run1 == HIGH)
  {
    digitalWrite(sleepPin1, HIGH);
    digitalWrite(sleepPin3, LOW);
    if(progress1 < steps1)
    {
      unsigned long currentMillis1 = micros();
      if(currentMillis1 - previousMillis1 > interval1)
      {
        previousMillis1 = currentMillis1;
        progress1++;
        if(stepPinstate1 == LOW)
        {
          digitalWrite(stepPin1, HIGH);
          stepPinstate1 = HIGH;
        }
        else
        {
          digitalWrite(stepPin1, LOW);
          stepPinstate1 = LOW;
        }
      }
      if((progress1 > (steps1 - 2000)) && (once1 == 1))
      {
        status1 = 2;
        once1 = 2;
      }
    }
    else
    {
      if(status1 != 2)
      {
        status1 = 2;
      }
      run1 = LOW;
    }
  }

Furthermore, if you want the X and Y to start and end at the same time - to give you true rounded corners and such - you will need some kind of proportional speed control. This is how I did mine:

if((steps1 > steps2) && (steps2 != 0)){
      difference2 = (float)steps1/steps2;
      difference1 = (difference2)*TopSpeed;
      speed1 = TopSpeed;
      speed2 = int(difference1);
    }
    
    if((steps2 > steps1) && (steps1 != 0))
    {
      difference1 = (float)steps2/steps1;
      difference2 = (difference1)*TopSpeed;
      speed2 = TopSpeed;
      speed1 = int(difference2);
    }
    if((steps1 == steps2) | (steps1 == 0) | (steps2 == 0))
    {
      speed1 = TopSpeed;
      speed2 = TopSpeed;
    }

Let me know if you need any other help, and good luck!

Hey DaBeej ,

Nice work on the coordinated moves. that’s complex, but I know it has been coded in different machines.

One approach is to have a timeslot concept that is finer than the fastest steps on either axis, then every timeslot it evaluates whether each axis needs to step then. Maybe that’s what you’re doing, haven’t really read your code…

I did a 3-axis machine almost 20 years ago but the stepping timing was done in hardware counters so that the correct ratio between x,y,z was maintained regardless of speed. So I could control a ramp generator and have accelerated and decelerated 3-axis moves. I used it to carve wax to make molds for jewelery.

Once I’m back in the USA for good in 2 years, I will be recreating my home automation system (Now an IBM AT 8) … notice that the emoticon is balding??) with an arduino MEGA. The XYZ machine might be next.

Show us some stuff you cut!

Hey Terryking228,

My comment is slightly misleading. I used a CNC platform in which I developed everything from scratch, but I didn't make a CNC machine, but instead a 3D printer using food product. I can't divulge everything, because the device is actually in the process of being patented. So I can share some of the "hows", but I can't give everything away unfortunately.

As for the logic in the stepping sequence, it sounds like we're talking the same language. In English, my code basically is:

Who is bigger, X or Y? How much bigger is the biggest? Over the next A seconds, you both need to to start and stop at a rate of B microseconds and C microseconds.

My third line controls the overall pulses as they have that limited time, and the slower the rate, the less steps they are allowed. I then have to factor in the volumetric demands of my Z axis, and then control that (patent pending) device.

I am young, and that project no joke, left me bald! I did the entire thing with 1 Arduino, too; I am beyond impressed by that little micro controller. The rise and fall time of the pulses though seem to be far slower than that from a computer, as I could never get my motors to move as fast as they did with a real CNC machine.

I'm good at coding, not great; that project though made me go from terrible to good! If you already understand coding, which I take it you do, you'll have a blast undertaking a CNC project with today's technology.

The rise and fall time of the pulses though seem to be far slower than that from a computer, as I could never get my motors to move as fast as they did with a real CNC machine

Are U talking about the Stepper Motor pulses?? The Arduino pulses themselves should be fast.

To run many steps/sec stepper motors have to have fast rise and (pretty fast) falltimes. OldSkool was use higher voltage supplied through big resistors which made initial current higher at the beginning of each pulse. Falltime was decreased by not using regular flyback (back EMF) diodes, but Zener diodes which dissipated the energy stored in the coil inductance rapidly. I had heatsinks on my Zeners!

Could you run faster before you caught up with the abilities of your (Pat.Pending) Squirter/Extruder/Masher ??

Alright, I’m curious what your input is on this then:

So I use that Quadstepper board shown above, and the code is essentially:

digitalWrite(sleepPin, HIGH);
digitalWrite(dirPin, HIGH);
for(a = 0; a < totalStep; a++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(Speed);
digitalWrite(stepPin, LOW);
delayMicroseconds(Speed);

Now, the highest speed I could ever achieve is 40 microsecond delays, and that gives me like 10 inches per minute travel speed on my machine. However, using Mach3 CNC software, and the same motors (different driver), I am able to achieve around 20 inches per minute travel speed.

If I attempt to increase my speed by decreasing the delay between pulses, the motors hum. I have used a few different motor driver boards, but the story ends up the same, where 40 microseconds is as fast as I can go. So I always chopped it up to the Arduino.

Am I missing something?

Mach3 CNC software, and the same motors (different driver),

Different Driver? Drivers control how fast the waveforms on the stepper windings are.

Also, are you accelerating and decelerating the motors? Steppers can RUN at Pulses-per-second that they can't START at...

I might have used the wrong terminology with Driver; I meant motor controller.

The acceleration is an interesting one, I have been just starting at the top speed. So are you saying if I start at 40 Microseconds I might be able to ramp it up to, let's say 20? I hadn't considered that ever before, but I could certainly implement it and test it out pretty easily.

High Five for you if you just made my machine faster!

I might have used the wrong terminology with Driver; I meant motor controller.

Hey, that's the guy that zaps the electrons to the motor, right.. THAT guy..

All high-performance stepper driven systems do acceleration/deceleration, AFAIK. Doing that in 3 axes so a straight path happens in 3-D is difficult but way cool.

Awesome! I just did a quick test where I did a slight acceleration on the motors, I was able to get as low as 22 Microseconds. The code change isn't optimal, as the acceleration is far to exponential, so I'm going to play with it more to make a more robust version.

Thanks for the advice, this is making a huge difference. It is one of those "Duh!" moments, as I always wondered why my machine did not match the sounds of the Mach3 version, and now with the variable acceleration rates, they do. So the acceleration variable was exactly the missing element.