Pumpkin Project

pumpkin header

Task: To create a light-up Pumpkin

Difficulty: Beginner/Intermediate

DSCF3795

For this project you will need:

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

You will then either need a carved pumpkin, and a zip-lock bag to protect your Crumble etc., or if you are making your own:

  • Two sheets of A4 card (one with printed template if using);
  • Scissors/craft knife and cutting mat;
  • Colouring pens/pencils;
  • Glue/tape.
DSCF3798u

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. 

DSCF3798u

Now we need to connect our Sparkle. We connect the + and – on the Crumble to the corresponding + and – on the Sparkle (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 Sparkle.

hint: when connecting the Sparkle, place it so that the letter D is the correct way up.

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

Basic candle flicker

Now we are going to write a program which will replicate the candle inside of a pumpkin. We want our Sparkle to quickly change to various shades of red/orange/yellow. To do this, we are going to make use of the random function inside of the Crumble software.

Inside of a ‘do forever’ loop, we are first of all going to set up two variables, t and u(these can be named anything). We are going to set ‘t’ to a random number between 0 and 96. Then we will set ‘u’ to a random number between 0 and 128. Next we are going to turn on our Sparkle, setting the RGB in relation to the variables. We will set the red value to ‘t + u’, and the green value to ‘t’. This will then always create a colour ranging from red – orange – yellow. We will then wait a random amount of time from 25 to 75ms; this will give us the illusion of a ‘flicker’.

Basic candle flicker
button candle flicker

To improve this further, we are going to add in the  ability to turn the Sparkle on and off using a push switch. First of all we want to turn the Sparkle off, and then we are going to ‘wait until A is HI’ (switch pressed). We will then add in a 250ms wait, to allow us to remove our finger from the switch before the program moves on. We have put the ‘candle flicker’ code inside a ‘do until A is HI’ loop, so that the Sparkle continues to shine until we press the switch again. Finally, we will add in another 250ms wait statement at the end of the code (inside the loop), to stop us accidentally starting the Sparkle again.

There we have it! A ‘flickering candle effect’ Sparkle, ready to go inside of a pumpkin. You could either use a real carved pumpkin, and place the contents inside of a zip-lock bag, or you could make your own cardboard pumpkin.

DSCF3756

We are going to make our own pumpkin, so the first thing we need to do is print off the pumpkin template (see downloads), and draw our ‘scary face’ onto it.

DSCF3756
DSCF3764

Now we need to colour in our pumpkin, and cut out the eye/nose/mouth.

hint: if you carefully punch a hole in the centre of the section you want to cut out, it makes it easier.

IMG_20170921_112530

Finally, we need to fold the edges of the pumpkin and glue it to the other A4 piece of card. We want the face of the pumpkin to be curved, so when sticking it down, don’t line up the edges.

If you wanted to you could trim the edges so that they matched.

 

IMG_20170921_112530
DSCF3792

And there we have it! Our very own switch-controlled pumpkin, ready for Halloween!