Made another Arduino thing today, this time using a sonar rangefinder and an LED matrix. It doesn’t quite make for clever photography, but I still like it.

The original assignment was to just use a simple set of resistors and LEDs, but I took it a step farther. Thankfully I still didn’t have to bother with computing voltages or resistances, because I believe the two parts I used are rated for 5V.

The first thing I did was set up the rangefinder, for which there is a library that I used. I grabbed the reading from its analog voltage pin. Unfortunately, that didn’t save me from having to filter it. The library I used does some filtering, but it isn’t all that great. So I used this tool to generate one (not that I have any idea how it works or anything).

Next I broke out an LED matrix that I bought but never used. The sensor readings run from right to left on the matrix, like a line graph. I’m actually happy with how it came out; I basically used an array as a ring-buffer so that I didn’t have to shift the data every iteration. It flickers a lot, but I’m not sure there’s much I can do about that since I’m looping once per millisecond.

If you want to see what I did, the Fritzing file is right here. It’s not useful in the slightest, but it’s kinda fun.