Hull Raspberry Pi Jam with robots


Well, that was great fun. Spent the morning at the Hull Raspberry Pi Jam. It was something of a "RobotFest". I had my Hull Pixelbots and Coretec Robotics were there with their balloon Raspberry Pi powered balloon busting robots. I was trialling a new idea I've had, called the "Robot Rumble". The idea is that players code up their robot warriors to get as far into their opponents area as possible. You can find the draft rules here

As it turned out we didn't get that many rumbles going, but folks had great fun making their robots do things, including some things I'd never have thought of, which was rather nice. And from the sounds of bursting balloons and cries of victory coming from the other side of the library, fun was being had there too. 

The second part of this post was going to have the title "Three Thing Game Judging Fun". But instead I'd have to use the title "I probably shouldn't have eaten that chicken from the fridge". Number one wife did ask me to check the sell by date but I was confident it was fine. And besides, I'd thrown the package away.

By 2:30 it was turning out that the chicken might not have been that fine after all. And an attempt to "kill or cure" by drinking a can full of "Old English Ginger Beer" didn't have the desired effect. Which meant I had to beat a hasty retreat from the event and head home for a lie down amongst other things. 

Fortunately the effects don't seem to have been too long lasting, which is a good thing as I'm supposed to be driving to Birmingham tomorrow. 


Raspberry Pi at c4di Hardware Meetup this Thursday


If you were at the "Easy as Pi" HullDevs presentation from John Tasker last week (incidentally he has put his slides and sample code here) you might like to come along to our Hardware Meetup onThursday this week at the c4di, starting at 6:00. 

If you have any questions, or have a Pi that you want to get started with, or want to see what you can do with your Pi, then come along. Hardware welcome. I'll be bringing some of my Pi collection, including the world famous Logo Blaster. You can sign up here.

The Pimoroni Mood Light Rocks

 I just love a busy desk. 

I just love a busy desk. 

A while back I ordered a Mood Light kit from Pimoroni. It never came (sad face). I told them about this and they dispatched a replacement. The same day. With no quibble or question (happy face). It arrived a couple of days ago and today I found enough time to assemble it.

With it being based on the Raspberry Pi I had to find a video display and a keyboard for it to get things going. I ended up using my video projector of Logo Blaster fame and a little remote keyboard that didn't work until I connected it via a usb hub.

The good news is that the Raspberry Pi experience has come on a lot since my early days with my Pi B. The great news is that the kit itself is awesome. Lovely attention to detail, even down to little rubber feet for the stand. It all fits together in a very impressive way and worked first time. If you're thinking of building one, you'll need to solder the connectors onto the Pi and the display device. If you've not soldered before it might not be the best thing to learn on, but if you've soldered a bit you'll have no problems. You'll need a power supply and a micro-SD card but nothing else, the kit has everything and comes beautifully packed in a nice plastic box. 

Once I'd got the Pi going and set up remote access I was able to do everything via my PC, so I could put my keyboard and monitor away. You control the lights (there are 32 neopixel leds on the lamp) from Python, so there is no limit to what you can make the light do. 

I'm very impressed with the kit and the Raspberry Pi Zero that it is based on. The fact that you can get the thing for thirty quid (or even less if they are having a discount offer running) makes this thing astonishing value. You should get one. So much power and potential for less than a full price video game. I'm going to get the Scroll Bot next.

Hull Raspberry Pi Jam

Today I was in Hull doing a bit of shopping. As you do. I also dropped into Hull Central Library to give Matt a pixel for his Hull Pixelbot. He's written a lovely blog post about building a robot last Thursday, and I thought I'd give him something extra to work with.  Matt was helping at a Hull Rasp Jam event.

Libraries have changed a bit since we used to take the kids every week to swap their books for different ones. There are still books there, but you can also find crafting sessions, people playing chess and  Raspberry Pi events too. Great stuff. 

I wasn't able to stay long at the jam, but it was great to see lots of people engaging with technology and having fun doing it. I'll try and make a bit more time for the next one. 

Using a Raspberry Pi as an Access Point with Windows 10

I've got a few things running for my TechDays sessions next week. They are working fine on my home network. Now, I know that the conference will have WiFi, but in my experience this can be problematic. Sometimes they use browser based authentication steps which are hard to replicate on a device with no screen, keyboard or mouse. 

