a man, a plan, a cake: nirvana

PodBreakout Mini and Teensy

A couple of weeks ago Paul at pjrc.com, the maker of Teensy, kindly sent me one to review. A few days after that Mike at Kineteka sent me a PodBreakout Mini to try. Mike also sent me a PodSocket but I’ve not had a chance to mess with it; could be handy for analyzing auth chip serial shenanigans once my Openbench arrives.

The Teensy and the PodBreakout Mini seem like a match made in much-smaller-iPod-serial-remote-heaven, no? Let’s see…

Teensy 2.0

PodBreakout Mini

The Teensy 2.0 that Paul sent me is based on the ATMEGA32U4. What makes this chip particularly interesting is that it has a real USB interface, rather than just a serial port with an FTDI chip in front of it doing serial-to-USB. That means you can use it to interact with a host computer as if it were a USB keyboard or mouse, for example. Ladyada has a
recent project using this feature of the Teensy. The ATMEGA32U4 also has a regular hardware serial port - that’s going to come in handy in a minute.

The Teensy can be programmed a few different ways. I used the
Teensy Loader which comes in versions for OS X, Windows and Linux; I used the Linux version on my 64-bit Ubuntu 9.10 box and it worked fine, barring some minor device file quirkiness in Arduino Serial mode (which Paul tells me seems to be specific to 9.10).

What’s particularly handy for me is that Paul has done a
lot of work to integrate the Teensy with the Arduino IDE. Following his instructions I added the Teensy board types very easily using the script he provides.You run the Arduino IDE and the Teensy Loader simultaneously; when you verify a sketch the Teensy Loader detects this and magically uploads the sketch to the Teensy for you; that is you don’t need to (and can’t) use the upload button in the Arduino IDE. It’s pretty slick.

Once I had
Blink up and running I set about seeing if my iPodSerial library would work. The usual Arduino Serial object isn’t of type HardwareSerial for the Teensy so I had to tweak the library to take a HardwareSerial object in its constructor rather than defaulting to Serial. Other than that it was fine. Again Paul has good information about the differences. I think I could probably just #ifdef based on the board type so the same version of the library would work for the Teensy or regular Arduino boards. I haven’t done this yet though, so the version on github won’t currently compile for the Teensy without the aforementioned minor tweaking.

I didn’t feel like hooking up a switch so I just tweaked the play/pause example sketch to toggle every few seconds. I tried this and it worked first time! (Well my code didn’t first time, but the electronics all did).

Now by default the Teensy comes configured for 5V, but there are
instructions on how to switch it to 3.3V using an optional 3.3V regulator, which Paul had kindly included with my review Teensy. I followed them without any problems.

WIth the board converted I had to tell the Arduino IDE to clock the Teensy at 8MHz instead of 16MHz (it’s not rated for 16MHz when operating at 3.3V although it may work just fine, depending on what you’re doing with it). This was just a matter of editing the
boards.txt file to cut-and-paste an existing section to make a new variant with the slower clock speed (the build_f_cpu line below):

myteensy2_ser.name=Teensy 2.0 (USB Serial) - 3.3 volts

With the Teensy operating at 3.3V you no longer need a Logic Level Converter between it and the iPod, since both the serial ports are now operating at 3.3V.

This is when I broke out the PodBreakout Mini that Mike had sent me. It doesn’t have all 30 pins but it has what they call the “most commonly used” pins: 1, 3, 4, 5, 6, 8, 13, 12, 21, 23, 25, 27, 30. 12 and 13 are the serial port, so that’s good. I wasn’t sure what to do about GND though — I’d been using pin 11. I checked with Mike and he said they hadn’t observed any differences between the grounds, so I went with pin 1.

Here’s the final setup (click-through to Flickr for eXtreme closeup):

Teensy and PodBreakout Mini

It is a nice compact setup, it only needs three wires (Tx, Rx and GND), it doesn’t need a converter board in the middle, and most importantly it works perfectly!

The PodBreakout Mini’s board fits entirely inside the usual white plastic case (which it comes with), so it ought to be much more robust than the full-size PodBreakout boards I’ve been using up until now, where the wide board is hanging out the back of the connector.

