Archive for the ‘Arduino’ Category

CNC Update 2: 3 Functioning stepper drivers on 1 Proto Board!

Sunday, February 21st, 2010

Yesterday was spent picking up supplies and installing and learning Autodesk 2010. I have never really worked with any CAD program before so this was a challenge. However I was able to learn enough to draft my first item. It will be the spindle holder for my machine. I then used the trial version of CAMBAM+ to generate the Gcode. So I then loaded that into Mach3 and simulated the cut. All of that worked well. I thought that was enough software learning for one weekend and moved on to more of the electronics. Although I will be returning to cover these software packages in much more detail later.

I have decided to put aside the plans to run this from the Arduino for now and instead I will use a parallel port on a spare PC. I am still using the Arduino for testing for now. The reason for this decision was simply that the use of the Arduino was going to severely limit my integration of some very good off the shelf software. I suspect I will be revisiting the integration of the Arduino later.

Today’s goal was to construct a proto board with the 3 EasyDriver’s on them and the breakout terminals to simplify hookup. I purchased a proto board from Radio Shack and intended to purchase the terminals as well, but much to my disappointment they didn’t have them. So I had to sacrifice a breakout board I built for my OOPIC several years ago. I had  to amputate the terminals I needed! Oh, the carnage! Well at least it had signed the organ donor card so this project my live.

Here are some pictures of the construction:

This is the layout of the stepper drivers on the Proto Board

I had to first solder pins to the other 2 driver boards that I hadn’t used yet. Then I started with the wiring on the under side of the board. Here is a picture shortly after starting the wiring.

Let the finger burning begin!

Man, I will be glad when I have my own CNC router that I can just put a copper clad board in and zap out my custom PCB.

A few minutes later I have this:

Aint it Purdy?!

OK, well maybe it took more than a few minutes and several puncture wounds and a few burns as well. You will notice every like trace is color coded.

Here is the Key:

Light Red-> Coil A

Dark Blue-> Coil B

Yellow-> MS1

Dark Green-> MS2

Purple-> Dir

Brown-> Step

Light Green-> Sleep

Light Blue-> Enable

Black-> Ground (There are two gnd sources)

Red-> V+ (12v)

If you are asking yourself, why is he giving so much information here about the color codes and such, remember this blog is as much for me as it is for anyone else. I can use this as a reference should I need it.

Here is the top view again with the wiring completed and the standoffs installed.

Board with Z axis wired up to Arduino

 Here it is labeled:

Hillbilly Skimatic!

Here is a video of it working:

 

 

 That is where I finished today. I ordered some 80/20 extruded aluminum Friday. I hope to get to work assembling the frame and axises next week.

Crank up the Volts on that Stepper!

Wednesday, February 17th, 2010

I found some larger stepper motors that I had salvaged from a large dot matrix printer years ago. They are rated at 4.4V 1.15 A. However I have discovered that the EasyDriver chops and current limits the output so you can run these motors at much higher voltage then they were intended to run at. This can come in very handy in CNC operations because under low load you can drive them very fast and have great response. I plan on redesigning my linear actuators to take advantage of these larger steppers. Someone on Chiphacker coincidently asked this question the other day as well so I thought it was a good time to test my theory.

 

CNC Update 1 “We Have Motion!”

Saturday, February 13th, 2010

NOTICE: I CORRECTED ERRORS IN THE CODE AND DESCRIPTION ABOUT MICROSTEPPING AN PULSE DELAY!

Videos at the bottom.

Ok, a lot has happen this week. I started out with a general ideal of how I wanted to accomplish the X and Y axis movements. I was going to go with the sliding table design rather than the Gantry. No real good reason why I have this method in mind it just seems simpler to me. Anyway I go scrounging around through some surplus junk I have picked up from an industrial auction and I came across a couple of pneumatic cylinders with a linear motion mount. This caught my eye right away. The design is quite nice but it only gives me about 10.5″ of travel. This should be fine for my first build and it should be plenty for routing printed circuit boards. Here is a picture of what one of these mounts looks like.

Linear Motion assembly

Today the Stepper motors and EasyDriver boards came in from SparkFun. This is the new version 4.2 driver boards. There isn’t much out there in the ways of tutorials for using this board yet so I hope I can help someone. 

The first order of business was to get some mounting pins soldered onto the driver board so I could plug it into a breadboard for testing. Here is a picture of the module with the pins soldered. 

EasyDriver v4.2 with Pins soldered on

Hint: it’s easier to solder the pins in if you lay the circuit board on the breadboard and stick the pins through the holes into the breadboard then when you have all the pins inserted solder them while its still on the breadboard to hold them straight)

Next I started laying out the jumpers and terminals on the breadboard. I know I could just stick the wires in the breadboard, but I find using these screw terminals work much better. The terminals I have are something like 5 mm pitch so they only pickup every other rail on the breadboard. So it takes a little thought on how to lay the jumpers out.

Jumpers

Terminals

Here is what it looks like when I finished placing all jumpers and terminals.

Completed test board

Wired up

Wired test board

