STEM Raspberry Jam Pilot

I organised an event with the STEMNET (Science, Technology, Engineering & Maths Network) team at the Museum of Science and Industry (MOSI), based on the Manchester Raspberry Jam I run monthly at Madlab. The STEM Raspberry Jam was to be a new activity the STEM Ambassador network could offer to schools, so we ran a pilot (pi-lot) to give the idea a whirl.

MOSI supported the event and kindly offered to host it at their fantastic venue in the museum on Liverpool Road off Deansgate in Manchester, and the STEM team had invested in ten Raspberry Pi kits (Pi, SD card, VGA converter, power cable & PiFace) which they intend to loan out to ambassadors running Raspberry Pi activities! We invited a number of schools to the Jam, and awaited their response.

I was given the ten SD cards and asked to add the software we’d need to them. I imagined this would take forever but it was actually rather rapid – I initially wrote the standard Raspbian image with PiFace pre-installed to the first card using dd, booted it up on my Pi, set the raspi-config settings to enable ssh, boot to desktop, correct timezone, etc. I then updated apt and installed a few essential packages and python modules. I then ran the dd command in reverse (switching input file to the SD card, and output file to a new file on my machine: stem.img) – this copied the image from the SD card to my computer, in the state I had left it. I was then able to run the dd command again, this time writing stem.img to the blank card. I tested each one by simply booting it to desktop, with no problems whatsoever!

We set a schedule for the day which included introductions, a morning session playing with Scratch and the PiFace, followed by an afternoon in Python. We had some Scratch and PiFace activities prepared, complete with booklets and instructional step-by-step guides. I’d written some Python activities for the kids to work through in the afternoon. With more time I’d have written these as part of the image I wrote to the cards but I wanted to make sure the cards worked ASAP, so I had to add the files on the day. Luckily this wasn’t difficult either – I just inserted the card in my laptop, one by one, and copied the files to the user’s home directory when it came up as an inserted drive, like a USB stick would!

Six schools responded saying they would attend, bringing six pupils each. On the day, we started with a welcoming word from Donna, the STEM Development Manager, (in her best teacher’s voice!) followed by an intro talk from me (in my normal voice). I explained what the Raspberry Pi is, what happens at a Raspberry Jam and why it’s all important (“Raspberry Why?“). I showed some pictures of the Manchester Raspberry Jam, and other Jams around the world. I explained what Scratch and Python are, and talked about the general perspective of “geeks” and compared this to real world geeks – now popular figures such as Mark Zuckerberg! I talked about singer will.i.am donating £500,000 to improve STEM education in the UK, and how he’s now learning to code!

Raspberry Why?

 

Then we kicked off with some Scratch and PiFace – we handed out the booklets and let the groups choose an activity based on their interests and abilities. With a group of STEM ambassadors on hand, as well as their teachers, there was plenty of guidance available so they weren’t left stuck for what to do. It was great to see the kids building things in Scratch – some following examples by the letter, others just experimenting and exploring! I’ve not really used Scratch myself, but I am amazed to see it in use – some really cool things happening on screens everywhere you look – animations, controlled characters, games, interaction with real world hardware – really awesome how they just got on with it.

We stopped for lunch and I chatted with some of the kids and teachers about what they were doing in school – mostly just dull ICT stuff with Word and PowerPoint, a bit of Scratch and (eugh…) Dreamweaver. However some of them seemed more excited about Code Club being run after school – so that’s something!

Stem-13

For the afternoon session we moved on to the Python activities I’d written late the previous night! To start, I gave them intro.py – a single Python file containing a linear set of tasks, each explained in comments in the code. It was just an idea I’d had the night before, as an easy way for me to make sure they covered all the fundamentals to move on to tackling some interesting problems. This activity went down really well and lasted the whole afternoon session! All twelve groups (three kids per Pi) attempted to work their way through it – with ambassadors on hand to help out with syntax errors and general clarification, it went rather smoothly and as I wandered around the room I saw amazing progress! The script covered printing, variable assignment, basic data types, lists, if statements, loops and so on. You could see them working through the challenges and understanding the concepts.

A few of the teachers (and kids) asked if they could take a copy of the code, or download it from somewhere. I let anyone with a USB stick take a copy, and promised to publish it on github. I knew it needed some work to be at a decent standard but it had been a really good exercise that day and fulfilled its purpose. We wrapped up the day by asking groups to raise their hands if they got past the first level, then proceeded to raise the bar and see how far everyone had got – every group had got to around Level 16, and one had reached the very last challenge, Level 22! (I’d purposely made this one fairly complex)

I uploaded the files to the MadlabU18 Github account, and it immediately had a couple of contributions from my partners from Coder Dojo! I’ve since been considering options for the project’s future. This week I ran a session at the Python North West User Group, where we each paired up and attempted to build a more sophisticated automated learning tool (similar to the Python Koans, but for kids). From that session I’ve had a few more ideas about how it can work. Well, watch this space.

