Add a dashboard jack for your car stereo’s rear aux input

When I bought my car, one of the first things I did was buy a fancy new Alpine head unit to replace the factory stereo. This gave me the ability to add an XM tuner and an iPod adapter. I ran the iPod cable into the glove compartment, so I could just connect the iPod in there and close the glove box when I hopped in the car.

This was pretty sweet. Between XM (BPM and The System mostly, since you asked) and my iPod, I never had to suffer through a commercial in the car again.

Then I, upon receiving instructions from Steve, went out and bought an iPhone.

That's now the iPod that I use most of the time. Strictly speaking, though, the glove compartment isn't the most useful place for one's phone (though it could be in the top 10). And, to boot, when I attached the iPod cable from the stereo to the iPhone, the screen cleared and just said “accessory attached”. Not terribly useful.

So, I decided I'd add an aux input to the radio, and hook it up to the iPhone's headphone jack. That part was easy; since I had an Alpine head unit, all I had to do was buy a $20 cable and attach it to the existing “AI-Net” bus. This gave me a pair of RCA-style connectors behind my radio.

Well, that project was far too straightforward and had little to no chance of inflicting significant damage rendering my vehicle undriveable, grotesque, or en fuego. I decided what I really needed was a jack on my dashboard so I could plug the iPhone in there, and wouldn't have an ugly cable crawling out from some dusty crevice in my dash. That would give the project the professional look that I want deserve pine for.

Materials

If you want to follow along, here is the stuff you'll need:

  1. A soldering iron (with solder, nimrod)
  2. A headphone extension cable (or any other stereo audio cable with a 1/8″ plug and a female connector on one end) such as this one
  3. A 1/8″ 3-conductor (stereo) jack, such as Radio Shack part 274-249
  4. A 1/8″ 3-conductor (stereo) to dual RCA cable, such as this one

The Plan

So, here's what we'll do:

  • Mount the jack in a convenient location in the dash area of the car.
  • Cut the extension cable and solder the female end to the connectors on the back of the jack.
  • Use the 1/8″ to dual RCA cable as-is, connected to the RCA female inputs on the head unit.
  • Then, connect the male 1/8″ plug from that cable to the female 1/8″ connector attached to the jack, and we'll be done!

When we're all finished, we'll be able to pump our awesome tunes through our car stereo, and look like smooth and sophisticated as we do it. 'Cause that's just the way we roll.

Note: I'll show you pictures of how things looked around my radio, but you'll be on your own to find a good, convenient spot to mount the jack. I highly recommend using a Crutchfield Mastersheet for your vehicle if you're not familiar with accessing the area behind your radio. I don't know that you can buy the Mastersheet by itself, so you might have to buy something else to get it. It won't be hard to find something you want.

Another note: Be careful. There are wires behind your dash, and some of them carry scary, impish little beasties called electrons that would love nothing better than to zap you and ruin your day. Don't give them the satisfaction.

Step 1: Rip stuff apart

First, I opened the dash according to the Mastersheet instructions to expose the aux input jack that I had attached to my head unit.

Aux input jacks; do not taunt

Step 2: Burn yourself with the soldering iron

Next, I went to my workbench to build the jack that I would install later.
Out of the box, the jack has three connections on the back–one each for left, right, and ground. On the back of the box, there's a helpful diagram that shows how the connections match up to the conductors on the inside. This diagram is not terribly helpful. Based on that diagram and some independent research, I've labeled the jack a little more clearly so you can see the purpose of each of the conductors in our project.

Connection diagram for the audio jack

Take your extension cable, and cut it a few inches behind the female connector. Inside it, there should be three wires, which will eventually match up with the three solder points on the jack. Usually there will be a red wire for the right audio channel, a black wire for the left audio channel, and a bare wire for the ground. You'll need to strip the outer covering of the wire for some length (maybe about an inch and a half) to expose the inner wires, then strip off about a half-inch from the shielding on the inner wires.

The end of the split cable

So, ok, it's time to solder. This involves a power tool, so you should feel good about yourself as you do it.

If you need an intro to soldering, you can find those on the web pretty easily. The only thing I'll say about the topic is that, if you need to buy a soldering iron, you should get one that uses butane fuel, like this one:

Butane soldering iron; totally 1337

In my opinion, these are better because you're not tethered to an electrical outlet, and they heat up faster than the cheap electrical soldering irons that I've used before. You can buy the butane fuel in the tools area of a hardware store for a few bucks. Plus, it's powered by FIRE! And fire is cool.

Anyhoo, attach the wires to the appropriate conductors and apply the solder. Once you're done, you should have something that looks like this, but maybe a little better since I just kinda learned how to solder on my own:

Wires soldered to conductors on the jack

After the solder cools, you should wrap a bit of electrical tape around the left and right conductors to make sure you don't get a short. If you had more foresight than me, or if you're reading this before actually doing it (ha!), you could also thread some heat shrink onto the wire before you solder, and then just move it into place and heat it up. But I didn't think of that at the time, so bah.

After you tape it up, it will look like this:

All taped up

At this point, you have done all of the electrical work. This would be a good time to test it out. If you have headphones and a 1/8″ stereo patch cable, you can attach one to each end of the device you've assembled (one to the end of the cord, and one to the jack), and then the extra male connector to some audio device, like your iPod, or a can of tuna. If you hear music through the headphones, that's a Good ThingTM. If not, then check your soldering to see if you have a loose connection.

Even if works just fine, bend the wire gently (not hard!) to see if it affects the sound. If it does, then you should check your connections and resolder. If not, then you totally rock.

Step 3: Mounting the jack

The next part is going to be highly specific to the vehicle you're installing the jack in, so I can't do much more than provide a case study of what I found. You need to find a spot in your dashboard, preferably on a piece that you can temporarily remove, that is thin enough and has enough room behind it to accommodate the back of the jack.

In my case, there was a spot right next to the radio that suited my needs just fine. The area surrounding my head unit is actually removable, so it was easy to take it over to my workbench. I originally was going to use a spot lower on the console near the gear shift, but ultimately decided against it since it was not removable, and thus much harder to access.

A couple other things to consider in selecting a spot: Give some consideration to how you'll run the wire from the aux input on the back of the radio to the installed jack. You'll make your life easier if you minimize the amount of cable fishing you have to do. Also, remember that you'll be plugging a wire into the front of this jack and running it to your portable device. I chose to put the jack on the right hand side of the radio instead of the left so the wire wouldn't obscure my view of the radio's display.

Next comes the big scary part: drilling the hole.

I started by removing the metal mounting collar from the jack (very important!), and choosing a bit that was obviously slightly smaller than the part that pushes through the hole. After taking a few nips of brandy, I drilled that small hole all the way through. I then repeatedly increased the size of the bit in 1/64″ increments and redrilled, until the jack would push through. I'm not going to lie to you, this was nerve-racking. It was difficult to get past the “ZOMG I'M DRILLING A HOLE IN MY CAR ZOMG” feeling, but I did it, and that means you can, too.

In my particular case, when the hole was large enough for the jack to fit through, I found that the plastic was slightly too thick so the threads on the front weren't quite exposed enough. The mounting ring couldn't grip them! To save the day, I broke out a Dremel with a grinder attachment and slightly deepened the hole on the back of the panel so the jack would poke though a little farther in the front, allowing the mounting ring to grip the threads. I also had to grind a little bit of the trim so the square backing of the jack would fit properly, but I was careful to only grind the inside edge so it wouldn't show once it was installed.

Grinding down parts of your car. Not scary at all.

Once I was done grinding, though, it fit just fine, and as you can see, the jack fit nice and flush against the back.

Aw, yeah.

The threads poked through in front, and the mounting ring grabbed them to hold the jack tight:

View from the front

Once the grinding was done, it looked like this:

Phew.

Step 4: Hook it up

I just had to connect the wires and reinstall the panel in the vehicle to be all done.

It was a simple matter to attach the 1/8″ to dual-RCA cable to the female 1/8″ plug that I had just installed:

