Introduction: CNC, Dont Lose Your Job
In this instructable i will show you how arduino saves the line number of your job from mach3 to its EEPROM.
I imagine you have your holding circuit so you dont break your machine in case of powerloss, and your limit switches so you can restart your work from correct place, so all left in case of powerloss is to know from what line restart the job. All you need is clossest already cut line from where you can continue.
And in this instructable i will show you how to set this up with arduino.
Step 1: Arduino Setup
The arduino contains simple code which in addition makes a use of display and modbus library.
The modbus ibrary i used can be found here https://code.google.com/archive/p/arduino-modbus-s...
The dispaly library is the one used for standard LCD keypad shield... but find correct one for your shiels as there are more types with different pinsetups.
On first image you can see on arduinos display Line: xxxxxxx which represents the actual line recieved from Mach3 (which you can see on image too). Note i am rounding it for thousands so last 3 digits will be always zeros. The second line has a word Saved: xxxxxxxx this is showing the last number saved in EEPROM. Program saves there every 30 seconds, so the access is bit restricted to prolong lifetime. You can ofcourse change this to your liking.
Second image; After you turn on your system again and arduino is powered it shows text "From memory:" and the last saved number from EEPROM which is the one from where you want restart your job.
And last but not least... you need to press any button on keyboard for arduino to start recording the data (to see the screen on image one) from Mach3. If you dont press any button Arduino will be displaying the number from last job even if you press reset or loose power again and no new data are saved to memory.
Arduino code is attached.. that is the: codeline.ino
Step 2: Mach3 Setup
First image is of the finished brain.
Note the Formula in the brain .. it is to round the number before sending an int to ardiuno. Not that Line Number isnt integer but i think Mach saves it in float type and it was doing some issues if i remember correctly. And i divided it by 1000 as biggest number you can send is 65535, and every 1000 line is is good enough for me as repeting max. 1000 already cut lines in 300 000 line job is very acceptable time loss and you can use this for a job of up to 65 milion lines.
Second image is where i found the "Current line" input is in DR'o. (if anyone wondered)
Third is output setup to modbus. The forth image shows the modbus setup where we send the data. thats why on third image there is CFG#: 4.
Fifth image, when you will be testing port on which you have your arduino and you click open, status will be No error, this way you are almost certain data is sent to arduino.
This Port must be correctly set also on the 4th image port/address othervise data will not be sent.
And at last. the codeline-ok.brn goes to brain directory in Mach if you wana just copy it. but do not forget you still need to set the brain enabled in brain controll in mach3 menu.
Hope this will be nice addition to someones CNC system.
Tip 2 years ago
You did not cover the hardware. I run Mach3 and I think this may be a good utility, but I am not familiar with the arduino hardware. If/when I build this, I may request clarification on the hardware aspect. The project seems simple enough;I came here from 'MACH3 4 Input 4 Output Simple Expansion' which I really need.
5 years ago
I thought you meant in the sense that the robots are taking my job!
Which they are... So i'm trying to get in to robots now.
Reply 5 years ago
Hmm, yeah the name is probably confusing, its just system which in case of powerloss helps you restart your work, as you know where from to continue cutting.
Anyway, good luck with robots, they can be fun, ... sometimes