I recently bought a
Sonic Impact T-amp audio amplifier, which has been turning a lot of
heads recently.
The photo shows my big, ugly homebrew amp on the left, the tiny Sonic Impact on the right, and the speaker wires heading off the bottom of the photo. The only thing I had to prepare for this application were 8 wires to connect the amps to the board; no soldering needed.
Of course, I had to do a comparative study between the two amps. In the past that required lots of switching speaker wires around, but I realized that the gadgetboard could alleviate this hassle and offer much faster switching, giving the listeners more opportunities to listen for differences.
All we really need is a 4-pole double throw switch. Double throw just means that when the switch is "off", it actually connects to a separate wire. 4-pole means that although the switch has a single handle, inside it's wired to 4 separate switches. We could buy one for about $15 at digikey ( photo), but we'd still have to solder up all the pins.
Instead, we'll use all four of the Gadgetboard's double throw relays together, one for each of the speakers' + and - wires. Actually, we could probably get away with wiring all the minus wires together and just use 2 relays to switch the + wires, but it's always sketchy to wire multiple amplifiers together, so we'll play it safe. The speaker wires go to the center, "common" terminal for each relay. That terminal will connect to the "normally open" terminal when the relay is switched on, and the "normally closed" terminal when it's off. We want the old amp to be selected when the relays are off, so the Left +/- and Right +/- wires simply go to the "normally closed" terminals for each relay corresponding to the L/R +/- speaker wires. The new amp goes to the "normally open" side. Click on the photo for the enlarged version, in which you should be able to see each of the connections.
We can switch all 4 relays with a single command; in the terminal program, just type "s 11111111" at the ">" prompt to switch on all 4 relays, selecting the new amplifier. "s 00000000" turns all the outputs off, selecting the old one. Just for fun, I added a small light bulb to one of the output channels to indicate when the relays are on.
One of the great things about relays is that they allow us to switch signals with no electrical connection to the rest of the circuit; all the gadgetboard signals are completely separate from the signals coming from the amplifers.
Migrating to the onboard controller
It took only a few minutes longer to make the prototype into a
standalone system, controlling the relays from the board itself. So I opened
up gadgetboard.c (the source file for the built-in command line interface),
found the main() function, and replaced the call to mainloop() (responsible
for the serial command line interface) with this little snippet:
while(1) {
if(reada2d_(1) > 128) {
setall_("11111111");
} else {
setall_("00000000");
}
}
I called my modified program "4poleswitch.c", copied it to another
directory along with "global.h", "Makefile" and "cmdlineconf.h", changed
the "TRG" line to "4poleswitch", and did a "make", then "make load". Voila!
My board now switches the relays on when input 1 gets a voltage above
about 2.5v. Conveniently, the terminal right next to input 1 has 5v,
so I wired two halves of a clip lead to the two terminals to make a simple
switch. Clip the ends together, and the relays turn on. Simple as can
be. (Of course, I'll have to "make load" the original gadgetboard code
before the command line interface will work again.)
The image on the right shows the completed project.