error handling in baby toys

This commit is contained in:
Wouter Groeneveld 2024-04-01 13:14:59 +02:00
parent c1d7fa45eb
commit 55762e2a65
3 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,47 @@
---
title: "Error Handling in Baby Toys"
date: 2024-04-01T10:36:00+02:00
categories:
- 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?
![](../clementoni.jpg "The Clementoni puzzle board, with four buttons clearly visible in the orange part in the center. Note the recesses in the plastic pieces.")
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 `1`s 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](https://www.vtechnl.com/onze-merken/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.
![](../vtech.jpg "The VTech water fun play center, with two figurines upside-down (left; green) and three figurines on the right. Note the switches in the orange round section on the lower left that identify these pieces.")
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 `1`s, 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...

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB