Whenever our 2-year-old finds something with a flashing light on it, he holds it on top of his head and runs around shouting “nee-nah nee-nah”. I decided we would make a flashing helmet, using a variable to set the Sparkle colour and brightness in the Crumble Software.
- 1 laptop with Crumble software installed
- Crumble controller & Sparkle
- 1 battery box with croc-clip attachments; 3 AA batteries
- Croc-leads and a micro-USB cable
- A switch/Switch Crumb
- Plastic dome; glue; tissue paper; blue paint; cardboard; & sellotape
Connecting the Crumble
This diagram shows one way of wiring up a Crumble, battery box and switch. The switch is connected to Pad “A” on the Crumble and to the +ve terminal of the battery box. By default, the input pads are at zero Volts (“low”). When they are connected to the batteries they receive 5 Volts (“high”).
In this case, when the switch is pressed, input A is connected to the batteries. In the software, therefore, we can use the “Wait until A is Hi” block to tell the Crumble what to do when the switch is pressed.
The croc-leads on the right-hand-side of the Crumble connect to a Sparkle (see previous blog posts)
The photo, left, shows the Crumble and Sparkle connected with a standard push-to-make switch. There are a couple of problems with this set up, though. Firstly, 2 croc-clips have to connect to the top-left “power-in” pad on the Crumble. Also, the tips of the two croc-clips connected to the switch are very close (see right) and can easily short-circuit.
A tidier soloution is to use a Switch Crumb (the one pictured is designed and sold by ). This has pass-through power lines, like the Sparkles, meaning it can be connected in line with the battery box and the Crumble.
A pad at the bottom of the Crumb connects to an input on the Crumble (the yellow wire in the picture), in this case to Input A.
Programming the Crumble
Within each Sparkle there are actually 3 LEDs: red, blue & green. Their relative brightnesses are varied to create any colour from the visible spectrum. The RGB Sparkle block (below) allows us to precisely control the colour, by setting each of the LEDs to a value between 0 (off) and 255 (maximum brightness). In this program we keep red and green at 0, only changing the blue.
The Crumble program used is shown above. It continuously checks to see if Input A is high (i.e. if the switch has been pressed). When it is, a loop is executed five times. This gradually increases the brightness of the blue LED within the Sparkle then decreases it (by incrementing the variable “t” from 0 to 200 then decrementing back to 0).
The plastic dome came from a supermarket package of profiteroles. A hole was cut in the top so the lid of a fabric softener bottle could be inserted. We glued bits of torn tissue paper all over the plastic (a la CBeebies “Mr Maker”) so that it could be painted blue.
I was planning to construct some sort of headband, attached to the bottom of the dome, with the switch mounted on it like a badge. The two-year-old, though, had already decided we were done. After that, he was never still enough for me to take a better photo than this (see right), so I think I can claim the project was a success!