Thursday, May 28, 2009

Tripping Up?

About two years ago one of my best friends (I’ve known him since the 9th grade in school, and we were in JHC, A-Div together) gifted me a Griffin iTrip. He had just recently bought (been gifted?) an iPod video, and the iTrip 4014 was not compatible with it. Not wanting to throw the iTrip out, he very sweetly gave it to me (thanks bro!).

Incidentally, I happened to be the second in our ‘gang’ to own an iPod, after another one of my best friends (c’mon, I can have more than one best friend! As a matter of fact I happen to have 15 at this moment). He had a silver Mini, and we would take turns listening to it in the electronics lab, while we soldered away at a 7447 and a 7490 counter-with-display circuit.

I take a teensy moment now to salute my alma mater – Jai Hind College. JHC, was an oasis in a concrete jungle, ‘figuratively’ speaking (wink, wink :-)). Just off Marine Drive in Bombay, JHC was where I did my junior college. I studied Electronics as a vocational subject and was taught Sam’s Laws, by none other than Prof. Samel, who also taught us other important things, such as the reason Darlington pairs are named so (Note to reader: if you are opening your eyes in bewilderment – ‘what is he talking about?’ – you are pardoned; this is an internal joke). Coutinho, Rane and Bai were the ‘awesomest’ of teachers!

Right. Back to the topic at hand. I used the iTrip with my iPod Mini a couple of times before keeping the iTrip aside in disgust because it used to drain my already weak battery super quick. Earlier iPod batteries had notoriously short run times – only 4 hours for a new Mini; these days, play times of over 20 hours are not unheard of! One mod I made to my Mini was swapping out the Hitachi Microdrive, and replacing it with a CF card. By the time my iPod got ‘old’ enough for me to gather the courage to disassemble it, my Li-Ion battery was too far gone to make any real judgment about the modded performance. However, in all fairness I must say that I did notice marginally improved battery life (the CF card has no moving parts as opposed to the spinning platters in a Microdrive, so battery juice lasts longer), but nothing that merits boasting.

I am, at some later date, planning to strip down a Nokia BL5C and replace the original Mini battery. Why go through all of this trouble when I can simply buy a new Mini battery online? Well, for one, at the time of writing this replacement batteries (USD 30) are horrendously expensive compared to a BL5C (INR 125; ~USD 3); Apple charges a bomb (USD 75) to replace the batteries themselves; and lastly, I’m doing it just BECAUSE I CAN :-)

The iTrip 4014 is an FM transmitter that is capable of transmitting from 76 MHz to 108 MHz. Based on the BH1415F from ROHM, it also has a PIC12F626. The frequency at which the iTrip broadcasts is set by the '629. Small sound clips (provided by Griffin) are to be played by the iPod to change the frequency. The clips contain codes which tell the '629 which frequency to set.

Sadly, the iTrip 4014 can only be used by an iPod, and that too, only from its remote control port. Naturally, I did not like this forced restriction. So I decided to see if I could mod the iTrip to play from any old source with a 3.5mm jack.

I trawled the net for pinouts and specs, and came across several tutorials to increase the transmission range, but none that told me how to make the desired modification. This site came close, but a different iTrip was used. Anyway, I took apart the iTrip with a sharp craft blade. You can see the scuff marks at the bottom – these are the only visible signs of damage to the case (which I plan to discard anyway).


After a bit of poking around and with some intuitive guesswork I figured out which wire went where and did what. The images are marked with the relevant data incase you decide to take your iTrip apart. The image on the right has the microcontroller (a PIC12F629) and the one on the left has the FM chip (BH1415F). Click on the image for a better view.






I rigged a rough setup to power the iTrip externally. In the image below, my trusty PICKit2 is providing 3.3v to the iTrip. Also visible is the connector which plugs into the remote control port at the top of the iPod. The image to the right is a close up of the connections.






The audio jack was connected to my laptop, and audio was broadcast to my radio. It worked perfect. The ultimate aim is to make this into a standalone FM transmitter, therefore to change channels I would need some way to provide the audio control commands to the iTrip.

The audio commands are extremely simple – they follow an ASK-like format. A command is 19 bits long, and is transmitted LSB first to the Audio L wire (it’s the tip on the 3.5mm jack). A sample audio command clip being analyzed in Goldwave is shown below.

5

To switch frequencies the user plays a command file (which sounds like random beeps), pauses it after the ‘random’ beeps, waits for a few seconds till the iTrip automatically locks the frequency, and then resumes playing audio. The first string of blips is the actual command to switch to 107.7 MHz. The three blips towards the end mean ‘Ignore the previously issued command’. This is to prevent inadvertent frequency switching incase this file is played when the player is in ‘shuffle’ mode. In case the file is played by mistake, the iTrip will receive the command beeps, try to lock the new frequency, then receive the ‘ignore’ beeps (since the user would not have paused midway) and not lock to the new frequency.

6

7






The 19-bit command is (LSB first) ‘1010 10101100001 1001’. A command is framed by ‘1010’ to the left, and ‘1001’ to the right. The actual command word itself – ‘10101100001’, if read right to left is ‘10000110101’, which happens to be 1077 in decimal. Divide that by 10, and you get the FM frequency, 107.7. The ignore command is just ‘10101’. Each ‘1’ is 20ms of a 1000Hz sine wave. Thus each ‘1’ consists of 20 peaks and 20 troughs. A ‘0’ is just 20ms of silence. The commands are fed to the PIC, which decodes them, and sets the desired frequency.

Some commands are given below:

Freq.

Decoded Audio

Frame

Data (LSB first)

Frame

Data (MSB first)

Data in decimal

76.0

1010000111110101001

1010

00011111010

1001

01011111000

760

76.1

1010100111110101001

1010

10011111010

1001

01011111001

761

76.2

1010010111110101001

1010

01011111010

1001

01011111010

762

76.3

1010110111110101001

1010

11011111010

1001

01011111011

763

76.4

1010001111110101001

1010

00111111010

1001

01011111100

764

76.5

1010101111110101001

1010

10111111010

1001

01011111101

765

76.6

1010011111110101001

1010

01111111010

1001

01011111110

766

76.7

1010111111110101001

1010

11111111010

1001

01011111111

767

76.8

1010000000001101001

1010

00000000110

1001

01100000000

768

76.9

1010100000001101001

1010

10000000110

1001

01100000001

769

77.0

1010010000001101001

1010

01000000110

1001

01100000010

770

93.0

1010010001011101001

1010

01000101110

1001

01110100010

930

96.6

1010011000111101001

1010

01100011110

1001

01111000110

966

105.6

1010000001000011001

1010

00000100001

1001

10000100000

1056

108.0

1010000111000011001

1010

00011100001

1001

10000111000

1080

To figure this scheme out I had to open multiple files and compare the data. Here’s a shot of my desk. Notice the dual screens :-). iTrip open heart surgery is in session.

8

So this got me thinking – more likely than not, the PIC was simply ignoring the fact that the signal was a sine. It could work just as well with a square wave. And I could provide a square very easily with another microcontroller.

As a proof-of-concept experiment I generated the square wave in Goldwave (image-left), and created an audio clip similar to the command file (image-right).

9 10






I played this to the iTrip, and it switched frequencies like a charm. I can easily program a PIC to poll a couple of buttons, provide the requisite string of square waves when a button is pressed, and display the changed frequency on an LCD/numeric LED, thereby giving me a standalone FM transmitter.

Sites that were useful / will be useful:
http://badacetechshow.com/psp_itrip.htm
http://www.maushammer.com/systems/ipod-remote/ipod-remote.html
http://stud3.tuwien.ac.at/~e0026607/ipod_remote/ipod_ap.html
http://nuxx.net/wiki/Apple_Accessory_Protocol
http://www.petertyser.com/2005/04/28/motion-based-ipod-remote-control/

Future plans:
1. Make it into a standalone transmitter with button-selectable frequencies.
2. Provide power from a tiny rechargeable Li-poly. This would entail making a charger circuit (for recharging), and a buck regulator (to provide 3.3 volts to the hacked iTrip).
3. Make a nice enclosure.
4. Boost range/power.

Stay ‘tuned’ for future updates! :-)

Wednesday, May 27, 2009

After the Long Break

