When the visitor has chosen a color using the Wheel of Fortune, we still need to couple it to a ticket number. Of course, we can ‘by hand’ read the ticket number and enter it using a keyboard to the PC application. But since we already have a ticket reader to open the locker at the end, it would be even more nice to read the card by a ticket reader. And even better if the card would be dispensed automatically.
Due to the lack of time (Lego World is already in four weeks), we decided to start building with the reader part. In the picture below you’ll see the result:
The ticket looks as follows:
But how is the number ‘687’ read by three color sensors? Well, instead of a ten-digit based number, we use a four-color based number system.
The card contains three rows of colors and a decimal number. When the ticket is fed into the reader, the colors are read by the three color sensors. The colors represent a number in the 4-digit system: blue (0), green (1), yellow (2), red (3). In the previous picture, the first row contains the number: 0 x 45 + 2 x 44 + 2 x 43 + 2 x 42 + 3 x 41 + 3 x 40 = 687. The third row contains a so-called CRC check (Cyclic Redundancy Check) for the numbers of the first two rows (for the digital fans: it is based on a binary OR):
By this means, we can detect if a color has been misread. For example, if in the ticket the blue color is read as green, the CRC code should be ‘green + yellow = red’ but the third row of card is yellow, so the reader knows that something is not correct. It is not a failsafe mechanism though, since if two colors are misread, the fault will not be detected. But since our layout is not a life critical system, we accept this risk.
On our Youtube channel, you can watch a video of the working TDU: