Close

Switching to a Pi Pico, piezo sensors, and a Da Vinci hammer

A project log for Exploring the internals of trees with sound

Time-of-flight, tomography and more

After the initial exploration, I found some problems with the setup I used:

I decided to look for something new...and found it, thanks to a Pi Pico that my father had given me as a gift.  I started looking for ways I could do high-resolution timing with it, and came across this thread in the Raspberry Pi forums that had pretty much exactly what I needed: example code that would do microsecond-resolution timing...and in microPython, no less!  I had not done any reading on the capabilities of the Pico, and the state machine blew my mind.  The example code posted by one of the folks in the thread was an excellent introduction to what could be accomplished; after a few hours of reading through the excellent SDK documentation, I thought I could get the timing I needed.

(Side note: the friendliness on display in the Pi forums, at least from what I saw, was amazing.  It stands in unbelievably stark contrast to the unrelenting crankiness in seemingly every post I come across on the Arduino forums -- to the point where I now ignore search engine results that take me there, because the result will usually be unhelpful and depressing.  Well done, Raspberry Pi folk.)

Meanwhile, I switched to using piezo sensors I had ordered from AliExpress:

I wanted to get something that was easy to hook up (love those pre-soldered header pins), and the adjustable threshold meant I could get it to act as a simple vibration detector, rather than measuring the vibration.  One thing I didn't anticipate, though, is that the attachment of the piezo wires to the board is extremely fragile; the wires are quite thin, and are not well-secured to the board.  I quickly broke 3 just by moving them around; a short attempt to resolder one didn't work (operator error, I'm sure).  Fortunately I'd ordered 10, so I added electrical tape to them to give them a bit more structural integrity:

So!  After some futzing around, I had:

With this setup, I started gathering data by knocking on the board and capturing the timing between different sensors as the sound travelled through:

(Side note: BEHOLD MY MIGHTY DIAGRAM.)

I was able to measure the time of flight successfully -- yay! -- but there was still a lot of variation when hammering by hand: for one set of measurements, it was anywhere between 855 and 1095 microseconds to travel 30cm.  That's about a 25-30% difference.  I tried dropping the hammer from the same height, but that really didn't do much.

I decided to assume for the moment that the code was okay, and try to eliminate the variation in the impact.  I did more looking, and came across the Da Vinci hammer.  There were lots of variations, but this video really inspired me:

Why do I say inspired?  Because I'm a sysadmin by trade, and I'm not exaggerating when I say that I find it amazing that people can make matter do what they want.  But this!  It's hot glue and cardboard!  I can do this!  This video is glorious, and I really want to hold on to that sense of revelation.  Here's the one I made:

Contents: some leftover cardboard packaging, a wooden spoon nationalized from the kitchen, a pen and a pencil to use for axes, and a steel rod bent into shape for a handle.  I love it.

The result?  The timing became immensely more consistent: I could get within 20 microseconds easily, and with some practice within 10 microseconds.  There were slight variations in how the hammer/wooden spoon fell, but these were fairly controllable -- even when cranking it by hand.

I showed this to my father-in-law, and we decided to build a better version out of wood and metal:

Behold the Hammer of Science, Mark II:


Since my father-in-law is a) a retired millwright b) with every tool you could want, it looked much better -- and the handle no longer falls off when I crank it.  And the results were just as repeatable as before.

In the next post, I'll take you through how the data looks so far, and what we found when we went crazy with the drill press.

Discussions