Matthew C Good : Musician, Software Engineer, Hobbyist.

Posts Tagged DIY

“The Scream” Update

“The Scream” is starting to look finished, but it has two more steps to go. Chase’s “Good Vibrations” tremolo pedal is starting to look like a Jamaican flag. Oops. I think it will still be cool. It needs text, and then it will be done.

DIY Sous Vide

Thanks to Jeff Potter of Cooking For Geeks, I’m building my own DIY Sous Vide rig with a thermostatic controller and an off the shelf cheap slow cooker.

Mains wiring is scary as heck though.

Work in progress.  I have to get a couple more parts to make sure it’s safe before I’ll plug it in, but most of the guts are there.  Needless to say I’ll be doing a lot of voltage checking before I touch this thing.

I think first up will be some sous vide salmon, then hit it hot and fast in a cast iron skillet for color and Maillard reactions on the outside.  Should be one heck of a good time.  More to come.

PWM Pedal

I was scrounging around yesterday, looking for something I could build/make…  When I realized that with but one quick trip to Radio Shack, I could be the neato PWM guitar effect pedal that Collin Cunningham video demo’d for Make Magazine.  So I did:

PWM pedal (foreground) with a few homebuilt friends

PWM pedal (foreground) with a few homebuilt friends

Here’s the guts:

PWM Guts

PWM Guts

It’s a really cool pedal.  Way different animal than other guitar effects.  It makes sounds that most closely resemble a synthesizer.  Hope to use it for some fake-synth parts on some of my tunes in the future.  It’s kinda “glitchy” though, which I think is by design.  But every now and then the pedal does something weird, and I can’t tell if there’s something wrong with the it, or if that’s just the way the weird pedal sounds.  For instance, it doesn’t always pick up every note, and I don’t know if that’s just how it works (it *is* glitchy) or if I’ve got something loose in there.  I’ve also got some rhythmic clicking going on when the pedal is engaged but I’m not playing.  I don’t think this is umm… desired behavior, but I checked my wiring and I think it looks good.  It’s not awful, and since I mostly do recording, I can edit it out fairly easily, but it would be much more nice if it just didn’t happen in the first place.  If I figure it out, I’ll update the post.

Good Vibrations

My tremolo pedal is done.  This is my version of the Baja Trembulator, which i have christened “Good Vibrations.”  A little overspray on the text stencil, but that’s okay.  I’m not very good at this kind of thing, so I’ll take what I can get.

It. Sounds. Awesome.

Homemade “Vactrol” using a red led and a photoresistor in some heat-shrink tubing.  Very fun.  Have to build one of these for Chase now.

Trotsky -> Shostakovich

My "Shostakovich Overdrive" pedal, built into an electrical junction box.

My newest completed pedal, based on Beavis Audio Research’s Trotsky Drive.  Real simple circuit.  I didn’t even have the special Russian transistor Beavis used, but it still sounds cool.  But I kept with the Soviet theme, and named it after one of my favorite composers, Dmitri Shostakovich.  Though, if good ol’ Shosty were really distilled into pedal form, it would scream one or two whole hecks of a lot more than this one does.

Oh yeah, you’re not seeing things.  That is an electrical junction box you see there.

Trotsky Drive Breadboard

After finally having some success with my “Mastodon Dave” guitar distortion pedal, I’ve been wanting to make a few more.  I’m continually amazed, however, at how many different electronics parts there are out there…  I’ve got coffee tins full, rubbermaid organizers full, and I STILL hardly ever have the parts on hand I need to make one of practically anything.  So I was looking around for a pedal circuit I could build without waiting around for parts to show up, and I found the Trotsky Drive.  After digging around to see what diodes I had, BINGO!  So tonight I threw it all together on the breadboard.

It sounds pretty good too, but it’s a little hummy – which I think is probably the breadboard.  A very simple circuit, but has a couple options for modding.  There’s a low-pass switch you can throw, and you can swap out the capacitor for different amounts of low-pass.  And you can mess with the kinds of diodes you use, and whatnot.  Fun project, with a Russian name, so I’m going to have fun painting this one.

