×

We are actively looking into website issues. You may encounter degraded performance on the site as we perform maintenance. Thank you for your continued patience!

Enginursday Tapas

Rather than a lengthy exploration of a single subject, I'm going to touch on a couple of smaller dishes.

Favorited Favorite 2

<floobydust>

The Teensy Plate

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.

Stealth Feature

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.

Parts

You’ll need the following parts – a Teensy 3.2, two Audio Adapter boards, and some male and female headers.

Teensy 3.2

DEV-13736
19.95
45
Female Headers

PRT-00115
1.5
7
Teensy Audio Board

DEV-12767
14.95
2
Break Away Headers - Long

PRT-10158
2.95
2

PCB rework

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.

alt text

Remove this cap from both boards.

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.

alt text

Cuts for channels 3 and 4.

Then, new connections need to be wired to those pads.

  • The first two jumpers configure to codec to read and write alternate channels on the I2S peripheral.
    • From the inner pad near pin 22, run a wire to pin 15.
    • From the inner pad near pin 13, run a wire to pad 30 on the bottom of the Teensy.
  • Use a solder blob to connect the center and left pads of the three-way jumper. This assigns the board to its secondary I2C address.

alt text

Connecting the channel 3 and 4 data lines.

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.

alt text

When you plug the boards into each other, make sure the orientation is correct – the headphone connectors face the same way.

alt text

Software

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.

alt text

A simple four-channel patch.

Some details to note:

  • The inputs and outputs are represented with i2s_quad objects, each providing four input and output terminals.
  • The two codecs are represented with individual control blocks, sgtl5000_1 and sgtl5000_2.
  • The codec objects need to have their I2C address assigned in setup(), by calling sgtl5000_1.setAddress(LOW) and sgtl5000_2.setAddress(HIGH).
  • The quad-input object requires at least eight buffers. You might need to add a few extra when calling AudioMemory() in your setup() function.
  • The potentiometers on the Audio Adapters no longer work, as pin A1 has been repurposed as a digital audio data pin for the second codec.

Finally, with two Audio Adapters, it’s time to test four channel playback.

alt text

Four-channel audio test apparatus.


The Porridge Plate

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>


Comments 4 comments

  • “Floobydust” is my new favorite word.

  • Thanks for the “Heads Up” on Bob Pease! I really liked his articles and I grabbed the E-Book.

  • I know this is an older post, but hopefully someone sees my comment. I’m rather new at all this, so I need some assistance. The directions say to cut the trace between the left and center I2C pads, but the picture is pointing to the space between the right and center. Could someone please clarify that for me? Do I cut the left one, then basically reconnect the two pads with the solder blob? If so, why not just leave the trace connected to begin with?

    Also, what’s the best way to remove the capacitor in the first step? And do I remove it on both boards?

    Thanks!

  • A better way to stack the Teensy audio boards might be to make use of those long pin Arduion stackable connectors on the top board so you can just stack the two of them together, and then put the Teensy on top. In fact, that’s how it’s done on the Teensy web site.

Related Posts

Recent Posts

Tags


All Tags