STEM Raspberry Jam

Huge thanks to MOSI, STEMNET, Donna, Dan, and all the ambassadors who volunteered their time and effort to make this happen – Arran Gallagher, Graham Nelmes, Etinosa Ogiesoba, Amin Hoque, Joe Haig, Erinma Ochu, James Burnstone, Lisa Mather and Dan Mather.

Read more on the STEMNET blog » Pupils celebrate at the first Raspberry Jam for schools at MOSI

Free Software Culture Talk at Manchester Bracamp

Last month I attended the Manchester Girl Geeks Barcamp – affectionately known as bracamp. I did a talk on Free Software Culture, covering the varying definitions of “free” (libre/gratis), the principles of free and open source, why people do it, how development is managed and demonstrated use cases, as well as battle some gripes from a misunderstood audience member – which really helped me get my point across better.

I started the talk quite poorly but got more steady as it got going. It’s not filmed from the best angle (limited options) and there’s some background noise at times but it’s generally ok.

Thanks to Les and Olly for filming & publishing online

Raspberry Jamboree 2013

Manchester recently held the first ever Raspberry Pi conference – Raspberry Jamboree, held at Manchester Central. It’s been a year since the launch of the Pi, and this event was to review what we did in the last year, and look forward to what we’re going to do this year and in the future.

The day kicked off at 10.30 with an opening talk from organiser Alan O’Donahoe, followed by a wonderful keynote from BBC Micro pioneer Steve Furber. The first session of talks featured Andrew Robinson (creator of PiFace), Carrie Anne Philbin (from Geek Gurl Diaries) and CERN‘s William Bell (talking about MagPi). Meanwhile, in another conference track, a hands-on workshop was being led by Mike Hewitson (LateRooms) and Pete Lomas (Raspberry Pi Foundation).

Up next was a panel discussion with Raspberry Jam organisers and attendees – including Lisa Mather, Dawn Hewitson, Ben Smith, Jack Wearden and myself. We introduced ourselves and discussed what Jams are, how they work and what we think about them, and answered questions from the audience:

One of the things that came out of this was when asked where teachers and Jam organisers could get material from to teach coding or run activities, the panel suggested using existing online resources like Codecademy and asking for help on Twitter, and I said that between the community we should strive to make resources available for this kind of use. I suggested anyone interested get together with me to discuss creating a central repository for programming tools and exercises for the classroom, code clubs or for personal skills development – using GitHub as an example platform for how this could feasibly happen and have contributions of new projects and improvements of existing ones, and making it easy for teachers to download and use. Since the Jamboree I’ve been in talks with a few people regarding this. All I can say right now is watch this space – or, better – email me your thoughts if you’re interested.

After lunch I got to see Raspberry Pi Foundation evangelist Rob Bishop speak about what’s going on with them, which was fantastic. He’s a wonderful enthusiastic speaker and I really felt the energy of what this is all for. I got a bit carried away with this tweet:

Next up was Paul Hallet, whose project DjangoPi had caught my attention when it was announced last year. That’s one of the great thing about the Jamboree – we’d all heard of all these names but never met most of them, so it was amazing to have everyone all together in one room where you could put names to faces, shake a few hands and pat people on the back! Paul’s talk was on crowdsource funding for projects, and he went over the story of his projects such as DjangoPi and the coding club he ran in a local school. Great going for an undergraduate student! He already has a fantastic CV!

Following Rob and Paul was one of the Manchester Raspberry Jam regulars – a 13 year old who goes by the alias ‘Mini Girl Geek’. Amy Mather was asked to present a project she and I started at a Jam in December – Conway’s Game of Life. What began as a simple Python programming exercise turned in to a really interesting project involving pygame, Raspberry Pi, Arduino and an LED matrix display! Amy’s talk was extremely well received, she was praised by all and congratulated personally by the likes of Paul Beech, Rob Bishop and Pete Lomas! As one of the adults who has guided her along the way, I’m very proud of her for giving this talk and can say she did so professionally – a thoroughly enjoyable talk. Now watch it!

It’s since been featured on the Raspberry Pi blog and in the Pycoders Weekly newsletter!

A closing address from Alan rounded things up and a few of us headed to the nearby Pizza Express. After a mishap with their machine not accepting my (perfectly valid) card, Alan pulled a few strings and persuaded them to accept slightly less cash than than the value of the meal, we hastily moved on. Most of the group headed home but a few of us stayed out and proceeded to Brewdog where we later met up with Rob, Paul, Carrie Anne, Simon and Andrew and the others. We had a great night getting better acquainted with each other – as I said, many of us knew each other by online personalities only so it was interesting to speak in person for a change. We also dished out a few dozen Raspberry Pi coasters around the bar. I had a fantastic day and really enjoyed socialising in the evening. I tweeted this the following morning:

Thanks to Alan for organising the event, to Les & team for their work on getting the videos recorded (and live streamed!), to all speakers and attendees and to the sponsors for making the event possible – CPC, Bytemark, BCS Manchester, Frogtrade, OCR & PC Pro.

You can see all the videos from the day on Alan’s YouTube account (or download the video files from Bytemark Jamboree Download Centre)

Update: here’s a video summing up the Jamboree:

Richard III

A skeleton found beneath a Leicester car park has been confirmed as that of English king Richard III.

Experts from the University of Leicester said DNA from the bones matched that of descendants of the monarch’s family.

Richard was killed in battle in 1485 but his grave was lost when the church around it was demolished in the 16th Century.

The skeleton had suffered 10 injuries, including eight to the skull.

The bones, which are of a man in his late 20s or early 30s, have been carbon dated to a period from 1455-1540.

Richard was 32 when he died at the Battle of Bosworth in 1485.

~ BBC News » Richard III dig: DNA confirms bones are king

Baldrick nails it:


~ The Black Adder S01E01 – The Foretelling

Comprehension in Python

Python is a wonderful dynamic language offering various functional programming features, including standard library modules itertools and functools borrowed from Haskell and Standard ML. Some see it as the best of both worlds as not only can you perform complex tasks with these functional programming tools but you can do it using simple readable code thanks to Python’s beautiful syntax.

Early on in my experience with Python I discovered list comprehension. Traditionally, to generate a list (an array) of values according to a particular rule, let’s say a list of square numbers, we initialise an empty list, and loop over the domain, square each one and add it to the list:

squares = []
for n in range(10):
    squares.append(n ** 2)
-> [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

However, using list comprehension allows you to generate this list in a single (readable) line:

squares = [n ** 2 for n in range(10)]
-> [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

I really like this shorthand. It’s a list definition in the assignment. Not assigning [] to the variable, then building it up, just assigning it to exactly what you want it to be. Concise!

You can do list comprehension with two domains, say a rows range and a columns range:

rows = cols = range(3)
grid = [(r, c) for c in cols for r in rows]
-> [(0, 0), (1, 0), (2, 0), (0, 1), (1, 1), (2, 1), (0, 2), (1, 2), (2, 2)]

grid = [(r, c) for c in cols for r in rows if r != c]
-> [(1, 0), (2, 0), (0, 1), (2, 1), (0, 2), (1, 2)]

This example generated a single list of all the tuples of coordinates of a grid – the second ignoring the diagonal – which is equivalent to:

rows = cols = range(3)
grid = []
for r in rows:
    for c in cols:
        if r != c:
            cell = (r, c)
            grid.append(cell)
-> [(1, 0), (2, 0), (0, 1), (2, 1), (0, 2), (1, 2)]

The following example generates a nested list of tuples, separating each row:

rows = cols = range(3)
grid = [[(r, c) for c in cols] for r in rows]

-> [[(0, 0), (1, 0), (2, 0)],
    [(0, 1), (1, 1), (2, 1)],
    [(0, 2), (1, 2), (2, 2)]]

You can wrap a list comprehension in a function such as sum:

sum(i ** 2 for i in range(10))
-> 285

An example of string generation from joining comprehended lists:

msg = [['M', 'J', 'S', 'F'], ['A', 'O', 'O', 'O'], ['K', 'H', 'M', 'O'], ['E', 'N', 'E', 'D']]
' '.join(''.join(msg[j][i] for j in range(4)) for i in range(4))
-> 'MAKE JOHN SOME FOOD'

There are other ways you can manipulate list comprehension but this gives you the idea.

More recently I discovered it’s also possible to comprehend dictionaries and sets in the same way, using curly braces instead of square brackets:

my_dict = {i: i ** 2 for i in range(1, 11)}
-> {1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64, 9: 81, 10: 100}
my_dict[7]
-> 49



Note the sets only contain each value once, as it cannot contain duplicates.

Finally, another interesting feature is generator comprehension, known as generator expressions:

gen = (i ** i for i in range(1, 10))
print gen
-> <generator object <genexpr> at 0xfc7d20>
gen.next()
-> 1
gen.next()
-> 4
gen.next()
-> 27
gen.next()
-> 256

Generators don’t keep the list in memory. Instead, each time the next() method is called on it, it returns the next value. This can be done in custom functions by use of the keyword ‘yield’ rather than ‘return’. Return would be used to send a whole list back, whereas yield could be used to return each value individually, when prompted. You can also request a list from a generator by wrapping it in the list function.

Comprehension’s not always the right way to do something. It’s natural to want to use it for everything once you discover it can be done, but some situations are better written longer. I tend to follow PEP8 – one of the guidelines is that a line must be shorter than 80 characters. If my list comprehension is longer than this, or I struggle to explain it to someone, it should probably be changed. If there’s any logic in the item generator, it could be abstracted out to a separate function. Sometimes even the nested list is the way to go.

Read more on list comprehension and data structures at docs.python.org. Note this functionality was brought in in version 2.7

You can discuss this article on Hacker News