As a part time woodworker (and not a very accomplished one at that) I'm always looking for ways to improve my accuracy and precision. Along those lines I have added an Incra TS III Fence to my Jet 10" contractors saw, a Wixie Digital Readout for blade angles, and numerous home made jigs and fixtures all in my quest for more accuracy. The Incra fence has been a great addition due to its excellent accuracy and repeatability. What I was missing was an accurate way to measure and set the height of a saw blade above the table. Like most table saws the blade height is set with a hand crank that controls a worm gear/spur gear segment arrangement that raises the blade by pivoting the arbor arm. While the system works, there tends to be backlash in the gears that makes it difficult to set the height accurately and it's easy to overshoot. Then you have to come down below the desired setting and raise the blade back up again. Although you can measure the height with a ruler or height gauge, you still need to make a trial cut and then measure the cut to check for accuracy. You can adjust out some of the gear backlash but, if you get the gears too tight, they will bind up. I could not find a commercial unit to accomplish this task so I set out to design my own.
I tried various sensor approaches including linear pots, rotary pots, even an LVDT. I also looked at cheap digital calipers and some of the sites for hacking them to read the values with a microcontroller. One of the problems is that the saw blade arbor pivots on an axis, most of these sensors read a linear distance, and the height change is not linear with the rotary movement of the arbor. I considered an encoder attached to the pivot point but that became a complicated mounting problem. I finally settled on using an accelerometer attached directly to the arbor arm. Besides measuring acceleration as the name implies, an accelerometer is also a very good device for measuring tilt.
After some research, I chose an Analog Devices ADXL202e. The guts of this accelerometer consists of a mass suspended by polysilicon springs that deflects when the chip is subjected to a positive or negative acceleration. The deflection of the mass moves a central plate between two fixed plates and changes the capacitance of these plates. The electronics of the chip ultimately produce a duty cycle modulated wave, the frequency of which changes with acceleration. The signal looks like this:

where T2 represents the frequency of the signal and T1 represents the amount of acceleration or deceleration or, in our case, tilt angle. When the chip is level, the duty cycle is approximately 50% and then increase or decreases as the chip is tilted. By changing a single resistor, you can change the complete cycle frequency of the output from 0.5 ms to 10 ms. I chose to use the longest frequency since speed was not critical and I wanted to get the most resolution that I could. So, in the figure above, T2 would be 10 ms and T1 would be proportional to the tilt angle.
Now that I had a sensor, I had to have a way to read it and display the results. I have been playing around with Atmel AVR processors for a while now and so I decided to use an Atmel ATMEGA8 microcontroller. The plan is to start the internal counter in the processor and then count the number of counts for the T1 part of the cycle as well as the entire T2 cycle. Then dividing the T2 counts by the T1 counts gives us the duty cycle of the output. This should be proportional to the saw blade height. I decided to use a simply 2 line by 16 character LCD display since they are inexpensive, readily available, and easy to interface. I also planned to use Bascom for the programming. Bascom is a very full featured Basic compiler for the entire AVR line of controllers.
I used an 8.000 mhz crystal on the processor and a prescale of 8 on the counter. With that combination, I should get one count every microsecond and 10,000 counts during the 10 millisecond period. In the real world I consistently read about 8350 counts. I'm not sure what the discrepancy was - it may be processor the crystal, the accelerometer itself, the resistor used to select the period, or the fact that I was using basic instead of assembly language. The important part is that the count was very repeatable which is what was important to me. I did find that the output of the accelerometer tended to vary with ambient temperature so I added temperature compensation to improve the accuracy of the reading.
Once I attached the accelerometer to the saw arbor and began to take readings, I found that the saw height was in fact linearly proportional to the blade height. This worked out great and made it very easy to calibrate the output.




