Currently set to Index
Currently set to Follow
Skip main navigation

Connecting sparkle lights using a crumble microcontroller

Learn how to connect a Sparkle RGB LED (which stands for Red, Green, Blue Light Emitting Diode) to a Crumble, and control it using code.
Using a Crumble gives you more control over your components than a simple switch.
In this article, we will show you how to build a circuit including a component that requires a microcontroller to use: a multi-coloured LED known as a Sparkle.

How to use a Crumble Sparkle

Crumble Sparkles are multi-coloured lights made especially for the Crumble microcontroller.
A Sparkle contains an electrical component called an RGB LED, which stands for Red, Green, Blue Light Emitting Diode.
This means that the Sparkle can create nearly 17 million different colours by combining different amounts of red, green, and blue light. You can use the Crumble software to set how much red, green, and blue light the Sparkle will emit, to pick one of these colours.
Labelled photo of a Sparkle indicating the positive, negative, and signal (D) connections on each side. The left side will be connected to a Crumble and the right side can be connected to another Sparkle. The terminals along the top row are for positive connections. The terminals along the middle row are for negative connections. The terminals along the bottom row are for signal connections.
To use a Sparkle, you need to connect it to your Crumble in the correct way. The Sparkle connects to the positive (+), negative (), and signal (D) terminals on the Crumble microcontroller.

Connecting the Sparkle to a Crumble

  1. Look at the Sparkle to see which way the two small arrows are pointing. The side the arrows are pointing to is the right side. Rotate your Sparkle so the D is at the bottom and the arrows are pointing right.
  2. Use a cable with crocodile clips to connect the positive terminal (+) on the right side of the Crumble to the positive input (+) on the left side of the Sparkle.
Illustration showing a Crumble with positive and negative terminals on the left side connected to a battery (not shown) and the positive connection on the right-hand side of the Crumble connected to the positive connection on the left side of a Sparkle using a red crocodile lead.
  1. Use another cable with crocodile clips to connect the negative output (-) on the right side of the Crumble to the negative input (-) on the left side of the Sparkle.
Illustration builds on the previous image, with an additional black crocodile lead connecting the negative connection on the right side of the Crumble to the negative connection on the left side of the Sparkle.
The positive and negative connections you have made so far create a circuit, which supplies power from the Crumble to the Sparkle.
  1. Finally, make the signal connection, which is used by the Crumble, to set the Sparkle’s colour. Use another cable with crocodile clips to connect the D terminal on the right side of the Crumble to the ->D-> input on the left side of the Sparkle.
    Note: The signal connection must always be to the D terminal on the Crumble. Sparkles don’t work if you connect them to any other terminal on the Crumble.
    Illustration builds on the previous image, with a yellow crocodile lead connecting the D connection on the right hand side of the Crumble to the D connection on the left hand side of the Sparkle.
Great! Your Sparkle is now fully connected, and it is time to light it up.

Your first Crumble program

The image below shows the Crumble software programming environment. It is a little like Scratch, but there are only six types of blocks, and only one starting block, which is called the program start block.
 
A labelled screenshot of the Crumble software programming environment identifying how several controls work. At the top left of the screen, the green triangle runs your code, the red square stops your code running, and the blue anti-clockwise arrow undeletes the last deleted blocks. To the left of the screen is the code block palette, with an upper panel which contains buttons to access the basic, input/output, sparkles, control, variables, and operators code block palettes. The basic block palette is shown, and this contains commonly used blocks, including the program start block which should be used at the start of your code. The white panel on the right hand side of the screen is the program workspace.
 
 
    1. In the Crumble software, drag the program start block into the program workspace.
       
      A screenshot of the Crumble programming environment with the start block in the program workspace.
       
      Every code block that you connect below the program start block is part of your program. When you click on the green triangle button, your program is sent to the Crumble and run.
       
      Any blocks in your workspace that are not connected to the program start block are not part of your program.
       
 
    1. Click on the Sparkles button to open the Sparkle code block palette and have a look at the Sparkle coding blocks.
       
      A screenshot of the Crumble programming environment showing the six Sparkle code blocks in the Sparkle code block palette. The code blocks shown are: 'set sparkle 0 to red', 'turn sparkle 0 off', 'set all sparkles to red', 'turn all sparkles off', 'set sparkle 0 to red, green, blue values', 'set all sparkles to red, green, blue values'.
       
      There are three different types of Sparkle blocks that you can use:
       
        • set sparkle to with a colour picker box
       
        • turn sparkle off
       
        • set sparkle to with three fields for red, green, and blue values
       
       
      For each block type, there is a version for a specific Sparkle and another for all Sparkles!
       
 
  1. Drag a set sparkle to block with a colour picker box into your workspace, and connect it below the program start block.
    A screenshot of the Crumble programming environment. A 'set sparkle 0 to red' code block is connected below the program start block in the program workspace.
  2. Click on the new block’s colour picker box (this is always red by default) to make a colour picker appear.
    Screenshot of the stock Windows colour picker panel.
    Note: The colour picker may look different depending on the type of computer you are using.
  3. Choose a colour for your Sparkle and click on OK.
    Your code should now be complete and ready to try. Click on the green triangle play button to run your code. At the top of the window, you should see the message Programming successful. If you don’t see this message, you need to check the USB connection between your Crumble and your computer and then try again. If your program is successful and your wiring is correct, the Sparkle will light up.
    Animation showing the green triangle play button in the Crumble software being clicked and then a Sparkle briefly lighting green

Saving a program on the Crumble

Once you’ve got the Programming successful message, your program is stored on the Crumble and will remain there even when the power is disconnected. When you connect a Crumble to a battery pack, it will automatically run the program that is stored on it, regardless of whether the USB cable is connected. To change the program stored on a Crumble, you will need to connect it to your computer and use the green triangle play button in the Crumble software to send a new program to it.
This article is from the free online

Teaching Physical Computing to 5- to 11-year-olds

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education