Most of the trouble with this project was hacking through the various electronics components grab bags I bought to find the right parts.  The numbering schemes on the caps in particular are tricky.  I got a few that I think are caps, but I’m still not sure.  And how do I tell what kind a random diode is?  If I ever find out, I’ll let you know.

FishApp – Water Change Detection

The other day, I went to the mall with Kristin.  I usually finish up quicker than her, and this time being in possession of a shiny tiny netbook, I was able to code and tweak the water change detection algorithm for the FishApp while sitting on a bench outside of Macy’s.  I had a couple rather confused onlookers.  I may or may not be on a “do-not-fly” list now.

To refresh your memory, the FishApp keeps track of water changes, and gives you a graph showing weighted-age values for the water in your fish tank.  This requires you to pay attention while you’re doing the water change, and to log in to the website and report how much water you changed when.  Well, I want to have the FishApp sense, measure, and publish water changes for me.  To those ends, I designed a system that can measure the water level in the tank over time, report it to a computer, figure out when and how much water was changed, and report that back to the main fishapp web application.  The measurement is done using a Ping))) ultrasonic rangefinder, and data from that (and other sensors) is fed into a computer.

But just how is the computer supposed to figure out when a water change happened?  It’s input is just a string of numbers, and it’s gotta be smart enough to filter out random noise from tank cleanings, frisky fish, the water filter starting and stopping for one reason or another, or any of a hundred other situations.  What to do?

If you’ve read the last post about the FishApp, you know where to start – smooth out the data.  To recap, I have the sensor set to read the water level every half-second, and report it to the computer.  The raw data is pretty noisy:

but if we make new data points from the median of  every 20 samples, things smooth out pretty quickly:

The system should be able to handle this muuuch easier.

The algorithm works by keeping a queue of recent (smoothed) samples.  By comparing the oldest sample with the newest sample, you can get a “slope” value.   On the graph above, for example, it doesn’t take very many samples until the oldest will be just over 600 but the most recent will be around 800 or so, and you’ll have a large positive slope.  Once the algorithm sees this large positive slope (above a certain trigger value), it knows that a water change is beginning, and notes the water level beforehand.  At some point in the process of a water change, I start filing the tank up again, and we see a large negative slope (around 55-60 on the graph above).  The algorithm notes the capitulation and the minimum water level.  If the absolute value of the slope stays low enough for long enough, the algorithm detects a steady state, and calls it the end of the water change.  The “steps” you see on the graph are because I do my water changes bucket-by-bucket, but because the algorithm is using a slope from a queue maybe 10 samples long, it already does a pretty good job of smoothing these steps out, and not getting too confused.

After running the algorithm against the data above, it worked flawlessly.  Take a look at this graph:

The gray lines are where the important steps in the process were detected.  For example, the first gray line @ x=10 is where the algorithm first noticed we were emptying water out of the tank.  It looks late – and it is, but that’s merely a consequence of using a queue of 10 samples to generate the slope.  The actual “before” water level value it uses is not the one at the gray line, but the minimum one in the queue – which is correct (enough for rock and roll).  Then, at x=54, the algorithm detected a large negative slope and decided that we were filling the tank up again.  It started looking for the start of a steady state, which it found at x=121, and it stayed steady long enough that at x=150, the algorithm wrapped up and decided that we’ve done a water change.  NIFTY!

If you think about what is going on here, it’s really calculus, under the covers.  The slope value is the derivative of the function, and we look for the points that derivative changes sign.  But the function we’re using isn’t perfect, and isn’t continuous, and so we’ve got to build in a little extra wonkitude-resistance.  The algorithm has inputs for the size of the queue, the trigger value for large positive/negative slopes, a tolerance value to ignore noise during steady states, and the number of samples to go during a steady state before deciding we’re really done with the water change – so in theory, this algorithm could be adapted and tuned for a wide range of input sources with little-to-no modification.

