As I mentioned in an earlier column, I’m currently having a lot of fun with my Awesome 12 x 12 Ping Pong Ball Array. As I also mentioned, I’ve been documenting the ongoing development of this project in in my monthly Cool Beans and Programming Tips and Tricks columns in Practical Electronics (PE), which is the UK’s premier electronics, computing, hobbyist, and maker magazine (PE is available around the world in both print and digital formats).
In the September 2020 issue of PE, which — due to the vagaries of print publishing — will hit the streets in the first week of August, we visualize the array as laying flat on the floor with drips of virtual water falling on it from above.
We start with individual drips lighting their associated pixels (ping pong balls) with white light one at a time. The way we implement this algorithm, each drip appears in a random location, turns hard on, and then turns hard off again. The duration of each drip is random, as is the inter-drip delay (i.e., the delay between adjacent drips).
As an aside, while I’m thinking about it, I should perhaps mention that you can see videos of all of this in action on the Cool Beans YouTube Channel (make sure to tell your friends LOL).
Next, I decided to light the drips up with random colors, but which colors should we use? Theoretically, since each pixel has red, green, and blue color channels, each of which can have 2^8 = 256 values numbered from 0 to 255, we can achieve 2^24 = 256 x 256 x 256 = 16,777,216 different hues, shades, tints, and tones.
In practice, however, we want to use a small subset of colors that are as bright and vibrant as possible. This leads us to the topic of primary colors. When I was a kid, my teacher told us that the primary colors were red, yellow, and blue, and that we could make other colors by mixing these primaries (red + yellow = orange, blue + yellow = green, and red + blue = purple).

What she didn’t tell us is that this is just one set of primaries, and that term “primary colors” simply refers to any collection of three or more colors that can be combined to form a gamut of other colors. I only came to understand this much later when I learned that printers use cyan (C), magenta (M), and yellow (Y) inks as their primary colors.
Furthermore, inks, paints, and pigments are subtractive in nature. The way I think of this is that we start off with a white canvas in white light. When we daub one of our primary colors on the paper, it absorbs some of the frequencies from the white light and reflects the rest, and it’s these reflected frequencies that we see. When we merge primaries, they each absorb their own frequencies, and all we see are the leftovers (yellow + magenta = red, magenta + cyan = blue, and cyan + yellow = green). When all of the primaries are mixed, they absorb all of the frequencies, leaving us with black.

By comparison, in the case of light, the primary colors with which we are most familiar are red, green, and blue, and these act in an additive manner. The way I think of this is to start off in a dark room and then turn on floodlights featuring the additive primaries. In this case, red + green = yellow, green + blue = cyan, and red + blue = magenta. When all of the additive primaries are mixed, we perceive the result as white light.
One way to represent colors is to use a color wheel. There are myriad representations out there in cyberspace, but I must admit to being rather proud of the one I created and the information it conveys. As we see, we can mix our three primary colors (red green and blue) to generate three secondary colors (yellow, cyan, and magenta) and six tertiary colors (flush orange, chartreuse, spring green, azure, electric indigo, and rose).
The 0 to 11 annotations reflect the way I index these values in an array in my programs. Given a random color value, these numbers allow me to quickly determine things like that color’s complementary, split complementary, triadic, and analogous counterparts.

Speaking of which, in the October issue of PE, we are going to create some functions that allow us to fade from one color value to another. This isn’t as complex as a beginner might fear, but it does have its subtleties, and we do have to treat the red, green, and blue channels independently. Later, in the November issue of PE, we are going to take the initial randomly determined color of each drip, and — in a series of small programs — experiment with fading to that color’s various complementary etc. counterparts.
All of these experiments are going to prove useful when we come to determine what colors we wish to use when we implement more sophisticated programs, like displaying scrolling text messages and implementing Conway’s Game of Life. But all of these will be the topics of future columns. In the meantime, as always, I welcome your comments, questions, and suggestions.
In your color drips program, are you going to allow multiple drips to be on at once?
I am, but I’m building up to it slowly. If you see the most recent two videos I posted earlier this morning (which go with the September issue of PE, which hits the streets the first week in August), I start off with single white drips and then move to single random color drips. In the October issue I introduce a fade algorithm that allows us to fade from one color to another, but still only with single drips. In the November issue, we are going to start by fading from color to color (experimenting with complementary, split complementary, triadic, and analogous color schemes). The next part is to move to having multiple drips happening simultaneously, and then we’re going to add a “splash” effect whereby the pixels north, south, east, and west of the main drip light up and fade down after the main drip — the thing is that at this point we’re going to have to introduce the concept of a Z depth so that later drips appear “in front” or “on top of” older drips…
That’s the way to do it. Bring them along slowly. Having multiple drips in different stages adds complexity even before you worry about overlap.
I like the thought of a splash or maybe a puddle effect where the color fades and spreads.
That’s what I’m thinking — the center pixel lights — while it’s still lighting the north, south, east, and west pixels start to lighten up, then the center one fades away, followed by the surrounding ones — this could look great with lots of raindrops with random colors — or all one color but slowly change that color across the spectrum…
I just received an email from David Coen pointing me at a complementary (did you see what I did there?) Color Theory column on the DesignWizard.com website: https://www.designwizard.com/blog/design-tips/color-theory