Piezoelectric Surface Roughness Meter

My goal was to build a profilometer/surface roughness meter based on a piezo electric speaker/buzzer used a displacement sensor. This was inspired by an experiment I developed for a physics class that uses a similar piezoelectric device as a nanometer-resolution actuator.

First, I used an oscilloscope to examine what kind of signal I can get out of some piezoelectric devices.

Image of an oscilloscope directly connected to piezoelectric sensor showing nice large signal. Note that though a piezoelectric sensor cannot be used for DC measurements, it appears to be good down to a few hertz.

I tried using an ultrasonic sensor and giving it a stylus point with a bit of razor blade. It turned out the ultrasonic sensor was too stiff to be reasonable to use by hand; it would pick up too much signal just from varying the force that you dragged it across the table with.

Next, I built and programmed Neil's standard hello.mic.44 board. I had to invert the bits in its assembly code to get it to talk successfully through my USB-TTL cable.

To use the board with the piezoelectric sensor, I had to modify the board and code for the signal that the piezo gives out. I centered the input around 2.5V and changed the ADC settings to measure a 0-5V range.