RCA cable attached

From there, I took the whole assembly back to the car, and connected the RCA cables as appropriate:

Everything connected

If you're following along at home, it's a good idea to test your setup at this point before your car is all put back together, so you don't have to take everything BACK apart if you have problems. If you connect your audio source to the jack with a patch cable and turn on your radio, it should work! If it doesn't, check your connections and go backwards, a step at a time, until you find the problem.

In my case, things worked just fine, so I put my car back together and admired my expert craftsmanship.

…and there was much rejoicing

Step 5: Drink heavily

And you're done! Now, when you've ripped your favorite music to your iPhone and you're jonesing bad in the car, you have a solution that doesn't compromise your style. And, it's pretty awesome to be able to put that patch cable away when you don't need it.

If you decide to do this project yourself, let me know how it goes in the comments!

PS: If you decide to buy something from Crutchfield as a result of this post, and you're a new customer, hook a brotha' up and give them referral code “p51zi-fiv3b-gx3yu”; you and I will each get a $20 credit. That's cool.

Technorati Tags:
, , , , ,

DIY Podcasting

Using the ideas behind declan's blog post, I recently created
unofficial podcasts for two of my favorite WPTF radio talk shows: Neal Boortz (a Libertarian,
author of The
FairTax Book
) and Bill Handel (a true master of sarcasm,
delivered in the context of legal advice to
callers-in). Though I listen to the radio quite a bit during the day,
those shows come
on at inconvenient times. Truly, a technological solution could assist here, and
declan's blog
got me almost all the way there. Though his taste in radio
obviously differs quite a bit from my own, our needs were
the same in this regard.
🙂

radioShark, complete with terror-inducing fin. Soundtrack optional.

Here's an overview, for those impatient. I use a radioShark to schedule an automatic recording of
the shows I am interested in. I wrote a Perl script which runs after the
recordings finish that converts them into AAC
files (with an m4b extension, to support bookmarking on an iPod) using
a Nero
encoder and sends them via FTP to my web server. A specific URL on my web site invokes
a PHP script which scans the directory for those files and creates an on-the-fly RSS
XML document. Then, using iTunes or whatever software you may prefer, you can
register that URL to download new
episodes as you feel the need.

Ready to see how it's done? Good. Let's go.

[more below]

 

Step one: Obtain radioShark

I got mine on amazon,
where you can buy a new one for $45, or a used one for about $35.

The software that came with the radioShark was
quite outdated; there were much
newer, more functional versions available on the official radioShark download page.

 

Step two: Set up your recordings

Use the radioShark software to
schedule automatic recordings of the shows you
are interested in. In my case, I knew that the shows started about
5-6 minutes
after the hour (after a news break), so I took this into account; for the first
hour of Neal Boortz, I
started recording at 8:05pm and recorded for 55 minutes.
(Note: experimentation has shown that the show actually
begins at about 8:06pm, so
I might adjust this accordingly.) Neal's show broadcasts for two hours on
WPTF, so I
set up two recordings, one from 8:05pm-9:00pm, and another from
9:00pm-10:00pm. I did similar trickery for Bill
Handel's show. Remember to set your
programs up to recur on the appropriate days.

 

radioShark recording schedule. Note the separate
recordings for each
hour of programming, to skip news
breaks

The radioShark lets
you decide how to encode your recordings, and I chose to
save them as raw WAV files. These are quite large
(I believe around 550 MB per hour), but the purist in me wouldn't
let me encode them to MP3 just to re-encode
them later. (It probably would be fine
to do that so as to save massive amounts of disk space, since I'm going
to
use a high-compression encoding later, and let's not forget that it's already AM radio quality!
I'm just weird that way, and I couldn't bring myself
to do it. Ahh well, disk space is cheap.)

 

settings for recording one hour of
programming

In your radioShark settings, note the directory
where your captured audio will
be stored, as we'll process files in that directory using our encoding and
upload
script.

At this point, your radioShark should be spamming your hard drive with massive
meggage of unencoded
audio on a regular basis. This cannot be, so we must
proceed to…

 

