Archive | Crumble Projects

National Coding Week – Blog Special

Next week is National Coding Week, and we thought to celebrate this, we would release a series of blogs dedicated to a project theme. This time we have chosen ‘games’. Each day there will be a new blog post detailing how to create a simple game-related project. Then at the end of the week, each one of these projects will connect together to form a game, which we will go into more detail on Friday.

As it stands, here is our current plan of action: Monday – colour picker using a Sparkle; Tuesday – dice using a Matrix display; Wednesday – letter spinner; Thursday – audible countdown; and Friday – Playing the game!

Each individual blog (apart from Friday) aims to provide you with a small project that you can do discretely, and then if you complete each one, you will be able to combine the smaller projects into a form of game.

Like other initiatives, National Coding Week is designed to encourage people of all ages to try something new, around the theme of coding/programming. There is a massive emphasis that not just schools get involved, but individuals and businesses too! You can find out more on their website.

If you have a go at any one of these projects, we’d love to see! Get in contact with us via email, FacebookTwitter or our Forum.

NCW Day 1 – Colour Picker

Welcome to our first blog post, in a series of five, in celebration of National Coding Week. If you haven’t already, take a look here to find out more about what we’re doing, and why we’re doing it. The first aspect of our game is going to be a colour picker. The aim of this […]

NCW Day 2 – Dice

Welcome to our second blog post, in a series of five, in celebration of National Coding Week. If you haven’t already, take a look here to find out more about what we’re doing, and why we’re doing it. The next aspect of our game involves a random number selection, and in our case, digital dice. […]

NCW Day 3 – Letter Spinner

Welcome to our third blog post, in a series of five, in celebration of National Coding Week. If you haven’t already, take a look here to find out more about what we’re doing, and why we’re doing it. The next part of our game is going to be a letter spinner. The aim of this project […]

NCW Day 4 – Countdown Timer

Welcome to our fourth blog post, in a series of five, in celebration of National Coding Week. If you haven’t already, take a look here to find out more about what we’re doing, and why we’re doing it. The next part of our game is going to be a countdown timer. The aim of this project […]

NCW Day 5 – Game Time!

Welcome to our fifth and final blogpost from our National Coding Week special. If you’ve missed any of the other four, or want to find our more about what we’re doing, and why we’re doing it, then head over here to find out more. This final post, as mentioned previously, is all about playing a […]

Growing Plants Under LEDs

This project is one of the activities that makes up part of the Global STEM Award’s coding route.

In the future, it may be the case that the Human race begins to settle on another planet – probably Mars. We will inevitably need to grow food, as you can only carry so much, and with a journey taking around seven months, emergency rations wouldn’t arrive quick enough!

Scientists are certain that areas of Martian soil do contain the right levels of nutrients to grow plants, but unfortunately the climate isn’t conducive to horticulture. At the height of summer, temperatures near the equator only just reach 20 deg C. Not too bad – but over night they still plummet to an eye-freezing -73 deg C. Just a reminder, this is Summer. At the equator. The warmest part of the planet!

So if growing plants isn’t an option outside, where else can you grow them? Well it would be possible to set up greenhouses, but they would need a lot of protection and heat to keep the plants going. You could also bring the plants ‘indoors’ – setting up growing stations mixed in with living quarters, the environment would already have to be the right temperature, and the plants will assist with air purifying. Another option would be to head deep underground, where geothermal warmth could be used, but then you are posed with another issue – plants need light. Where is this going to come from?

Using the Crumble, along with some Sparkles, we’ve had a look into growing plants under artificial lights. We initially set up a tester investigation to see whether or not there would be a difference, and whether the plants would grow at all! We decided to use some cress as it is easy to grow, and it has a short germination time. We left one pot in the sunlight, another covered up, and another three covered, but with a Sparkle shining inside (one Red, one Green, and one Blue).

Our initial test was very positive, so we have upscaled the investigation. We know that plants grow well in the spectrum of light produced by the sun as they have likely adapted themselves to do so. But there is a question as to whether they prefer a certain colour of light. We are going to look at how well cress grows under different colours of light.

dav

Our first step was to create an open-fronted enclosure for the pots (which we’ll come to later). As we wanted to grow a larger amount of cress, we have used two Sparkle Batons, but if you wanted to do this on a smaller scale, with lots of groups, you could easily use some paper cups and individual Sparkles. The spacing was set so that there were two Sparkles lit with each colour, on each baton, so four in total. This means that there are two unused Sparkles on each baton. The Sparkle Batons are loosely held in place, with a piece of card and some split pins. This is enough to prevent it moving.

Once we had our container made, we decided to draw and 3D print some custom pots and water trays, to get the most out of our growing space. We filled these with some damp compost, and sprinkled 0.2g of seeds across each one.

We then put the filled pots into our divider, and connected our Crumble. The code running on the Crumble isn’t too difficult. Put simply, we are turning on the Sparkles we need, to the colours we want. After a set amount of time, we turn them off (to simulate night time) for another period of time. The amount of time that we wait is determined by how many hours we want the Sparkles to be on for.

Once set up, we switched on the Crumble and waited. During the course of the investigation, we routinely inspected the plants and made sure that they hadn’t dried out. It is worth noting that we set up our test in a dark cupboard, to make sure that we were only using the Sparkles as a light source.

We had a go at capturing the first few day’s of growth. Each fade represents the night time and is shortened as you cannot see anything!

When the seed is in the soil, you don’t get to see the moment it germinates, so we thought that we would have a go at capturing that moment. Notice how the seed swells as it hydrates, before it splits open and starts growing.

Which worked the best can be difficult to determine – you cannot just go by a plant’s height. When a seedling doesn’t get enough light, it rapidly grows taller, in search of light (often described as leggy) and it takes on a rather yellow colour. A healthy cress plant shouldn’t be floppy or spindly, and it shouldn’t have any yellow tinge to it at all. In fact, working out which is best is rather subjective, but the easiest way is to see which one ‘looks the healthiest’.

To work out which colour of light was the ‘winner’, we took into account the height of the plant and looked at how green the leaves were. We took a picture, with no filters or effects, and in natural daylight, which we then uploaded into an image editing program. Using the software, we used the colour picker to work out the green RGB level . By taking an average of 4 different leaves from each section, we got the following results: Green – 87.25; Blue – 95.25; and Red – 130.25. This tallies with our visual analysis – which pretty much tied the Red and Blue plants. Unfortunately, we have ended up with a large amount of soil on top of the Red cress, making it harder to see.

Blue – Red – Green

From our first investigation, with only a few seeds, we found Blue light to be the best, and Green to be the worst. So the common result that we have found is that Green is the worst light to grow under.

This isn’t the only way you could combine plant growing with the use of Sparkles. You could try combinations of colours, more/less ‘night’ etc. You could even use low-power heating devices like a peltier cell to adjust the temperature of the soil.

If you have a go at this project, or any other, we’d love to see! Get in contact with us via email, or on FacebookTwitter or our Forum.

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.

More Christmas Crumbling

As we draw closer to Christmas, we thought that it would be nice to share a few festive ideas. If you end up at a loose end over the holidays, especially if you have kids, then why not give these seasonal makes a go? They’re a great use of any cardboard that won’t fit into your recycling bin!

First up, we have our uber-christmassy Crumble-powered Rudolph, complete with flashing red nose. A quick internet search brought up loads of different cardboard reindeer templates. After cutting out all of the pieces, we got to work on the nose. For this, we used a ping pong ball. We sliced part of it off, and then glued it to the nose. We wired up a Sparkle, and wedged it inside the nose.

We then secured the rest of our reindeer together, and wired up the Crumble. We stuck the components towards the back of the head which allowed it to stand up on a table.

There we have it, one quick Rudolph, ready to guide your sleigh.

🎶Rudolph the red-nosed reindeer, had a very shiny nose, and if you ever saw it, you would even say it glows.🎶

Next up, we have another festive-favourite. If you, like the vast majority of people over Christmas, don’t need more cakes in the house, then why not have a go at a gingerbread-free faux gingerbread house? There is a wealth of inspiration to be had, just by doing a quick image search on the internet. Once your house is made and decorated, then we covered the windows with some tracing/baking paper, to diffuse the Sparkles inside. We then wired up our Crumble with a Sparkle baton, because you can never have too many lights – especially at Christmas!

Once it’s all wired up, simply program your required lighting sequence – we went for a flickering fire-like program (as seen here). Pop it inside the faux gingerbread house, and you’re all set!

If you have been inspired by any of these projects, or want to share something else awesome with us, then give us a shout on the forum or Twitter.

Add some Magic into your next Project – Magic Candle

The leaves are turning, conkers are coating the path and the ground seems to be permanently wet. This can only mean one thing – it’s Autumn. This means that it is nearing Halloween, and Harry Potter can be found on the tv most weekends. Who doesn’t love a bit of magic, right?

We wouldn’t declare ourselves the biggest of Harry Potter fans, but, one of the team has decorated his downstairs bathroom with all things Potter… Anyhow, we thought it would be a perfect opportunity to perform a bit of magic with the Crumble!

You could do much more than a candle, we’d love to see some of your magic creations!

We have made a ‘Magic Candle’. Spoiler Alert: we have used a reed switch and a magnet to control the Sparkle!

As you can see from the photo, we’ve made our candle using a rolled up piece of white card. We’ve used a glue gun to add some ‘dripping wax’ too. Inside the top we’ve placed a Sparkle, and a reed switch. We then placed a piece of plastic over the Sparkle (we cut up a scrap of frosted polypropylene) and put it through the ‘top’ of the candle. We’ve used our laser cut wand (with a magnet in the end).

After making the candle, it’s really easy to program and control… ahem, I mean cast a spell, to light it up.

The program (code) for this is simple, once you get your head around it. The reed switch (as the name suggests) is a type of switch. This means that when a magnet is placed near it, it closes, and the current flows through to the Crumble. When the magnet is moved away, it opens and the current stops.

Our code waits for the wand to be waved, which will set A HI, then it runs a ‘flickering’ Sparkle algorithm. We set the Sparkle to random shades of Red, Orange and Yellow, and wait a few random milliseconds before changing it again.

Note: the wait 100ms allows you time to move the wand away from the switch again.

When the wand is waved again, it sets A Hi, waits again and turns the Sparkle off. Simple!

And there you have it! One ‘Magic Candle’ ready to mystify and amaze.

We would love to take credit for the magnet and wand idea to set off a reed switch, but that comes courtesy of Mike and Beckie at UKSTEM. (We are definitely bigger Harry Potter fans than they are, though!)

A Crumble-Powered Automatic RGB Nightlight

Sometimes inspiration can be hard to come by. We have known for a while that we’ve wanted to make a nightlight, but didn’t know how to make it different from all the rest.

We stumbled across an interesting video on YouTube which peaked our interest and gave us the inspiration we needed. How awesome would this nightlight look if we added a whole heap of Sparkles (a Matrix display) and gave it a Crumble kick?!

The Crumble-powered RGB nightlight was born.

Although this post will be a whistle-stop tour of the process, when we have our finished Sparkle Matrix display, we will definitely work on some in-depth instructions and teaching resources.

We started off by preparing a cardboard box, by removing all of the sellotape. We then glued it back together, to make sure that it was sturdy.

We then cut the faces of the box off, leaving a border. This would give us the frame for our light.

After this, we drew some straight lines on a word document and printed off 5 copies. We then trimmed each sheet so that it could be glued inside the 5 faces of the frame.

When we had finished our light, we decided that we didn’t like the bare cardboard, so we used a silver permanent marker to give it a metallic look.

Wiring up the Crumble was simple enough.  After connecting the Sparkles (inside the shade), we connected a light-dependent resistor (LDR). One end connected to a + output, in this case from the batteries, and the other end connects to an input (A, B, C or D). We used A.

It’s really easy to use an LDR with the Crumble. Take a look at the following program. When the analogue value of the LDR (we’ve renamed it to be helpful) is above 90, turn all of the Sparkles off,  if it isn’t above 90, and therefore less than it,  then turn the Sparkles on.

To get the nice RGB effect, we have cycled through the red, green and blue values.  This graph shows how increasing or decreasing the different values gives us different colours. Doing it in this particular order gives us a lovely rainbow effect!

We have created variables called Red, Green and Blue. We then set the corresponding red, green and blue Sparkle values to our variables. We have cycled up/down the RGB values to give us our transition of colours. Each time the colour changes, we check to see the value of the LDR, and whether or not to turn the lights on/off.

And here is our RGB nightlight, in all of its glory! When the Sparkle Matrix gets finalised, we will create some more in-depth teaching resources for this project, as it’s easy to make and really satisfying.

Getting Musical with the Crumble

A Crumble powered instrument that can play a tune? You must be mad!

Don’t worry, we thought we were too, but after having this idea in our head for a long time, we finally bought a glockenspiel to try it out-  and lo and behold our Crumble powered glockenspiel is alive.

Surprisingly, you don’t need many parts to make the instrument work. A glockenspiel with a beater, two servos, some cable ties and a sticky pad or two. We placed it on a spare piece of corriflute so that we could keep the servos and the glockenspiel aligned.

We needed two servos for this. One servo with the “cross” attachment, and the other with the “double arm”. These were then wired into the Crumble, one on A and the other on B.

The two servos were then connected with sticky pads and cable ties. The bottom servo moves along the X axis (left to right), and the top servo along the Y axis (up and down).

To allow us to easily play the given notes, we created a variable for each one and worked out, through trial and error, which notes were at which angle.

We then moved onto setting out variables for a crotchet, a minim, and then the angles at which the top servo needs to be to hit the glockenspiel, and where it should rest at.

This is the block of code to hit the ‘F’ key, for one crotchet (same as the beat). The total of the wait statements is 750 milliseconds, which equals 80bpm.

And there you have it, one Crumble-powered Glockenspiel! Our instrument came with some free music, so we decided to use one of those pieces. After piecing together many snippets of code, here is Beethoven’s 9th Symphony – well the first line, in all of its Crumble-y glory.

Christmas has arrived!

Our first proper Christmas since we moved in to our new building with Mindsets. We’ve decided to mark the occasion with a suitably decorated tree!

We connected 20 Sparkles and a Sparkle Baton together using croc-leads. We then wrapped these around the tree, with the Baton on the top. The croc-leads are almost a decoration in themselves!

The Crumble is connected to a Raspberry Pi, which is connected to our network, meaning we can remote-desktop in and change the lights! It’s pretty much an Internet of Things Christmas tree.

We decided to add our big red button near the base of the tree, to allow the user to cycle through the light sequences. The code runs a light sequence, and waits for the button to be pressed before moving onto the next sequence.

We decided that the tree was a bit bland, especially during the day time, so we added a few more decorations to it.

And there we have it, our IoT Christmas tree, ready to be programmed by anyone in the office.

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!