Right now, the algorithm is coded in python, but I think it might even be possible to do the crunching on the Arduino.  If I did that and wired the Arduino up to an ethernet shield, I could ALMOST eliminate the computer altogether.  I still need the computer to run the webcam, however, so there’s no point in trying to run this code on the chip or anything like that.  But I think it would be possible in theory, if you don’t want the cam server running.

What A Water Change Looks Like to the FishApp

One of the goals of the FishApp is to have automatic water change detection available in phase 1. In order to do this, I have a Ping))) ultrasonic distance sensor pointed down at my fishtank. This little guy works by producing a sound above human hearing range, and listening for it to bounce back. If you know the speed of sound, you can calculate how far away the object was that caused the reflection. The sensor I am using is mounted above the tank in a piece of 1/4 inch wood to help shield it from the moisture, and samples the water level at predetermined intervals, sending its data over a serial connection to a host computer via an Arduino controller.

The host computer gets this stream of numbers, and has to have some way of determining when I’ve done a water change, and how much water I’ve changed. I got the feeling that random variation (noise) in the data from the sensor could throw off whatever method I use to compute all of this, so I needed to figure out exactly what the data looks like coming in to the computer, preferably saving it so I can test my algorithms against it without having to do a water change after each revision – that would be a heck of a lot worse than just waiting for the code to recompile.

So I fired up Arduino and Python did a water change, saving the raw data from the Ping))) sensor to a file. Without further ado, this is what a water change looks like to a computer:

Pretty cool, huh?  When I do a water change, I siphon water out of the tank into a 3 gallon bucket, and empty it a bucket at a time, until I’ve taken out as much as I like, and then I re-fill the think 3 gallons at a time.  You end up with the very visible “steps” on the graph.  While the data looks mostly consistent, you can see some wonkiness in some of the steps – which almost looks like thick lines.  The sensor isn’t quite reading the distance regularly in this case.  This looks to me like the kind of data which could really throw of my detection algorithm.  So I had the bright idea of taking a median of 5 samples for each data point and using that series for detection.  Here’s what a median-of-five graph looks like:

Median of Five Graph

Median of Five Graph

You should notice two things: 1) there are fewer datapoints by an order of five, because of the median, and 2) the curve is smoother.  I could prove this by computing the standard deviation on some of those trouble spots from above, but I don’t think it’s necessary: it’s plain to see when graphed.  The data could still be better though – look at the jaggies around 100.  We’ve got plenty of data, so we should be able to create a very smooth line and still have enough resolution to see each step, etc.

I’ll spare you all the gory details, but suffice it to say that the larger the median used, the better.  A median of 10 was better, but still not good.  A median of 15 was nearly perfect, but there was still just a little weirdness.  A median of 20 was perfect:

Median of 20 graph

Median of 20 graph

That’s more like it.  We’ve still got enough data there to see the water change in detail, but smoothed out all the ugliness that could throw off the computer.  Cool stuff.

More details on the detection algorithm’s implementation to follow.  Charts generated with my new favorite tool, Python.

Make-ing Things

I’ve been busily  making stuff.  Here’s what’s been keeping me busy:

This is my version of a Woolly Mammoth guitar pedal I’m going to call “Mastodon Dave.” This is the test wiring.  Yet to be done is to get Kristin to paint the case, and then I’ll do the final wiring.

I’m working on a balsa glider with plans I got from (the incomparable) Make Magazine.  Here I am working on the critical step of joining the two sides of the fuselage together.

You can see that the two sides are more or less straight.  After doing some more finicky work, sanding, gluing, tweaking, and fussing, it looks even a little better now.  In the background of the above photo, you can see my new telescope – the latest accoutrement for my long series of intellectual obsessions.

The fuselage nearing completion.  Shaping the nose cone was a little hard.