Step three: Encode and upload

Now, we must create encoded AAC files from our currently massive, unencoded WAV
audio.

In his blog, declan used the free FAAC encoder, but,
despite my repeated efforts, I could not get the results I
wanted; iTunes always complained that the audio
files were corrupted. I am most certain that it is
something I was doing wrong, despite the fact that I used the
exact same syntax
as he, but after much research and many failed attempts, I went with something
else: BeSweet v1.5 (beta) using the Nero DLL's.

Note that Nero is a commercial product, and so
you must have a license in
order to use this method. I did have such a license, so it was a good fit for me. If
you
don't have a license, I can only advise you to either get one (Nero is
an excellent product, that's why I
have a license) or try something else.

Download version 1.5 of BeSweet (this version is still in
beta, at the time of
this writing) and install it on your machine. Then, as it says in this (confusing) page, copy
aacenc32.dll, aac.dll, and NeroIPP.dll from your Common
Files/Ahead/AudioPlugins folder, into your BeSweet
installation directory.

Now, you have a functioning encoder. We just need to set it up to run on the
audio
files generated by the radioShark. I do this via a Perl script which I set
to run every evening at 10:15pm, when all
of the day's recordings should have
completed. It scans the directory where the radioShark's recordings
live,
encodes anything it finds, uploads the result to my web server via FTP, and then
cleans up.

 

radioShark recordings; these huge files are
generated automatically by radioShark

You likely don't
have Perl on your Windows machine, so you'll have to grab ActivePerl (which is free) and install it. This will
give you the ability to run the
encoding/upload script.

All that being said, here's my script:

use Net::FTP;
use Time::localtime;

$filepath = "C:/Public/RadioSharkRecordings/";
$besweet = "C:/BeSweet/BeSweet.exe";

$ftp_host = "####";
$ftp_user = "####";
$ftp_pw = "####";

@file_prefixes = ('Neal Boortz', 'Bill Handel');

# Add path prefix and ".wav" suffix to each, then concatenate the prefixes into a single string for "glob()"
$prefix_string = join " ", (map "${filepath}${_}*.wav", @file_prefixes);

# Now look for filename matches
while (defined($infile = glob($prefix_string))) {
print "Processing file $infilen";
# Parse the filename to extract the info it contains
if ($infile =~ /^.*[\/](.*)_(www)_(dd)_(dd)_(dd)_(dd).wav/i) {
($show_name, $day_of_week, $month, $day_of_month, $hour, $minute) = ($1, $2, $3, $4, $5, $6);
$year = localtime->year() + 1900;

$aacfile = "$filepath$year-$month-$day_of_month $show_name.m4b";

print "$besweet -core( -input "$infile" -output "$aacfile" ) -bsn( -vbr_tape -aacprofile_lc )";
system("$besweet -core( -input "$infile" -output "$aacfile" ) -bsn( -vbr_tape -aacprofile_lc )");

print "Connecting via FTP to $ftp_hostn";
$ftp = Net::FTP->new($ftp_host);
$ftp->login($ftp_user, $ftp_pw);
$ftp->binary();
print "Sending $aacfilen";
$ftp->put($aacfile);
print "Closing FTP connectionn";
$ftp->quit();
print "FTP transfer finishedn";

print "Deleting $infilen";
unlink $infile;
print "Deleting $aacfilen";
unlink $aacfile;

print "DONE WITH $infilen";
}
} # while loop for one prefix

You'll note that the configuration information (location of BeSweet,
location of your recordings) is up at the
top for convenience. There's also a
list (@file_prefixes) that specifies the show names that should be
processed. The
script looks for recordings with the specified show names in the format used by
the radioShark
recording system. Note that, for the converted filename ($aacfile)
I switch up the format a bit, using an ISO
standard date format which also makes
the encoded files sort properly.

