Wednesday, October 19, 2011

Creating unique colour combinations for playing card reader

Ok. With the numerous problems and repetitions in our previous attempt, we've turned to Excel to help us solve this conundrum. We need to be sure that every playing card has a unique combination of red, green and blue in the colour block (whether we settle for a single colour in the block, or stick with the 2x2 grid approach, we'll have to wait and see, once we know how sensitive our LDR is going to be).

Each colour will have an intensity of zero-to-three.
By writing out all possible permutations, we get 64 combinations (three colours, four intensities, 4^3=64)

RedGreenBlue
000
001
002
003
010
011
012
013
020
021
022
023
030
031
032
033
100
101
102
103
110
111
112
113
120
121
122
123
130
131
132
133
200
201
202
203
210
211
212
213
220
221
222
223
230
231
232
233
300
301
302
303
310
311
312
313
320
321
322
323
330
331
332
333

We only need up to 52 colours, so we've decided to do away with the "darker" colours
(e.g. a block with the colour combination 0 1 0 would have one single green square and three black ones in a 2x2 grid). The easiest way to do this was to sum the totals of RGB and any block with a total of two or less was discarded (0-1-0 gets binned, 0-1-1 gets binned, but 0-0-3 can stay, as can 0-1-2 and so on)

This leaves us with 54 colour combinations:

RedGreenBlue
003
012
013
021
022
023
030
031
032
033
102
103
111
112
113
120
121
122
123
130
131
132
133
201
202
203
210
211
212
213
220
221
222
223
230
231
232
233
300
301
302
303
310
311
312
313
320
321
322
323
330
331
332
333

Where the total sum of colours in a block exceeds three (1-2-3 for example represents 1R-2G-3B) we'll have to mix the colours to make secondary colours (magenta, cyan, yellow) and maybe even black and/or white. But hopefully, using these colour intensity charts as a guide, we'll come up with colour blocks that enable us to uniquely identify a card based on the RGB values received by the LDR/light sensor.

No comments:

Post a Comment