Thread Tools
Jan 27, 2017, 05:14 AM
Registered User
Thread OP
Build Log

Cnc Foam cutting with Arduino - Development log

After having introduced Theremino into the Cnc Foam Cutting world, I think it's the right time to give a chance to Arduino as well.
I'll keep here a rather unusual 'development log', to describe my project and my development steps.

The basic idea
The 3D printers world gives us a great option: to have cnc controllers with very good performances and low price, ready to use.
I speak for example of the well known setup of Arduino Mega + Ramps + Pololu steppers drivers. These setup is very interesting as:
- You can find this setup on the web for about 40 euro
- To assemble it you must just fit the parts, plugging the Ramps over Arduino, and then the stepper inside Ramps. No soldering or external wiring is required. Also the stepper motor are already supplied with the right connector, to fit the Ramps shield
- You throw away the old parallel port, using a plug & play Usb port instead.
- It also includes 3 medium power PWM outputs, so we can use one of them to control the Hot Wire
- Limit switches input are already included, these can be used to perform an easy and reliable homing function, to setup the right zero position of all 4 axes
- The performance as speed and smoothness are similar or better than other more expensive controllers
- You can finds this hardware from many sources at a very low price, referred to other controller.

So, why this setup is not (or just barely) used in the Cnc Foam Cutting world?

The answer is simple:
actual firmware of Arduino doesn't offer a good management of 4 interpoled axes, with the possibility to select the external pin according to the Ramps setup (or I never found it...)

In the next message I'll explain my development idea...
Last edited by durone; Jan 28, 2017 at 07:05 AM.
Sign up now
to remove ads between posts
Jan 27, 2017, 05:57 AM
Registered User
Thread OP
My project:
I already have devCnc Foam, this is my foam cutting cnc application, linked to all my dev applications devoted to foam cutting.
Actually devCnc Foam support only Theremino or Theremino like (like CobraUsb for example) controllers.
But when I developed it, I structured the application to be expandable to other possible controllers. This is now the case of Arduino.

The first step is to write the right firmware (sketch in Arduino terms) for Arduino.
The requirements I imposed are:

- high frequency and smoothness of the stepper outputs. To get that I'll use internal timers and interrupt, writing directly on registers. The high level function of Arduino (digitalWrite, for example) cannot offer the requested performances here

- 4 linear interpolated axes. Optionally also a 5th interpolated rotary axis will be added, to my next devFoam 3D project (but this is another story...)

- PWM output to drive the hotwire, optionally also in a simple switch on/off mode

- management of input switches to detect the hardware limit. This can be used then to perform a good and reliable Homing function.

- creation of a custom map pin, without the single port rule imposed by many stepper sketches. In this way I can use an external stepper shield without any rewiring.

Said that, I decided to start with the well known Arduino Mega + Ramps + pololu stepper drivers.
This setup is very easy to find, cheap, but good performances. No re-wiring is required and limit switches input and a medium power PWN output is already supplied.
Last edited by durone; Jan 27, 2017 at 06:06 AM.
Jan 27, 2017, 06:22 AM
Registered User
Thread OP
First step: development of the right firmware/sketch for Arduino Mega

I got inspiration from 4 different sketches. Some of them performed a good stepper output generation, some a good fast management of pin mapping, some good acceleration/decelerations management and so on...

After a lot of struggling I have now a very first working prototype. Referring my list, it already includes:

- 5 axes interpolated (the fifth will be used as a rotary axis)

- PWM management

- Free stepper pin mapping setting available both at compile time, or also at runtime (in this way I can then use the same sketch with different stepper wiring, without recompiling and reloading it)

Now I'm working on the Switch limit management, and writing a firmware side robust homing function, that must be tailored in a special way to the foam cutting case.
I explain better this point:
the homing function moves the axes to reach the limit switch position, carefully detect it, then offset to a safe distance from it.
The usual homing functions work on an axis at a time. This is simpler, but creates a possible problem with foam cutting machines: is the axes position is far from the origin, moving a single axis will get a very big angle to the hot wire, and this is bad specially if you use a simple spring as retaining/tension of the hot wire. So I'll try with a first stage of movements of the same speed for all axes, until one axis reach its limit. After that I can apply the 'one axis at a time' logic.
With Theremino I used this same logic, but at pc side, as I cannot write in Theremino custom firmware functions. But putting that function in the firmare will be (I think) more reliable and easy to use. So this is the way I'll try to go...