The Teensy seems to be a great value at $18 ($19 if you get the 3.3V regulator to go with it), and the size is nice too. I’m going to start playing around with its USB features when I find some more time.

Thanks again to Paul and Mike for sending me cool things to play with, with no strings attached.

PodBreakout Warning

UPDATE: 4/21/10 Kineteka have now updated their pinout page.

I’ve had email discussions with a few people who’ve been having trouble replicating my work. They all had v1.4 PodBreakout boards, whereas the two I have are v1.2. So I asked Mike at Kineteka if there was a difference and he said there was:

There is a slight difference in the v1.4 due to a manufacturing glitch.
The boards still work the pinout is just flipped.
The pins are odd /even as opposed to even / odd. see below.

Back side of dock connector v1.2
 02 04 06 08 10 12 14 16 18 20 22 24 26 28 30
 01 03 05 07 09 11 13 15 17 19 21 23 25 27 29

Back side of dock connector v1.4
 01 03 05 07 09 11 13 15 17 19 21 23 25 27 29
 02 04 06 08 10 12 14 16 18 20 22 24 26 28 30

So for instance the audio pins 3,4,5,6

PodBreakout Pin         V1.2    V1.4
 Right Line Out         3       4
 Left Line Out          4       3
 Right Line In          5       6
 Left Line In           6       5

We are working on updating the http://www.kineteka.com/PodBreakout-v1.aspx  page to reflect these changes should be up soon.

So if you have a v1.4 board you’ll need to adjust your connections appropriately.

iPod Serial wake up!

In my talk last night I had my easy button rig hooked up to an iPod Photo, rather than the iPod Touch I built it for, and used with in my car for months. A couple of times it stopped working and I didn’t know what had happened.

I did some digging tonight and the iPod Photo will respond to the remote just fine until the iPod goes to sleep — either explicitly via the “Sleep” menu item, or implicitly because it times out after sitting unplaying for a while. After walking it up, it will no longer respond to the remote. Disconnecting and reconnecting the remote doesn’t help; resetting the Arduino doesn’t help either. Resetting the
iPod does cause it to start responding to the remote again — without doing anything at all to the remote or its connection.

As I mentioned, I used this remote for months, but only with an iPod Touch. I don’t have the iPod Touch any more, but I do have an iPhone. I cannot reproduce this behavior on the iPhone. There’s no real equivalent to the older iPod’s sleep, but if I press the button on the top of the iPhone, which shuts off the display and causes the lock screen to appear when the main button is next pressed, the remote continues to work just fine.

So that was with the SimpleRemote_with_Bounce example sketch. I then tried the SimpleRemote_ethernet sketch, since that lets me try other Simple Remote commands interactively. I put the iPod to sleep via its menu and tried sending “play” via my telnet connection to the Arduino running SimpleRemote_ethernet. Again it ignored me, just like it ignored the easy button. I then sent it the Simple Remote “iPod on” command, and voila! It woke right back up and started responding to me again.

So then I modified the SimpleRemote_with_Bounce sketch so it would send “iPod On” just before sending “Play” and it worked! I can no longer reproduce the unresponsiveness after the iPod has gone to sleep.

If you have been using the SimpleRemote or SimpleRemote_with_Bounce example sketches, please consider using the new
SimpleRemote_with_Bounce_and_wake instead (yeah, I have no imagination when it comes to titles, but I wanted to rename it). I’ve deleted SimpleRemote and SimpleRemote_with_Bounce from the library on github to avoid confusion.

If you try this and it works — or doesn’t — for you, please let me know.

iPod Serial Talk

I had the great pleasure of giving a talk about my iPodSerial library at Make:PGH last night. I’ve been a subscriber to Make Magazine since issue one, so this was especially exciting for me. Thanks to those that came out and suffered through my ramblings, to Hack Pittsburgh for hosting, and to the Make:PGH crew for setting it up. I enjoyed listening to Eric Singer’s talk too.

If, for some strange reason, you want a copy of the slides you can grab the PDF version
If, for some even stranger reason, you want a copy of the Keynote file just contact me through the captcha link in the footer.