Archive for September, 2006

Timing closure

Saturday… me being a Guild Whore, tackling a quest log (dwarfed only by my Project Stack) as a travelling-salesman optimization problem. Meanwhile, attempting (with no success, yet) to load an .iso of Shadow of the Colossus with HDloader. Eventually gave up on both of those and crashed for the night.

Had a dream that night about someone from my past. In it we were at the cabin (which, not atypically for my perpetually mis-timed and mis-scaled dreams, was unusually large, or we were unusually small) in a storm raging throughout the night. The power was out and the only illumination was from the fireplace and discontinuous lightning through the windows. And as thunderstorm turned to hail and trees bent and snapped outside the window I held her close, wrapped up in blankets and head buried under my chin and reassured her that it was okay, no matter what happened it was all going to be all right, and in the land of vikings those words actually meant something.

It was so vivid it scared me awake in that not-quite-rational-yet state, and I thought I was going to see a tree crashing right through the window. Needless to say it was entirely calm out, except for some vague and distant traffic sounds floating in from the window. Eventually I managed to fall back asleep, and the rest of the night was uneventful, except for a dream about cooking ribs over a fire at my parents’ house. Pretty much identical to one I had the last time I was in Chicago, but those had barbecue sauce on them and these didn’t. (Armchair psychologists may recognize recurring baby back dreams as a sign of dietary BBQ deficiency ;)

Sunday was a day of everyone coming out of the woodwork and wanting to do stuff at the same time, after a couple weeks of pretty much not seeing a soul outside of work. There was meetup @ dunkin donuts &|# go to the farm w/ An* # BBQ @ GJM’s, for the explicit short-notice invitations. By the time #1 materialized, #2 was already committed to, and there was no possible way we could mesh the timing. It’s annoying the way everything seems to kind of cluster together like that; just like about three work projects that (admittedly, my own misplanning is a slight contributing factor for one of them) suddenly picked this week to go timecritical. What ended up happening was that An*, J.R. and I went out to the farm coop (coming back with 2 huge bags of sungold cherry tomatoes, and 3 different colors of radishes, among other things), then shopping, then to dinner at an Indian restaurant near Harvard square.

[19:44] A*: Ok, I’m stealing that.
[19:52] me: haha
[19:52] *** Auto-response from A*: rm * /dev/bladder; cat /dev/fridge | grep food
[19:52] me: trouble with that is remembering to treat /dev/fridge as a FIFO and not a block device
[19:52] me: *contemplates 3 day old pizza vs. 2 day old indian food*

mYpod : my CompactFlash-based, in-dash mp3 player

Yay…after all this being too busy, too lazy, or any number of other excuses, one more project finally off my stack. The “mYpod”* is a small CompactFlash-based mp3 player I built from leftover spare parts from a bottom-secret government project, free samples and a standalone mp3 decoder chip.

(Click thumbnails for larger image)


  • Supports CompactFlash media up to 2GBytes officially (FAT16 file system limitation); 4GBytes if you “relax” (i.e. violate) the FAT16 specification a little by setting a 64KB cluster size (Win2k/XP will allow this, but Win98 and below will bitch loudly and not read the card)
  • Actual, real, full FAT16 implementation – handles fragmented files, deleted files, etc. (You’d be amazed how many card-based music players, and even some digital cameras, do not fit this description, or at least not reliably)
  • Playback of mp3s with bitrates all the way up to the maximum mp3 bitrate of 320KByte/sec
  • Display title and artist from ID3 tag if present (display filename if no ID3 present), and elapsed time
  • Saves the currently-playing song when powered off – picks up where it left off
  • Song selection: next, previous, “skip 10”, pause and menus (e.g. restart card from the beginning)
  • Buttons light up at night like a glow-in-the-dark Bomb Pop
  • Line-in and line-out from stereo available on front panel (anything plugged into line-in is switched in instead of mp3 player)

An early view of the guts, before they were enclosed in anything

One evening a year or two ago, GJM and I were about to head home from work and talking about part of an environmental monitoring system we were developing at the time. This was a handheld data-retreival unit that queried the environmental loggers in-the-field and recorded their wireless data to a CompactFlash card. I remember jokingly saying, “Hey… we have a memory card, A/D, processor, LCD and buttons…how many extra parts do you think it would take to turn this into a music player?” Next thing I know we’ve got a couple beers cracked and are laying out a quick-n-dirty mp3 player board in an unused corner of a layout set to go out that night.

