Rather than a lengthy exploration of a single subject, I'm going to touch on a couple of smaller dishes.
<floobydust>
Working at SparkFun, it's hard to keep up with all of the cool technologies we have in the building. Sometimes interesting and useful things land in my lap when I'm not expecting them, and sometimes they coincide with me having the interest and time to dig deeper.
One of those opportunities found me last October. A friend was building a piece of interactive artwork and he needed need some troubleshooting help. He was going to put a Teensy 3.2 in it to play .wav files, but was having trouble getting the system integrated with a small power amplifier. I asked him to bring it to my office so we could get it working.
I'll admit I never worked much with any of the Teensy boards. I knew they were small, and Arduino compatible. In preparation for our debug session, I perused the schematics and chatted with a couple colleagues about their experiences with the Teensy.
As I gathered background information for troubleshooting, I got a closer look at the Teensy Audio environment -- I was pleasantly surprised by what I found! In a nutshell, it starts with a web-based user interface that is used to lay out audio processing blocks (and the menu of available blocks offers quite a few useful items). The web page exports code you paste into an Arduino sketch, then compile and load it into the Teensy. Paul Stoffregen, the guy behind the Teensy, has put a lot of work into this package, and development is ongoing.
I'm not going to get too deep into the basics of Teensy Audio here. If you want the crash course, you can start with this video.
I spent a fair amount of time through the winter getting familiar with the platform, and started planning how I'd like to build it into some more ambitious projects.
On January 16, Paul quietly announced that he'd added support for two simultaneous Audio Boards, allowing four channels of 16-bit input and output on a single Teensy.
To me this is a really useful feature -- one Teensy can be used where a pair were previously required. Coupled with polyphonic .wav file playback, you can play different files on each output -- or, in my case (I'm building a drum synthesizer), I'll be able to route each voice to its own analog output.
In the original thread, the finer details of getting everything connected and working were left as an exercise for the reader. I've got it working, and I'd like to share the magic recipe.
You'll need the following parts -- a Teensy 3.2, two Audio Adapter boards, and some male and female headers.
To use two Audio Adapters, you'll need to modify the boards to coexist.
First, you'll need to remove the 0.1 uF capacitor on Pin 15. That's ADC input A1 (or digital I/O 15), which will be repurposed as the TXD pin of the second audio channel.
Then, you'll need to select one board to be channels 1 and 2, and the other to be channels 3 and 4. The 3 and 4 board needs some extra cuts and jumps.
The pairs of pads near pins 13 and 22 need to be cut apart. The trace between the center and left pads of the I2C address selector also need to be cut.
Then, new connections need to be wired to those pads.
Last, add the headers. For my stack, I put long pin headers on the bottom of the first Audio Adapter, then ran them through the Teensy and soldered them in place with the Teensy about halfway up the pins. This leaves the pads on the bottom of the Teensy accessible for future expansion. The other Audio Adapter got female headers on top of the board.
When you plug the boards into each other, make sure the orientation is correct -- the headphone connectors face the same way.
To make use of the four inputs and outputs, you'll need to use the corresponding library objects. This four-channel wiring diagram simply passes the inputs to the outputs.
Some details to note:
i2s_quad
objects, each providing four input and output terminals.sgtl5000_1
and sgtl5000_2
.setup()
, by calling sgtl5000_1.setAddress(LOW)
and sgtl5000_2.setAddress(HIGH)
.AudioMemory()
in your setup()
function.Finally, with two Audio Adapters, it's time to test four channel playback.
Those of you who have been in the electrical engineering field for a while might remember when the late Bob Pease wrote a monthly column for Electronic Design magazine. I'm sure I'm not the only person who would grab each new issue, and immediately go hunting for Bob's Pease Porridge column.
Bob was a longtime staff scientist at National Semiconductor. He was an insightful engineer, and also an engaging writer and storyteller. As someone who has to do it regularly, I realize that writing about specialized engineering topics is hard. His columns made dry engineering concepts approachable, while sometimes diverging into subjects as varied as high-altitude hiking and defensive driving.
To commemorate the fifth anniversary of his passing, Electronic Design have released a new eBook with some of Bob's articles. If you're interested in analog subjects, downloading Focus On: Bob Pease on Analog, Vol I. is worth the free registration.
Since that's Volume I, I'm assuming there are more volumes in the works. In the meantime, there are many other articles in the Pease Porridge archive.
</floobydust>