Monday, 18 August 2014

Home Schooling ICT part 7: The Pi and the cardboard TARDIS

Summer holidays are here, and this year’s project is the most ambitious so far: to build a TARDIS!

Summer holidays are here, and with it the Family Project. We have a large cardboard box (big enough to fit a small DD) that has stayed with us over the last 6 years (and one house move). Each summer the box has turned into a café, pirate galleon, robot, rocket and castle. All that’s needed is some paint, some string, and a lot of imagination.

This year, we’ve decided to go one better and combine the box with the Raspberry Pi, to create a TARDIS. The plan is to paint the box Doctor Who blue, and install it in the doorway to the playroom, so that it’s bigger on the inside than the outside. We’ll use the Pi to control the flashing blue light, and the wheezing whooshing noise. DD1 has decided that the flashing and the whooshing should be synchronised, to add to the challenge!

We started off with a bit of planning, just enough to fix the idea in our heads, to have a common vision of what we wanted to achieve. DD2 drew a picture of the final TARDIS, with arrows pointing out which bit did what. DD1 drafted a swim lane diagram that described the cause-effect of what we wanted the computer program to do. I wrote a shopping list of the stuff we needed to buy.

DD2's choice of pink on pink makes the plan hard to read

TARDIS Project Plan
a) Planning
* Draw picture of what we want to build (done)
* Draw cause-effect diagram of how we want the program to work (done)
* Create a shopping list for the stuff (done)

b) The TARDIS box
* Paint the box blue (done)
* Install in doorway (done)
* Paint the “Police Public Call Box” sign
* Paint and attach box telephone handset
* Find a light lantern, and attach lens, for LED light

c) Programming the Raspberry Pi
* Learn how to make an LED flash (done)
* Learn how to play a sound file
* Learn how to play a sound file through an external speaker
* Write a program that flashes an LED and makes a whooshing sound, in sync

d) Connecting the Pi to the TARDIS
* Buy the components and check that they connect together (a bit done)
* Build any bespoke connectors
* Prototype the light and sound rig on breadboard
* Build final rig, and test that it all works

It’s required a bit of investment, mainly of blue poster paint and also components from Maplin. The total spent on bits is around £59 so far. To make the light, we got an IO buffer to protect the IO port, the blue light and the lamp unit (with lens). To make the sound, we got an amp and speaker kit, and I’ve somehow acquired the sound file already.

This was the shopping list:
* 2 bottles of blue poster paint
* Duct tape (to attach the cardboard in a door configuration)
* Raspberry Pi GPIO buffer board
* Ribbon cable to connect Pi GPIO to breadboard
* Breadboard
* Assorted LEDs
* Assorted resistors
* Key switch and mini push-button switch
* Amp and speaker kit
* 3.5mm jack plug
* 10m of red and black bell wire
* Electronics circuits textbook from the library

We already had:
* Door-sized cardboard box
* Raspberry Pi
* “Adventures in Raspberry Pi” by Carrie-Ann Philbin
* Soldering iron and solder
* Multi-meter
* Needle-nose pliers
* Blu-tack and “helping hands” (to act as the additional limbs when soldering)
* Masking tape (to tape over the duct tape on the box, so that the tape can be painted blue)
* Lantern
* Lens
* Assorted jump cables of various lengths (for prototyping on the breadboard)

The painting was straightforward, if time consuming, because we needed to do both sides with two coats. The next step is to paint on the “Police Public Call Box” sign. DD2 had a great idea: to stick the letting onto a white background using collage.

We got the right shade of blue. Next: the lettering.

The computer programming is a challenging for the DDs to understand. There are lot of concepts to get across, concepts that they will not have come across before. For example, they’ve not had to deal with variables, with code libraries, with user access privileges. But the hardest part is the precision required; code must be exactly correct, otherwise it won’t work.

The approach I’ve taken is to try to explain why we have to do things, but the DDs seem to be satisfied with just knowing how to do them. They seem to be able to memorise all the rules, but show less interest in meaning, preferring to focus on outcomes. I wonder if that’s how they absorb their classes at school?

We started with making an LED flash by controlling a GPIO pin. The code is less than 10 lines of python, but the process took over an hour. Perhaps some of that time was because I was trying to involve both DDs at the same time, rather than individually. DD1 typed in the code, and DD2 plugged the components into the breadboard.

Of course, even though the program was copied from the book, it didn’t work first time. Nor even the second. So DD1 and I learnt how to debug code – compare carefully with what’s written down and be exact with how it’s typed in. The error messages are still hard for DD1 to understand, but I’ll continue to explain them. The program did work the third time, and you could hear us whooping with success around the house!

Things learnt so far:
* Poster paint washes off anything, as long as you get to it quickly enough.
* It’s good to write down plans. They needn’t be detailed, but just enough to fix the ideas and vision in your head.
* Nothing works first time, not the building, not the electronics nor the programming. So don’t be discouraged; learn to either fix or work around as you go along.
* There’s a lot to learn, and attention spans are short. Split the work into small (15min) chunks, punctuated by tea for the grown-ups and ice cream for the DDs.
* Always finish when a chunk is complete. Don’t try to do just one more thing, especially if bedtime is looming. Similarly, don’t leave the program half-written to return to the next day.

* Celebrate the achievement of each task in the plan, not just the creation of the final object.

More in this series: part 6, part 8.

No comments:

Post a Comment

It's always great to hear what you think. Please leave a comment, and start a conversation!