Search This Blog

Showing posts with label UCCNC. Show all posts
Showing posts with label UCCNC. Show all posts

Monday, 12 August 2019

Using DXF2Gcode with UCCNC

I have now output a drawing from my proof of concept CNC machine.


Created in Inkscape, saved as a DXF file, processed in DXF2Gcode, loaded in to UCCNC and plotted using a pen as the tool in my CNC machine.





I needed to configure DXF2Gcode to stop the pen crashing in to the page as it tried to act like a cutter. In the process I have learnt some of the configuration for the post processor but apart from a minor compatibility change for UCCNC, the post processor can remain almost as default.

I found some of the choices in DXF2Gcode disappointing. There is a save function for the post processors but not for the Machine settings. That seems to be the reverse of what would normally be needed but perhaps that's just because I am new to CNC control. I'll investigate this further.

Workflow for a plotter
  • Load the DXF file. This takes a few moment. It's not very quick.
  • Turn off layers that are not required. Just untick. The display usually changes to reflect this. (View-Show Disabled Paths)
  • Worth saving the project at this stage.
  • Change settings (Options-Configuration...)
    • Machine config (to generate a single pass and avoid crashing in to the paper)
      • Slice depth = -0.01mm
      • Final mill depth: -0.01mm
  • Apply those changes
  • Options-Postprocessor configuration... (now I have created a suitable config.)
    • Choose configuration file: Plotter_WIP_v7b.cfg (or whichever file is appropriate)
    • Apply that
  • Move the starting point somewhere appropriate (Options-Move Workpiece Zero)
  • Export-Optimize and Export shapes


That works with UCCNC. I have to press the Cycle Start button twice, so I think I still need to sort out the correct G code startup sequence.

==

Config
On Windows 10
Config file location: C:\Users\%USERNAME%\.config\dxf2gcode\config
Post processor file location: C:\Users\%USERNAME%\.config\dxf2gcode\postpro_config

For UCCNC: 
Each G code needs to be on a separate line. The default startup sequence puts them all on one line. This is easily changed by inserting the returns in to the Startup field on the post processor config page.

==

Shapecut Series:
Part 1 - Magic Eye to CNC
Part 2 - CNC proof of concept design
Part 3 - CNC controller enclosure

==

Appendices
These are some notes that I didn't know where else to put.

==

Applications
DXF2Gcode source: https://sourceforge.net/projects/dxf2gcode/

Alternatives to DXF2Gcode
I've struggled to find a comparable alternative. Most are now inactive projects that have no working links or are far behind what DXF2Gcode can do.
Most of the time I will use Fusion 360. That is more than capable of carrying out this task but it needs a lot more setup than I think should be necessary for most simple profile and 2D cutting jobs.
Here is a list prepared by others:
https://www.reddit.com/r/CNC/comments/aizatc/free_and_open_source_camcnc_software/
The Path Workbench on FreeCAD looked interesting but as it stands at the moment, the DXF file importer, built in to FreeCAD v0.18, failed to import any of my test DXF files correctly. I was therefore unable to test it for what I wanted.
Another one to try is FreeMill.

Paid for products
I have not tried them but the following have been recommended on forums:
Cut2D https://www.vectric.com/products/cut2d-desktop
EstlCAM https://www.estlcam.de

==

The Travelling Salesman Problem (TSP)
In reading about CNC G-code generation I kept coming across references to TSP and the Travelling Salesman Problem.
Most articles did not explain what this was but that it was to do with optimising the g-code.

I eventually managed to find an article that explained it. In short:
What is the shortest travel time for the sales person to reach all the destinations on his agenda.

In the context of CNC this relates to the long travel between cuts. What is the optimum number and lengths of travel to accomplish the task in the shortest time.

==

Saturday, 10 August 2019

UCCNC setup quick reference

There are full instructions for the UCCNC software however wading through those is time consuming.
This is supposed to be a quick reference to make it easier for me the next time I set up the software.

These notes assume the default screen layout and colours. I am sure I will reconfigure this at some point in the future.


Axes

I started with the pins and ports for the Pulse, Dir and Enable lines.


I use active high. In the case of the step pulse, this means that the pulse activates on the rising edge not the falling edge of the pulse, therefore there is no tick required in the 'active low' check box.
The pins and port numbers come from the breakout board.

Enable Line
I have the enable line connected, in that case I had to activate the enable pin on all three axes, otherwise nothing moved. Active high.

Speed and Calibration

I was expecting this to be more difficult but the built in calibration routine made it very easy.

The software calculates the 'Steps per unit' based on the measurement of a known distance.
I work exclusively in millimetres (mm) so for me, one unit = 1mm.


I just pressed the calibration button and followed the instructions. In short that was, measure the distance travelled in, my case, millimetres, enter that back in when requested and the correct value is calculated.


I ran this a couple of times to get a more precise result.
I also adjusted the velocity to something I was comfortable with. For a cutter the velocity would need to based on the material being worked on but for the pen I am using for testing, a rough guess is acceptable.

Soft Limits
These look like they will be useful for my proof of concept machine because I do not have any physical limit switches. I have not tried these settings out yet.


I/O Setup

There are lots of optional settings on this page but I only use the emergency stop (E-stop).

My E-stop is connected to pin 10, and this is normally ground when the machine is OK to run. It is therefore, active when it is not low, which is high or technically floating, as far as I know.

Lining up the tool head with the UCCNC software

I followed some online tutorials and started with the Z axis to avoid crashing that on the bed.
I used a piece of paper resting on the bed or it could have been the work piece. I jogged the head down until the paper was just gripped by the tool.


I then zeroed the position in UCCNC using the pale blue button next to the axis.
I raised the head, a little, to avoid it fouling the work piece.

Image from an older software version [to be replaced with a newer version]

I moved the tool X and Y positions to move the tool to a position that corresponds with the tool position indicated on the tool path view.
I was looking at the machine upside down, so from my view the pen needed to be in the far right corner. That corresponded to the lower left corner on the tool path view.
I don't know if that orientation is normal for CNC machines, but it would be correct if I was peering over the top of the gantry from, what I call, the back of the machine.



Once the screen view and the physical tool were in corresponding positions, I zeroed the X and Y positions using the pale blue buttons within UCCNC.

For me, that had aligned the tool head on screen with the real world position of the tool.
UCCNC was ready to use.

Xbox 360 controller

The Xbox controller is a very popular addition as a hand held jog control tool. It's a lower cost than the professional dedicated units and very effective.

The add-in for using an Xbox 360 controller is included with the UCCNC software installation and there is a description file within the UCCNC folder for what codes to use for each function.

I followed the instructions to enable and configure the plugin.
It's on the Configuration, General Settings tab.

After ticking the Enable button for the Xbox 360 plugin, it was necessary to close UCCNC and restart it.


I used the Show button to configure the controller buttons.


I have changed what all the buttons do. My preferences are:
  • The Z axis controlled by the bumpers.
  • The X and Y axes controlled by the left stick.
  • The jog speed is changed using the controller X and Y buttons
  • The movement speed is controlled by the controller A and B buttons
  • Cycle start uses the controller Start button
  • Cycle stop uses the controller Back button.
The right stick on the Xbox controller is not available for use with the UCCNC plugin. None of the buttons on my Xbox 360 controller activate buttons 10 or 11 within the plugin. I even downloaded a text app to make sure my Xbox controller was working but it was.

Much more convenient using the Xbox controller to move the tool about. A bargain for less than £15.

==

Links:
The video for the Stepcraft Machine Setup, shows aligning the tool before starting work.
https://stoneycnc.co.uk/uccnc-software/
Setting up an Xbox 360 controller.
https://www.youtube.com/watch?v=ve-HJjnXvog


==

Shapecut Series:
Part 1 - Magic Eye to CNC
Part 2 - CNC proof of concept design
Part 3 - CNC controller enclosure

==


Wednesday, 7 August 2019

Simple workflow with DXF2Gcode

Now I have my proof of concept CNC machine running, a little, I need to learn how to get drawings in to a format that can be output to the machine.

For testing, I decided to use a pen instead of a cutter. I am therefore looking to do basic 2D profile cutting or plotting.

For flat 2D drawings, it is possible to convert DXF or SVG files to G-code.
The most common method, that I could find, is to use the free, open source, DXF2Gcode app.
https://sourceforge.net/projects/dxf2gcode/

Drawings with Inkscape
For use with CNC machines, it is either necessary to construct a drawing in an application, from scratch, or to convert a bitmap image to something usable for machine control.
The free vector drawing app, Inkscape can do either.


Inkscape, as I've said above, is a vector drawing application. That means it draws using mathematics to store the results rather than pixels. That's what makes it possible to use the output for machine control. Basic and complex shapes can be drawn from within the programme.

If the source is someone else's drawing which has been scanned or saved as a bitmap image, InkScape has an option to trace the edges of a bitmap to convert it to a vector based format, SVG.

DXF2Gcode
G-code is the command structure used by CNC machines including 3D printers.
Some people create G-code instructions by hand but more commonly an application is used.


DXF2Gcode is a free programme for doing just that.

DXF is a file format commonly used by architects and engineers. It was made popular by professional tools such as AutoCAD. InkScape can save as a DXF file.

When saving DXF files from Inkscape, to be compatible with DXF2Gcode, I use the LWPOLYLINE option.


When importing in to DXF2Gcode from Inkscape, I found I had to turn off every other layer. This is because Inkscape outputs either side of a line as a separate path in the DXF file.

UCCNC control software
DXF2Gcode outputs as LinuxCNC Gcode. I am not using LinuxCNC, I am using UCCNC. I did get an error loading it in to UCCNC but it still looked correct on screen.


The above is a fairly quick and relatively easy method to create a simple 2D profile suitable for plotting.

When I change to using a cutter, I'll have to allow an offset for the kerf width. That is the size of the material removed by the cutter. That's another thing for me to learn about.

==

Shapecut Series:
Part 1 - Magic Eye to CNC
Part 2 - CNC proof of concept design
Part 3 - CNC controller enclosure

==

Tuesday, 6 August 2019

CNC first movement

Last night I got a few minutes to hook up my CNC proof of concept and run it for the first time.


This is a learning exercise. I have never used an engineering style CNC machine before.


I purchased a licence for UCCNC from CNCDrive and installed that on my laptop. Hooked up the ethernet cable and followed the instructions for setting the 10.10.10.10/255.255.255.0 IP address and subnet on the adaptor card on the laptop. I work in I.T., so that was the easy bit for me.


Crimping up a crossover network cable was also an easy job. It would have been easier if I could have found my existing crossover but with several boxes of normal network cables and only a single crossover cable, it eluded me.


I ran the little UCxxx utility file to find and view the UC400ETH controller on the network. I don't think that was necessary, but it showed the controller with IP address 10.10.10.11.

Now for the fun bit. To run the UCCNC software. On first run, with the licence file copied in to the folder, it automatically did a firmware update of the controller card.

I am yet to learn how to use the UCCNC software but having fiddled about with it in Demo mode, I knew where the important settings were.


I had wired up my parallel breakout board in, what I believe, is a common configuration. It must be because the X, Y and Z axes settings were already default within the UCCNC software. I had deliberately used port one on the UC400ETH card, so even that setting was already included for me.

Using the pop out control window on the left side, I tried to move the machine but nothing happened.


Looking at the circuit, I had the 'enable' line wired, so I set this to pin 14 in all three axes and that did the trick, I could move the CNC machines, from the software.

I tried out a few of the home and zero buttons but without knowing what I was doing, I just crashed the empty pen holder against the platter.

That was it for last night.  Now I need to learn how to calibrate the movement, import a file and generate some G-code.

==

Shapecut Series:
Part 1 - Magic Eye to CNC
Part 2 - CNC proof of concept design
Part 3 - CNC controller enclosure

==

Friday, 2 August 2019

Choice of CNC control

When designing my CNC setup I had some choices to make.
The software was an initial consideration but that has a direct bearing on what hardware is suitable.

My criteria
The decision process I went through was driven by the end goal I have in mind.

The idea is to modify a Shapecut 3200 Oxy Gas cutter. The setup of the massive, up to 2" thick, plate steel is a manual process.

Image from Mass Cutting Systems
Even on new CNC controlled gas cutters, the gas flame, work alignment and pre-heat, is still done with minimal, if any, software control.

  • Visual display
    I believe it would be easier to setup the steel plate, if there is a view on the screen of the path of the cutter.

Arduino or Not
Many CNC machines are controlled by an embedded Arduino. Nothing wrong with this. There is lots of software aimed at the Grbl code that the Arduino uses for CNC. It is also how most 3D printers work.

I opted not to go with Arduino because I wanted a visual interface to help align the work piece.

All-in-one controllers
I looked at a few of these on the internet. They look tidy but they were either more expensive than buying a used computer and building my own or there was insufficient information to know if it was a good choice.

I opted for a PC based solution but I may revisit the all-in-one controllers in the future when I have more experience.

PC based software
The most popular choices, that I came across, for use on a PC are LinuxCNC, Mach3, Mach4 or UCCNC.
I recently found mention of bCNC but I have not read enough information on that to include it in my list, for now.

My early research established that the problem with Windows, is that it is not a real time operating system. In short, other things going on could easily interrupt the CNC signals and mess up the timing for the CNC control.

PC based CNC machines have traditionally been controlled by using the parallel, printer, port. That is because, it was, up until recently, a real time port closely controlled by the computer to not be interrupted. Modern commercial operating systems don't do that anymore. Linux still does, or can if need be.

Motion controllers
The solution for a Windows PC is to use a Motion Controller. That is a bit of hardware that in one way or another buffers the controls from the computer to ensure the signals, to the CNC drivers, are always on time.

I'll cover off LiuxCNC first. I would like to have tried that but was unable to for several reasons.

LinuxCNC can still use a parallel port and that is what it was designed to do. As I don't have a computer with a parallel port, nor even one large enough to have an expansion slot to fit one, I decided that direct parallel port control was not an option for the future.

There is an Ethernet motion controller, that many people recommend for use with LinuxCNC. That is the Mesa 7i76E. It sounds great but is very hard to get hold of in Europe and comparatively expensive! That stopped that chain of thought.

What is available to me?
There are lots of budget USB parallel port adaptors. These are not recommended because they do not compensate reliably for the non-real time operation of USB.


There is only one, recommended, USB motion controller, that I could find easily available. That is by a company called CNC Drive. They have other products and I prefer Ethernet connections. Ethernet is usually more reliable and has a much longer range. In theory, they can even be controlled via the internet, although I'm not suggesting that is a good idea.


I liked the specification, and the reviews, of the UC400ETH motion controller.

Windows Software
With the motion controller selected, I had a choice of the following Windows software:

Mach 3
This is old and not fully compatible with modern computers, without some tinkering.

Mach 4
I tried the demo but that does not simulate use with the UC400ETH motion controller I have. The demo is too limited.
What really put me off was that I got several screen anomalies, mainly, incorrectly sized fonts and hidden menus. It did not inspire any confidence.

UCCNC
As this is produced by the same company that make the motion controller, the demo included a setup for that board.
The software installed and ran without issue and I found the setup screens immediately obvious.
It is considerably lower price than the alternatives and it is licensed to the serial of the motion controller board. That will be easier to manage in the event of a computer hardware failure. Better still, I can install it on multiple machine and use whichever is handy.


UCCNC with a UC400ETH motion controller are what I have decided to work with.

==

Shapecut Series:
Part 1 - Magic Eye to CNC
Part 2 - CNC proof of concept design
Part 3 - CNC controller enclosure

==