2023-07-27

The Easter Egg that wasn't in Mission: Impossible – Dead Reckoning Part One

There I was quietly minding my own business watching Mission: Impossible – Dead Reckoning Part One when who pops up on screen? None other than Polish actor Marcin Dorociński playing a character who is simply known as "Captain". He's (SPOILER ALERT!) the captain of a secret Russian submarine called the Sevastopol and runs into trouble with a rogue AI.

But I'm not here to talk about rogue AIs; I'm here to talk about chess. Because Marcin Dorociński also played the Soviet chess world champion Vasily Borgov in the series The Queen's Gambit

And right there in the control room of the Sevastopol is a chess set. We get a few seconds glimpse of it as "Captain" snatches up a microphone to speak to the crew. The chess set has the pieces laid out for a game that's in progress. "Aha!", I thought, "This must be a neat little Easter Egg linking these two recent Dorociński roles."

Alas. Here's the chess board from Mission: Impossible.


(Note that the board appears to be mirrored and I've unmirrored it below).

How I was hoping for the chess board to be showing the final positions of Borgov vs. Harmon's final match. Unfortunately, this is the state of the board on the Sevastopol right before (SPOILER ALERT!) they get hit by one of their own torpedoes.

Maybe this began as a fianchetto but not sure what happened after that.


(rnbqk2r/p1p1pp1p/1p1p1npb/8/8/1P1P1NP1/PBP1PP1P/RN1QKB1R w KQkq - 2 6)

No wonder a rogue AI got the better of them.

2023-07-18

Revisiting the "Cansole", my silly Pong game, because my TV doesn't have the right connectors

Back in 2011 I put together an implementation of Pong that uses an Arduino Pro, a couple of resistors, a couple of potentiometers, and two sweet cans from M&S. I called it the Cansole: video game console in a can. Just a silly weekend project.

Recently, someone asked to try it out and I retrieved it only to find that my TV doesn't have composite video inputs, only HDMI. The Cansole creates a black and white 128x96 PAL composite video image in software using a project called TVout. So, I ordered a composite to HDMI converter and while waiting for it to arrive decided to refresh my memory about how the video circuit (which is two resistors!) works.

In the image above you can just make out that the video signal is provided from two digital pins on the Arduino fed into two resistors that connect to the RCA connector for composite video. Here's the schematic of the whole thing:


The video signal is created on pins 7 and 9 which are connected to two resistors (470 ohm and 1k ohm) which connect to the pin of the RCA connector for the composite output. To understand how that works it's worth delving quickly into composite video. 

Here's a look at two lines in a PAL composite video signal. There are three parts: line sync (telling the TV that a new line is starting), colour information (which we won't have since TVout only does black and white), and brightness information (we'll be using just black and white with no in between).


Composite video uses a signal that varies between 0V and 1V. Since we only need line sync (which is 0V), black (which is roughly 0.3V) and white (which is 1V), the Arduino needs to generate three different voltages. It does this using different settings of pins 7 and 9. Each pin can either be 5V or 0V. 

Here's what the different combinations give on the pin of RCA connector when it is disconnected from the TV.

    Pin 7 (470 ohm)   Pin 9 (1k ohm)    Voltage
    5V                5V                5V
    5V                0V                3.4V
    0V                5V                1.6V
    0V                0V                0V

The case where pins 7 and 9 are both 5V or 0V are boring: the pin of the RCA connector will be 5V or 0V. But the other two cases are more interesting. These are calculated be seeing that the two resistors form a voltage divider and the standard voltage divider formula can be used. 

Forget for a minute that these are not the values that we want for composite video (we'll get to that in a minute, but remember I said that this was when the RCA connector was disconnected). To make it a little clearer to see, here's a diagram just showing that the two resistors form a voltage divider with pins 7 and 9 determining which side is 5V and which is 0V.


Let's take a look at the waveform being generated by the Cansole by hooking it up to an oscilloscope. Here I've captured four line syncs. The first one is followed by no information at all (the line is entirely black), the second one has a bunch of brightness information (which you can see is either black or white).


The oscilloscope is telling us two things. Firstly, the time between line syncs is 64 microseconds giving a line sync frequency of 15.6kHz (the actual composite signal is 15.625kHz for PAL). Secondly, the peak to peak voltage is 5.16V (which seems to confirm the range of voltages) from the table above.

So, the signal looks like composite with the wrong voltages. How come?

Well, that's because it's disconnected. When it's connected the input impedance of the TV comes into play (and the impedance of the cable connecting the two, but I am going to ignore that). For standard composite the input impedance is 75 ohm. If you were to measure the composite input of a TV you should find 75 ohms. Here I measured the input to the composite to HDMI converter I'm using.


So, effectively there's a 75 ohm resistor across the video input when connected. The circuit would now look something like this.


So, when a pin is at 0V (and the other at 5V) the input impedance of 75 ohm is in parallel with that pin's resistor. 

Imagine that pin 7 is 0V and pin 9 is 5V. So the 75 ohm resistor and the 470 ohm resistor will be in parallel. That's effectively a resistance of roughly 65 ohms. So, the voltage divider that was 1k ohm and 470 ohm is now 1k ohm and 65 ohms. That means a very different output voltage will be created. Using a voltage divider calculator that says that the voltage will be 0.3V (perfect for black!).


When pin 7 is 5V and pin 9 is 0V the situation is reversed. The 75 ohm resistor is in parallel with the 1k ohm resistor which gives an effective resistance of roughly 70 ohms. And again using a voltage divider calculator we find that the composite voltage will be 0.7V (which could be grey).


Now what happens if both pins 7 and 9 are 5V? Now there's yet another voltage divider created. The 1k ohm and 470 ohm resistor are now in parallel with an effective resistance of 320 ohms. That resistance forms a voltage divider with the 75 ohm input impedance. Hence the video voltage will be 0.95V (very close to the 1V needed for pure white).


    Pin 7 (470 ohm)   Pin 9 (1k ohm)    Voltage
    5V                5V                0.95V
    5V                0V                0.7
    0V                5V                0.3V
    0V                0V                0V
 
So just with two resistors and two output pins its possible to create the voltages necessary.

As a final test let's try this under load. Here's the oscilloscope trace with the Cansole connected to the composite to HDMI converter.


The peak to peak voltage is now close to the 1V needed for composite. Each horizontal line represents 200mV so you can see the line sync being about 300mV below the black line (recall that line sync is 0V and black is 0.3V) and the peak of white is about 700mV above black (which would be white at 1V).

Ok, enough analyzing, let's play Pong in a can. 


Shout out to the designers and makers of the little Chinese composite to HDMI adapter I bought. Their little gadget coped very well with my messy PAL composite signal!

2023-07-17

Is it hard to design a mute button or something?

Here's what a muted Google Meet call looks like on CarPlay


and here's what unmuted looks like.


1. The "End" and "Add Call" buttons have actions under them. If I press them the call will end, or I will be able to add a call. The mute button is not an action, it's just a name for the button. The name does not change if the call is muted or unmuted.

2. The mute icon doesn't change. At all times it shows a microphone with a slash throughout to mean "a microphone that is disabled/switched off/muted".

3. To know if the microphone is muted you have to see whether the button itself is white vs. grey. White indicates "mute is activated" and grey "mute is not activated". 

4. Muting is the absence of something: your voice being transmitted but the design here make you think of a positive to get the negative. It's not "the microphone is muted", it's "the mute function of the microphone is activated". 

5. You can easily interpret the button states as the opposite: white could mean "you are unmuted/microphone is active" and grey could mean "you are muted". 

A terrible interface.

And here's what muted looks like in the app. on my phone


and here's what unmuted looks like.


Here the icon changes form as well as colour. Two different user interface experiences for the same function. The app. version is much clearer. 

It's time for an ISO mute button standard! This is such a critical function (and muting speakers too) that it should be clear and unambiguous.


2023-07-10

Unfortunately, Kelly Rowland couldn't have used the =HYPERLINK() function to message Nelly

The Kelly Rowland/Nelly song Dilemma features an infamous scene amongst nerds where Kelly Rowland tries to send a message to Nelly using a Nokia 9210 Communicator (like this one that I just happen to have to hand):

Unfortunately, she does this using the built in spreadsheet program and receives no reply.

Recently, a TikTok indicated that she might have been using the Microsoft Excel =HYPERLINK() function to create a mailto: link to send email to Nelly. 

@xlninjadan Kelly Rowland in Dilemma by Nelly is finally justified for using Excel on her Nokia flip phone! #exceltips #xlninjadan #nelly #nellyiloveyou #kellyrowland #excel ♬ original sound - Dan Strong

Sadly, this clever idea isn't possible. 

The spreadsheet built into the Nokia 9210 Communicator isn't Microsoft Excel (although it can read and write Excel compatible files), it's something call Sheet, and it doesn't have the =HYPERLINK() function.

Filed under "well... actually".

2023-07-05

How to beat an adaptive/Bayesian spam filter (2004)

That was the title of my talk at the 2004 MIT Spam Conference on January 16, 2004. As I recently recovered the slides I am creating this blog for posterity.

The core of the talk was that it was possible to take one machine learning spam filter and use another identical one to learn the characteristics of the other. That way one machine learning system would fight spam and the other would automatically identify the other's weaknesses. Thus a machine learning algorithm could learn how to write spam that would get through a tuned machine learning spam filter. This is now referred to as "Adversarial Machine Learning".

The talk also point out that spammers were trying a technique dubbed "Word Salad" to include random words to try to evade filtering.

Slides are here as a PDF and embedded below as images.