Light Painting Project

light painting cover

Task: To create a ‘light painting’.

Difficulty: intermediate/advanced

Before we begin, we are going to get our head around what ‘light painting’ is.

Light painting is a photographic technique, where lights are used to ‘paint/draw’ images. A camera is set to a long exposure, so the shutter is kept open for an extended period of time. You may have seen photographs which use a similar technique – often of a busy motorway where the streaks of white and red light travel the length of the road or of the stars streaking across the sky. A quick internet search will provide you with thousands of amazing photos of both long exposure photography and light painting, but if you want more information about the technique, you could head on over to:  


For this project you will need:

  • One Crumble with USB lead;
  • A computer with the Crumble software installed;
  • A battery box with batteries (not rechargeable!);
  • A Sparkle Baton;
  • A push switch;
  • Seven croc-leads.

This project has a vast range of possibilities, and can be made as simple or as complex as you wish.

For our first attempt at this, we are going to ‘paint a rainbow’. This will involve the Sparkles being set to the colours of the rainbow. When we take our long-exposure photograph, we will move the Sparkle baton around and it should leave a rainbow trail.


First of all, we need to connect all of our components together.

We need to connect up the battery pack to the Crumble (keep it turned off for now). We need to take care with this as we must make sure that the + on the battery pack goes into the + input of the Crumble, and – on the battery pack connects to the – one on the Crumble.


Now we need to connect our Sparkle Baton. We connect the + and – on the Crumble to the corresponding + and – on the Sparkle Baton (the left-hand side – the arrow will point to the right). Then we need to connect D on the Crumble to the D input on the baton.

hint: when connecting the Sparkle Baton, place it so that you can read the words along the top.

Finally, we just need to connect our switch, where one end connects to the + of the battery and the other end to A (or B or C).

rgb rainbow

Now we want to create a program that will turn our sparkles on to the colours of the rainbow. This is easy enough, but we need to think carefully about the brightness of our colours. Normally we could use the colour palette, however when doing light painting we need to use ‘dim’ colours. Otherwise they will be too bright and we won’t see the colours properly.

In this case, we will need to use the RGB values to create suitable colours. We need to set our Sparkles to the following colours: red, orange, yellow, green, blue, indigo and violet (we won’t worry about the 8th Sparkle in the baton).

hint: use Richard Of York Gave Battle In Vain  or RoyGBiv to help remember the colours of the rainbow.

switch rainbow

It would be useful if we could control the Sparkle baton, so that it turns on or off when we want it to. We have adapted our code so that when we first run the program, the Sparkles are turned off. When the button is pressed, the Sparkles all turn on, and when the button is pressed again, the loop repeats and the sparkles are turned off again.

hint: we use the wait statements to help prevent us triggering the next ‘wait until A is HI’ statement. The program runs faster than we can move!

switch rainbow

Now we need to try it out!

We set up our camera in a dark room (a large cupboard), on a tripod. We then made sure that the settings were correct so that it could take a long-exposure photograph. Our camera will shoot for up to eight seconds, and through trial and error, we found that to be a good length of time.

N.B. If you weren’t in a completely dark room, you may find that you have to shoot for less time, as you may get too much of the background in shot.

After setting it all up, it was time to take some pictures. We held our baton in front of the camera, and half-pressed the shutter button, so that it would focus the camera. We then moved the Sparkle baton out of shot, pressed the shutter button down, and moved the baton around in front of the camera.

We were pleasantly surprised with our results.


Now we wondered if it would be possible to create patterns using this technique. We wanted to have a go at making a chequerboard.


What we want to do is to create alternating squares of colour, by lighting up pairs of sparkles in different colours. We will then swap the colours of each pair, and this should create our chequerboard pattern.

In this code, we are going to start our alternating Sparkles when the button is pressed down. The Sparkles will then flash in sequence until the button is released again.



We can just about make out the colours of the chequerboard in the photograph.

If you wanted a more obvious pattern, you could remove one of the colours, leaving those sparkles off instead (shown in image 2).

After being so pleased with our results, we decided to test one more thing… Would it be possible to write a message using this method?

We tasked ourselves with writing the word ‘HELLO’. It works in exactly the same way as the chequerboard pattern- we just need to program lots of different sparkle sequences.

We were overjoyed by the results of the photographs.

We even decided to take it a step further, and light the room up for a second during our long exposure photograph. This gave us the incredible illusion of Pac-Man being in a lit room!

If you want to have a go at creating your own words or pictures, you can use the helpful template in the downloads section. After printing it off you can colour in the boxes and get coding.

As an example we have gone for the letter ‘H’  – we will be dividing our picture into 100ms ‘columns’.


The first step in our program is to wait for 100ms and then light up all of the Sparkles for 100ms. Then we want to turn them all off and turn on Sparkle(3). This can last for three ‘columns’, so instead of repeating our code and using 100ms waits, we can use one 300ms wait. After this, we turn all of the Sparkles on for 100ms and then off again.

There we have it, the letter H!