Packaging this quick ‘n dirty design as a truly portable device would have been non-trivial (and, I got a Creative Nomad as a gift sometime between the start and end of this project); it would be much easier to package it into a car-stereo size enclosure. My car already came with this plastic tray (officially for holding papers, garage door clickers, etc.) bolted into the spare bay where an auxiliary radio component would go (or the bottom half of those huge, double-height stock radios), so I took it out, drilled some holes and screwed the board and extra parts directly into it.

Most of the parts were leftover lab spares, such as the PIC microcontrollers (scrapped from the Real Project because of a silicon defect in the revision we had; they can act unreliably above 4MHz and therefore can’t be used in production gear), the membrane keypad and the LCD. The only major extras needed were the STA013 mp3 decoder ($12) and a stereo DAC (free sample from Cypress Semiconductor)** to convert the decompressed digital (PCM) audio from the STA013 to real sound.

Guts during assembly. The large tall chip toward the front, hiding behind the too-fast oscillator (more on this in a bit) is the mp3 decoder, the square 64-pin bitch-to-solder in back is the PIC. (Click for larger image)

For the front panel, I grabbed a piece of Lexan left over from building the terrarium and of course, cut a bunch of holes in it. I started off with the usual score-and-break method of cutting the Lexan, but when it came to inner cuts (e.g. the rectangular holes for the CF card and LCD) consulted my dis-is-how-we-do-it-in-da-ghetto handbook, laid a hot soldering iron against the back of my X-Acto knife blade and pressed it into the piece. Like a hot knife through buttah! Using a straight edge as a guide, this provided straight, clean cuts, which were touched up a bit with a small hand file. Round holes were cut by making a pilot hole with a small drill bit, working up to larger and larger drills until the desired size was reached. The Lexan has a tendency to grab the drill bit and suck it in (depending on the intricacies of classical physics, this either yanks your drill out of your hands and into the piece, or yanks the piece out of whatever’s holding it, potentially snapping it), so don’t go diving immediately in with the large bits.

The keypad features an adhesive backing and insertable overlay for the button graphics – being the perfectionist that I am, I doodled some arrows and symbols on a piece of paper and slid it in. Since the front panel is clear, and surprisingly, the buttons themselves are translucent, it was easy to stick a few colored LEDs on a piece of Veroboard behind them, angled and distanced so that they cast a tight circle of light on the entirety of only one button each. I was originally going to have this turn on automatically when the headlights were turned on, but couldn’t find such a signal on the radio’s wiring harness. The LCD unfortunately comes without any backlighting, and no way in hell to add any since it’s mounted flush against a very opaque PCB full of traces. A metal guard ring completely surrounds the glass; if removed, the glass ceases displaying anything and falls out (the metal band presses it tight against a zebra strip that connects it to the board).

The button panel, without sexy backlighting. You can see how much effort I spent on it! ;) (click for larger image)

Software / Featuritis:
A couple features are missing, either because they were accidental, or too much of a pain to implement. The most notable is fast-forward. The firmware is already handling FAT16 fragmentation transparently in the background; all the decoder requires is bits, as fast as you can stuff them in. Mp3 files are made up of many small time segments called frames, which often incestuously share bits with previous frames, so you can’t just play the file at 10x by dropping 9 out of every 10 frames. All you get from this is a bunch of blips and pops… fast-forwarding an mp3 turns out to be non-trivial, so it is not implemented here. The other non-implemented “feature” is Chipmunk Mode. The mp3 decoder runs off of a very precise master clock, typically around 14MHz. Following this (internal to the decoder) is a Phase-Locked Loop system of clock multipliers/dividers that can be software adjusted to provide a correct timebase from a wide variety of input clocks. While I was testing, I got the sensation that everything from my player sounded a little “sharp”. Indeed, a side-by-side comparison between the early mYpod and WinAmp confirmed that the same 3.5-minute song finished almost 10 seconds faster on mYpod. Turns out I had the PLL set for a slower master clock than I used, so it was playing back too fast. I discovered the PLL settings are very, very adjustable; you could make all your favorite artists sound like demons or chipmunks. Unfortunately, this is not exactly a “fast-forward” feature (by the time you speed it up enough to be a decent FF, it’s too high and whiny to be intelligible – besides, the micro can’t pump data out that fast anyway), so I set the correct speed and didn’t leave provisions for messing with it via the front panel.

