Thursday, December 6, 2012

Configuring Mach3

Mach3 main screen

     I wanted to put together an easy to follow guide for configuring Mach3 to work with my converter board and other similar breakout boards. The exact pins used for each signal will vary from board to board. This example will specifically use the pin-out from the converter boards that can be purchased from my product page.
A good general Mach3 guide can be found here.

Before we get started, Mach3 uses your computer's parallel port to send pulses to the stepper drivers. Make sure your computer has a parallel port and that you have a standard parallel port cable. (NOT cross-over) 

NOTE: If this is your first time using Mach3 I suggest reading the above link. Mach3 isn't very straight forward when you first use it. Also each time Mach3 starts up or you make changes to the config you will need to press the red "Reset" button in the lower left hand corner of the screen.
     
     The first thing that needs to be done is to tell Mach3 what address our parallel port is using. Find your parallel port listed in device manager. Open up the properties for your port and look for the resources. The first hex number shown in the I/O range will be your address. When Mach3 is started for the first time, it will prompt you to define an address. If the setup wizard was bypassed you can change your address by going to the Config drop down menu and selecting Ports & Pins. Once I updated Mach3 to my parallel port's address, I had to restart Mach3 before it seemed to work correctly. I have also heard of others needing to enable their port in the BIOS settings.

     Next thing we need to do is to setup our X, Y, and maybe Z axis. Go back into the Config drop down and again click Ports & Pins. This time navigate to the Motor Output tab.

Stepper config
In the image above you can see how to setup for a 2-axis machine using my laser converter board. You first need to enable all the axis you need and tell Mach3 what pins on the parallel port are connected to the step and direction lines. In this case, X step is pin 2 and X direction is pin 3. The following two columns define how your stepper driver interprets the pulses. The Pololu drivers I use are active low devices. You will notice that my X direction is NOT set to active low. The direction pin can be active high or active low and still function the same. The only difference is the direction the axis will move. On my machine I wanted the axis to go the direction the arrows pointed on my keyboard. Configure this to your personal preference. Last define the port as 1. Unless you have defined two parallel ports all active signals should be defined to port 1.

     At this point, if we return to the main page, press reset, and try to jog our steppers they should respond but may not sound or move smoothly. Lets tune those motors.

Motor tuning
Each machine will have it's own method for moving the axis when the stepper shaft rotates. Because of this it is important we can define parameters that work for our setup. First, find out if your stepper drivers are running in a micro-stepping mode. On the converter board sold here there is a 9 switch dip switch that defines the micro-stepping. The first three switches correspond to the first driver, the second three to the second, and the third three to the third driver. The switch table can be found mid way down the page here. The above image works well for my steppers on eighth step. I found it was easiest to tune the "steps per" value by setting the stepper driver to full step mode and use a ruler to see how many full steps it takes to move an inch (or in some setups mm). Once the number of full steps per unit of measure has been found you can simply multiply by the micro-step value (2, 4, 8, 16). An easy way to perform single unit of measurement movements is to return to the main screen and click on the MDI tab near the top. In this screen you have the ability to execute G code commands. To move one unit, simply type "G0 X1" to move to X1, (or replace X for Y when testing Y axis) "G0 X0" returns back to where you started. Continue to turn the "steps per" value until your machine moves one unit (inch or mm). The velocity and acceleration values are determined by the weight of the object your steppers are trying to move and the torque they are able to deliver. This will vary a lot on each individual machine. I found the above values to work well on my laser cutter, feel free to experiment and let me know if something works better.

      Lets get those end-stops working. Mach3 needs to know what inputs the end-stops are on and where they are.

End-stops

The guide I have a link to up at the top explains this better than I do. So for a more complete understanding go there. The end-stops on my board are active high and are routed on pins 12 and 13. Go to the Config drop down menu, click on Ports & Pins, and select the Input Signals tab. I defined my end-stops to be X home and Y home. With this configuration I can press "REF ALL HOME" on the main screen and it will perform a homing sequence.

Scroll down on the Input Signals list and you will see the EStop config. The laser cutter I bought did NOT come with an EStop button so I have simply bridged the signal to always be off. I left the ability for others who wanted to add an EStop the can remove the bridge and solder a switch.

Update: Due to some confusion about the solder bridge I have decided to not ship with U6 bridged. If you have a board that is bridged the picture below will work for you. If there is NO bridge remove the green check from Active low. If you don't plan on wiring in an EStop you can probably just leave the EStop disabled. 

EStop config

     This next part is specific to laser cutters. We will be disabling the normal spindle and having our laser controlled instead. If you are running a spindle, the setup document I link to at the top of this post is very useful. To use a laser we need to define an output that can be turned on and off when needed. Go to the Config drop down menu, click Ports & Pins, and click on the Output Signals tab.

Laser output
On my converter board the laser logic level is on parallel port pin 9 and is an active low signal. Set Output #1 as shown in the image above.

     Lastly click on the Spindle Setup tab in Ports & Pins. Un-check use spindle motor output and make sure output 1 is defined as M3 and M4. See below image.

Spindle Setup
     You should be ready to cut with Mach3. Somethings to keep in mind when using your laser with Mach3. Because the parallel port can be in an unknown state until Mach3 fully loads, I recommend always leaving your laser on/off switch in the off position until ready to cut. Also, G code that assumes your machine is running a spindle will give you code that doesn't produce the cuts you would expect (the laser doesn't turn off when rapids are performed). In order to make useful G code I have made a post-processor for Cambam. I will post that and instructions how to use it in the next few days.

     If there are suggested improvements to this basic tutorial let me know in the comments or email me at support@chriscircuits.com.

To order a board to convert a 40W Chinese laser cutter go here.

Next: How to use a post processor

2 comments:

  1. Perfect timing on these instructions, Chris! I got my board in the mail today - will be installing it soon. Thanks for sending it out so quickly.

    ReplyDelete
  2. Thank you very much for these valuable information, Chris.
    I would like to add a horn to my table, so Mach3 sounds it when finish the work.
    Is this possible? How can it be done?
    Regards
    Cristobal
    cristobalmunoz@hotmail.com

    ReplyDelete