Here’s a little trick I picked up from this guy’s photoset – bevel the edges of the equipment bay hatch so it will slide in and out rather than tack-gluing it or using tabs like the plans said.  I am really happy with the job I did on it, too, and when it is closed, you can barely tell there are two seams there.

I’m also working on the physical hardware for the sensors for my Fishapp. It’s coming along well, but slowly, as the mounting and hardware is the hardest thing about those kinds of projects for me.

Happy Making!

Building the A12 Microphone Preamp

Lately I’ve really been in the mood to build things. So I was very happy when I finally got some cash lined up and plunked down for the really nice-looking Seventh Circle Audio A12 preamp kit. My audio/recording friends will know why this is such a big deal, but for the others, it’s a thingy that makes mics sound better. And its way cheaper than many of the alternatives. But the real beauty of this particular kit is that you can mix and match eight different channels of several different “sounds” in one box. So it’s got lots of room to grow. Check out their full line of preamps at seventhcircleaudio.com.
Here’s a basic walkthrough of what I did to get my preamp running.
When you get the kit and break through the really great job they did packing the thing, you find yourself with a chassis & power supply prebuilt, and then a circuit board, some bags of parts, and a schematic.

So you have this blank circuit board in front of you and it’s a little daunting. There are a lot of holes and many of them are tiny and close together. Luckily, you have just bought a nice soldering iron and some helping hands, so you shouldn’t worry too much. Download the assembly instructions pdf and get going.

Be sure your work area is well-let, and start stuffing the components. Follow all directions carefully, look up what you don’t fully understand, and double-check each resistor with a DMM. I just have a cheapy $10 DMM i got at Sears, but it was enough to complete the project with relative ease.

Remember to trim the leads on the back a little. It will make working with the board easier. I used a nail clippers to do this, I’m not sure what you’re supposed to use…

Before long, it will start looking like something:


The kit uses high-quality Cinemag transformers, which should make EVERYONE happy. Audio guys sometimes underestimate the amount of coloration that comes from big iron transformers, and just call everything that’s colored “tube.”

Before long, the board is fully-populated.

Before you go plugging anything in, be sure to follow the instructions carefully and test as much as you can. I did fully re-check all the resistor color codes and cap values, as it said. It took a while, but you can smoke components if something is wrong. And that’s a hassle, I’d imagine.
At about this time you realize that there’s a few things you need to do with the power supply too, like attaching the ground wire (VERY IMPORTANT), and soldering up the lamp and power switch. My only gripe out of the whole project came here, because the PDF of instructions for the power supply appears to be for a previous revision where you had to do more of the wiring yourself. Now, they ship with a wiring harness. This normally would make your life a lot easier (and probably still does), but the instructions are vague on what you need to do and what you can skip. Also, the freakin’ little metal things you crimp on the wires to get into the white connectors are REALLY hard to get on solid. I suggest soldering them all after you crimp them, to be safe.
Now all that’s left to do is power up, do more testing with your DMM, and then calibrate the voltages with your DMM. Note that at no point should the bottom of the board or any of its electrical contacts touch the case or anything. This could create a short and I think bad things would happen. Note the bubble wrap:

You’re supposed to connect the leads to the op amp at one point here, and it is a little tricky. Some notes: You NEED both alligator clips and probes for your DMM. Mine just had probes, so I bought a cheap bag of alligator clip jumpers to attach, and that worked fine. It just looked funny. Also, you might wonder how you’re supposed to get the clips on the op amp leads while the op amp is still in the socket – well, the simple answer (for me) was to clip them on to the back of the board, attaching them to the big metal post things the op amp pins go into. Hope that makes sense. You’ll figure it out either way, I’m sure.
Wahoo! Stick it in its case, plug a mic, power it up, and YOU’VE GOT YOURSELF AN AWESOME PREAMP!

Hope that’s been enlightening. I hope to do more of these photoblog type things for more projects in the near future.