Just for laugh, you can see here some pictures of my high tech test device, in its first version (I added now light to simulate the hotwire, and I'm going to add switches to simulate the switch limits).
Jan 27, 2017, 10:13 PM
Registered User
Kevin Matney's Avatar
Will this have to run in G code? Or will it work with GMFC
Jan 27, 2017, 10:35 PM
Registered User
I agree this would be very nice if it ran in gmfc. Then adding a 5th axis to gmfc programing would be good.
Jan 27, 2017, 10:43 PM
Registered User
Kevin Matney's Avatar
what about the Profili prg for foam?
Jan 28, 2017, 03:57 AM
Registered User
Hi Durone
Nice project I'll follow with interest!
Jan 28, 2017, 04:26 AM
Registered User
that is just what i have been looking for when will we see the first program
nice work
Jan 28, 2017, 04:54 AM
Registered User
Thread OP
Originally Posted by Kevin Matney View Post
Will this have to run in G code? Or will it work with GMFC
This will be driven by devCnc Foam, and it accepts GCode or GMFC .cut files.

But the easiest and most productive way to go is to use the chain of my applications, as they are optimized to work together, like a single application at user's eyes.
With the Cam Foam applications (devFoam, devWing Foam and devFus Foam) you draw the parts, then these applications run devCnc Foam to drive the Cnc machine. You don't need to customize/create/save/open GCode files, all is done automatically and the Cam Foam application create silently the right gode and load it in devCnc Foam.
Last edited by durone; Jan 28, 2017 at 07:02 AM.
Jan 28, 2017, 04:56 AM
Registered User
Thread OP
Originally Posted by Kevin Matney View Post
what about the Profili prg for foam?
As advised in Profili home page, the development of Profili for drawing and cutting is stopped, as its internal architecture reached its limits.
See instead the devXXX application series, these are under continue development and improving.
Last edited by durone; Jan 28, 2017 at 07:03 AM.
Jan 29, 2017, 09:22 AM
Registered User
krles's Avatar
...interesting thread,
will the results be better than by using Theremino with cnc-shield and 8825's?
Jan 29, 2017, 09:54 AM
Registered User
Thread OP
Originally Posted by krles View Post
...interesting thread,
will the results be better than by using Theremino with cnc-shield and 8825's?
Probably not a great difference as speed and smoothness, for sure it will be much easier to plugin, as no external wiring are required.
And the Arduino + Ramps is easier to find in the market,
Jan 29, 2017, 04:26 PM
Registered User
Watching with interest
Jan 31, 2017, 06:44 AM
Registered User
Thread OP
The hot wire management and other improvements in the Arduino sketch have been applied.
Also the automatic procedure to detect the Arduino port and version, and to automatically upload and update the right sketch release is working.
Doing that the user doesn't have to worry about Arduino IDE, compiling procedure, uploading, clearing the eeprom and so on, all will be performed automatically by devCnc Foam.

Now I'm testing the new Usb communication protocol between the Pc and the Arduino board.
When this is ok I'll move to devCnc Foam, to integrate Arduino Mega + Ramps among the supported controllers.
Feb 05, 2017, 12:34 PM
Registered User
Thread OP
A brief update about the actual development stage.
I'm working to integrate Arduino in devCnc Foam.

- automatic detecting of the right Arduino Board on the right port
- automatic check/upload of the right sketch to Arduino
- Gcode command flow to Arduino done and working
- reverse status flow from Arduino to devCnc Foam, with full synchro of the 3D graphic with the real position of the stepper motors done and working

To do:
- alarm and switch limits management
- automatic Homing
- Jog commands by mouse
- smartpad commands
- parameter setting to Arduino

I think the hardest and more oscure (for me) part is now done and tested.
Rather optimistic now about my project!

Quick Reply

Thread Tools