For the firmware – that was actually the most annoying part of this project, a lot of assembly coding. The FAT16 stuff was actually written already for the most part, as part of the actual work project (otherwise, I’d release the code here). All the fiddly bits (buttons and menu system, LCD scroller, play timer, hunting for ID3 tags, position-saving hack to an already crufty file handler, etc.), and getting them to play nice with one another (e.g. does the play timer stop when playback is paused? What’s the easiest way to restore the song title/info on the LCD after it’s been overwritten with a menu?), still had to be done though. The PIC programmer supplies and requires 5V to program, but the mp3 decoder chip can only handle 3.3V. The solution to this was to load the Jolt serial-port bootloader onto the PIC before soldering the decoder in (and hope I never introduced something in my code that overwrote the bootloader). Sending new firmware over the serial port, the PIC can self-program at 3.3V.

Last but not least, this beast had to be connected to the headunit somehow. Pioneer decided that all good headunits should have line-ins, but ensconce them in this proprietary 11-pin “IP-BUS”*** connector (with differential inputs, no less). Bah. Luckily, breakaway pin headers plus heat shrink equal reasonable facsimile of funny plug, and the differential inputs work fine by just dumping single-ended signal into one side and grounding the other.

So yeah… it sounds good! Now I just need to put the TrashAmp back together (strip away the melty bits, etc.) for that phat window-rattling bass, yo.

* my brother calls it my mpthriller – then again, he’s got some shizzle on his nizzle.

** I only sampled it because I couldn’t get it from Digikey or any other decent distributor. Ohh, that was a mistake. Samples came at a cost of about 6 months of horny Cypress rep calling me about how the chip’s working out for me, when he can come over and show off the full product line, and how soon I’ll be ready for those 10,000 units…

*** as in like, Intellectual Property Bus? As in, if any competitors try to reverse-engineer our funny plug and make something compatable, there will be hell (or IP lawyers) to pay? All right, maybe it stands for “Interconnected Peripherals” or something.

0b00011010 // Happy birthday to me…

I was driving to work this morning, which takes me past Tufts…so I was enjoying the scenery, and that’s when it hit me. “Oh, fuck, it’s happened. I’ve become a dirty old man.”

* * *

I mentioned this revelation to GG and the ‘Nator in the lab. They were proud of me. Said I was past the Denial stage…and that before I knew it, I’d be through all those intermediate stages and be where they are today…embracement. “You’ll come to embrace your inner dirty old man, just like us.”

* * *

Last weekend we had a party at J.R.’s. She made a sushi cake, with my age spelled out on it in binary (if you can’t read binary, I’m not tellin’ ya how old I am ;-) ). The candles were cucumber cores with a bit of nori wrapping and red/orange roe for the “flame”. Way too many pictures here!

(And the thursday before, Father’s day cake with L* and housemates (our birthdays are a day apart).

Labor day Chicago trip

Some pictures

I think I’ve been forgetting what I actually made this here blog thing for – jotting down all the stuff I do, people I hang out with, etc. So anyway…Chicago trip from Labor Day.

It was a 10-4 week, so I got the friday off “for free”. The only decent flight I could get was at 6:30am, though, which meant (besides no shampoo, toothpaste, or spermicidally lubricated condoms, because it’s just so easy to make a James Bond explosive in the lavvie) getting up at 4am to deal with the man with the rubber glove expected security line. So rather than try to get all the way from my house to Logan before I was conscious, I crashed at J.R.’s place the night before.

On the way there, while walking to the T I ran into that guy*. Way-locals (GJM) might know the one I’m talking about. Sometime last year, someone had painted the text “WATCH OUT FOR THE MEDICATED MAN” on the sidewalk, with an arrow in the direction of Powderhouse Square. I wonder if this is what it was referring to. Anyway, there’s this older guy, definitely, shall we say, not all there, who’s always hanging around on that stretch of sidewalk between the bus stop and the next street. Usually he just sits on a bench shouting unintelligible things at people. This evening I guess he was more in a mood to talk–a lot–because he was standing and started following me, walking alongside and talking (/yelling) some stuff for the next several blocks. (This speech had the “tongue three sizes too big for face” quality, and I could only make out a few words. It seemed to be some kind of religious diatribe; there was something in there about angels of death etc., and ended with “peace, brother”.) I didn’t tell him to fuck off since I wasn’t sure how stable/unstable a person I was dealing with, but I also knew if I gave him any acknowledgement, I might never be rid of him, so I pretty much just tried not to make eye contact. Eventually the speil ended and he started walking back to his spot next to Powderhouse.

Then home!

This would not be complete without a visit to Fry’s Electronics (of “I am retiring these pants” fame), where I picked up a sweet, actual real digital camera (of the non-hacked, non dispose-o-cam variety)…8MPx and 12x optical zoom. You can practically count the facets on a damselfly’s eye. My folks covered part of it as a birthday present :P (Why does holding a camera with a huge lens make one yearn to shoot amateur pornography?)

Spent a nice night hanging at Nando’s place in his jacuzzi…his little brothers were trying to score with some hoes they brought over; with a poorly-hidden case of Bud Light (blech!) in the bushes. Undoubtedly having nothing whatsoever to do with the sons + girls thing, Mr. Nando decides that 11pm is the perfect time to pull his car out within eyeshot of everything and start washing it. “Washing”, in this context, involving the notional fine-tipped toothbrush for those hard-to-reach spots up inside the muffler. You know, just being thorough and all. Once he’s reached the “risk of wearing holes in the paintjob” point, out comes vehicle #2 for a DEA-grade detailing. Finally “CINDI 71”, not-worth-washing-mobile, comes out for some suds. By now it was well after midnight and we were placing bets on whether he’d do the conversion van next. What instead happend was he went a-scouring around the outside perimeter of the house, found the kids’ case of Bud, and shooed everyone out. This included shutting down the hot tub on us fully grown adults and ordering Matt to come in for the night, so we snuck him out and did some drinking/movie/party stuff at our house.

(As an aside, sometimes I get the feeling that I’m the only person I know whose parents aren’t completely fucked in the head. And as for you Matt… high time to move out!)

Spent a night at the cabin, luckily not getting chased around by my little cousins** any more than usual. An aunt and uncle from my dad’s side and two aunts and uncle from my mom’s side were there – supposedly, my dad managed to get both uncles to come fishing with him together, on the same boat and everything. I took some pictures of mushrooms, had an apple off my tree (not bad, but kinda dry and wormy), and brought home one of the big puffballs I found in the woods for a snack (a lot like tofu; good with butter and onions). My brother and I hot tubbed, got a bunch of us together for a bonfire (s’mores, foil-onion-burger-balls, and meat on a stick!).

My bro and I went out to KRISTOFF’s new place in Elburn, IL… where the hell is that, you ask? Yeah, that’s what I said too. But found it anyway (even if it involved at one point being headed westbound on East North Street…I am not making this up), we got a little party together, rocked out to rad 80s tunes, and built a fort out of blankets, chairs and couch cushions :-P

Went over and hung out with J* and E* briefly… saw E* again the next day, and it branched into romantic territory. More into romantic territory than I expected. Leave it to me to feel more guilty than excited, heh. I like her, but (besides the part about living back in IL) she’s not the one. Ticktockticktock…

* Apparently he’s at least somewhat known; this Tufts student publication (everything The Rag could have been, if we didn’t have to sneak around at night posting them in bathroom stalls) makes reference to crazy Powderhouse guy on p22.

** speaking relatively here; since I remember them both at diaper age. I think both of them actually weigh more than me now, which is kinda sad.

Void Where Prohibited: The Phantom Urinator strikes again!

At work today we had a meeting in which we discussed toilets. We talk about toilets way too much.

Figure 1: Toilets, and the discussion thereof, are thouroughly appreciated by everybody.

Anyway, for at least the last few weeks or so, there has been a problem with leaks in the men’s room. Specifically, somebody taking them all over the floor. Now, surely, it’s not intentional…we’re all big boys (engineers and research scientists, at that), so I don’t suppose anyone is doodling on the floor to make a point, or play starship captain* or anything. However, while it’s not unheard-of for a couple stray drops, including splashback from a right torrential piss, to land on the rim or outside the bowl, these have been substantially more than a few drops…more like small puddles. Since this particular fluid dynamics problem has been brought up in meetings for the third time (the nightly cleaning staff have even brought it up), I haven’t seen the puddles return in the last few days. Hopefully this means the phantom urinator has cleaned up his act.

Today’s tank talk focused on a new matter, however. Our wing of the building has two sets of toilets–a mens’ and a ladies’ room (“one-holers”) inside the office proper, and a pair of massively parallel, multiporcelain public johns located in the hallway just outside. For the longest time, there was an informal agreement that any “serious business” be taken care of in the outside johns, not the ones right next to our offices/kitchen, due to the non-stellar nature of their ventilation systems. In fact, some jokester had taped up a little handlettered sign on the wall opposite the throne: “if you can see this, you should be in the other bathroom.”

Eventually the sign fell off, and for whatever reason, over time this informal rule fell by the wayside and never got passed on from old staff to new. Someone brought this up, with some vigor, at today’s meeting, formally enacting/renewing the rule. Later today, someone went so far as to zip-tie the seat in the ‘up’ position. Doubtlessly, some form of amusing signage will also appear within the next few days. I feel bad for whoever unwittingly dropped the bomb that brought about a staff meeting discussion, No Deucing signs AND a zip-tied seat.

Figure 2: Just had to be spades…

* and boldly go where no one has gone before

The Slimeball Shuffle

Today I received my VIP invitation to the Women’s Financial Conference.

…uncomfortable pause…

Right now, you’re probably wondering a few things. Like, “is there something you haven’t told me?”, or, “did the operation hurt?” No, I haven’t been in for a change of equipment. But at least I know where they got my name*.

Fuckin’ marketers. I had that fishy feeling even before I opened it. Bright pink envelope hand-addressed to me** and bearing what appears at a sufficiently cursory glance to be a real stamp. (A less cursory glance reveals “presorted std. massmail blah blah” in teensy tiny print at the bottom.) Ellen Munson wants to share with me her unique wealth-creating secrets and strategies. Bleah.

Among the spoils of yesterday’s mailbox haul were a Second Notice that my highschool yearbook information urgently needs updating*** (I can’t imagine why anyone would want this information), and two, count ’em, two little blue postcards from the ever-mysterious “Awards Verification Center“. Apparently, both myself and one of my housemates are Grand Prize Winners of a New Luxury SUV xor Vacation to Somewhere Tropical xor Big Cash Prize. Two lucky winners, on the same day, in the same house. What are the odds?

(Probably about the same as my odds of travelling somewhere to hear a long annoying timeshare seminar from a shady company who’s been called out by both the FCC and BBB, with a bunch of sales douches jumping down my throat faster than Viagras at an old folks’ home zoned in a red-light district. Or devising, in the course of my top-secret work geeking involving magnets and miracles, a way to partition spacetime such that multiple individuals can timeshare a boot in the ass. This would likely require said asses to be simultaneously occupying the same time and space, which sounds downright uncomfortable.)

* There’s only one organization I know of that thinks I’m a woman, and that’s the Massachusetts Registry of Motor Vehicles. About a month after I waded through all the lines and got my MA license, it was needed for some kind of paperwork at the office. When MvS was done with it, barely containing laughter, she motioned me into the mailroom and said, “Hey, do you know about this? It says here that you’re a female!” Sure enough, there it was on the license. I’m pretty sure I gave a little adjustment to make sure, and checked the correct box at the RMV. To this day however, no one except MvS (including club/pub bouncers, cops, the TSA, etc.) has ever noticed.

** where ‘hand-addressed’ == ‘TrueType handwriting font in blue with telltale inkjet dots’ … oh, and as long as you’re going to the effort of forging handwriting in your mass marketing communications for that “personal touch”, the least you can do is cobble together some basic randomization script so that all occurrences of each character that appears more than once aren’t glaringly identical. The TrueType fonts are digitized from a sample of someone’s actual handwriting, but have the limitation of being able to store only one symbol to represent each ASCII character. Take it a step further and store, say, ten samples of each character in vector files; let your script plop them down sequentially as that character is used in your malodorous disquisition. Ideally, your spiel will be short enough that you’re unlikely to run out of unique symbols, but if you do, they might be far enough apart not to have that jarringly machine-generated quality. BTW, there is my Unique Wealth-Creating Secret for the day.

*** where ‘high school’ == ‘Harris Connect, Inc., written to appear to have come from LTHS, using their name and logo’… reminds me of certain credit card offers ;-)

UPDATE: The Better Business Bureau (BBB) has a few things to say about Ellen Munson and her wealth-creating secrets. This company also does business as National Training conference, LLC and Money in Training, LLC., among others.