# Dice reader, version 2

The last time we covered this neat die reading machine by Steve Hoefer, he had a very nice design that was starting to be able to determine the number of a die placed on it. Well, he swapped out his problematic photoresistor sensors for an infrared emitter/detector-based scheme to produce version 2, which he claims works with almost perfect accuracy. Another feature he added is to display the complement of the sensed number, so that the display shows the same number as the top of the die.

I find this project especially interesting because of the homemade sensing apparatus. Instead of going with a full-blown computer vision system to solve this problem, he used a bunch of simple sensors in a creative way, and was able to build the whole thing using a low-power microcontroller. In fact, his solution reduces the problem so well, that even the microcontroller could be eschewed for a straightforward set of logic gates. Anyone up for that project?

Challenge: Steve determined that he needs to look at five ‘pip’ (black dot) locations to uniquely identify each number. Can you explain why? Are there any other arrangements of five sensors that could work? Remember that each number could physically be rotated to four different positions, and you need to detect it no matter how it is stuck in. Answer on Monday.

The first question is why you only need to look at five ‘pip’ locations. Rather than brute-forcing the whole solution (trying every answer until we find one that works), let’s start by looking for some geometric relationships to make the problem easier.
Lo and behold, it turns out that each die face exhibits a 180 degree rotational symmetry, which is a fancy way of saying that if we turn it halfway around, we get the same arrangement of dots that we started with. This is nice, because it means half of the spaces are exactly the same as the others, so they can be eliminated because they are redundant. Now, we can’t get rid of exactly half, because there are an odd number of squares, but it knocks off 4 right off the bat. A quick inspection of the remaining five squares shows that they are all necessary, because if any of them are removed, two of the numbers would be indistinguishable.
Just for kicks, we can verify that a die face rotated 90 degrees will still be uniquely distinguishable. It turns out that 1, 4, and 5 also exhibit 90 degree rotational symmetry, so they still look the same. Numbers 2, 3, and 6 do change, so they look different, but are still unique.

The second question was whether any other sensor arrangements would work. The answer to this is yes, because each sensor point could be rotated 180 degrees and see equivalent data. I count four unique sensor arrangements (the others are just rotated versions of these). So there you have it!

Discuss this article with the rest of the community on our Discord server!
Tagged

### Matt Mets

View more articles by Matt Mets