Skip to main content

Toy decoding: vtech Push and Ride Alphabet Train

So, it's Christmas and you end up visiting people with kids... and they've got a fancy new vtech Push and Ride Alphabet Train. Now, you're the world's worst child minder because you see it and think: how does that work?


Specifically, when you insert one of the 26 alphabet blocks into the side of the train how does it know to say the correct letter? And how does it know which side (letter or word) is facing outwards (so it can say a letter or a corresponding word: "A is for Apple" etc.).

Now it quick examination shows that there are 6 small switches in each block receptacle and that each block has corresponding bits of plastic and holes to make different binary patterns. The top bit (bit 5) seems to be used to indicate which side of the block is showing.

That leaves 5 bits for the alphabet. Of course that means there are 32 possible combinations (actually 31 since 'block not present' indicated by all switches up is important), and 26 letters in the alphabet. So which 5 binary combinations are not needed for the alphabet and what do they do?

First here's the mapping between letters and their five bit patterns. Here 0 = button is depressed by little sliver of plastic, and 1 = button is left up because there's a space in the block.

a 11010 b 00010 c 00011 d 00100 e 00101 f 00110
g 00111 h 01000 i 01001 j 01010 k 01011 l 01100
m 01101 n 01110 o 01111 p 10000 q 10001 r 10010
s 10011 t 10100 u 10101 v 10110 w 10111 x 11000
y 11001 z 00001

As I'm sure you've noticed there's something very odd about this sequence. Letters b through y follow a nice pattern, but what's up with a and z? Here's the same information using decimal to make the problem clear:

a 26 b 2 c 3 d 4 e 5 f 6
g 7 h 8 i 9 j 10 k 11 l 12
m 13 n 14 o 15 p 16 q 17 r 18
s 19 t 20 u 21 v 22 w 23 x 24
y 25 z 1

As you can see it appears that the numbers for a and z are swapped. You'd expect a to be 1 and z to be 26. Now, there could be some clever explanation for this but I'm guessing it's the work of Captain Cock-up.

When I used to write software in a hardware company it was pretty common for there to be mistakes in the hardware design or implementation that had to be fixed in software. I remember one very snowy December outside of Route 128 at an HP works debugging something nasty with an EISA card on which our code was running inside some new HP workstation (pretty sure it was a Series 700 with the native GSC bus and something called the Wax ASIC to provide an EISA bus). Turned out that our hardware wasn't latching things onto the EISA bus with quite the perfect timing that the ASIC needed and corrupt data was hitting the main bus. This is not the sort of thing you want to have happen. The fix was done in software to alter the order of writing (which was done with two 16-bit writes) and a little loop to spin around checking for stability.

So, I bet vtech had a little mistake like that. Somehow the codes for a and z got swapped in software there's a fix.

If you haven't played around with hardware much you might have been surprised that button depressed = 0 (see above). This is actually pretty common because it's typical to connect logic lines going into some logic (especially if it's TTL) to positive 5V (or similar) with a pull-up resistor.

In TTL logic an unconnected pin will float around and try to be high, and so most designers ensure that it is actually high with a pull-up. Then to change the input you connect the input pin to ground via your switch (with no resistance). Thus the input is normally high (which is typically interpreted as 1) and goes low (normally that's 0) when the switch is depressed.

Here's a typical circuit:


The only disappointed me was that the extra 5 combinations of 1s and 0s don't do anything. I was really hoping for an Easter Egg left by the developers.

Comments

Stephen said…
I've been meaning to decode this for a while: LeapFrog: Tad's Counting Farm Smart Block Book

No easter eggs again, but it uses an extra bit than actually required. I think the numbers have been used for their pattern:
1 = 0101
2 = 1010
3 = 1001
4 = 1100
5 = 0011
6 = 0110
Simon Zerafa said…
Hi,

Could the a=26 and z=1 simply be a deliberate mistake to catch out pirates?

Anyone who simply copies the hardware and duplicates the toy would then have to explain why this odd choice was used.

This is the same technique as the deliberate mistakes in log tables or on maps to catch copy-cats.

Kind Regards

Simon Zerafa
Jim M. said…
Does this reverse engineering leave you open to prosecution under the DMCA?

Looks like fun anyway, so here goes:

LeapFrog: Fridge Phonics

6 switches 1 = pressed 0 = not

A 010001 ;Skipped 010000
B 010010
C 010011
D 010101 ;Skipped 010100
E 010110
F 010111
G 011001 ;Skipped 011000
H 011010
I 011011
J 011101
K 011110
L 011111
M 100001 ;Skipped 100000
N 100010
O 100101
P 100110
Q 100111
R 101001 ;Skipped 101000
S 101010
T 101011
U 101101
V 101110
W 101111
X 110001 ;Skipped 110000
Y 110010
Z MIA Unknown

It seems to have an aversion to XXXX00. It probably needs bit 0 or 1 to activate the device.

cheers,
MLW said…
I don't know about other products, but when I programmed video games for young children, putting in Easter eggs was probably the quickest way to lose any future contracts (assuming they were discovered, of course). The designers might be far too cautious to even put a benign surprise inside :). But I'd love to hear about any examples out there if you know any.
Anonymous said…
We just got the Fridge Phonics today, and I was wondering at the odd encoding (skips) as well.
I'm kind of disappointed that the unused bytes aren't programmed for something like foreign letters. I'd be more than happy to make my own tiles.
Rainbow said…
Great post!

Popular posts from this blog

Your last name contains invalid characters

My last name is "Graham-Cumming". But here's a typical form response when I enter it:


Does the web site have any idea how rude it is to claim that my last name contains invalid characters? Clearly not. What they actually meant is: our web site will not accept that hyphen in your last name. But do they say that? No, of course not. They decide to shove in my face the claim that there's something wrong with my name.

There's nothing wrong with my name, just as there's nothing wrong with someone whose first name is Jean-Marie, or someone whose last name is O'Reilly.

What is wrong is that way this is being handled. If the system can't cope with non-letters and spaces it needs to say that. How about the following error message:

Our system is unable to process last names that contain non-letters, please replace them with spaces.

Don't blame me for having a last name that your system doesn't like, whose fault is that? Saying "Your last name …

Importing an existing SSL key/certificate pair into a Java keystore

I'm writing this blog post in case anyone else has to Google that. In Java 6 keytool has been improved so that it now becomes possible to import an existing key and certificate (say one you generated outside of the Java world) into a keystore.

You need: Java 6 and openssl.

1. Suppose you have a certificate and key in PEM format. The key is named host.key and the certificate host.crt.

2. The first step is to convert them into a single PKCS12 file using the command: openssl pkcs12 -export -in host.crt -inkey host.key > host.p12. You will be asked for various passwords (the password to access the key (if set) and then the password for the PKCS12 file being created).

3. Then import the PKCS12 file into a keystore using the command: keytool -importkeystore -srckeystore host.p12 -destkeystore host.jks -srcstoretype pkcs12. You now have a keystore named host.jks containing the certificate/key you need.

For the sake of completeness here's the output of a full session I performe…

More fun with toys: the Ikea LILLABO Train Set

As further proof of my unsuitability to be a child minder (see previous post) I found myself playing with an Ikea LILLABO 20-piece basic set train.


The train set has 16 pieces of track (12 curves, two straight pieces and a two part bridge) and 4 pieces of train. What I wondered was... how many possible looping train tracks can be made using all 16 pieces?

The answer is... 9. Here's a picture of the 9 different layouts.


The picture was generated using a little program written in Processing. The bridge is red, the straight pieces are green and the curves are blue or magenta depending on whether they are oriented clockwise or anticlockwise. The curved pieces can be oriented in either way.

To generate those layouts I wrote a small program which runs through all the possible layouts and determines which form a loop. The program eliminates duplicate layouts (such as those that are mirror images of each other).

It outputs a list of instructions for building loops. These instructions con…