The mill’s soul

IMG_2456.JPGI just published v0.4 of Pleasant Mill‘s firmware on Github yesterday:

As you might guess from the version number, this firmware isn’t finished yet and probably still has some bugs to fix (help’s highly appreciated, BTW :).

As mentioned before, I use a Seeduino Mega and some Pololu A4983 stepper motor drivers.

One recent addition on the hardware side was a 24V/6.3A power supply. I also glued some small heat sinks on the A4983 chips.

Then I increased the current to 1.68A, the max current, the stepper motors (SY42STH47-1684B) are rated for. Driving the steppers at 24V/1.68A enabled me to dramatically increase the top feedrate for the machine (about 1800mm/min instead 600mm/min). Unfortunately, the little heat sinks weren’t enough and the thermal shutdown of the A4983 kicked in after a few minutes. So I had to lower the current to about 1.2A again (and the max feedrate to 1100mm/min).

As you can see in the image at the top of this page, I’m still using a messy bread board for the electronics. As soon as I have the feeling to know the main issues with the whole shebang, I’ll build some kind of Seeeduino Mega shield, of course.

Right now, I plan to put the stepper motor drivers on a separate daughter PCB, somehow integrated in some kind of big ass heat sink.

If anyone knows a good way to cool the tiny A4983 chips on the Pololu breakout boards, please let me know!

The just published firmware release contains code for the G2/G3 commands (arcs) and for several drilling cycles (G81, G82, G83, G85, G89 and G73, see video below).

The drilling cycle commands also recognize the L (loop) parmeter, which is nice to drill multiple holes in a row. Just switch to incremental positioning (G91) and use something like G81 X10 Y0 Z-12 R1 L7 to drill 7 holes along Y=0mm, 10mm apart and 12mm deep. Don’t forget to switch back to absolute positioning (G90) after :)

I also added the M6 (tool change) command. Of course, I have no automatic tool changer (and I don’t really plan to build one). On the Pleasant Mill, the M6 command pauses the G-code processing and displays a message on the LCD, containing the tool number, requested by the G-code program and waiting for feedback from the operator.

For example, the line

M6 T3

results in


I even wrote some code to save a “tool database” in the Seeeduino’s EEPROM, so the LCD would say something like “Insert tool: 3mm drill bit”, but this code doesn’t work properly yet.

Both, the drilling cycles and the tool change command are showed off in the following video:

And here’s the G-code, I sent to the machine during the video:

G0 Z3
G0 X2 Y2 ; Simple drilling cycle
G81 X6 Y0 Z-8 R2 F300 L4
G0 X2 Y7 ; Drilling cycle with dwell
G82 X6 Y0 P500 L4
G0 X2 Y12
G4 P1000 ; Peck Drilling cylce
G83 X6 Y0 Q2 L4
G0 X2 Y17; Peck drilling cycle, high speed
G73 X6 Y0 Q3 L4
G0 X2 Y22 ; Drilling cycle, slow retract
G85 X6 Y0 L4
G0 X2 Y27; Drilling cycle with dwell, slow retract
G89 X6 Y0 P500 L4
G0 X0 Y-25 Z19.5 ; Tool change position
M6 T2 ;  Change Tool
G0 X2 Y32
G81 X6 Y0 Z-5 R2 L4
G0 X2 Y34
G81 X6 Y0 Z-5 R2 L4
G0 X0 Y25 Z13.5

I also implemented the commands G54 to G59. Each of these commands switches the machine to one of 6 “work coordinate systems” (WCSs). These are 6 user defined “zero positions”, saved in the machines EEPROM.

To define a WCS, use the “Jog XZ”, “Jog Z” and “Jog AB” functions in the mill’s UI (“Cartesian”) to move to the desired position. Then choose the menu command “Set WCS” to save this position in the EEPROM. You also can view already saved positions with the “Show WCS” command.

When writing G-code, you can then use one of the commands G54 to G59 to load the previously saved positions as zero positions.

In order to get the whole WCS stuff working, you need to “home” the machine once (either by sending the G28 command or by choosing “Find home” from the Cartesian menu in the UI). This is necessary to give the firmware an idea of the machine’s absolute zero position. If you try to save a WCS position in the UI or to use G54 to G59 without homing, an error is displayed.




  1. Hi,

    Just writing to say that I love this project and have begun my own clone.

    I just had a couple of questions. What type of lead screws did you use? and well the electronics being the part I know least about, can I use any stepper drivers with the firmware or do I have to use the A4983 that you use?

    Anyway, thanks I am looking forward to the next post regarding your mill.

    • See
      The lead screws are TR10x2 (i.e. ACME lead screws). However, I’d probably try to use TR10x3 or TR12x3 lead screws for my next mill (if I ever build another one…).
      I guess all stepper drivers controlled by a “STEP”, a “DIRECTION” and “ENABLE” pin should work (which should be probably most of them out there). The most important factor might be, if the driver as able to drive the stepper motors you’re using.

      • Hi again,
        I just wanted to ask a couple more questions. First off all I was wondering how you were getting on with this and if all is still going well? Secondly, is the LCD programed to work as a serial or a normal LCD? and lastly I’m sure I had previously opened the firmware in the arduino IDE but I can no longer seem to do that, I notice it is all written in C but was wondering how then you compile it for the seeeduino?

        Well thats all for now ;) Thanks again for your help and a great machine.


Leave a Reply