Wednesday, November 30, 2011

Downton Abbey Series 1 Episode 1 Morse Code

The very beginning of Downton Abbey's first ever episode begins with a close up of a Morse code key being used to send a telegram that will announce the critical news of two deaths. If you're like me you instantly wondered what was being keyed.

Here's what I hear:
dah                   T 
dah dah dah           O

di dah di dit         L
dah dah dah           O
di dah dit            R
dah di dah dit        C

dah dah dit           G
di dah dit?           R
So, it appears that the message begins: "TO LORC GR". I assume that is meant to be "TO LORD GRANTHAM" and that the C is actually D and has been incorrectly transcribed.

Here's the audio as an MP3: Downton Abbey Series 1 Episode 1 Morse Code (first part).

Then over loud music it continues:
dah dit               N
dah dah dit           G
dit                   E
di dah dit            R

di dah di dit         L
di dit                I
di di dit             S
dah                   T

di dah                A
di dah                A
di dah                A

di dah dah dah        J
di dah                A
I think that's a fragment of "NGER LIST AAA JA". Since AAA is a full stop and this telegram is referring to the sinking of the RMS Titanic where Patrick and James Crawley were on the passenger list (as we later learn in the episode) it's likely that this is a fragment of "PASSENGER LIST. JAMES".

Here's the audio as an MP3: Downton Abbey Series 1 Episode 1 Morse Code (over music).

Anyone else hear something different?

PS It's pleasing that the producers must have gone to the trouble of composing the complete telegram and the recording its transmission using Morse code just for that small segment at the beginning of the first episode.

PPS A little Google search reveals that it was G3YXZ [PDF] who was recruited to send the CW and he notes that for television reasons the key was adjusted to increase the gap size thus making sending more difficult (hence, no doubt, the mistake with C and D).

Tuesday, November 29, 2011

A nice bottle of Lorem Ipsum 2009

Going out to lunch with friends, having a nice bottle of wine in a gastropub. Good way to spend the weekend. Then you decide the wine was really nice and you'd take a quick photograph of the label so you don't forget it.

And then you notice the text on the bottle of Domaine Tissier Sancerre Rouge 2009. Yes, it's Lorem Ipsum filler text!

Interestingly it's the version that's popular in English speaking countries and not in France. I called the vineyard in France who were only able to tell me that the bottle of wine was genuine, that there's very little of the 2009 red left, and that it's only available in the UK to the restaurant trade.

So, if you want to get a bottle as a souvenir or Christmas present for the designer in your family you'll have to persuade a restaurant to part with the bottle.

Thursday, November 17, 2011

The Lack of Affordance Problem

Yesterday, I complained about the lack of an eject button on an Apple USB DVD drive. That design philosophy problem goes much deeper than just a single drive. It pervades Apple products, and, although I love them, it drives me spare!

If I could say one thing to Jonny Ive it would be: "In designing to make the every day use of Apple's products a wonderful experience you're missing the moment when your users need you most. It's when everything goes wrong that the user needs the maximum help. It's in those moments (of despair) that a well designed product will surprise and delight the user."

The DVD drive is an example of the opposite. When it's working it's lovely to look at, but when it goes wrong it's as enigmatic as the 2001 monolith.

The mystical incantations necessary to remove the DVD from the drive (such as the hold down the mouse button while rebooting your machine) have to be passed on from the Apple elders in secret whispers (or found by a desperate Google search). Surely, there's a better way? The DVD drive could have had a discreet eject button. And Apple software could be better.

Take the MacBook Air. If it's gone wrong and I need help I'm going to need the serial number. How do I get it? There are (at least) two ways. First it's printed on the bottom of the machine in tiny type printed in almost the same colour as the case. It's as if the designer wanted to make it hard to read. For goodness sake it's on the bottom of the machine, it wouldn't have killed you to use bigger type, or a different colour.

The second way is in software. But knowing that requires more mystical knowledge and reveals something truly nasty. Here's the dialog you get by clicking Apple -> About This Mac.