I haven’t blogged for aeons! It’s been around six months since I last blogged. So much has happened in these six months. I am now an engineer – BE Mech. It feels good. My last six months in college (BITS – Goa) were an absolute blast! Quark, Waves, Spree, all in one semester! Walkie-talkies for backstage members was fun :-) . I made a bunch of new friends, and came closer to those who earlier happened to be just acquaintances. I learnt (and started using) a load of very weird sounding slang (which, mind you, is unique to BITS – Goa). Some BITSian slang, in their (hopefully correct) usage are noted below, and, while a few may be common in other parts of India, I assure you, each phrase has multiple meanings, many of which I have not been able to list here.


In BITS, BDM, Pinky, Shalini, Aruna & Co. would be pleased and proud (NOT!!) with our attempt to include classroom grammar rules in daily conversation. Naturally ‘lol’ becomes ‘loler’; and if you find the ‘zoke’ very funny, you’d say ‘lolest’. Very very funny would be ‘lolest-est’. It is obvious…oh! sorry – it is ‘ob’ that such grammatical extrapolation can be used for other words – ‘ob’, ‘obber’, ‘obest’, ‘obest-est’? If you find this tiny task in English tough, then you’d surely be ‘raped’ in our examinations. You’d probably come out saying ‘Damn! Paper ne phaad di. Rapest paper!’ Or maybe, ‘paper ne f*ck maar diya’? The sad thing is, that in BITS, exam ke samay life mein f*ck ho rakha rehetaa hai.


If you are one of the chosen few who manage to turn the tables on the paper then you are ‘proest’. You’d go around the campus shouting ‘backslash-m-forwardslash’! ‘backslash-m-forwardslash’ or ‘Yaar, life mein sex ho rakha hai’! Otherwise, by the second paper most people take it lite (light). A friend of mine once commented upon the marvelous way these two phrases – ‘life mein f*ck ho gaya’; and ‘life mein sex ho gaya’- actually mean the same, an yet are completely opposite in terms of how they are used.


Regardless, by the third paper, if lite has not been taken by you, then tum noobism kar rahe ho; faaltu mein apni maraa rahe ho, kyunki abhi tak toh sabka ‘gg’ ho gaya hai. Finally when you get your corrected papers, the only excuse you can make to your parents is “Mama, lol ipoindi. But chintaa mat karo, baaki sab ka bhi ‘gm’ hua hai, in other words, sab ne m2l2”. ‘m2l2 (right here I was facing this dilemma – should I capitalize the ‘m’ in ‘m2l2’ since it began a new word/acronym after the full-stop? I decided against it, since the quandary I would be in next would be the issue of capitalizing the ‘l’ in ‘m2l2’ – I’ve upper-cased the ‘m’, so to maintain an evenness, it would only be right to upper-case the ‘l’. But then that might distort the acronym so much that this much loved phrase would be unrecognizable – M2L2. I say ‘much loved’ because I know that through careful cogitation people have extended this to m5l5 and even m6l6. I must point out that m2l2 actually started out as m2l2. It only changed into its present form to aid quick typing on DC main chat). DC is absolutely ‘ulti-mate’! Many chaps are called by their DC nicknames, rather than by their real names – Tillu, Rash, Achillies, Sid bloke. There are cases where people don’t know the real names of these people! If people don’t know your real name, then you simple have to take lite, and chill, machha!


Anyway, I am back home in Gurgaon now, and have a lot of free time on my hands. Just yesterday I met up with some really close friends – Prawn-soup and Sanso. We met up to hang out, and in the course of time, as most college-goers are wont to do, landed up at CafĂ© Coffee Day – CCD where Sanskriti had the following conversation with the waiter:


S: Could I please have the chocolate cake?

W: Chocolate cake?

S: Yes, please.

W: Anything else?

S: No, thanks, that’s it (big Sanso-smile)

W: Would you like it with warm?

Sanso, Pranshu, Rohit (to themselves): What the …?

(aloud): Umm, excuse me?

W (louder and slower, as if that would help!): Would you like it w-i-t-h-w-a-r-m?

R: Oh, you mean would we like it warmed?

S: Aah yes! (Bigger Sanso smile)

R: maybe we could ask the waiter to give us a portion of ‘warm’ in a separate dish? Maybe with two spoons? :-P



I am presently taking apart my iTrip from Griffin. Next blog topic: Cool iTrip mod.

Visitors