You are here

MINI NC Controller for Z-axis: Stage One

Last modified: 
Sunday, December 14, 2014 - 14:20

Main project page: MINI NC Controller for Z-axis

The start of a NC (numerical control) Controller for the Z-Axis of an IH Manual Mill.
In the end i hope to have:
A box on the side of the mill with buttons, knobs, switches, lights and a LCD display to... rapid the head up and down, increment the head .001, .01 and .100 thousands for depths of cut, auto feed for boring, auto peck drilling, offsets for different tools (i use a Royal R8 Quick change tool holder alot), a 'Q' setter for setting tools (and z-zero), DRO (of some kind) and what ever else pops into my head.

As of now, for the first stage, i build a small contraption to simulate the Mills Head so i have something to test with (and not crash the mill :-) ).
There is a momentary rocker switch to rapid the head up and down.
A Rotary Encoder to control the depth of cut.
LCD to display menus along with a 4x4 keypad for input.

What you see in the video is pretty much one of the first test runs. First thing i did was wire up the keypad and LCD, then worked on the software (while waiting for the motor and driver to come in). Once the motor came in, got that all wired up, build the simulation contraption, pulled everything togeather, played around alittle bit then recorded the video... so there has not been too much debuging or trouble shooting so far.
In the video you will see a little of the menu system, as of now it is only software and is not coded to move the lead screw.
In the Boring and Drilling menus you will see me enter + positive numbers for drill and bore depths, for entering info from the keypad it just seamed easyer to key in the depth with out having to hit a - negitive button, in the end, the c++ code will know which way to move.

Hardware used, so of now:

  • Arduino Mega - $60 (i went with the Mega because it has a lot of pins too hook things to and for the "kit" it was not that much money).
  • 4x4 Keypad (which came with the Mega kit)
  • Replacement 20x4 LCD - $10 (the kit came with a 16x2, for what i want to do, its alittle too small so i picked up a bigger one).
  • KY-040 Rotary Encoder Module: $2 (to control the depth of cut)
  • Momentary Rocker Switch: $13 for 3pc  (used for the Rapid up and down)
  • 125 oz. Stepper Motor: $25 (for testing, when the time comes i will have to do more research for a Motor, Driver and Power Supply for the Mill)
  • EasyDriver Stepper Motor Driver: $15  (for testing)
  • PC 12v power supply (have acouple of these laying around, using one to power the Stepper Motor Driver)
  • Little mill head simulater contraption to test with.
  • So not counting the cost of "labor and time" (roughly 40 hours so far) or the stuff i had laying around, its around $125 bucks.


KY-040 Rotary Encoder Module: Cheap-o and not the best (but can not complain too much for what it cost, $2).
Have "bounce" problems with it, if you turn it too fast it will "loose" itself and start jumping directions and some times it does not "read" at all. After searching the net, it seams like this is a commen problem with these type of encoders. Tried acouple tricks floating around the net and they helped, but it is still not perfect. For now im just gonna be carefull and move it slow.

The stepper does not always step, gonna have to add an encoder to the lead screw when the time comes (which the rotary encoder will also work with).

Accuracy when using the hand wheel (rotary encoder) to move the head for a depth of cut. Not sure if there really is a problem or a crap indiactor being used. For the most part its working, but at times it seams to be alittle off. Gonna hook up some of them cheap digital scales along with double checking with a caliper.

AccelStepper stepper library: Using this library for the rapid moves, but could not get it to work for the handwheel depth of cut so i used the default stepper library for that.

As of now, thats all the issues which have popped up (but im sure that will change :-) ).


Stage Two link:
Drill Cycle working and Temp Pannel -


Resource References: (modified that for a 4x4 keypad),209005.0.html (used the core of "reply 3's" code, modified it to fit my needs) (thanks again Jaakko (and every one else))

Since this is a big project, i will be creating new pages for each stage and will try and update older pages with stuff i missed.

Heres a 10min video of it in action

Mobile QR Barcodes: 
Save Article as PDF
Current URL Address

Add new comment