If you click on the grey text that says Version 10.6.8 the text changes, first to the build number and then to the serial number. There's is no indication that this will happen. The cursor doesn't change, it's normal text that the user wouldn't expect to see change like this. (You can also click More Info... to get the System Profiler where you can find the same information).

Why do this Apple? Why not let me know this is clickable? What's needed is an affordance. Something that lets the user know that this is interactive, that leads the user to the right action.

This situation gets worse with touch screens. Because there's no 'hover' possibility you are left guessing which inscrutable user interface element might be interactive, or what gestures are possible.

I swear that one day the iPhone will do something interesting if you take the Tai Chi "Carry Tiger to Mountain" position.

And don't even get me started on the abomination that is the Apple keyboard USB extension cable fiasco which is a USB cable with a special little indentation in the USB plug so you can't use it for anything else. That just feels like that designers sat around laughing at the purchaser.

And then there's the problem of video connectors.

PS A commentator on Hacker News pointed out that the USB specification prohibits extension cables and so although millions of the things exist, Apple probably did the right thing by making the extension a non-USB cable.

Wednesday, November 16, 2011

How to forcibly eject a CD/DVD from a MacBook Air USB SuperDrive

So you've got a DVD stuck in the external USB SuperDrive that connects to the MacBook Air? And you've tried hitting the magic Eject button on the keyboard to no avail?

And you've tried drutil tray eject at the command-line? And you've tried booting with Option held down and clicking eject? And you've tried plugging the drive into other machines (Macs, Windows PCs, Linux machines) to no avail?

What do you do?

Clearly you hit the physical eject button, right? Every DVD drive has one of those. On the SuperDrive you first look for it on the front:

Hmm. Nothing there. Perhaps it's one of those pinhole things on the back.

Or on one side:

Or, heart in hand, the other side:

I know, I know. Jonny Ive hid it on the bottom out of sight, right? It's so obvious now. Put a pinhole on the bottom where it will only be seen when needed. Form and functionality in one. Sleek lines when in use. An accessible emergency button when needed. Genius.

Nope. But, phew, at least there's an Apple logo there. I was beginning to worry.

So, the easy procedure for removing the disk is as follows. First you pry open the case with some thin available tool:

Then you remove the six screws holding the drive into the case:

Then you turn the drive over in anticipation of seeing your DVD only to be thwarted by another cover and a set of screws:

And then, finally, you peel back the cover to see your DVD and remove it.

Once reassembled the drive complains about the missing disk and promptly goes back to working normally.

And then you wonder to yourself. The drive inside the case is a Sony NEC Optiarc AD-5630A. And every other drive that Sony sells has a physical eject button, even the slot loading ones. Did Apple hide it? Did they ask Sony to not provide a button? I'm guessing that the Cypress Semiconductor microcontroller inside there knows all about doing an emergency eject.

Of course, you stop worrying about that and wonder how the cable has managed to fray on this barely used drive:

PS Some people have pointed out that there may be a secret lever inside the drive accessible from the front by sticking a thin screwdriver inside. I can't find any reliable mechanism (although jamming the DVD in place using a wad of paper and rebooting does work).

Sunday, November 13, 2011

Back from the dead with a power supply repair: my BBC Micro Model B

A couple of weeks ago I plugged in my BBC Micro Model B and it went up in a plume of smoke.

Unfortunately, the 30 year old machine had undergone one of the most common failures. A capacitor that had been sitting there all these years failed, burst open, emitted smoke and leaked all over the circuit board.

Today, I repaired the damage. This blog post is for anyone who faces the same thing.

To fix the damage I replaced three capacitors that are likely to die over time (including the one that had burst) using a kit costing £2.70 from this site and a copy of the BBC Microcomputer Service Manual.

The kit has one electrolytic capacitor (which is polarized and has to be inserted the right way round) and two ordinary capacitors which can be inserted in any way. The three capacitors to be changed are marked C1, C2 and C9 on the circuit board. On my machine it was C2 that had failed.

The first step is to remove the power supply from its case. This is carefully described in the service manual (including two cable ties that need to be cut and replaced). Here's the supply without its case. I've marked the three capacitors to be replaced.

