William Hayward

William Hayward

Software Developer

© 2020

Fitting 8 pigeons into 4 pigeonholes

Let’s talk maths for a moment. In particular, the Pigeonhole Principle. https://en.wikipedia.org/wiki/Pigeonhole_principle

The pigeonhole principle is simple. If n items are put into m containers, with n > m, then at least one container must contain more than one item. In plain talk, that means that if you have five pigeons and only four pigeonholes, two of those pigeons are gonna have to be roommates.

Right now, I have 8 pigeons and 4 pigeonholes.

“William, what on earth are you talking about? Has the tension of your looming deadline finally gotten the better of you?”

Thanks for asking, Me In Quotation Marks, but I’m doing fine. What I’m talking about isn’t pigeons - it’s wires. It’s always wires.

In order to interface the dial phone to other technology, there are 8 wires I’m going to need. Two for the dial (power and output), two for the hook (power and output), two for the speaker (data and ground), and two for the microphone (data and ground).

In theory, I can just have 8 wires and it would work - but it would be kind of ugly. Luckily, the phone already has a cable! The cable that connects to the wall.

On the outside, this has 6 metal contact points. Unfortunately though, only 4 of those run through to the phone.

These are my pigeonholes. Now to group some pigeons.

First up, the dial and the hook can share power through the same cable. 7 pigeons.

Next, let’s talk about how audio cables work: By magic. Probably. I’m actually not sure, and I’ve been unable to find any online resources that adequately explain how it works. Luckily, I don’t need to fully understand the mechanics of it in order to utilise it.

In order to get the microphone and speakers to connect with a computer, I’ve been using alligator clips from the relevant contact points in the phone to a double ended 3.5mm audio cable, which is in turn plugged into a computer. Both microphone and speaker have two contacts - data and ground. As an experiment, I tried to see if they could share a ground.

Now, this does work - but with two weird side affects, depending on particulars of how the cables are connected.

The first is that any input into the microphone is routed straight to the speaker. Anything you say is immediately routed back into your ear. This wasn’t ideal, and was honestly pretty offputting, so it was a no-go.

The second was the exact reverse of the first: Any audio played out of the speaker would be captured by the microphone. The primary side effect of this is that recording and playing audio simultaneously is impossible. This would be unusable for a phone call, but the automated nature of the Social Dial means that audio is only ever recording or playing - not both. So that was neat and convenient.

At the end of that, if both audio connections share a ground that puts us at 6 pigeons. And still only 4 pigeonholes. I blame the 1985 Perth Engineering Workshop for only wiring up 4 of the 6 contact points in the phone cable. Sure, they were just “doing their job” and “following international phone standards”, but it’s made this very inconvenient.

Okay, 6 pigeons. 4 pigeonholes. 6 pigeons. 4 pigeonholes. We can do this.

There’s an old adage: What goes up must come down. Before we can remove some pigeons, we might have to add a few in.

If I house an Arduino Mini in the case of the phone, I can use its Serial TX port to send the hook AND dial data. The drawback of this is that I need to connect 5v electricity and ground to the inner Arduino. So that’s still 6 pigeons, but don’t worry - we’ve got this.

I was playing around, and the inner Arduino can share the ground with the audio. This introduces a little bit of noise, but not an unmanageable amount. We’re down to 5 pigeons - 5v, Ground, TX, Microphone, Headphone.

Now let’s get janky.

There’s a great YouTuber called Tom Scott, who does interesting videos on everything from the history of computer viruses to a massive keyboard he made which could type any Emoji that was available at the time. For the Emoji keyboard, he also produced a 17 minute video discussing his methodology. It’s called The Art of the Bodge, and I really like it. https://www.youtube.com/watch?v=lIFE7h3m40U

This next bit is honestly pretty bodgy. See, there’s one last pigeon optimisation left. I can connect the TX port to the microphone. I’ve run some preliminary tests, and there IS interference, but only if both are active at the same time. Luckily, there’s no reasonable situation with The Social Dial in which someone would need to dial/use the hook at the same time as the microphone.

4 pigeons.

4 pigeonholes.

I haven’t tested it all to completion, but each individual segment has worked fine.

Now I’m gonna go have a nap.

WillHay out.