Hey everyone, I just added some functionality to make Chilipeppr execute custom G-code after

Hey everyone,

I just added some functionality to make Chilipeppr execute custom G-code after pausing for a tool change and before resuming. For tool changes, I’ve so far had to manually type code to move my mill over to the tool change position and back to the original position, which was slow and error prone. Now it will do that automatically, which will make tool changes much smoother. Hopefully this will be useful for others, too.

At John’s request, I made a video showing how it works: https://youtu.be/bNGGEp64hec

This was my first Javascript ever so quite possibly there are bugs, let me know if you try it and notice anything weird. Also, since it’s possible to crash the machine by adding incorrect code here, please be careful.


@Patrik_Jonsson very nice Präsentation. For my XATC (automatic tool changer) i use G59 Coordinaten System to use my special moves. But, my system are little bit more complicate and different to your’s, but very nice!

One question, which cnc controller and firmware you use for this machine?


This is running G2 on an Arduino Due. It’s a forked version where I added tool length offsets, but they’re working on bringing that into the latest “edge-100” G2 branch.

An automatic tool changer would be nice but that’s way up there in cost and complexity compared to this little machine…

@Patrik_Jonsson For XATC, please check my video. i’ll publish this in the next 5 minutes :slight_smile:

If i right understand, you use the new g2core on an Arduino Due, if this possible? Which Shield you use? Can u publish a Pic of ur Controller Board?

@Frank_Herrmann : Technically, this is the old edge branch from about a year ago, with my own changes, but there should be no problem running the new g2core on a Due.

The motor drivers are Geckodrive G251’s, and the shield is DIY. You can find some info and pictures at https://blog.familjenjonsson.org/blog/2015/12/21/cnc-mini-mill-6-the-arduino-shield/

@Patrik_Jonsson any chance you’ve tried this with a touch plate? I ask because I’m having a massive problem with my TinyG locking up when I attempt to use the touch plate widget after an M6, Synthetos thinks it may be an incomplete M6 function on the TinyG but I’m willing to try anything to keep from having to load a different file for each tool.

XATC: https://plus.google.com/+FrankHerrmann1967/posts/iNMRomQzwqf

@ehrichweiss No touch plate, I settled on the manual method. I think I’m going to head the way of repeatable tool changes, rather than automated probing, in the future.

@Patrik_Jonsson this is really great stuff. I will say I’m glad you made a video because it is a bit confusing all the commands going on with your tool change process, but I’d like to adopt your process into my workflow. Where did you get that guage block and what is cost? One technique for dealing with tool length offsets that is brute force that I use is just to reset machine coordinates, but I know that’s not the best approach. That mini mill looks awesome.

@jlauer The problem with resetting machine coordinates is that you can’t use soft limits, which I do. You could just reset the G54 Z-position to the gauge block, but that would force you to write down and type in some random number to 4 significant digits on every tool change. (You can’t count on remeasuring G54 Z0 since ypu may have milled away the datum.) Using G55 I know that the expected Z-position is just zero.

The block is like $60. Search “Z axis setter” on ebay.

What kind of Mini Mill is that??


I learned to plan my cuts so that G54 Z0 is never milled. I purposely leave it so I can rezero.

Yeah, but it’s not always possible. And even if the datum is still there, if it’s e.g. at the bottom of the stock you can’t locate it without removing the workpiece and completely rezeroing your work coordinates.

One important thing that I missed in this video, and which caused me to break a $30 endmill: DO NOT use G28/G30 to return to the original position after tool change! Those are machine positions, so if you change to a longer tool, you’ll slam it into the stock upon return. Ask me how I know…