And here's the reverse of the circuit board (clearly hand soldered) and I've marked the six joints that have to be desoldered. I used my normal soldering iron and a solder sucker to remove all three capacitors.

And here's a shot of the three capacitors after they've been removed with a close up of the ruptured C2.

With the capacitors removed you can see the capacitor juice that had leaked onto the PCB. I cleaned it off with some alcohol and Q-tips. You can also see that C2 actually had four holes drilled for it. Two were used for the supplied capacitor and the other two are used in the repair as the new capacitor has leads that are slightly closer together (good of Acorn to plan 30 years ahead!).

Soldering the three in is not hard (make sure the electrolytic is the right way round). Here's my finished circuit board:

And the reverse side showing the three new capacitors in place:

And here are the two cable ties that need to be replaced. One holds the low voltage cables going to the main PCB in place (it's attached to the power supply casing), the other holds the mains cables in place (it's attached to the power switch).

And putting it all back inside the case... it works!

Monday, November 07, 2011

Turning GE Color Effects G-35 Christmas Lights into a 7x7 display with Arduino

Some time ago I saw some GE Color Effects G-35 Christmas lights and was fascinated by the combination of color patterns that they were capable of and the fact that they only had three wires. That meant that something digital was going on.

Happily, a chap called Robert Quattlebaum did the hard work last year of hacking these lights to reveal that they are linked by a simple self-clocked serial protocol that can easily be driven by a microcontroller. That blog post gives the full details of the protocol.

Each lamp can be set to a specific brightness and an RGB color (4 bits per color). And the protocol is clocked at 30µs per bit so it's possible to refresh the entire 50 LED string at a rate of 24Hz. Perfect for hacking fun.

So I got a set and plugged them in just once (still in their packaging) to check that they worked. Here's a video of the lights getting their one real work out before the soldering iron got to them.

The first thing I did was remove the lovely plastic blub covers (these are being saved to brighten up a simple set of Christmas lights) to reveal the LED inside. This picture shows all three states: one has the original plastic cover on, the one in my hand has it removed but the plastic base intact, the bottom one is the naked LED and controller.

Once you've ripped off the protective plastic you are down to a simple LED with three wires going in (+5V, Data and GND) and three coming out. With 50 of these on a string I decided to make a 7x7 display (with one LED 'spare' should I break one).

Here's the finished display. The entire chain of lights has been cut up, mounted, resoldered and is now controlled by an Arduino Pro. All that's needed is a 5V power supply to plug into the power socket.

It's controlled by a small piece of Arduino software that contains a simple frame buffer implementation, code to implement the LED protocol via bit banging, code for scrolling text and for making faces. You can get the source code here. The key file is protocol.cpp which initializes the display and allows simple setting of the color and brightness of each LED. The most interesting part of that code (at least to me) is the initialization of the LED addresses. On power up the LEDs wait to learn their 6 bit address. They wait in turn and have to be programmed for use. I exploit this to make addressing them easy:

To build this I first cut up the entire string of lights to get just the LEDs with a small amount of cable attached to each. Then I prepared a piece of plywood, marked it up, drilled guide holes and then drilled the 49 mounting holes for the lights.

Then I glued in place each of the lights taking care to orient them for easy soldering into the chain. Then just 144 solder joints and little bits of heat shrink later I had the chain reattached and capable of being driven by the GE supplied controller.

The next step was some sort of opaque diffuser to put in front of the display. For this I used a cutting board that I cut to the right size. With the board in various positions it's possible to get different diffusion effects.

The final step in the hardware was to get a picture frame made to measure (I got a cheap, but deep, one in simple white wood from these folks) and then stuck the cutting board inside, used some old nylon nuts as spacers, mounted the LED board and finally used a piece of MDF that was supplied with the frame as a backing. The back is fixed on using some parts from an old servo.

Electronically this modification to the original lights was pretty simple. Having eliminated the original power supply and controller all that was needed was a new controller in the form of an Arduino Pro and a 5V power supply. The supply provided with the lights gave 5V at 3A (which seemed at lot). I measured the actual power usage and the highest current seen was 1.68A with all LEDs on white at maximum brightness. Thus I used an off-the-shelf power supply for the lights (plus Arduino Pro) capable of providing 2.25A.

