Shop Stereo 2.0

24 Apr

Can you really count yourself among the mighty if you have not built something up around a Raspberry Pi?

At work I’ve been asked to do something that really requires a hacker, rather than an engineer.  I don’t really like to think of myself as a hacker, but I suppose I’m a dab hand.  I suppose that got my juices flowing or something, because I felt like I just had to have me on of those Raspberry Pi things, but only if I could make a proper use of it.  Anything less than that seems like posing.

The music in my shop comes from a laptop running Pandora pumped through a kit-build amplifier.  I definitely think no woodshop is complete without a SketchUp-capable laptop, but there are problems:  My kids go running off with the laptop sometimes.  The laptop gets in the way, and all the dangling wires for the music and power are a big hassle…

What if I got a Raspberry Pi to be a Pandora player?  That’d be cool, but it doesn’t require any GPIO…  But what if it could detect the ambient noise in the shop and adjust accordingly?  Yeah, now there’s something…

Maybe this’ll do it:


It’s pretty simple, really.  Well…  no.  I suppose not.

Okay, so it took a while to get to that hairball.  It works.  Not real well, but it works.  Let me take you through the adventure of how it got to this point…

We need some tools – software

My Dad’s not a TV repairman, but I minored in Computer Engineering in college, so I had a few things lying around, and I can watch some Youtube.  That’s when I found out about LTSpice.  What an amazing thing that is – if I’d’a had this in my Embedded Systems lab I would’a burned up way fewer IC’s, I’m pretty sure.  One thing, though, the tutorials on the LTSpice site itself are flat out incomprehensible.

The guy you want to watch is Afrotechmods, not only for LTSpice, but for basic analog circuits in general.

So off I went to Vetco (more on this in upcoming episodes) and got an LM324 OpAmp and set to work creating this circuit:


This should work, right?

We need some tools – a scope

Nope.  I just couldn’t get it to work with any of the crappy old headset microphones I dragged out.  None seemed to work at all, even when I yelled at the mic.

There’s these things called Oscilloscopes; I’ve never used one but they sure seem like the thing to have for a time like this, and there’s some at work I can use.

So one evening I went into the lab and I fussed, and I fiddled, and I got some help fussing and fiddling from a more experienced hand, but no dice.  It sure seemed like my two microphones were dead.  But that seemed unlikely.

Then I found this craigslist posting for an oscilloscope for cheap.  The seller makes no claims to whether it works or not beyond the fact that when he flips it on things light up and there’s a satisfying whirring sound.   That’s the limit of his expertise.  I felt that the force was strong with this craigslist post, and I just bought the thing.


It was manufactured before I was born, but indeed the force was strong; it does work.  The microphones, both of them, don’t seem to work.  I can tell that, because I found something that does work.  More on that later.

I looked around for a little while for a manual for this thing, had no luck at all.  My neighbor came by and said he knew a guy who knew a guy…  What he knew was the Boat Anchor Manual Archive.  I got me a manual!  Thanks Keith!  Now if I can just use it to get those angry looking orange “Uncal” lights to turn off.

A Proper Enclosure

Then the ripples in the force were amplified by my wife, who declared that another piece of 1960’s high technology just had to be removed from the kitchen so that she could install something in its place to pile crap into.


I admit I didn’t understand it at first.  No, I thought this was just another random chore in the way of true enlightenment.  Fortunately, patching drywall is a meditative process, so I was able to understand the true nature of it all.

I could repurpose this 1968 Internet of Things, highest of techno-bling for your house to be the case for the pi…  And the knobs and dials.  Surely they could be made to work.

For more bonus material, take a look around back:


That’s a speaker…  Or a Microphone, depending on your point of view.  When I wired that speaker up to my oscilloscope, sure enough, I got waveforms at ~20mv.  Got my amplifier together and made that into waveforms around a volt, and a little more tinkering to get a boolean +3v/0v signal into the Raspberry Pi.

Basically, all it is is this:  sound hits the speaker, pressure moves the paper back and forth, that moves the magnet in the back of the speaker against a coil of wire.  The moving magnet induces a current in the speaker coil, which I detect with a voltage comparitor circuit (as above) and that feeds into a GPIO pin on the PI.  All I needed to do was use a potentiometer in series with a large resistor to create a comparison voltage down in the millivolts.  The potentiometers (the blue wheelie thingies in my picture), allow me to fine tune the trigger voltage, so that I find just the volume that will trigger when a noise source is on (e.g. my filter), and not when it’s off.

What’s Done?  What’s Next?

So with that speaker wired up like that, if I sample the pin at ~100 times per second, when there’s stuff making noise in the shop, I get 20-40 positive signals.  When nothing is running and things are quiet, I get none.

I’ve also got the Pi’s audio out going to my amplifier and that’s actually split so that the audio output also goes into another comparitor so I can tell if the music might be responsible for the signals on the microphone.

I’m a little bit mystified by my result there – although there’s a good correlation between lots of ones on the signal being sent to the speakers and lots of ones coming in from the Microphone, they don’t happen at exactly the same time…  I can think up a handful of reasons why that might be so, so I’ve got some work to do there.  I don’t know that it necessarily matters – I think I can get a pretty good prediction of whether there’s noise or not over 10 second intervals.

The bigger problem is that the sound quality from the Pi is just terrible.  Or perhaps it’s just weak – the voltage levels coming out of it are about a tenth the strength of map laptop’s.

I used my mad analog circuit skills to create a pre-amplifier, but the sound quality isn’t what you could hope for.  There’s lots of possible reasons for that – certainly with wires roping around a breadboard, there’s RF a-go-go, weak connections, and all manner of electrical mayhem.

My man at Afrotechmods has a couple of amplifier circuits to try, and maybe I’ll go to Fry’s and pick up one of their audio amp kits.

I also want to wire up some of the switches and such from the old house intercom.  I’m particularly interested in seeing if I can make the AM/FM knobs work to switch Pandora stations.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: