Author Archive | Helen Roberts

Lockdown Learning: A tooth-brushing timer

On Monday we had our first dentist appointment for over a year! No major issues (phew…) but the kids received a reminder about the importance of brushing teeth for 2 minutes every time. Faced with the prospect of having my phone waved around over a tiled floor and a toilet bowl twice a day, I suggested we should make a Crumble timer.

This turned out to be a really nice project. Even with just the components in our Starter Kit there is scope for different approaches (sounds/flashing lights/colour sequences) and it was a great opportunity to learn/recap how to use inputs and outputs.

My 8-year-old decided on the simplest approach: wait for 2 minutes and then sound a buzzer. While we were connecting the components, he asked if we could just connect “+” on the buzzer to “+”  on the battery box and use the battery box switch to turn the buzzer on and off. This is an excellent question because, of course, we can do that: the buzzer and battery box (with its built-in switch) can be connected in a simple circuit. When the switch is closed the electricity will flow and the buzzer will sound. 

Buzzer, battery and switch connected in a simple circuit.


Inputs and Outputs

This brings us nicely to a fundamental question: why do we use the Crumble at all? The reason is to give us control. We only want the buzzer to sound after 2 minutes has elapsed.

The chip (microcontroller) on the Crumble (or in your central-heating system/washing machine) takes information (input) from the user and runs a set of instructions (an algorithm) in order to determine which processes to run and what to ouput.

A clever feature of the Crumble is that pads A, B, C and D can function either as inputs or outputs. The Crumble will either set them (as outputs) or begin to monitor them (for input) depending on which blocks (processes) are used in the program:

We instruct the Crumble to monitor inputs using commands like:

When we connect a switch between “+” on the battery box and (e.g.) pad “A” on the Crumble we are not using it to turn the Crumble on and off. Instead, when the switch is pressed, electricity flows to pad A and the Crumble detects this as an input. If the switch is closed, A is “Hi”; if it is open, A is “Lo”.

We set outputs using these blocks:

When we connect the “+” pad of the buzzer to (e.g.) pad “C” on the Crumble, the Crumble then controls whether electricity flows to output C and, hence, whether the buzzer will sound. 

The wiring for the 8-year-old’s project is shown, below:

Wiring diagram for a simple timer with buzzer.

And here is the program that is sent to the Crumble:

Crumble program for a 2-minute timer

The Crumble waits until the switch is pressed (in this case, it is connected to “B”); waits for 2 minutes (quick bit of maths to convert this to seconds); then turns the buzzer on.

We had also thought about how you would use the timer in the bathroom. You could turn the buzzer off with the switch on the battery box but you shouldn’t do this with wet hands! Instead, we added the “wait 10 seconds” and “set C LO” blocks so the buzzer turns off after 10 seconds. The program then loops back to the start and the timer is ready for next time.

A coding challenge

Meanwhile, the 11-year-old was working on his own timer. (He found a Sparkle baton to use for his lights but the individual Sparkles from the starter kit can be used in a similar way.) He decided he wanted to see the time progressing so programmed each Sparkle to change from red to green, in turn, over the 2 minute period. At the end of the 2 minutes a buzzer (connected to “B”) pulses on and off for a few seconds.

This is the first program he wrote:

Crumble program for a 2-minute timer using a Sparkle baton and buzzer.

It works as required but it contains a lot of repeated lines. This suggests it is not the most efficient way to write the code. I set him a challenge to re-write his program using a loop and a variable:

Program with the same function as above, but coded more efficiently.

The resulting program does exactly the same but it is a lot shorter and would also be much quicker to adapt if he decided he wanted to change the colours or the time interval. Note, also, that it only takes up half the space in the Crumble’s memory. Writing efficient code is an important skill!

Design for purpose

Now we have the Crumble connected and programmed, we can think about other elements of design. We added a loop to the first program so we wouldn’t have to manually turn the buzzer off but there is always a risk, in a bathroom, that the components could get splashed. How could we mitigate this risk? Can we enclose the timer but still be able to press the button to activate it? Or is there a different type of input we could use?

We do, in fact, have several inputs that can be activated without touching them: the light sensor (included in the starter kit); the ultrasonic distance sensor; a tilt switch and a reed (magnetic) switch.

My version of the toothbrush timer, therefore, uses all the starter kit components inside a Tupperware box. Instead of being triggered by the push-button switch, the light sensor is used at the bottom of the box. When the box is picked up, the Crumble detects the change in light level and starts the timer sequence.

Wiring diagram for the light-sensor activated timer

Crumble program for the light-sensor activated timer

I used modelling clay to hold the Sparkles and light sensor in place, facing outwards. For the light sensor, this also helps to block out the ambient light when the box is resting on a surface. We pick up the box to trigger the timer sequence.


The Sparkles turn red, amber then green, in turn. I have used a variable “time” to control how long the light sequence lasts. This is set at the top of the program so could easily be changed, if required. Once the 2 minutes have elapsed, the buzzer pulses. The Sparkles are then turned off and the program loops back to the beginning and waits for the trigger.


What other types of timers can you think of? Would they require any different design features? If you try this, or a similar project, we’d love to see it!

Programming challenge: a temperature-sensitive light.

This project builds on the previous post, where we explained how to set Sparkle colours using the “RGB” block:

Sparkle RGB block

It was inspired by the type of night-lights that are available for babies’ bedrooms, where the colour of the light indicates to parents if the room is getting too hot or too cold.

We want the Sparkles to display predominantly “cool” colours if the room is too cold and “warm” colours if it is too hot. As we are using the matrix display, it would also be nice to have a pretty “twinkling” effect.

The block which randomly changes the colour of each Sparkle in the matrix display

The program is, therefore, based around the block, above. The colour of each Sparkle in the array is updated, randomly. The level of green light also changes, randomly. If the value of “red” is low and the value of “blue” is high, the Sparkle colour will vary between blue and cyan (depending on how bright the green light is) while if “blue” is low and “red” is high, it will vary between red, orange and yellow.

A previous night-light project shows how to connect up the Crumble, battery pack and Sparkle matrix display. The input from a light-dependent resistor (LDR) was used to control whether the lights are on or off. In this project, instead of the LDR, we are using a thermistor (a resistor whose resistance varies depending on temperature). You can simply attach a croc clip to each “leg” of the component but, to make it a bit easier to handle, we have soldered ours onto a “crumbliser”

The first thing we need to do is calibrate the input, i.e. work out what temperature the resistance of the thermistor corresponds to. The thermistor is connected to “A” and “B” on the Crumble: “A” will be the output and “B” will be the input. The following program allows us to monitor the value of “B”. As it depends on temperature, we have assigned it to a variable called “t”.

Something I learnt during the course of this project is that, if you want to calibrate an analogue input, it is better to connect it across 2 of the Crumble I/O pads (A,B,C & D) as we have done, here, rather than connecting one pad to the Crumble and the other directly to the “+” pad on the battery box. This is because the voltage level from the battery box can vary, whereas the Crumble itself outputs a fixed voltage.

We then immersed the thermistor in hot water; in iced water; put it outside; and, finally, my 6-year-old held it in his hand. We watched how the value of “t” changed (in the “Variables” menu of the Crumble software) and my 9-year-old made a table and then a graph of the results.

Based on this investigation, we decided that the red emitter should be off (0) when t = 85 and fully on (255) when t = 170. (Ice water and boiling water being a bit too extreme in this case!) The blue emitter can then simply be the inverse of this (i.e. 255 minus the value “red”).

Our table of results and graph

I briefly explained the formula for a straight-line graph (y = mx + c) and “we” determined that m = 3 and c = -250. We then input these numbers into the Crumble program in order to convert the value of the input “t” into our outputs “red” and “blue”:

We also used two “if” blocks to set limiting conditions to prevent the value of “red” (and, hence, “blue”) going higher than 255 or lower than zero.

The completed program is:

Crumble program for our temperature-controlled night-light

The program is inside a “do forever” loop so the colour of one random Sparkle in the array is changed every 100 ms.

It is difficult to capture the different colours on camera, but here is the finished night-light (mounted in the Sparkle matrix pixelator) at three different temperatures:

Aaah…. just right!

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!

Programming challenge: Traffic lights

IMG_1538We used:

  • 1 laptop with Crumble software installed
  • Crumble controller & Sparkle baton
  • Crumble-friendly switch & ultrasonic distance measuring sensor
  • 1 Crumble-friendly battery box; 3 AA batteries
  • Croc-leads and a micro-USB cable

