Tag Archives | Science

Science with the Crumble: Colour mixing

Red, Green & Blue:

Can you make your Sparkle baton display a rainbow? The simplest way is to set each Sparkle colour, in turn, with the computer’s colour picker:

Simple “sparkle baton rainbow” program
Sparkle baton displaying a “rainbow”

But do you know how a Sparkle LED can display all these colours? The primary colours of light are red, green and blue (RGB). Each Sparkle has a red, green and blue LED inside and the relative brightness of each of these determines the colours that your eyes see. Mixing equal amounts of red and green gives yellow; green and blue make cyan; and blue and red make magenta. Red, blue and green mix together to make white light.

Under the “Sparkles” menu in the Crumble software is a block which allows you to set the level of each RGB emitter (0 is off; 255 is maximum brightness). The following program will, therefore, display the primary and secondary (yellow, cyan and magenta) colours along the baton.

Primary & secondary colours

If you are interested in seeing how other colours are made, the colour picker will tell you the RGB values of the current colour and allow you to change them, via sliders or by typing the value. Here, for example, we have chosen orange:

The red emitter is fully on (255), green is at half-brightness (127) and blue is off. If we now increase the blue to fully on, we get pink:

Note: this is the MacOS colour picker, Windows may look different but should still have the same information. You might also notice a Hexadecimal colour code (Hex code #FF7F00): I won’t go into more detail, here, but if you are interested in computer programming and/or graphic design you should investigate this further. 

Colour & the Human Eye:

We can use the block

to show that equal amounts of red, green and blue light mix together to make white light. The program, below, though, also demonstrates our eyes’ persistence of vision.

Sparkle cycling between red, green & blue

The last Sparkle on the baton (“sparkle 7”) cycles round the primary colours more and more quickly. The time interval starts at y=1000ms then halves after every z cycles while the number of cycles starts at z=1 and then doubles. As the LEDs cycle faster our eyes will first perceive a flickering and then a steady white light. You can show, though, that the LEDs are still cycling, even when the white light appears steady, by rapidly moving the baton from side to side: now our persistence of vision lets us see separate red, green, and blue “lines”.

Further Colour-mixing Activities:

Can you use your colour mixing knowledge recreate the “rainbow” display, above, but now get it to scroll along the sparkle baton? This diagram may help:

RGB colour mixing diagram

If you have a sparkle matrix, you can experiment with more colour effects. For example, what do you think the following program does?

Or pick your favourite colour(s) to draw a picture:

Sparkle matrix displaying a pink heart.
Happy Valentines Day!

The next blog post will explore using variables as RGB values and show how to use an input to control the Sparkle colours.

Science with the Crumble: Test your reactions

HYPOTHESIS: Humans react more quickly to something they hear compared to something they see.

In order to test this hypothesis, we used:

  • Laptop with Crumble software installed
  • Crumble controller & Sparkle baton
  • Crumble-friendly battery box; 3 AA batteries
  • Croc-leads and a micro-USB cable
  • “Crumble-friendly” switch and buzzer

The Crumble, Sparkle baton, switch and battery box are connected in the same way as the last reaction timer project (although the switch is connected to input A, rather than B). The program, however, is much simpler:

At the start, all the Sparkles are turned off. The Crumble waits for a random period of time (between 2 and 6 seconds) and then begins lighting the Sparkles in quick succession (every 50 milliseconds). The aim of the game is to press the switch as quickly as possible. Note: you have to hold down the switch until you have read your “score”. When the switch is released, the game restarts. Joseph & I discovered that, after a bit of practice, we could consistently press the switch after 4 or 5 Sparkle LEDs had lit up (i.e. after 150-200 milliseconds). 

In order to test whether we could react more quickly to a sound, a buzzer was then connected between “output B” and “Ground” (a “-” pad on either the battery box, or the right-hand side of the Sparkle baton). The program was modified so that the buzzer turns on at the same time as the first Sparkle LED:

For a fair test, you have to close your eyes while playing – but remember to open them and read your score before releasing the switch! Now we found that we could press the switch after 3 LEDs were lit (100 ms). 

So, our small sample does support the hypothesis, above. Further reading suggests that humans react even faster to touch-stimulus: can you think of a way to measure that with the Crumble? If you do the experiment with a larger group, let us know your results and we will publish them, here!