In case you are trying to follow my wiring here, notice the color coding on the stepper motors. On the circuit board there are 4 terminals to hook to the stepper motor. Coil A and Coil B. Coil A terminals are next to each other and Coil B terminals are as well. However due to my use of the 5mm blocks I had to stagger the connections so what you see here  is ABAB, so Blue and Yellow are A coil and Red and Green are B coil.

The wiring of these units is pretty much straight forward. You have a direction Pin, that is held high for one direction and low for the other. A step pin that is pulsed high then low for 1 step. You have 2 other pins that enable micro stepping, ms1 and ms2. Tie them both low if you don’t want to micro step. ( I recommend tying them HIGH until you have tested for successful operation). You have two sources of power, one for the motor and one for the logic. If you are using an external power supply for your motor, which is almost always required, then the board will supply power back to the Arduino through the 5v logic connection. (However I had some issues getting my sketch to upload properly without my normal external supply hooked to the arduino). You have an enable pin that must be held low for the board to operate. The last connection that I used is the Sleep pin. If you tie it low then your motor will not be powered even though the arduino and the easydriver boards are still supplied. This also allows the motor to free wheel. I haven’t used the RST and PFD pins so I can’t speak to them just yet.

Here is the code to get the test running

NOTICE SEVERAL ERRORS WERE CORRECTED SINCE MY ORIGINAL POST!

// Some of this code was scavenged from different places on the Internet but I have changed a few things to get it working.

int dirpin = 8;
int steppin = 9;
int ms2pin = 10;
int enablepin = 11;
int ms1pin = 12;
int sleeppin = 13;
void setup() {
Serial.begin(9600);

pinMode(dirpin, OUTPUT);
pinMode(steppin, OUTPUT);
pinMode(ms2pin, OUTPUT);
pinMode(enablepin, OUTPUT);
pinMode(ms1pin, OUTPUT);
pinMode(sleeppin, OUTPUT);

digitalWrite(enablepin, LOW);    // enable easy driver
digitalWrite(sleeppin, HIGH);    // easy driver operating
digitalWrite(ms1pin, HIGH);    // microstepping disabled
digitalWrite(ms2pin, HIGH);    // microstepping disabled
}
void loop()
{

int i;

digitalWrite(dirpin, LOW);    // Set the direction pin to move forward

delay(1000);                  //Give it some time

Serial.println(“Forward”);    // Print Forward to the terminal window
for (i = 0; i<31000; i++)    // Step Forward 31000 steps
{
digitalWrite(steppin, LOW);   // Start out with step pin low
delayMicroseconds(500);    // Delay controls speed and Torque I originally had these at 100 that was too short
digitalWrite(steppin, HIGH);    // Now switch it high
delayMicroseconds(500);    // Delay controls speed and Torque you need at least a 500 delay
}             //

digitalWrite(dirpin, HIGH);    // Change direction to reverse
delay(100);                     // Give it some time

Serial.println(“Reverse”);     // Print Reverse to terminal window
for (i = 0; i<31000; i++)    // Step in Reverse 31000 steps
{
digitalWrite(steppin, LOW);   //  Start out with step pin low
delayMicroseconds(500);    // Delay controls speed and Torque you need at least a 500 delay  
digitalWrite(steppin, HIGH);    // Now switch it high
delayMicroseconds(500);    // Delay controls speed and Torque you need at least a 500 delay
}            

}

OK, now time for a couple of videos. Note the wire ties holding the stepper motor on, I couldn’t find any m3.5 screws today so I just used the wire ties for now.

CNC 040 6.5 Meg

CNC 044 5.5 Meg

I am not impressed with the torque of these small steppers I will most likely need to size up but more testing is required. This was because I had my pulse width too narrow. After increasing the delays to 500, I have plenty of torque!

I was the happy recipient of some really cool parts today (Thanks Brian). I now have some 20mm rails and 2 20mm ball screws. These will be the DADDY project after I flush all of the software and driver issues out with this junior unit. (insert smile).

I guess that’s enough for today. More to come…

Schematic for AC4X Board

Saturday, January 30th, 2010

I finally had a chance to draw up a quick schematic of the AC4X board. This is just the external hookup schematic for interfacing it to a microcontroller such as the Arduino.

Ir Ranging added to control delays

Saturday, January 23rd, 2010

I added a couple more lights so you could see the effect better. I still have one output that isn’t being used yet. Also I added a couple of ways to vary the delays in the chase sequence. The first was a Potentiometer, the second was a Sharp Infrared Ranger. I am using the value from the ranger to determine the amount of delay in the chase sequence. You could also take the range value and break it down into windows and turn on individual outputs based on how close you are to the ranger. Here is a video of the Ir setup controling the delay.
Infrared Ranging ACLoads 12 Meg download.
Here are a couple more pictures:

Sharp GP2D12 Ir Ranger

I think I have about 500 of these assemblies that have the 4 output board and an intel 87C51 Processor.

I am not sure how many of the 8 output boards I have but it is in the hundreds as well.

Another note, It is possible to control 220v devices with these boards as well. The 4 outputs are paired so that you can provide a seperate line voltage to each pair. Here is the PDF file for the Triac’s that are used on the board. datasheet