Tamagotchis are keychain virtual pets. They communicate (“visit each other”) over IR. For the past few weeks, I’ve been trying to listen in on and understand this communication.
To start, I set up a liteon IR module to listen in on the transmission, and recorded the ouput with some help from DW and his digital signal analyser.
Plotting the signal, you can see a request and a response:
Looking more closely at the request:
Googling a bit, this appears to be similar to NEC encoding, athough the periods of the bits are stretched out (in normal NEC encoding, 0 is a cycle of equal size, 1 is a cycle that is low twice as long as it is high. In this case, 0 is marked by a cycle that is low twice as much as it is high and 1 is marked by a cycle that is low four times as much as it is high. Note that the graph above has 1 and 0 inverted, a feature of the IR receiver.) The main point is that if you look at the graph, there are some waveforms that are squished together, and those are zeros. The ones that are spaced out at ones.
Assuming this, it is easy enough to write a Python script that extracts the bytes of the request, which are:
ac 00 26 d6 0e 01 0e 01 00 01 33 87 00 00 33 c0 0b 00 00 ff 01 ff ff 7d
Looking at this, there are bytes in the same pattern as my Tamagotchi’s name (Nana):
ac 00 26 d6 0e 01 0e 01 00 01 33 87 00 00 33 c0 0b 00 00 ff 01 ff ff 7d`
Note that 0x0e = 14 and ‘N’ is the fourteenth letter of the alphabet. So 1, 14, 1, 14 could represent the name Nana.
Trying this with a Tamagotchi named Anna gives the following output:
ac 00 39 d6 01 0e 0e 01 00 00 34 87 00 00 20 80 8 00
so this is almost certainly the case.