Making PiFace Even Easier

I’m amazed how fast time goes, so a quick update on the world of PiFace

We’ve worked hard to package up the PiFace Digital software into debian packages. It’s now possible to install it using apt-get.

The latest version of Raspbian has the packages included by default http://www.raspberrypi.org/archives/4959

We’re also nearly ready to launch the new website — there’s a sneak preview below. I’d hope to post the URL in the next couple of weeks once we’ve finished testing.

Image

Praising the Fearless – Young Rewired State.

While it’s great to see the coverage of children coding, it puzzles me why journalists set them apart from the rest of us. How many articles in the general media refer to ‘boffin’ or ‘whizz kid’?

On one hand it’s flattering, but on the other hand is it helping to proliferate the idea that computers are magic, or “I couldn’t possibly do it”. Take the latest video about YRS http://www.bbc.co.uk/news/uk-23663350. The opening line ‘Meet the next generation of computer programmers’ suggests to me that a label has been attached to the children, suggesting their chosen profession, not that for the next generation, we’ll all have to be able to program a computer. Just over half way though, there’s then a scene of panic, suggesting how complicated it is to learn to code unless you’re some sort of whizz kid. The video features participants in Young Rewired State, a movement to try and get more people using computers to solve problems.

I was a mentor at one of the 40 Young Rewired State centres that challenged your people to build a phone app or website in a week. All the centres met at the Custard factory in Birmingham over the weekend to see what had been made and to swap experiences and generally have fun.

20130810_145307

The overall winner was Picycle, an app that indicated directions for cyclists with LEDs. Personally I was pleased it was recognised as I always love to see hardware hacking. And it was powered by a Raspberry Pi. I really want one!

While I was impressed by the knowledge shown by some participants, I was more impressed by those that had not coded before. By the end of the week, everyone in our group had done some coding and contributed to a new app. I found it an immensely positive experience, with everyone, adults included, learning something new. From the start we were taken aback by some of the young people reeling off their competences and discussing the technical merits of one language over another; clearly they’d spent a lot of time studying and practising their art. To me though, more inspiring was the nine year old and his sister who’d never coded before, yet by the end of the week had decided they wanted to spend the rest of the summer learning more.

Did they arrive at the centre as computer geniuses? No. They just had an open mind and a willingness to experiment and learn. Did all their code work first time? No, and I’m yet to meet a professional programmer whose code always does either. However, by the end of the week they’d beaten the bugs and they had made a website that was novel and a real need for. And above all everyone had a good time.

So, maybe rather than talking about computer whizz kids with some inherent magical techie powers, perhaps it’s more about recognising the hard work, determination and above all willingness to have a go. Maybe articles in the future wanting to grab the headline could use adjectives like ‘fearless’ rather than going for the stock set. That way, more people might realise, actually they can program!

PiFace, Ice Cream and the Gadget Show

I can’t believe it’s been a couple of months since the last post! We’ve been busy running workshops, presenting at Cheltenham Science festival, meeting teachers, staring on TV, as well as writing tutorials and squeezing in a bit of product development. We’re bursting to tell you what’s new, but will have to wait a few weeks longer. One problem we find is almost every week a new challenge pops up. So, our next challenge, how hard can it be to build a Pi powered ice cream machine?

You may have noticed the UK is experiencing a hot spell, and what could be more perfect for sunny days, than a Raspberry Pi and PiFace powered ice-cream machine! That’s exactly what Channel 5’s The Gadget Show have built. They use a PiFace to control the leds and the solenoid that operates a valve to dispense smooth, refreshing whippy ice cream. That’s the theory, and while the Pi and PiFace operated correctly, The Gadget Show didn’t manage to get their mix right, and sadly their contraption dispensed a dribbly mess.

You can see the results here: http://gadgetshow.channel5.com/gadget-show/blog/episode-8-ice-cream-maker-studio-build

Image 

We’ve reached a stage where computer control is easier that cooking! I’m really pleased to see PiFace and the Pi being put to work creating fun projects. The Gadget Show highlighted how easy it was to program Pi and PiFace in Python by pretty much anyone (including a TV presenter!). It’s exactly what PiFace was invented for!

So, how hard can it be? Inspired by Channel 5’s The Gadget Show I wonder if we can build something better? Maybe I could include a temperature sensor that will only dispense when the ice cream mix is ready? Perhaps it needs liquid nitrogen? I’ll post progress on the blog, but only after I’ve finished the tutorials, I promise!

We’ve got lots planned!

We can hardly keep up with everything going on with Raspberry Pi and PiFace! We know the blog has been quiet for a while, but it’s because so much has been going on behind the scenes.

We’ve got lots planned, an enclosure for PiFace, some tutorials and projects and a new website, so check back soon.

PiFace in Winning Raspberry Pi Competition Entry

Congratulations to Richard Pate School for their super entry that uses PiFace Digital, in the “PA Consulting Raspberry Pi Competition”. This video features the children showing a school assembly how their invention works. http://www.richardpate.co.uk/raspberrypi/index.html There’s also a link to a write up about their achievement. As well as budding computer scientists they’re clearly confident communicators too.

The BBC have covered it here: http://www.bbc.co.uk/news/technology-21882845 .

Screen_shot_2013-03-21_at_23

It’s really great to see this — the PiFace was designed to make it really easy for anyone to control things and sense inputs. In this case the children have used it to control the lock on the door and drive LEDs to indicate the status. The young inventors have used Scratch, and it shows what we’ve seen at workshops — no one is too young to learn to program!

So, congratulations to all involved, I’m sure that in the future we’ll see some of these youngsters as the engineers of the future, and who knows what they’ll go on to achieve.

 

Raspberry Pi at Bett 2013

Last week, Raspberry Pi received an amazing response at Bett http://www.bettshow.com, a huge show about educational technology at ExCeL centre, London. For some teachers, it was the first time they’d seen a Raspberry Pi.

20130131_150657

On Thursday, Robert Mullins, co-founder of Raspberry Pi gave a talk to the vast Bett Arena. Mark Dorling from CAS, and Christine Swan also shared their experiences of teaching in schools. This showed that teaching with Raspberry Pi was achievable, and it can be used in the classroom. On a personal note I was pleasantly surprised to see Christine showing her use of PiFace with her students to build Raspberry Pi controlled Lego buggies. Mark Dorling described his experience of teaching computing at primary level, including getting computational concepts across through dance activities with Scratch.

OCR, a UK exam board, were there showing their support for the Raspberry Pi, and how it was livening up lessons in ICT and computing. As the photo shows, their presentation was rammed with standing room only.

20130201_133700

I was amazed by Rob Bishop’s energy as he did demo after demo on the overflowing OCR stand. OCR have produced some lesson resources, with more being added soon. http://www.ocr.org.uk/qualifications/by-subject/ict/raspberry-pi/ It was personally a great honour to bump into Raspberry Pi founder Jack Lang on the stand. As Liz describes him at http://www.raspberrypi.org/archives/2926, he truly is a brilliant man. I do hope that Raspberry Pi inspires youngsters to go off and reach equivalent achievements.

20130131_140706

I’ve always felt that activities should fundamentally excite young people, so they want to learn about computing – it’s the same motivation for the twittering chicken http://www.itv.com/news/granada/update/2013-01-08/computer-tells-world-when-you-raid-the-cupboards/. The screaming singing jelly baby is a fab, really simple but imaginative example of interfacing with the Raspberry Pi. A couple of paper clips are inserted into a jelly baby which when squeezed complete the circuit, triggering the playback of a scream song. Clive Beale, the new Director of education for the Pi Foundation was also on hand and discussing plans to get the Pi in the hands of more children.

At the Computing At School http://www.computingatschool.org.uk/ discussion, Raspberry Pi was high on the agenda – the main theme being the importance of giving teachers an idea of what can be achieved with embedded computing. To that end, carried along by the enthusiasm in the room, in less than 30 seconds Rob Bishop had proposed an event, OCR had generously offered to support it, and I’d offered to host it! The event will likely be in the next couple of months, to help teachers realise the potential for Raspberry Pi as an embedded platform, and how this can help them teach computing/ICT. More details will be published when finalised.

Despite an exhausting few days, one of the big pluses about these events is the energy that comes from meeting other like-minded and passionate people and seeing how they are improving education. Miss Philbin aka http://www.ictwithmissp.co.uk/ and the founder of http://www.geekgurldiaries.co.uk gave a number of talks, including her development and use of e-portfolios with Google Apps.

I truly am amazed by the energy and dedication some people (especially teachers) have and hope their efforts encourage other teachers to excite youngsters about computing and ICT, and undoubtedly this is helped along by the Raspberry Pi.

 

Draft instructions for getting started with PiFace Digital (full instructions to follow)

Full documentation will be published in the next couple of days, but in the mean time, for those who have been lucky enough to receive the first interfaces, here’s a brief summary

Getting started with PiFace Digital

PiFace Digital is one of the quickest and easiest way to connect your Raspberry Pi to the real world. Follow this guide and you’re Raspberry Pi will be reacting to switches and controlling motors and lights in less than ten minutes! 

  • PiFace Digital features at a glance:
  • 2 changeover relays
  • 4 switches
  • 8 digital inputs
  • 8 open-collector outputs
  • 8 LED indicators
  • Easy to program in Python, Scratch and C
  • Graphical emulator and simulator 

Always disconnect the power before connecting anything to your Raspberry Pi or PiFace Digital.

Fitting the board

PiFace Digital sits neatly above the Raspberry Pi and connects using the expansion connector. Take care to ensure all expansion pins are lined up with the holes on the PiFace socket. Check the alignment for left and right and front and back and never force the boards together if they don’t slide smoothly.

Installing Software

The fastest way to get started is to download a prepared operating system image and copy it to an SD card. Images are available from http://pi.cs.man.ac.uk/download.

Alternatively, you can install the necessary libraries to your own Raspbian image with the instructions below.

Installing the software yourself in Raspbian

PiFace Digital communicates to the Raspberry Pi using the SPI interface. The SPI interface driver is included in the later Raspbian distributions but is not enabled by default. You can always enable the SPI driver, or you can load it by hand when required.

Always enabling SPI

To always enable the SPI driver:

  •  After logging in, edit /etc/modprobe.d/raspi-blacklist.conf

sudo nano etc/modprobe.d/raspi-blacklist.conf

  •  Insert a # at the start of the line containing blacklist spi-bcm2708 

#blacklist spi-bcm2708

     

    Alternatively, to load the SPI driver by hand (will not be loaded on reboot):

    ·      Type in a terminal:

    sudo modprobe spi-bcm2708

    Next, you we need to install the PiFace Digital libraries and change the permissions of the SPI interface. The following script automates this into one command.

    To install and setup the software, ensure your Pi can access the Internet and type:

    sudo apt-get update

    wget -O – http://pi.cs.man.ac.uk/download/install.txt | bash

    The software will complete installing in a few minutes.

    Reboot your Pi by typing:

    sudo reboot

    Testing

    After installing the software and restarting, login and startx.

    Start the PiFace emulator by typing in a terminal:

    piface/scripts/piface-emulator

    Outputs

    1.     To manually control the outputs, in the PiFace Emulator window, click Override Enable.

    2.     Toggle Output Pin 1 on by clicking on it. The PiFace interface will click as the relay turns on and the corresponding LED will illuminate. Notice the graphic onscreen updates to show the LED being on, the contacts have changed over on the relay and the first output pin is on.

    The LEDs are in parallel with the outputs terminal connectors and indicate when the output is enabled.

    Inputs

    1.     We want to observe the inputs so click Keep inputs updated checkbox so the emulator reads the buttons and updates the screen. The interval sets how often the inputs are read, for most cases, it is fine to leave it on 500ms.

    2.     Press one of the buttons on the bottom left of PiFace. Notice how the onscreen representation changes to indicate the switch has been pressed.

    First steps with Python

    To use Piface with Python import the piface.pfio module:

    import piface.pfio

    Before use, the board must be initialised with a call to init() .

    There are three main functions to control the interface

    ·      digital_read(pin_number)

    o   returns 1 or 0 depending on the state of the input numbered pin_number

    ·      digital_write(pin_number, state)

    o   sets the output numbered pin_number to state 0 or 1. State 1 turns the LED on and enables to open collector to sink current

    ·      digital_write_pullup(pin_number, state)

    o   sets a 10k pullup on input numbered pin_number to be state 0 or 1. State 1 is pullup enabled