As part of my woodworking hobby, I had acquired both a Dewalt DW733 portable thickness planer and a Performax (now Jet) 16/32 drum sander over the years. Both tools are fine but I have always wished for better, more accurate thickness control. I use a set of calipers to measure board thickness after a pass but the actual measurement scale supplied on each tool is just a moving pointer on a fixed scale so it can be difficult to get consistent, repeatable results. Wixey makes a digital gauge that I could purchase and install but what fun would that be. Besides I wanted a gauge that I could program to work the way I wanted it to not the way someone else wanted it to. It would be ideal to basically attach the calipers I was using directly to the machine. I had seen numerous sites over the years that covered hacking and interfacing an inexpensive digital caliper and thought that this might be a good way to go.I use several different sleds and jigs on both machines so a gauge which I calibrate once and then don't have to calibrate again wouldn't quite meet my needs. Wixey has a relative mode where you can measure your board, subtract the desired thickness from the measured thickness, set the gauge to zero and then adjust the machine to remove the required amount. My plan was to measure a board, set the gauge to the measured reading, and then, as you adjust the machine, the readout will read the actual board thickness.
As I mentioned above, my plan was to use an inexpensive digital caliper like the kind they sell at Harbor Freight. The calipers are made in normally China and you can buy them numerous places. There are also numerous web sites which have detailed information about hacking these calipers. I have actually seen them on sale at Harbor Freight for as little as $10. Here's what mine looked like:
The interesting thing about these calipers is that they have a small, sliding window that, when opened, exposes 4 connectors on the circuit board that provide an interface to the caliper and its readings. The interface looks like this:
The 4 connections are ground, data, clock, and 1.5 Volts from left to right. The data is clocked out on the data pin about every 300 to 330 ms and is composed of 2 - 24 bit numbers that represent an absolute position and a relative position since the last time the caliper was set to zero. The numbers are in 1/20480ths of an inch. There are a number of web sites that probably explain the protocol much better than I could and I provide a link to many of those sites at the bottom of this page.
I also needed a cable to connect to the caliper and Little Machine Shop sells just such a cable. The problem is that there really doesn't seem to be a mechanical standard for the caliper housing and they are not all the same. I have three of these calipers and the cable only worked really well on one of them. My solution, which I also found on the Internet, was to solder the wires directly to the circuit board and provide a simple strain relief. The idea and detailed instructions for this modification are provided on this web site (which is in German but translated here into English) and worked really well. This is what my circuit board looked like with wires attached ready to re-assemble:
Finally I made several modifications to the calipers themselves just to simplify mounting for my application. I added 2 - 1/4" X 3/16" bushings and planned to mount them on my machine with a pair of 3/16" shoulder screws. Unfortunately I ignored the fact that the calipers are positive ground (in that the +1.5 volts is connected to the frame of the calipers). For that reason they needed to be isolated from the metal frame of the machine so I ended up mounting the calipers with nylon hardware. This would be optional and may not be necessary at all depending on your application. Here's my completed calipers ready to go:
The final piece of the system is the interface itself. I chose to use an Atmel AVR micro to interface with the calipers - specifically an ATMEGA168. Most of the information I found on the Internet related to using PIC processors so this is the first AVR implementation that I'm aware of. The program only uses 19% of the processor memory so a smaller processor would work but I wanted room to grow and I only stock 2 or 3 different processors since the cost difference for a one-off application is nominal. Here's the schematic for the interface, you can click on it for a larger view and the files are available for download at the bottom of this page:
There are several interesting things to discuss here. As I mentioned, the processor is an ATMEGA168 running at 8 Mhz. I probably could have gotten by using the internal oscillator but I chose to add an external resonator. Although I'm not currently using it, I added a header for RS232 serial communications in case I needed it in the future and the internal oscillator is not always accurate enough for reliable RS232 comms. I'm using an external 5 volt regulated wall wart so no need for a 5 volt regulator but I do like to provide reverse voltage protection to my projects and that presents a minor problem since the normal method is a blocking diode but that would lower the 5 volts to only about 4.4 volts. The solution was to use a PMOSFET in an unusual configuration. Rather than a detailed explanation, here and here are two sites where I got the idea and that explain this use much better than I could.
The calipers require 1.5 volts so I used a TI TSP769 series LDO regulator. This regulator also has shutdown capability. I have connected this pin to a processor output pin but am not currently using this feature. The problem with 1.5 volts on the caliper volts is that signals from the clock and data pins are also 1.5 volts and, since I'm running the processor at 5 volts, the Mega168 data sheet specifys the input port high voltage needs to be a minimum of 0.6Vcc - that means I need a minimum of 3.0 volts to recognize a high signal. I solved this problem by using a 2N3904 NPN transistors with appropriate resistors on both the data and clock signals. This has the effect of boosting the high voltage to 5 volts and also inverting both signals. This doesn't really bother me since I can compensate for the inversion in software if necessary.
You can also see an NLAS4501 analog switch that can connect 1.5 volts to the clock pin through a 10K resistor. This can be used in software to zero the calipers. There is also quadrature encoder with push button switch which provides the user interface to the caliper gauge. This is connected according to the encoder data sheet.Finally there's a Crystalfontz LCD to display the readings and three LEDs - one for power on, one for mode display, and the final one is a heartbeat signal that is toggled every time a new reading is received.
I designed the board using FreePCB
and purchased the board through
I have used both of these for several projects now
and have been very pleased with the results. I also used an
from SparkFun. I have used these enclosures before
and I like the size and the fact that they are clear and you can see
your project and any LEDs you might have. Here's the
populated board and the finished enclosure:
Finally, here are all of the pieces together:
The calibrate routine uses several interrupts. The two
quadrature outputs are connected to inputs which are configured as pin
interrupts and a separate Timer1 interrupt is also enabled.
The Timer1 interrupt occurs every 65.5 ms and increments a
variable to a max of 5. Each time an encoder interrupt
occurs, the interrupt routine determines the direction of the encoder
and checks the value of the timer variable and, using these two pieces
of information, determines whether to add or subtract to the calibrate
value and how much to add or subtract. Each time the value
changes, the reading is updated on the LCD. Using this
method, if you turn the encoder fast, the value will be increased by
large amounts and, if you turn slowly, the value will be incremented by
a minimum amount. This way you can get to a large number
quickly and then slow down to dial in the exact value desired.