Archive | Crumble

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 to grips with the Crumble line follower

We often get asked questions about how to use the line follower with the Crumble, so we thought that we’d provide some updated examples on how to use it.

For those of you that aren’t familiar with it, the ‘Crumble Line Follower Widget‘ is a small board with two infra-red sensors in. Their resistance changes depending on the colour/ amount of light they sense. This means we can use the analogue values on the Crumble, along with some motors, to make a buggy follow a line!

There are many different ways to program a line-following buggy, and we are going to have a look at these. It is worth noting before we go any further, that there are many factors that can influence how successful your line-following adventure will be. Everything from how white your surface is, how reflective it is (for infra-red), how close the line follower is to the surface, to how charged your batteries are.

First of all, we need to wire up our Crumble and line follower. If you look at the back of your buggy, the right motor needs to connect to the motor two pads (red + and black -). The left motor connects to the motor 1 pads, but because the motor is flipped we need to reverse the wiring so that the ‘forwards’ block still makes the motor move forwards. So we will connect the black to + and the red to – . The line follower then needs connecting. The power (+ and -) connects to the corresponding pads on the Crumble or battery box and then the ‘left’ and ‘right’ pads need connecting to two of the I/O pads e.g. A and B.

note: This may be different depending on your motor configuration/set up. If you are in doubt have a play and find out!

Method One: The Simple One

We will first look at the shortest and simplest way of getting the line follower to work. This method links the analogue values with the corresponding motor speeds.

There are occasions when this technique doesn’t work so well – it will depend on the materials you are using and how tight the ‘track’ you are following is!

Method Two: Treating Them Digitally

The next method treats the inputs digitally – so that the readings are either HI or LO. If the left or right are reading low, we only want the opposite motor running. Or when a side is on white, we want that motor to keep running.

Method Three: Analogue Alternative

When the digital method doesn’t work correctly, whether it is the surfaces you are using, or the height of the line follower from the floor, we can use analogue values instead, to achieve exactly the same effect.

Method Four: Comparing Left & Right

The other methods we are going to look at rely on comparing the left and right values to one another. This one works as follows: If the left analogue value is less than the right one,  gradually turn left- else gradually turn right. The motor speeds can be adjusted depending on the complexity of your course.

Method Five: Joseph’s Brainchild

The other comparison method we are going to look at is the brain-child of Joseph, the Crumble’s creator. It involves finding the difference between the left and right values, and then adding/subtracting from the relevant motors.

These five different programs are just a snapshot of the vast number of ways you can program a line follower. If you wanted to use a white line on a dark surface then it is just a case of inverting the motors, or the comparisons.

Crumble heads to the Education Show

Last week, a few of us travelled up to the NEC, Birmingham for the Education Show. We were there mainly to exhibit the Crumble as the show tends to be geared towards Primary and Home Educators – and the Crumble is perfect for Primary Computing and Design and Technology. Loads of people had a go with the Crumble and there was a real excitement surrounding the stand.

We were sharing our stand with Mike and Beckie from UK STEM – they were launching their fantastic new initiative called ‘The Global Stem Award’ which you can find out about here.

When the show had quietened down, we even found time to set each other some Crumble challenges!

We thoroughly enjoyed our time at the show and it was great to meet so many new and familiar people, all of whom share our excitement and passion for education. We look forward to the next one.

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.

Kicking Off EU Code Week In Style

On Friday 6th October 2017, Joseph and Dan from Redfern/Mindsets and Mike Cargill from UKSTEM ventured into London, to help UCL kick start European Code Week. 

For those of you that don’t know, the European Code Week (EU Code Week) is a grass-roots initiative set up in 2013 by the Young Advisors for Digital Agenda Europe. The Code Week aims to get as many people as possible, from across Europe and the World, to take part in exciting Computer Science activities. It has been growing in success, with nearly 1 million  participants from across 50 countries taking part in 2016. 

The Code Week kickstart event took place at UCL’s BaseKX, Camden – a modern building, designed to provide a space for business start-ups to establish themselves. We were amongst about 15 different companies, including Lego education, Discovery Espresso and Ohbot. 

The morning started with a few guest speakers, discussing topics ranging from the history of coding, to the development of BaseKX. After a break, the various groups of children found their workshops, and the coding began. We had two different workshops running – one table of 10 children were working on line-drawing buggies, while the other table had a range of activities: our new countdown clock; a probability spinner; a reaction timer; and two matrix Sparkle displays. Each workshop ran for 40 minutes, and there were two more after lunch, so, all together, we got to work with around 60 children from 6 different schools. 

We love doing events like these, as they allow us to see the impact and enjoyment that the Crumble can have/cause. Without this, it’s really hard to judge what’s happening on the ‘front line’, unless we are given explicit feedback. It also gives us a great opportunity to see if our new ideas and projects are worthwhile, and whether they pass judgement from your average primary school child. At each of our workshop sessions there was a real sense of excitement and a buzz in the atmosphere. The children were always focused on their task and they were all desperate to reach the end-goal of their challenge.

When children are new to the Crumble they are great at finding bugs. We were trialling our latest Crumble software update and, sure enough, our first group discovered a bug! This is great because it allows us to fix these issues, before the software becomes public. These events also provide a good platform to test new workshop resources – all of our worksheets were new, along with two new products. As with anything new, there were a couple of teething issues, but this event allowed us to refine our workshop material and make it even better.  

Not only do these events provide us with a platform to let schools know about the Crumble, they provide us with a great opportunity to better ourselves – and for that we are thankful.  

The icing on the cake was being voted the favourite workshop by two separate schools. That’s not bad considering we only worked with six schools and had some high-quality competition!

Read more about Code Week 2017 news and events here.

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:

traffic_lights

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. 

button_cross

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!

FullSizeRender-3

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.

IMG_0894

FullSizeRender-3

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.

IMG_0892

IMG_0893

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.

victory_flash

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.

PastedGraphic-6

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!!