But I have a plan. I've got a portable access point that I use on occasions just like this. I know exactly which shelf it is stored on, in a nice little case and everything. So I go and grab it. Of course it's not there. It's not anywhere. Blarst.  

However, I do have a Raspberry Pi 3 which I was planning to take along as well. And it turns out that it will work as an access point too. And setting it up is a dead doddle. I started with the howto here. That got me the Windows 10 IoT Core Dashboard which is an awesome little program that will create an SD card to use to boot your Pi and then take you through connecting and configuring it. The great thing for me is that it lets you use a "naked" Pi, with no keyboard, mouse or screen. All the configuration can be done via the browser based control center. 

If you want to turn your Pi into an access point just head for the IoT Onboarding page you can see above, select a suitably obscure SSID and password and then save them. (I'd advise against the defaults). After a reboot you should have an access point which clients can connect to. 

If you want to share the wired network connection from your Pi you have to actually turn this on. The user interface here is a bit rubbish to be honest. There's nothing I could see that indicates if the sharing is on or off, and you have to make sure that you connect the right adaptors at each end. Which is why you might find the screenshot useful. Just select the items that you can see in the "Access point adaptor" and "Shared network adaptor" and then click the "start shared access" button. And then it all just works. Awesome. 

One tiny gotcha. On my Pi the SSID gets a bunch of hex characters added to it.  HullSSID would probably change to XY_HullSSID_ED50. Browse for the WiFi connection with another device before you put the text into a client program.

Raspberry Pi 3 - Most Interesting

The first Raspberry Pi was a nice device. At the time it was ground breaking. The Raspberry Pi 3 looks at least as ground breaking. It's faster, of course, but it also has WiFi and Bluetooth built into it, which makes it a ready to roll, fully connected Internet of Things device. Previously you'd have to use a physical  network cable and then directly connect your Pi to the device you wanted to talk to. Now you can do it all without wires.  

You can get the Windows 10 Insider Preview that works on the Pi 3 from here

I've ordered mine. 

Windows 10 on Raspberry Pi Rather Useful Seminar

We had a Rather Useful Seminar today. I talked about Windows 10 on Raspberry Pi 2. Great fun and all the demos worked. It is rather impressive to be able to flip a switch and swap from PC to Pi deployment, and still have all the Visual Studio loveliness including  breakpoints and full debugging support.You can find the slides here.


WiFi on Windows 10 Raspberry Pi

I've been playing with Windows 10 on Raspberry Pi for a while. It works really well. It is now my weapon of choice for proper embedded applications.

The Arduino is lovely for tiny apps, but if you find yourself adding SD card interfaces and network adapters and displays you might as well move up to the Pi and get the benefit of C#, Visual Studio and a properating system like Windows 10. 

Up until now I've been tied to a network cable as the previous versions of the Windows 10 Raspberry Pi platform didn't support WiFi. But the latest one does. You have to use the "official" Raspberry Pi WiFi interface, but as this is one of the cheapest (at six pounds) I don't see this as a problem. 

I've added one to my Pi and it works fine. The only problem I've found is that at the moment it doesn't support WiFi connections using the "organisation" authentication that we have at work on the campus network. However, it works fine at home my my domestic network. If you are writing Windows 10 applications for Raspberry Pi you should get one of these for each of your systems. They also raise the lovely prospect of properly powerful connected applications. 

Reading Raspberry Pi inputs using C# in Windows 10

 The LogoBlaster and its buttons

The LogoBlaster and its buttons

I had a lot of fun making my Windows 10 LogoBlaster. At the heart of the program is code that responds to the buttons that are pressed to select the required command. These are wired to inputs on the Raspberry Pi. It turns out that some of the inputs have pull up or pull down resistors, which helps keep the wiring simple.

I used the pins that have Pull Down resistors on them. These resistors do what the name implies. They pull the voltage on the input pin down to the ground level. The diagram above shows how this works. The Pull Down resistor connects the input port to the ground level, which means that if the switch is open the signal at the port is 0. But when the switch is closed it pulls the input port up to the power supply voltage, causing the signal at the input port to rise to 1.

If you don't have the pull down resistor (i.e. you let the input port pin wave about in the air with nothing connected to it until the button is pressed) you run the risk of induced voltages leading to spurious input signals. Sometimes you have to actually add your own resistors to the circuit, but in the case of the Raspberry Pi they are built into the hardware so all I had to do was connect the input port in to the switch. There is a table here which tells which pins have pull ups and which have pull downs.

        const int B1Pin = 12;  // wired to pin 32
        const int B2Pin = 13;  // wired to pin 33
        const int B3Pin = 16;  // wired to pin 36
        const int B4Pin = 26;  // wired to pin 37

These are GPIO pin numbers I used for each of my buttons.  Note that the GPIO numbers used by the software don't correspond to the pin numbers on the header on the Raspberry Pi, but I've put these in as comments.

var gpio = GpioController.GetDefault();
GpioPin nextColorPin = gpio.OpenPin(B1Pin);
nextColorPin.DebounceTimeout = new TimeSpan(0, 0, 0, 0, 20);
nextColorPin.ValueChanged += nextColorPin_ValueChanged;


private void nextColorPin_ValueChanged(GpioPin sender,
                    GpioPinValueChangedEventArgs args)
    if (nextColorPin.Read() == GpioPinValue.High)
        command = DisplayCommands.NextColour;

This is the code that sets up and uses the pin. Note that I set a debounce timeout of 20 milliseconds. This is there because the switches that I used were a electrically noisy and sent quite a few extra ones and offs when they were pressed.

The handler for the pin works very like a normal XAML button, in that it generates events when the input pin changes state. The  code in the event handler checks to see if the pin has changed to the high state (which means that the button has been pressed) and if it has it sets a command value to change the display colour. The code is repeated for the other buttons which select the different commands

Windows 10 Celebration fun and frolics

Well, that was nice. Turns out that Microsoft can build operating systems and also organise great parties. We got there a couple of hours before the doors opened and got everything working just in time for the start. I was responsible for the "Lift Off" game and the LogoBlaster. The Lift Off game has one or two gameplay issues, but I was surprised (and pleased) to find that some folks worked out how the game worked and then got very competitive.....

The LogoBlaster worked incredibly well. This is my pairing of a Raspberry Pi running Windows 10 and a portable video projector. We ere using it to project Windows 10 logos on passers by. 

It was interesting to notice that some folks didn't really get what it was doing until I showed them where the pictures were coming from. We managed to get the Raspberry Pi to load the LogoBlaster program on boot up, so that the unit became completely wire free. I was able to happily wander round adding logos to passing people.

 Demonstrating the power of Logo Blaster

Demonstrating the power of Logo Blaster

 Adding cheese to the surroundings

Adding cheese to the surroundings

 Shameless self promotion - and a hexapod robot

Shameless self promotion - and a hexapod robot

The best moment came when we pointed the LogoBlaster  at someone's head by mistake. And the results were awesome. He (I'm awfully sorry sir - I've forgotten your name) was even happy to pose for a while as we took some more pictures.

This came out really well. I've put a whole bunch more pictures on Flickr. You can find them here.

The event ran for four hours. By the end we were all thoroughly hoarse from talking to folks about what we had done. But it was wonderful. We packed up in double quick time and staggered back to the hotel. Thanks to Paul for inviting me and letting me be part of this event. Great fun. 

Game Mechanics and Raspberry Pi's running Windows 10

I had a go at writing a game for Three Thing Game last week. Just to be different I thought I'd do a hardware game using Windows 10 on the Raspberry Pi. We had some fun and games getting the Raspberry Pi to work in the labs, mainly because the lab network didn't give them a network address when the Pi asked. That and the fact that for some reason Logitech USB mice just don't work on a Raspberry Pi running Windows 10. No idea why. They just don't.

Anyhoo, we got everything working and I started building the game. I connected two leds and two switches to the Pi and got them working. Then I built the game mechanic. This is the way that the game is supposed to work. My first idea was that the player would have to press the button when the light came on, but I decided that this was a bad idea because after a while the switch will get destroyed by people bashing it in a hurry.

So I switched it around. When the light goes off you need to release the button as fast as you can. I called the game "Lift Off" because that's what you are supposed to do, and I made it competitive. The idea was that two players would compete in a number of rounds over a 30 second period. They'd press the button, the light would come on for a random time and then go off. The game would then time how long it took the player to release their button and then add that time to the player's score. At the end of the time period the player with the lowest score wins.

I got the code working and it was OK. But then I came across serious flaw in the gameplay.

You could win by not pressing the button at all.

If you never press the button, the light never comes on or goes off, and you end up with an unbeatable score of zero points. So I'd invented a game where doing nothing was the absolute best winning strategy. Oh well.

I've now added a timer so that if you don't press the button you get a big penalty, and I'm tuning the gameplay at the moment. I'll blog how the code works a bit later, once I've got the gameplay mechanic properly sorted - something I should have thought about earlier. Another lesson learned.

The experience of writing a C# XAML application for Raspberry Pi was a bit strange, but in a wonderful way. Everything was exactly where I expected it to be, but I was targeting a tiny device. I had access to all usual development tools. I could step through code and view variables in Visual Studio, use all the libraries that I know and love, but I was targeting a device that costs around 25 quid. If you're running Windows 10 and you've got the Visual Studio 2015 preview running you should have a go at this. It is going to make it much, much, easier to create rich applications for cheap embedded controllers. Very nice.

C4DI Hardware Meetup - You Should Come Along - Really

If you live in the Hull area and have any kind of interest in technology there's a very good chance you'd enjoy a C4DI hardware meetup. They are first Thursday of every month and we have a mix of folks who like playing with computers and hardware and stuff. This month we had a Raspberry Pis of various flavours (which sounds wrong but it's right), flashing lights, amazing embedded devices you can get for less than a fiver and some brilliant discussions amongst other things.

Keep an eye on the Hull Meetup site for the next one.

Benchmarking the Raspberry Pi 2 in Python

Well, I went off the the Post Office and got my Raspberry Pi 2. I really wanted to find out what kind of improvements you see when you use it.

The answer is, a lot. 

Booting was snappy, and the time to launch X-Windows was quite a bit quicker (although I'm not sure of the effect of the different SD cards I was using). But things got quite conclusive when I ran a little Python profiler:

  • Original Raspberry Pi B:  207 function calls in 0.017 seconds
  • Raspbery Pi B 2: 207 function calls in 0.003 seconds

This is just one test, but it shows a lot of promise. Python really seems to benefit from the extra cores as well as the faster processor.

Just pootling around the internet with the browser is a lot quicker than the original Raspberry Pi, but doesn't really compare with my super cheap Linx tablet, which is on paper a broadly comparable device. I'm not yet convinced that someone looking at the Pi 2 as a desktop replacement will find it a good plan, but as a step up from the original it is fantastic.

Raspberry Pi 2 and Windows 10

News of the Raspberry Pi 2 took me completely by surprise. And then, to add to this shock I find that it is not only an awesome device, but available to buy right away. Amazing. Who do these people think they are? Apple?

If the news of a new Pi with quad core processor and twice as much RAM wasn't enough though, I then find that the new Pi will be able to run Windows 10. For free. The only word I can think of to sum up this turn of events is blimey. 

The Windows 10 support will be limited to "universal" applications, which means an end to  any dreams of running Visual Studio on a device you paid 25 quid for. But that does mean that you can use Visual Studio to write and deploy programs onto the device, which will be great. You can find out more about Windows 10 on Pi here.

The development puts a mild question mark over devices such as Galileo and Edison, which are of the same ilk, but are more expensive and have no display capability. I guess everything will settle down and find its place eventually. The two Intel devices probably have a bit more straight line speed, although the 900 MHz four core processor in the new PI is not to be sneezed at. 

Anyhoo, my Raspberry Pi 2 is presently sitting in Cottingham Post Office waiting for me to drop round and pick it up. I actually bought 2. One to give the Video Arcade Table a shot in the arm, and the other for playing with.  We really do live in interesting times. 

Update: I've had a chance to do a very quick benchmark and compare the performance of the original and the new Rapberry Pi. You can find out more here

Minishift on Raspberry Pi

Well, that was a fight and a half.

I've finally got the Minishift that I was building connected to the Raspberry Pi and working. This turned out to be a lot less trivial than I expected. One of my strongest beliefs is that the best way to learn stuff is to try and do things. I've sure learned a lot this time. 

You can put items into the Minishift in a variety of ways. It supports SPI (Serial Peripheral Interface), so you can just connect an Arduino (or probably a Raspberry Pi) directly and it should just work. However, it is supplied with a rather spiffy USB-SPI interface and so I thought I'd use that instead. It looks neat. 

So I plugged the board into my Pi and up popped a new HID (Human Interface Device) in the dev folder. So I thought all I'd have to do was install the Minishift Python program and I'd be good to go.

Wrong. Wrong, wrong, wrong. 

What I had to do (from memory, there may be steps I've forgotten) was to:

  • Update everything
  • Upgrade everything
  • Install missing things
  • Install python-dev
  • Install pip
  • Install minishift
  • Install Cython
  • Install libusb
  • Install udev
  • Install hideapi
  • Remember to run Python as super user so it could see the device

Anyhoo, it now works fine and the hardware looks great. The next step is to get a perspex case for the Pi and then make a little mounting bracket so I can put the Pi and the display on the wall somewhere and have a clock/RSS feed reader/weather forecast thing going. 

The MiniShift is great fun to build. You can find it on Tindie

Raspberry Pi B+ Tabletop Upgrade

 Still a work in progress...

Still a work in progress...

It's been nearly two years since I started on my Raspberry Pi powered arcade tabletop. I got it to the point where it was just about working and promptly lost interest. For a considerable while the poor thing has been languishing in my office. I even took the drastic step of removing the monitor in the hope that the sight of the empty hole might motivate me to actually finish it off. 

Anyhoo, this week I've decided to actually get the project finished. I've made an arrangement with Robert that if I've not got the table finished by the time he comes back from his travels I'll give him fifty quid. I figured that this would force the issue nicely. So far it is working....

Another reason for finishing it off is that I needed a solid reason to play with the new Raspberry Pi B+ device. This has lots of advantages for this project. It has four USB ports so I don't need a USB hub or separate power supply. I now just need two power cables to the device. One for the monitor and the other for the Pi. 

My B+ arrived today and I spent a little while getting it going. There is actually an operating system image specially for emulating games machines now, it is called PiPlay and it is rather nice. You just download the image and it has emulators for lots of devices. It hooks into Mame4All, which is the latest incarnation of Mame for the Raspberry Pi. 

However, I found that Mame4All is not quite what I want for all the games I want to play. It is based on a slightly older version of Mame which is good because it performs better, but bad because it is missing one or two crucial features. The biggest omission is the lack of the "cocktail table" button.

One of the things I want to be able to do is have a player at each end of the table so that they can get proper Player 1 vs Player 2 action. This means that I need to be able to invert the screen when each player takes their turn. Mame4All doesn't do this, but AdvMame does.  But then Mame4All works with some games that AdvMame doesn't like...

So it looks like I'm going to have to have several different Mame installations installed and then write a script that fires up the appropriate version depending on which game we want to play. Which shouldn't be too much of a stretch.

As for the Pi B+, it works very well. The only problem that I've found is that if you connect a USB device that wants a fair amount of current, for example a USB hub or speaker, it causes the Pi to reset. I think there are some settings that you can adjust to allow more current from these ports. I'll have find out more about this. 

I've also ordered some glass from Jack's Glass for the top. I just hope that Robert will be impressed when he gets back....

Hull at the ICT Conference

 Talking Pi

Talking Pi

Today Mike and I took a bunch of Raspberry Pi systems to a teachers conference for the day. Great fun. Particularly if, like me, you contrive to arrive just after all the machines have been carried in and set up. Actually we have got this off to a bit of an art now. We have a kind of Pi road show which consists of a bunch of Ikea bags containing the monitors (the heavy bits) and a couple of boxes with all the other parts that we need to run the systems. Anyhoo, we set up shop and then talked Scratch, Python, Hardware and the philosophy of education and the role of teaching programming.

Then we packed it all back into Mike's car boot and left.

If you want to find out what we were talking about, and get notification of any new courses that we are running in the future you can sign up for our newsletter at: