brainbaking/content/post/2024/04/error-handling-in-baby-toys.md

5.0 KiB

title date categories
Error Handling in Baby Toys 2024-04-01T10:36:00+02:00
braindump

Electrical baby toys are interesting to disassemble and look at how it's made. Not up to the point of screwing out the PCB, decapping the chips and trying to reverse-engineer the ROM---I'm sure that's interesting too---but just on a basic mechanical level. Companies like VTech and Clementoni apply simple but clever techniques for their systems to provide just enough variation while keeping the production costs low.

Consider the Baby Clementoni puzzle farmer themed laying board game. The board is divided into four sections, where our toddler can place three plastic blocks in their correct respective place in and around the farm. It's just the plastic mold that keeps the puzzle pieces in place. But these pieces can also be inserted into the central mechanism that'll emit a charming sound, identifying the piece: if our daughter manages to insert the cat piece, it'll say miauw, and if that was the bird, you'll hear chirping. How does it do that?

The central system simply registers switch presses. It comes with 4 small switches, and the bottom size of the plastic puzzle pieces are cut out in a way that it'll press a certain combination of those switches. That means there are 2^4 or 16 possible combinations. But wait! There are only 12 puzzle pieces. Does that mean you can buy an expansion? We categorized each puzzle number and came to the conclusion that there are three unregistered binary combinations:

Binary Puzzle Piece
1100 Cow
1011 Rabbit
0010 Cat
0100 Rooster
1110 Frog
0101 Chicken
0110 Horse
1000 Farmer
1010 Sheep
0011 Bird
0111 Duck
0001 Dog

Then there's of course 0000 which shouldn't trigger any sound since it's the default state, meaning we're left with 1111, 1001, and 1101 as unassigned ones. Would pressing that combination of switches crash the whole thing? Nope! Clementoni's engineers were smart enough to "catch" that error: triggering one of the unknown states by forcing a combination with your fingers emits a bloop followed by a voice saying "uh-oh!". It made me laugh---good catch indeed!

You have to design these things a bit more robust: a baby or toddler mashing in plastic pieces without care in practice means our cow regularly sounds like the rooster, and our dog like the chicken: sometimes, the switches are stuck, and sometimes, the plastic pieces trigger 1s next to the ones they're supposed to trigger. In that case, having a fail-safe "uh-oh" seems like a good idea.

VTech uses this unique-combination-of-trigger mechanism in many of their products: on their Zoef Zoef Dieren animals, cars, and water amusement park. That last one is more interesting, as the figures are round, meaning the plastic notches at the bottom pressing the buttons to identify the figurine have to take rotation into account. A 010010 and a 100100 and a 001001 produces different numbers (18, 36, 9), but it's the same little hippo.

Bit rotation can be implemented using a combination of bit shifting and or operations, and on a hardware level, with different locical XOR ports. That's of course just one way, and you still need a way to identify the number without confusing it with another figure. Although I don't think that last was implemented: if you select your starting bits in a smart way, there won't be any overlap. The identification system here uses 14 bits, and all of the figures have either 6 or 7 1s, making it even possible to completely ignore bit rotation and just rely on the relative position of the enabled bits to do the identification. I'm of course merely guessing at this point.

The VTech animals of the zoo and farm emit a different sound based on the position where you put them in the zoo/farm. For example, before their feed tray, on the track itself, small plastic notches again press on the switches below the animals on wheels, triggering the correct "I love corn, yummy!" reaction.

Until you go off track, or the track breaks, that is.

So what happens when you press an unknown combination of buttons on VTech toys? Unfortunately, nothing. What a letdown and missed opportunity! Instead of putting in an easter egg like the Clementoni puzzle board, the VTech Zoef Zoef animals, Toet Toet cars, steam train blocks, and wobbly water fun figurines all go silent. Italian versus Chinese humor, perhaps?

That said, this article proves we have way too many battery-powered toys that make noise...