The traffic light sequence can be programmed to run on a single Sparkle (change all the Sparkle commands in the program below to read “set sparkle 0 to..”), but using 3 chained together or, as here, a sparkle baton is more “true to life”. The traffic lights are set to be the last 3 sparkles on the baton (index numbers 5, 6, and 7 being green, amber, and red, respectively). The program is shown below:


The sequence simply repeats every 3 seconds, but we can add a switch (here connected between the +ve battery terminal and Input A) to trigger the sequence. In the program below, the green light stays on until the button is pressed. 


The program was then modified further so that the sparkle at the other end of the baton (index number 0) functions as a “pedestrian crossing”. When the “traffic lights” are green the pedestrian crossing is red. When the button is pressed the traffic lights cycle through amber to red and then the pedestrian crossing sparkle changes to green. After 5 seconds the pedestrian crossing sparkle changes back to red and the traffic lights continue through red-amber to green.pedestrian_cross

For the final challenge we also added an ultrasonic distance sensor with its “trigger” (T) connected to input “C” on the Crumble and “echo” (E) connected to “B”.

As in the program above, the button triggers the traffic lights to change to red. The “pedestrian light” (i.e. Sparkle 0) then remains green until the ultrasonic distance sensor detects a “car” approaching (in this case represented by a hand waving less than 4cm away). The “car” triggers the pedestrian crossing to turn red and the traffic lights to change to green.

Screen Shot traffic_ultra

Unfortunately, the resulting tangle of wires is not very attractive. (Note: I have used the “power out” pads on the Sparkle baton as power inputs for the ultrasonic distance sensor.)

Next challenge: construct something to hold the baton vertical and the ultrasonic module in the right position to detect a lego car!


Crafty Crumble Creations: A steerable buggy

FullSizeRenderWe used:

  • 1 laptop with Crumble software installed
  • 1 Crumble controller & 2 Crumble-friendly switches
  • 1 Crumble-friendly battery box; 3 AA batteries
  • A pair of motors (with croc-leads attached) & wheels
  • 4 long & 2 short croc-leads and a micro-USB cable
  • 2 K’nex wheels and an axle.
  • An egg box

The construction of the buggy is ridiculously simple: we pushed the axles of the motors through the sides of an egg box lid, as close to one end as possible, then attached the wheels. For the front wheels we pushed a K’nex axle through he other end of the box and attached a pair of similar sized wheels. (Lego technic would also work fine.) The Crumble and battery box then sit inside the buggy.



The motors are connected to the Crumble’s motor outputs (the bottom two pads on either side of the Crumble). Note that to get the wheels to turn in the same direction and move the buggy forwards, the motors actually need to turn in opposite directions (as they are arranged back-to-back). This can be achieved in software, by setting one to “forwards” and one to “reverse” or, as shown here, by connecting one motor in the conventional way (red wire to the positive pad; black wire to the negative) and the other motor reversed (red wire to the negative pad).

One of the switches was connected between the second positive output of the battery pack and “input A” on the Crumble (the yellow croc leads). The other switch was connected between the Crumble’s “power out” (top right) pad and input D (the green croc leads). The battery pack is connected to the Crumble in the usual way.



The Crumble program is shown below. If both switches are pressed (“A is Hi” and “B is Hi”), both motors operate and the buggy moves forwards. If only one switch is pressed, only the motor on that side of the buggy runs and the buggy turns. The green and yellow croc leads are long enough that our 3yr-old can walk behind the buggy and use the buttons to steer it.

Screen Shot buggy prog

NOTE: The motor power is set to only 25%. This ensures that the buggy moves at a slow walking pace but it can also help to reduce glitches (e.g. the motor LEDs on the Crumble flicker, but the spindles don’t turn) due to interference being picked up by the long leads to the switches.


Programming Challenge: Reaction timer game

This challenge involves making a reaction timer game with a Sparkle Baton. The aim of the game is to press the button when you see a green light. We used:

  • 1 laptop with Crumble software installed
  • Crumble controller & Sparkle baton
  • 1 Crumble-friendly battery box; 3 AA batteries
  • Croc-leads and a micro-USB cable
  • A switch (check out our new Crumble-friendly switches!)

Connecting the Crumble

The Sparkle baton is connected in the same way as a single Sparkle: `+’, `-‘ and `D’ on the right-hand side of the Crumble connect to their equivalent pads on the left-hand side of the baton. The switch is connected between the +ve terminal of the battery box and input B on the Crumble (see photo).

Reaction timer game

Programming the Crumble

The program was developed and refined in several stages. First, I wanted a lit LED to “travel” backwards and forwards along the Sparkle Baton: Red_travellingThe variable “t” is the index number of the Sparkle. The variable “u” switches between +1 and -1 every 8 steps, so the “let t=t+u” command increments the Sparkle number from 0 to 7 then decrements it back to 0. At each step, Sparkle “t” is set to red for 100 milliseconds. This whole sequence is placed inside a “do forever” block.

Now, as the red light travels back and forth, we want just one of the Sparkles to turn green, instead. The “set sparkle ‘t’ to red” block is, therefore, replaced with an if-else statement, which changes Sparkle number 3 to green: if_block

The program now needs to respond to user input: the aim is to press the button when you see the green light. Inside the “do forever” loop, we nest a “do until B is HI” loop.

full_prog2When the button is pressed, the program will pause until it is released (“wait until B is LO”). If the user has succeeded in pressing the button when the green LED is lit they have “won”.

In order to emphasize this, a “victory flash” is now inserted: if “t=3” when the button is pressed (i.e. if the Sparkle is green) then all the Sparkles flash green 3 times before the program continues.


In order to increase the challenge, a variable “time” was created, which determines how quickly the Sparkles turn on and off. Initially, this is set to 300ms and it decreases by 50ms for each successive “correct” push of the button. If the button is pressed at the wrong time, however, the time is reset.


Can you improve on the game? Ideas:

  • Is there a potential problem if the variable “time” becomes negative? Would it be better to decrease it proportionally rather than by a fixed number of ms?
  • Can you keep track of the “high score” by counting the number of successive, correct button pushes and flashing the same number of Sparkles?
  • What if the green Sparkle is in a different position each time? (Hint: use the “random” operator.) Does this make the game more challenging?

Victory flash

At full strength, the Sparkles are too bright to look at for long periods of time. When writing and debugging programs using Sparkles I usually cover them with (e.g.) one or two sheets of paper.


Crafty Crumble Creations: When Santa got stuck up the chimney!

This year our Crumble Christmas decoration uses a servo to control an “animatronic” Santa leg stuck in a chimney decorated with twinkling lights.

We used:

  • 1 laptop with Crumble software installed
  • Crumble controller; a flexible strip of 30 Sparkle LEDs and a micro Servo (both with crumblisers attached)
  • 1 Crumble-friendly battery box; 3 AA batteries
  • Croc-leads and a micro-USB cable
  • Cardboard blocks, cotton wool balls, cardboard; red and black paint; sellotape & PVA glue

Making the Chimney

The Chimney is made from some sturdy, red cardboard building blocks, that we already had at home, with cotton wool balls stuck on for the “snow”. Santa’s leg is cut out from a cardboard box, painted red and black, with more cotton wool balls as a fur trim. The turning part of the servo is sellotaped onto the back of the leg (excuse the Stormtroooper: we used the box from a Star Wars toy) and the body of the servo is taped onto a smaller yellow block that sits behind and inside the chimney. The Crumble and battery box also rest inside. IMG_9899IMG_9900IMG_9885  

Connecting the Crumble

The Crumble was connected to the battery box with croc-leads and to the computer, using the USB lead. The micro-servo has three connections: power (“+”, “-“) and “control” (labelled “S” on the crumbliser). The power pads were connected to the second set of pads on the battery box and “S” was connected to the Crumble’s pad “C”. The Sparkle strip was connected to “+”,”-“, and “D” on the right-hand side of the Crumble and then wrapped around the base of the chimney. IMG_9897

Programming the Crumble

The servo control block needs to tell the Crumble which output the servo is connected to (in this case “C”) and the angle to set the servo. As this is an absolute, rather than a relative number, we had to do a bit of experimenting. Eventually, we determined that the servo needed to move between 65 and 85 degrees. To slow down the transition, we used a loop which steps the servo 1 degree every 60 milliseconds and a variable “x”, which alternates between 1 and -1, to make it move back and forth. Screen Shot 2015-12-15 at 18.19.04We wanted the Sparkle strip to change colour at the same time as the servo is moving. As there are 20 steps in the loop to move the servo, the simplest way to do this was to use only 20 of the Sparkles. We defined a variable “sprk” to be the index number of the Sparkle. Every time the loop is executed, Sparkles 5 to 25 are set to red, in turn. Variable “x” is used to set the adjacent Sparkle to green. Once we were happy with the effect, we disconnected the Crumble from the computer and placed our decoration on the fireplace. Screen Shot 2015-12-24 at 12.38.51 Can you improve on this and work out how to thread two programs together to use all 30 Sparkles? Merry Christmas!!

Crafty Crumble Creations: A Haunted Castle

We used:IMG_0001

  • 1 laptop with Crumble software installed
  • Crumble controller, Sparkle baton & single Sparkle
  • 1 Crumble-friendly battery box; 3 AA batteries
  • Croc-leads and a micro-USB cable
  • A “line follower” module
  • Cereal box; egg box, empty wipes packet; cardboard; paint; paper; pens; pin, scissors
  • Sellotape, glue stick and adhesive velcro strip

Connecting the Crumble

IMG_9816A Sparkle baton was used to give the “spooky” green glow. Croc-leads connect the “+”, “-” and “D” pads on the right-hand side of the Crumble to their counterparts on the left-hand (input) side of the baton. Another single Sparkle was connected to the output of the baton. This will glow red when the Castle door is opened.

The Crumble and Sparkles are powered by 3AA batteries. Croc-leads connect “+” and “-” pads on the battery box to the power-in pads on the top left of the Crumble.

In order to detect when the castle door is opened and so trigger the red Sparkle, we used the CRV line follower module. These have optical reflective sensors at each end which contain an IR LED and a phototransistor. As well as detecting black and white they can, therefore, be used as proximity sensors. The module is powered by connecting the “+” and “-” pads to the second pair of pads on the battery box. The left output (“L”) is connected to the Crumble’s input “A”.

Programming the Crumble

Screen Shot 2015-10-31 at 15.47.43The program uses 2 random numbers to give a flickering fire effect. The range of variable “t” is 2 to 255 and sets the brightness of the green LEDs. Variable “u” picks a random number between 0 and 7: the index numbers of one of the Sparkles in the baton. Thus, the brightness of all the green Sparkles is varying randomly.

Variable “v” monitors “Input A”, which is connected to the line following module. When the voltage from the module is higher than a certain threshold, the single Sparkle (index number 8) is turned to red. The Crumble software continuously updates the values of the variables being used (when the Crumble is connected) so we can investigate how opening and closing the Castle door changes “v”. We can then see what threshold is required in the if-block.

Making the Castle

The castle is made from a cereal box with the hinged lid of a wipes packet for the door. We cut holes in the cereal box for the windows, but then covered them with a sheet of paper which had the windows coloured in with black felt-tip pen. We used a pin to make small holes in the paper and create a green glow.


We cut a door out of cardboard, added some detail with a black pen, and glued it onto the wipe packet lid. Our 5-year-old drew a “zombie” behind the door and I used a pin to prick out his eyes and mouth. We put the Sparkle baton along the bottom of the cereal box and sellotaped the single Sparkle behind the zombie’s face. The line follower module was also taped behind the door, with a hole cut level with the sensor.



The rest of the electronics was placed inside the cereal box. A piece of adhesive velcro was used to stick the battery box close to the top so that we could easily unclip one of the croc-leads to turn the Sparkles on and off.

The roof is the bottom of an egg box and simply rests on top. The whole castle was given a couple of coats of grey paint and a “garden” to sit in. Finally, our five year-old added a sign to warn off the unwary! Happy Halloween!!

Crafty Crumble Creations: A “police” helmet.

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.

We used:IMG_9210

  • 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

Screen Shot 2015-05-18 at 16.49.34This 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)

IMG_9053The 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 IMG_9056croc-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.

IMG_9061A tidier soloution is to use a Switch Crumb (the one pictured is designed and sold by 4tronix ). 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

Screen Shot 2015-05-18 at 15.25.18Within 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.Screen Shot 2015-09-19 at 08.37.25


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).

Constructing the HelmetIMG_9191



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.

The Sparkle was positioned so that it shone up into the the bottle top and the rest of the electronics was sellotapIMG_9205ed into the dome then covered with a circle of card, leaving the switch exposed.

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!

DISCLAIMER: Clearly this is not a “toy” that would pass any of the safety tests required to make it suitable for under-threes.  The construction of the helmet was an afternoon distraction and our child was closely supervised at all times.