Interesting Tech Projects
Andy
Located in Tucson, Arizona, USA
Homepage: http://www.britishideas.com
Posts by Andy
Cutting Holes with CNC
Jun 23rd
The next step in testing the CNC machine is to try cutting a hole. For this I needed thinner wood than the scrap pine I’ve been using. Home Depot sells small boards of oak and poplar so I picked up a piece of poplar. It’s 1/4″ thick.
I also needed to raise the sacrificial platform so the tip of the end mill can reach the bottom of the wood. To do that I just cut some more 16″ x 9″ pieces of 1/4″ MDF and stacked them (see the post on fixtures for more information and pictures on what I am talking about).
I used CamBam to draw a 0.5″ x 0.5″ square and then created a profile on the inside using my 1.45mm (0.0571″) end mill. CamBam showed me that I would have slightly rounded corners, but that’s ok. I decided to cut the profile in passes, increasing the depth by 0.05″ each time. This results in five passes to get to the bottom of the wood. Tedious, but better than stressing the end mill and Dremel.
I was afraid that the tip of the end mill might bind in the sticky double-sided carpet tape so I held on to the poplar with one hand and kept my finger on the power button with the other hand just in case. I was also afraid that the cube being cut might fly out as it came free.
It turned out pretty good. No sticky residue on the end mill and no gouging of the sacrifical platform. The cube in the center held in place during cutting and while I lifted the poplar. It came out when I removed the carpet tape.
The cut is nice and clean with no burrs. I guess the carpet tape is a good method to continue using.
First Steps With CNC
Jun 22nd
Today I took my first steps cutting some scrap pine. I started off with a 2″ diameter circle then measured it. This is an acid test to check the CNC machine for accuracy and squareness. I used a 1.45mm four flute carbide end mill, 10″ per minute speed and cutting to 0.05″ deep.
Next I used CamBam to cut my wife’s name. That also went well, however even with the text 1.5″ high I was running into a limitation of the end mill. A small mill would have improved the detail.
Then I downloaded a DXF file of a horse and tried cutting that. Came out very nicely. The thin strip of wood left between the body and mane is thin enough to see light through it.
Here is a video shows the horse being made.
For all these I used the same end mill and cutting depth as I did for the circle.
Measuring CNC Backlash and Software Compensation
Jun 19th
This article describes how I measured the backlash on my CNC machine and then applied software compensation.
To measure backlash I used a Mitutoyo dial indicator with 0.0001″ markings and a full scale of 0.01″. The dial indicator was attached to an adjustable stand so the plunger could be placed against various surfaces on the machine. The stand had a heavy base to ensure the dial indicator and stand didn’t move when pressure was applied to the plunger.
The picture below shows the set up ready to measure the backlash of the X axis.
Here is the method I used:
- Position the plunger on the dial indicator a short distance from a surface that moves in the direction of the axis being measured. The plunger should be perpendicular to the surface.
- Jog 0.001″ along the axis being measured into the plunger, until the needle moves at least 0.001″.
- Note the value shown on the dial indicator. We’ll call this ‘S’ for start.
- Jog the axis 0.001″ seven times into the plunger. Each jog will cause the needle to move. Be careful not to cause the needle to move to the maximum position.
- Jog the axis 0.001″ seven times away from the plunger. The first one, two or three jogs may not cause the needle to move. This is the slack being taken up and hence the backlash.
- Note the value shown on the dial indicator. We’ll call this ‘F’ for finish.
- Calculate the difference between the finish value and the start value (F -S). This is the amount of backlash.
- Jog the axis away from the plunger
- Repeat two more times then work out the average value.
The next picture shows the position of the dial indicator used to measure the Y axis.
The last picture shows the position of the dial indicator used to measure the Z axis.
For my machine I measured the backlash as (averages):
- X = 0.00538″
- Y = 0.00250″
- Z = 0.00030″
EMC2 provides software compensation for backlash. This isn’t as good as using anti-backlash nuts, but I was curious to see how well it would perform. One thing to keep in mind is that over time wear will cause the backlash to change. To configure EMC2 simply add the backlash values to the axis sections of the INI file. Nice and simple. For example:
[AXIS_0]
...
BACKLASH=0.00538
I then remeasured the backlash and obtained the following values (averages):
- X = 0.00073″
- Y = 0.00010″
- Z = 0.00013″
The Y axis saw the greatest improvement (96%) followed by the X axis (86%) and the Z axis (56%). I think this is pretty good.
Backlash Article
Jun 18th
I just found a nice article on backlash and how anti-backlash nuts work – Backlash in Lead Screws: What It is and What to do About It.
Creating Fixtures For a CNC Machine
Jun 14th
Fixtures are the method used to hold down workpieces, which are the items that will be cut. There are many different ways to do this and the following describes the method I have chosen.
Once my CNC machine was assembled, the surface looked like this:
It is pretty much a piece of wood held down by four bolts. We can’t directly attach the workpiece to this surface however because when we cut all the way through the workpiece we will gouge the surface of the CNC machine. Therefore we need a sacrificial piece of wood in between. This sacrificial wood can be thrown away when it is no longer useful and replaced. In addition to using a method which allows the sacrificial wood to be easily installed and removed, it would be nice to allow different sizes of sacrificial wood.
The solution I used for this is a grid of holes which allow bolts to be used. I decided to use a row of five bolt holes down each side of the CNC surface, regularly spaced apart. The four corner holes are 1.5″ in from each edge. The remaining holes are spaced 3 gaps of 6″ and 1 gap of 5.5″ apart along the longest edges.
To drill the holes I used a 5/16″ wood spade bit. The next step is to attach 1/4″ – 20 x 5/16″ tee nuts. I achieved this by hammering them in. Attach the tee nuts to the underside of the CNC surface.
After reinstalling the CNC surface I cut a piece of sacrificial wood. I used scrap 1/4″ MDF from Home Depot. A sheet 4ft x 2ft cost me about $5. I cut the MDF down to 16″ x 9″ and drilled 5/16″ holes 1.5″ in from each edge (four holes in total). The MDF was then bolted down to the CNC surface using 1/4″ – 20 x 1″ bolts.
The final step was to use double-sided carpet table to fix the workpiece down onto the sacrificial wood.
Configuring EMC2 For Three Axis Stepper Motor Control
Apr 29th
There are many ways to configure EMC2, suiting many different uses. But perhaps the most common is control of three stepper motors. This post describes the process I went through to configure EMC2 for my CNC machine, which is a Fireball CNC V90. These steps may not match exactly your needs, but perhaps it will help as a starting point for further exploration.
It assumed that you have managed to get EMC2 installed and have run the latency tests with no overruns. If you are seeing overruns then try the hints on the EMC2 Troubleshooting page.
When you see ‘$’ in this post, it represents the user prompt. Don’t type it, only type the commands that follow. Replace “andy” with your own user name.
First we need to know how many steps per second your PC can generate. To do that we run the kernel latency test:
$ cd /usr/realtime*/testsuite/kern/latency
$ sudo ./run
The test will output a set of numbers. Use the PC to browse the web, play music and check email for a few minutes. However don’t run EMC2. Stop the test and note the largest value in the “ovl max” column. In my case it was 92,191. Values over 100,000 may not give good performance. In general the larger the value the worst CNC performance will be. There are some hints in the EMC2 wiki on how to lower this value.
92,191 means 92.191us (us = microseconds). Between the PC at the stepper motor is a driver chip, such as the SLA7078MR. This chip has some delays that are required for each edge. By reading the datasheet for the driver chip we can find out what this is, and for the SLA7078MR it is 12us. If you don’t know or not sure, I would suggest you pick a value similar to this and err on the side of caution by making the value a bit larger.
So we have 93us (rounded up) + 12us = 105us = 105,000ns (ns = nanoseconds). This is the BASE_PERIOD (more on that in a bit).
Therefore the maximum step rate for my PC is 1 / (105us x 2) = 4,762 steps per second.
It’s possible to tweak the steplen, stepspace, dirsetup and dirhold values to achieve better results than this, but that topic is outside the scope of this post. See the EMC2 documentation for details.
We next need to calculate how many steps are needed to move one inch with 1/4 microstepping. If you wish to use a different microstepping configuration or millimeters then adjust the following calculations accordingly.
My stepper motors require 200 pulses per revolution. This is a very common amount. With 1/4 microstepping it will take 200 x 4 = 800 steps per revolution.
On the X and Y axis of my machine the lead screw has 10 turns per inch but it is has two starts, which makes it 5 turns per inch. This is a pitch of 1 / 5 = 0.2 inches.
Therefore 0.20in / 800 steps per rev = 0.00025in per step.
Therefore 1 / 0.00025in = 4000 steps per inch. 4000 becomes the INPUT_SCALE value for X and Y.
The maximum speed is 4762 steps per second / 4000 = 1.1905in per second = 71.43in per minute. 1.1905 is the MAX_VELOCITY for X and Y.
On the Z axis of my machine the lead screw has 12 turns per inch. This is a pitch of 0.0833in.
Therefore 0.0833in / 800 steps per rev = 0.000104166in per step.
Therefore 1 / 0.000104166in = 9600 steps per inch. 9600 becomes the INPUT_SCALE value for Z.
The maximum speed is 4762 steps per second / 9600 = 0.4960416667in per second = 29.7625in per minute. 0.4960416667 is the MAX_VELOCITY for Z.
We now have all the information needed to complete the configuration of EMC2. First we must copy the example configuration files and then customize them.
$ mkdir /home/andy/emc2/
$ cp /etc/emc2/sample-configs/stepper /home/andy/emc2/
$ sudo chown andy:andy /home/andy/emc2/*
Rename all values to remove “dpkg-new” from the end of the file names. Then:
$ cd /home/andy/emc2
$ mv stepper_inch.ini mymachine_inch.ini
$ nano -w mymachine_inch.ini
Scroll down to the BASE_PERIOD line and set it to the value calculated in nanoseconds. In my case it is 105000.
Scroll down to the trajectory planner and set the MAX_VELOCITY value to the largest MAX_VELOCITY value of all the axis. In my example it is 1.1905.
Scroll down to the section that configures the first axis (X) and set the INPUT_SCALE to the value calculated. In my example it is 4000. Set the MAX_VELOCITY and STEPGEN_MAXVEL to the MAX_VELOCITY value for the axis. In this example it is 1.1905.
Repeat for the Y and then Z axis.
The final step is to edit standard_pinout.hal to match the pinout of your controller board. The important section in the file looks something like:
linksp Xstep => parport.0.pin-03-out
linksp Xdir => parport.0.pin-02-out
linksp Ystep => parport.0.pin-05-out
linksp Ydir => parport.0.pin-04-out
linksp Zstep => parport.0.pin-07-out
linksp Zdir => parport.0.pin-06-out
Simply change the “03”, “02”, etc. values to match the pin numbers used by your board. “Xstep” means the step input for the X axis.
Now run EMC2 using:
$ emc /home/andy/emc2/mymachine_inch.ini
Set the jog rate to the maximum for each axis in turn and jog the axis. It is possible that the axis may stall or lose steps. This is because the value we calculated is a theoretical maximum. However it gives you a starting point to reduce the speed of the axis until it works reliably. To do this lower the jog speed slightly until it works then using the INPUT_SCALE work out a new value for the number of steps per axis. For example, assuming we had to lower the jog speed to 60.000 in per minute on the X axis:
60.000 in per minute / 60 = 1.000 in per second. 1.000 in per second x 4000 steps per inch (INPUT_SCALE) = 4000 steps per second
Now a new value for BASE_PERIOD can be calculated:
1 / 4000 steps per inch / 2 = 125,000ns
Edit mymachine_inch.ini and set the new BASE_PERIOD value. Note that this will lower the speed of all axis. Recalculate the MAX_VELOCITY value for all axis and update the configuration file with the new values. Then retest.
I found that on my PC it can operate at the theoretical maximum speed without problems. I hope this helps you configure EMC2 for your machine.
First Steps With EMC2 and AXIS
Apr 28th
This post describes the first steps after running EMC2 with the AXIS interface for the first time. To start choose AXIS -> Sim from the menu after starting EMC2.
Starting the attached CNC machine (in this case a simulation) requires two steps. First the emergency stop (e-stop) must be turned off. Then power must be turned on.
To turn off the e-stop click on the toolbar button that looks like a red circle with an “X” in it.
To turn on the machine click on the toolbar power button (to the right of the e-stop button).
At this point most of the user interface should now be enabled. Until you have a real e-stop button connected to your machine, you can click on the toolbar E-stop button at any time to stop the machine.
Drag the “Jog Speed” slider to something like 30 in/min. Now to jog the axis. Make sure the “Manual” tab is selected.
- Select one of the axis X, Y or Z
- Choose “Continuous” from the drop down list
- Click on the “+” and “-” buttons to jog. Watch the cone move in the display
- Now try a different axis
The display also shows the current X, Y and Z position in inches of the tip of the cone, which represents the tool (drill bit).
Now try clicking on the execution toolbar button, represented by a blue triangle. EMC2 will execute the loaded g-code file, which outlines some text. Watch the cone move as the code is executed. There are additional toolbar buttons to pause, step through and stop execution.
To zoom in on the display move the mouse over the display and use the scroll wheel on your mouse. Alternatively press the right mouse button and drag.
To pan the display move the mouse over the display, press the left mouse button and drag.
To rotate the display move the mouse over the display, press the scroll wheel and drag.
There are also toolbar buttons to control this operation. In addition there is a toolbar button representing a broom. Clicking on this will clear the lines showing the path that the tool has made.
Next click on the “MDI” tab to access the command line interface. In the MDI Command box enter:
G00 X0 Y0 Z0
Watch the cone move back to the origin in the display. Now try the following and watch the cone move:
G00 X1
G00 Y2
G00 Z0.5
At this point the cone should be at 1, 2, 0.5. Any number of axis can be moved at once, and the number after the axis name is the absolute position. For example:
G00 X2 Y2.5
G00 X0 Z0.1
G00 X0 Y0 Z0
G00 means move the tool as quickly as possible. This is only used when not cutting, as it is typically too fast to move the bit through a material.
Note that all the numbers used in this tutorial are in inches, however it is easily possible to configure EMC2 and AXIS to use millimeters. In which case G00 X1 would move along the X axis one millimeter.
CNC Machine Cabinet
Apr 7th
I have started designing a cabinet to hold my CNC machine. This will allow viewing of the machine as it works and keep the mess to itself. It will also have a location for the electronics to keep everything self contained. Some anticipated features:
- Electronics storage with location for cooling fan
- Windows on two sides for observation
- Doors on two sides for easy access
- CNC machine sits on a sliding shelf for easy installation and removal
- ESTOP and power switches on front of machine
- Printer port connector (DB25) on back
- Minimises amount of chips and debris reaching electronics
- Power outlet for rotary tool
Once it is completed pictures will be posted.
Fireball CNC V90 Limits and Speed
Apr 7th
Yesterday I performed some testing on my Fireball CNC V90. I started off with each axis pretty much centered, to reduce the risk I crash the machine into it’s hard limits (the physical limits of each axis).
Using the full stepping inches configuration I tried:
G00 X1
to move the X axis (the longest axis) one inch. The motor accelerated and then stalled. This results in a nasty whirring/vibrating sound and no movement. A bit like crunching a gear in a manual transmission car. I found the same for the other two axis.
Next I tried moving the axis at slower speeds by specifying the inches per minute (IPM):
G01 F30 X1
G01 F50 X0
G01 F60 X1
etc. I found that I could achieve the following speeds before the motors stalled:
- X: 148 IPM
- Y: 80 IPM
- Z: 33 IPM
Fireball CNC confirmed that Y will operate slower due to the different forces on the rails.
The next step is to try 1/4 stepping. This will result in a lower speed, but will increase the torque, so it should be possible to get a little bit closer to the theoretical maximum speed.
I also measured the following amount of travel for each axis:
- X: 17.85 inches
- Y: 11.7 inches
- Z: 2.75 inches
Since I received my machine Fireball CNC has increased the Z axis travel slightly.
CNC First Steps and Coordinate Systems
Mar 29th
Today I connected the motors to the V90 machine, connected the motors to the HobbyCNC controller board and started EMC2. In the EMC2 interface AXIS the cartesian coordinate system is shown along with the position of the bit, illustrated with a cone:
I connected the motors to the board so the following coordinate system would be used on the machine. I picked this system because it seems customary to call the longest axis the X axis. Plus this system makes the most sense to me. However, note that other people may swap the X and Y axis from what I am using here:
Jogging each axis causes the cone (representation of the bil) to move in the display, and at the same time I observed how the machine moved. In AXIS a positive movement in any direction moves the cone towards the letters ‘X’, ‘Y’ and ‘Z’. However on the machine every axis moved in the opposite direction. This meant that I needed to reverse the direction of the motors.
The motor direction is reversed by swapping the ‘A’ and ‘a’ wires. Note that this may not be the case for all motors. Check the documentation that came with your contoller board to be sure.
Once the motors had been reversed the machine movements copied the movement of the cone in AXIS.
The next step was to make sure the machine was moving roughly the correct amount each time. I calculated a configuration (essentially the steps needed to move one inch) for each axis. On the V90 the X and Y axis are 5 threads per inch, but the Z axis is 12 threads per inch. More on how this calculation is performed in a later post. Plugging these values into the EMC2 configuration should do the trick.
I then zeroed the position of each axis in AXIS and used a ruler to measure the location of the Z axis assembly from the side of the gantry, which is the distance the Y axis is moved in from the side. I then jogged the Y axis until the display showed it had moved +0.5 inches. Remeasuring confimed that the Y axis had indeed moved half an inch.
These steps were repeated for the Z axis.
To be sure I also created an EMC2 configuration for the V90 in millimeters and repeated the test. This time I jogged each axis +0.1 x 10 times, to move the axis one millimeter.