On the BeSweet command line, I
specify a variable bit rate encoding, using the
"tape quality" preset. Though this is a relatively low
bit-rate
encoding, it shrinks it down nicely from 550 MB to 20 MB, and the quality has been
completely adequate for
my crazy AM radio needs. Note that I also specify an
extension of .m4b, which indicates to iTunes that the file is
an audiobook, so
bookmarking is enabled.

As this is a Windows machine, I set it up a Scheduled Task in the
Control
Panel to run this script every day.

Awesome. At this point, the radioShark is recording our shows,
and a Perl
script is converting t them to AAC format and uploading them to the webserver. Can
life get any better? I
submit that it can, if we only proceed to…

 

Step four: Generate
the RSS XML

Now, a directory on your web server is expanding at a good clip (~20 MB/recorded
hour),
although not as quickly as the directory on your hard drive was before.
So, how do we present them as a podcast?

We give iTunes a URL that resolves to an XML document in RSS format, with
attachments for the recorded
audio. That's all a podcast is. iTunes will connect
using HTTP to download everything. So, all we have to do is
generate that XML in
a web page at a URL that iTunes can access, and we're home free. Sounds like
an excellent
task for PHP.

Behold the set of scripts that I authored to do just this task.

I wanted separate
feeds for Neal Boortz and Bill Handel, so I needed to write
everything in a way that would allow me to have only one
copy of most of the
code. I did this by writing two very small scripts, one for my Neal Boortz
recordings:

<?php
require("podcast_base.php");

create_podcast_feed (
"Unofficial Neal Boortz Podcast",
"http://podcasts.drjason.com",
"*Neal Boortz*"
);
?>

…and a separate one for my Bill Handel recordings:

<?php
require("podcast_base.php");

create_podcast_feed (
"Unofficial Bill Handel Podcast",
"http://podcasts.drjason.com",
"*Bill Handel*"
);
?>

Both of these scripts use a function defined in
podcast_base.php, as follows:

<?php
function create_podcast_feed ($title, $url, $pattern) {
header("Content-type: application/xml");
echo "<?xml version="1.0" encoding="UTF-8"?>n";
?>

<rss xmlns:itunes="http://example.com/DTDs/Podcast-1.0.dtd" version="2.0">
<channel>
<title><?php echo $title; ?></title>
<link><?php echo $url; ?></link>

<?php
$files = glob($pattern);
$aacfiles = array();
if (is_array ($files)) {
foreach ($files as $file) {
$modtime = date("YmdHis", filemtime($file));
$aacfiles[$modtime] = $file;
}
krsort ($aacfiles);

foreach ($aacfiles as $aacfile) {
if (preg_match("/^(dddd)-(dd)-(dd) (.*).(m4.)/i", $aacfile, $backrefs)) {
$year = $backrefs[1];
$month = $backrefs[2];
$day_of_month = $backrefs[3];
$show_name = $backrefs[4];
$extension = $backrefs[5];
$file_url = $url . "/" . rawurlencode($aacfile);
?>

<item>
<title><?php echo "$show_name $month/$day_of_month/$year"; ?></title>
<enclosure url="<?php echo "$file_url"; ?>" type="audio/x-<?php echo "$extension"; ?>"/>
<guid><?php echo "$file_url"; ?></guid>
<pubdate><?php echo date("r", filemtime($aacfile)); ?></pubdate>
</item>

<?php
} // preg_match
} // foreach
} // if (is_array ($files))

?>
</channel>
</rss>

<?php
}
?>

As you can see, both of the small scripts pass in a
pattern, and the function
uses the PHP glob function to get a list of files that match that pattern. It
grabs the
modification time for each of the files and puts it all into a hash from
modification time (key) to filename
(value). I use the PHP krsort to sort the
hash by key, with newer dates at the top. Then, I iterate through the list
and
dump out the XML. Easy.

 

Podcast RSS XML in
FireFox

Any-hoo, I just dropped those scripts into the
directory with the AAC-encoded
audio files, and magic happens when I call them up on my browser.

 

Step five: Bathe in self-adulation

Now, it should all work. Just
enter the URL for one of the small scripts as a
manual podcast in iTunes, and you're golden.