The Arduino Pro is screwed to the back of the picture frame and there's only one component added: a 10K pull down resistor between GND and pin 7. Pin 7 is driving the serial data through the LEDs and it is low when not being driven with data. You can see that here:

If you're eagle-eyed you might have spotted a capacitor as well. I got this Arduino Pro free because it had a manufacturing fault and I repaired it using an old capacitor that I'd desoldered from the control board of a dead toaster. In that photo the Arduino Pro is connected via an FTDI cable for programming.

The other slightly tricky thing with this project was getting the timing of the serial protocol right. The simple serial protocol uses alternating high/low pulses of 20µs and 10µs (or low/high). In protocol.cpp I've made use of C #define statements to inline code for speed and also third-party code for fast changes to the I/O ports and accurate delays.

When working on this I used the Salae Logic analyzer to view the actual serial protocol in action. Here are two screen shots. The upper one shows the standard GE controller sending the initialization packets to the each of the LEDs in turn (with a gap of 40ms between them), the lower one shows a zoom into a specific packet being sent.

Finally, here's a video of the complete unit running through a simple "Hello World", followed by a few facial expressions and finishing with a "Thanks GE" for such a nice hackable string of Christmas lights.

PS If anyone from GE is reading this... how about making a 220V version of these? All you need to change is the wall wart to one that does 110-220V and you'd have all us Europeans interested in these lights.

PPS Other Arduino-based projects you might enjoy: GAGA-1: High Altitude Balloon Project and Cansole: Video games console in a can. Other non-Arduino projects: Revealing the secrets of the Ikea Lillabo wooden train set and Building a 'Ponyo' boat.

Tuesday, November 01, 2011

My BBC Micro Model B and a plume of acrid smoke

So, after yesterday's post about The Demon Machine I decided it would be fun to play around with the BBC Micro Model B and so I plugged it in and powered up. The familiar two-tone boot sound played and the machine was on.

About 15 minutes after power up there was a fizzing, popping sound from the computer and I ran to cut the power. Too late! A plume of blue/grey acrid smoke poured out of the left hand side of the machine right by the power supply.

I cut the power and moved the machine away from anything that might burn quickly and waited for the smoke to stop. It quickly dispersed and so I did the only thing a self respecting software engineer would do... I decided to turn it back on again.

But not without opening the power supply so I could take a look inside while it was running. Here's the PSU open after the fire:

Warning. I don't recommend that you do this sort of thing yourself. There are high voltages there, plus a bunch of electrolytic capacitors that can do nasty things if they feel like it. I was doing this while wearing my safety glasses.

You'll notice that there doesn't seem to be anything burnt in the supply and when I powered on the machine worked perfectly. Close examination shows that one of the capacitors used for power supply filtering had cracked open and burnt up.

If you look carefully you can see the cracking on the case of the capacitor and fresh capacitor juice running across the circuit board (most visible on the top photograph). A quick Google tells me that this is one of the most common failures on the BBC Micro power supply and easily repaired.

It's interesting to note that the capacitor used is rated by safety agencies because of the potential for failure leading to a short at mains potential and the metallized film is designed to self heal or fail safely. The device is also meant to fail safely at a peak potential of 2.5kV without burning with a flame.
EN132400 (IEC384-14): Active Flammability

The capacitor under test is connected to rated voltage through a transformer and filter. 20 transients are then introduced across the capacitor at random intervals while rated voltage remains applied. The amplitude of the transient is dependent on the class of capacitor. The capacitor may not flame during this test.
Not often you get to see an international safety standard take effect.

Here's the power supply circuit diagram.

The dead capacitor is C1 which sits right across the mains power input. Looks like I'll be getting the soldering iron out once the replacement part arrives.

Making an old USB printer support Apple AirPrint using a Raspberry Pi

There are longer tutorials on how to connect a USB printer to a Raspberry Pi and make it accessible via AirPrint but here's the minimal ...