This is the completed first fully working version of PiDRO. This project reads digital scales mounted on a milling machine and/or lathe. The data is displayed on a large computer screen. See figure1. Inch or mm display is provided along with a variety of ways to zero the scales. The scales are inexpensive. This work may aid others in adding scales to their projects.
I mounted some inexpensive iGage digital scales to a hobby milling machine. See figure 2. The scales worked fine but the displays were hard to read due to their small size and would automatically turn themselves off after one minute to save the batteries.I also wanted to do a project with the Raspberry Pi.
I decided to plug the scales directly into an Arduino.The Arduino reads the scales and sends a text string out the USB port. A Raspberry Pi reads and parses the string, then displays the scale data on a large computer monitor. To slow the digit flicker averaging was added along with four methods to zero each scale.
To make the scales easy to plug into the Arduino, I used Eagle to design a shield that accepts five input scales and one digital caliper. See figure 3. The scales are made by iGage and sold on Amazon.com and Grizzly.com. The scales come in 6,12, 24 and 36 inch ranges.
The iGage scales connect to their display modules and the PiDRO sheild via the same connectors used for Mini-B USB.Note: THE SCALES ARE NOT USB AND PLUGGING THEM INTO USB CAN DAMAGE THE SCALES AND/OR THE USB PORT.
Three scales are attached to mill axes X, Y and vertical Z.
Two scales are attached to a lathe for D - diameter and L - length.
A single interrupt driven data line is used to clock the data in for all five axes at the same time. This reads the data faster and provides better synchronization between the axes. Information on the scale data protocol is located here:
The caliper creates both the clock and data lines which trigger a hardware interrupt to capture the data.Information on the caliper data protocol is located here:
The display program running on the Raspberry Pi is written in Python.
The D-axis on the lathe measures cross slide motion but the part diameter is displayed.
A conventional 'zero' button is provided for each axis.See figure 4.
Three additional ways to initialize the axes are also provided.
The '<' button allows the axis to be 'zeroed' with an edge finder.When the button is pressed, the display is set to -0.100 inch. This is functionally equivalent to finding the edge with a 0.200 inch diameter edge finder, removing the edge finder, moving the axis 0.100 inch toward the part and zeroing the axis again. This sets the edge of the part to the center of rotation of the spindle.
The '>' button is used for zero on the opposing edge of the part.
The 'C' button is used to set the axis to the current caliper reading. This is particularly useful for tool mastering and setting lathe diameter. The part is machined oversized and measured with caliper. The D-axis is set to the caliper reading. Further diameter machining is now in actual part size.
The 'C' button can also be used with the mill. Say the goal is to mill a block to a given length. A test cut is made and the part length is measured with the caliper. The caliper reading is transferred to the axis display. Further machining will now be in part length units. If similar depths of cuts are maintained on subsequent passes, spindle bearing slop and tool deflection will contribute less to size error by common mode rejection.
The setup tab is shown in figure 5. This tab shows the scale counts in real time. The ‘scale by’ column shows the conversion factors used for the mill and lathe tab displays. Inch and mm scale factors are preprogrammed with buttons on the right but can be overridden by typing in scale factors. The number for the rolling average is also set on this tab.
In the next revision, I plan to add a USB microscope to provide a visual method to initialize axes to holes or part edges.
If anyone wants to help:
- Teach me how to easily make digital reticules or overlay targets for the microscope. I'm talking bitmaps here not Mylar.
- I picked the wrong FET to interface the caliper but got the board working by adding on some leaded components. Help source a new surface mount FET or transistor that pretty much uses the pads now on the board. See the Eagle data.
- If you look in the middle of the PiDRO shield you will see a spot for a Raspberry Pi GPIO connector. In theory the shield can be mounted directly to the Raspberry Pi without the Arduino. Does anyone know how to write the scale interface code for the Raspberry Pi?
- I purchased the cable shown in figure 6. The cable does not stay plugged in.A slight tug pulls it from the caliper. Even when hot glued in place, as shown, the connector is intermittent. It costs more than the caliper. Run away from this cable. The solution was to solder wires to the caliper connector traces.
- I put too many commands into one of the Arduino interrupt service routines. This made the routine run too slowly giving odd and hard to debug results.
- I used data line 2 for one of iGage axis inputs and found later that I needed the hardware interrupt for reading the caliper. I had thought about this general problem in advance and added extra plated thru holes to allow wires to easily be rerouted by cutting a small length of trace and adding jumper wires as needed. Note the red and yellow jumper wires in figure 7.
Files for this project are posted on GitHub.com at AlanBC7/PiDRO
PiDRO.py is the Python program that runs on the Raspberry Pi
Digital_Caliper_interupt5.ino runs on the Arduino
PiDRO1.sch is the Eagle schematic
PiDRO1.brd is the Eagle board layout