Introduction: Precision Digital Table Saw With Arduino Oversampling

A few months ago I discovered the YouTube woodworking community and the likes of Darbin Orvar and Bob Clagett. I've learned a great deal from watching their videos and I really appreciate their blend of woodworking and electronics. When I got my first 'new-to-me' table saw, I thought about how cool a digital readout would be.

Of course I found a commercial product on amazon. But you never learn anything buying an off the shelf solution so I decided to build my own interpretation.

The goal of this project was to build a digital fence indicator with accuracy approaching 0.001 inches. Realistically I'll never expect myself to be so precise in my cuts. But aiming for extra accuracy will never hurt.

Step 1: BOM and First Steps

A quick overview of materials used in this project:

Key Resources:

  • Microcontroller - Adafruit Trinket Pro or Arduino Pro
  • Display - Nokia 5110
  • Linear Potentiometer Strip from Spectra Symbol (This is where the measurement happens!)
Bulk Materials
  • Resistors (330, 1k, 10k ohm)
  • Linear Regulator (3.3v)
  • Push Buttons

I started prototyping this with an Arduino Uno. But the Uno is a little big and better suited to being your fast circuits multi-tool. So after proving the concept on my uno I transitioned to an Adafruit Trinket Pro 5v. In retrospect, the 3.3v version would have been more appropriate. The 5110 display just requires some extra resistors and regulator since I used 5 volts.

Step 2: Breadboarding and Functional Design

Two pictures here, one of my finalized breadboard, one of my KiCAD schematic. I suggest following the schematic and modify as necessary for your microcontroller.

The linear potentiometer has an adhesive backing. The resistance changes linearly with pressure applied from the top. My table saw fence has a few roller bearing under the far side which applies pressure to the potentiometer.

Beyond the digital readout, the functional design also includes a couple push buttons. One used for toggling between zeroing and displaying the absolute position.

Step 3: Code

I've placed the code in the uploaded .txt file. I recommend editing with Notepad++ and copying it into the Arduino IDE when ready. The bulk of the code is covered here, though some points will be left for later.

Functionally the buttons are important, one for blade selection and another for zeroing.

  1. Zeroing - pressing the button calls the Arduino to record it's current position. And change the "mode" from "Absolute" to "Zero". The recorded position is subtracted from the fence position in line 94 of the code.
  2. Blade Selection - This may not be necessary for all but I thought it might be useful down the road. Different blades have different kerf widths. If your saw is calibrated for your general ripping blade then obviously the numbers will change when you install a dado blade. The first value of KerfOffsets[] in line 24 should always be 0. That's the blade you will calibrate with. After calibration you'll have to test with any other blades you frequently use to determine what correction factor should be added or subtracted.

I think a zeroing button is useful, but you could drop the blade selection button or reprogram it for something else. Toggling between imperial and metric or decimal inches and fractional are alternate ideas I'll leave up to you.

Step 4: Learning Point - Oversampling on in the Arduino IDE

As stated, I had a goal of 0.001" accuracy. Most Arduinos have a 10 bit analog to digital converter (ADC). Any signal measured is broken into some number of levels. In this case, that number is 2^10 (or 1024). My chosen potentiometer is 750 mm long. Doing the math shows 10 bit resolution only give me 0.732 mm (0.028") increments. That assumes a full 5 volt drop across the potentiometer.

This left two options. Either buy an of the shelf higher bit ADC, or again in the pursuit of learning try oversampling.

After quick googling I found "RCguy" had already performed oversampling and wrote a nice library for performing it. Following his links I found the original ATMEL release detailing it. I believe I've sucessfully followed their documentation and implemented it here and shown in the code above.

While maybe oversimplifying it slightly, I picture it as PWM in reverse. Over time your signal source and circuit noise toggles the reading between two or more levels. Performing a moving average over time allows you to sum all your readings resulting in a much higher effective number of bits.
One caveat, the more bits your want, the more samples (time) needed.

In ATMEL's lingo, I using 16 effective number of bits which I believe should give me 0.011 mm (0.00045").

Step 5: 3D Printing the Guard and Strain Relief.

A commenter on the linpot product page mentioned the pot can burnout if pressure is applied at the very base of the strip. On this note, I thought it was best not to take chances and 3D printed a combination guard and strain relief.

There's absolutely no reason this piece has to be 3D printed. It could be made from a few tiny scraps of wood very easily, perhaps with a band saw or coping saw. But I do like to use my home built printer for small tedious project parts.

Step 6: Calibration

Calibration is fairly straightforward but best accuracy requires a pair of calipers. We need to develop a relationship between the quasi 16 bit over-sampled logic signal and actual real world measurement.

If you copied my code, it should display the 16 bit over-sampled number on the display. Or you could rewrite it to log it to the arduino console.

  1. Use a scrap piece of lumber (I used plywood). Set the fence and cut it near the maximum capacity of your calipers.
  2. With the calipers, measure it at several points and record the average.
  3. Record the 16 bit over-sampled number.
  4. Reset the fence to a smaller (thinner) cut, and repeat 1 through 3 for as many points as you have patience.
  5. Plot the data using excel or another program and fit a linear curve through the points.
  6. The equation of that line is your mathematical relationship between the over-sampled signal the your real-world cut.

In practice, I was pleasantly surprised with just how linear the soft pot is. Just take a look at that R squared value in the plot! My measurements were taken over a span of 6 inches. That's the biggest pair of calipers I had on hand. If you can measure a 12 inch span, your best fit line will be that much more accurate.

Step 7: Upcoming Work

With the breadboard setup and code so far, the project works for it's intended purpose. I'm using it right now making a nursery bookcase for my baby girl on the way. But I plan to transition this project from breadboard to soldered PCB.

I've done the PCB design in KiCAD. This was my first experience with any PCB layout program. I chose KiCAD for it's fully featured capabilities, high number of possible layers, unlimited board layout, and abundance of youtube instructional how-to's. Plus it's free.

I will update in the future.

Arduino All The Things! Contest

Participated in the
Arduino All The Things! Contest