Third party cookies may be stored when visiting this site. Please see the cookie information.

Home Babies & Children Gallery Information Free Software Reviews Blog

Stewart's Blog

Monkeys, megabytes, medical and more ...

(Children, computing, first aid and other ramblings ...)

Installing a MyPiFi LCD onto a Raspberry Pi in a Pimoroni Pibow case

December 10th, 2014

Having already done some work with LCD displays on the Arduino I had been looking for a project to use one with the Raspberry Pi. Wiring this up was a bit messy until the MyPiFi LCD display board came along. The problem I then had was that I couldn’t fit the MyPiFi LCD onto the Raspberry Pi when it was in a case and as a result the LCD was in a vulnerable position.

I decided to do some hacking on an existing case and this is what I came up with:

MyPiFi LCD display mounted on a Raspberry Pi installed in a Pimoroni Pibow case

This is based on the original PiBow for the Raspberry Pi model B, although there is actually a Raspberry Pi model A inside the case.

The LCD display is not the one I purchased with the MyPiFi LCD module. I originally purchased a 4×20 display which I decided was too big for this particular project. I therefore swapped it for a SparcFun 2×16 display – which is similar to the 2×16 display provided as part of the Kickstarter.

You can ignore the cables coming out of the top for now (all will be revealed about the mysterious sensor in due course). This is a Pimoroni Pibow Case with some alterations made to the top layer.

If you want to follow this yourself then you should be aware that this involves permanently damaging the top layer of the Pibow case. If you’d like to use the case for something else afterwards you can buy a replacement Pibow top layer from ModMyPi. Similar modifications can be made to the Pibow B+ case, but I believe that it should fit the B+ Pibow Coupe with less alterations (not tested).

The first thing is that there is no slot for the GPIO connector (there is for a cable, but not for a board to be mounted directly on top). The distance between the GPIO connector also meant that I needed to remove some of the top layer so that the PCB could mount where the top layer normally is. I therefore decided to saw off the corner of the top layer of the Pibow case to the same size as the MyPiFi LCD display. I did this by placing the MyPiFi LCD board onto the top layer and drawing around it then cutting with a small hacksaw. Then filed it down to make it a snug fit and smooth the edges.

With the PCB mounted the LCD display is still loose so needed to be secured with PCB mounts. I fitted the top layer and PCB on and marked holes to drill two holes to connect PCB mounts to hold the LCD display on the right hand side. I have also included a PCB stand on the bottom left, but it is not connected to the PiBow. I used M2.5 nylon screws and nuts to hold them in place.

MyPiFi LCD display mounted on a Raspberry Pi installed in a Pimoroni Pibow case - pcb mounts

More details of the sensor and software will be added in future.

Father Christmas at Creaky Cauldron, Magic Alley, Stratford-Upon-Avon

December 7th, 2014

One bricked phone and lots of reboots – I finally have Android Lollipop on my Nexus 4

November 28th, 2014

I have been a fan of Android since I had my first mobile phone. Since Gingerbread I’ve managed to have every new version (although still running an older version on some of my devices) and it just keeps getting better. So I was very excited when I heard that the latest version Lollipop was available for my Nexus 4.

Android Lollipop

I was notified that the update was available. I checked on the requirements for the update (min 500Mb space) and made sure my phone was ready to take the upgrade. I applied the update and then disaster struck. The install appeared to go well until the “Installing system update…” screen. The bar moved across showing the progress as the update was installed, but instead of booting into the new operating system it rebooted back onto the “Installing system update…” screen.

I checked on the forums and I was not the first to have this problem. The suggested solution was to go into recovery mode, clear the cache and then try booting again. Worst case I should have been able to do a factory reset and then try the install again; or at least I though that was the worst case…

The problem is that whilst I could get to the bootloader I was not able to get into recovery mode. This appears to be a rare thing to happen, but there are certainly others that also reported the same problem.

I phoned Google (the phone was purchased directly from them through the Play store) and to their credit they sent me a replacement phone. It was their update that caused the problem with my phone in the first place, but the phone was originally purchased about 2 years ago, and I’d already had a replacement due to a faulty touch screen about 18 months ago. So whilst I think it’s only fair that they did replace the phone I know of other suppliers that are not so helpful.

The new phone arrived the next day. It’s a refurbished phone, but apart from the lack of packaging it looks every bit as good as a new one. The problem is that the Nexus 4 is now quite an old phone and it came pre-installed with Android 4.2.2. I logged in to the new phone and it came up with an upgrade available to 4.3 Jelly bean. This installed fine, but then the next install to Android 4.4 (KitKat) wouldn’t install. It downloaded and verified the install, but then when I clicked “Reboot to install” it counted down to “installing now”, but then didn’t actually reboot. I tried rebooting, checking for new updates but it just refused to install the update. I even tried a sideload from a PC (using both the next incremental update and a jump to the latest version), but all of these failed due to a verification failed error.

So last resort I thought – start again and did a factory reset. I thought that the factory reset would take it back to the initial Android image (ie. 4.2.2), but in fact it reset it to factory settings to the last successful image which was 4.3. At least this meant that I had kept my last installed image (even if I did lose all my data again). This was good as this was not going to be the last time I performed a factory reset.
I then successfully upgraded to Android 4.3.3, but the update to Android 4.4.4 failed. Aftering trying to get the install to work I then did another reset to factory state (which kept it at Android 4.3.3) and was then able to upgrade to Android 4.4.4. Finally I was able to update to Android 5 (Lollipop), but first following the advise of the Google help desk (and the forums) this time I did a cache reset first. The cache reset is accessed through the bootloader and wipes the cache partition, without deleting any data. I then tried the update for Lollipop, Android version 5. After a bit of nervous waiting whilst it went through the update the phone booted into Lollipop and finally my upgrade is complete.

I don’t think my experience is particularly common. My wife has a similar Nexus 4 (although she has the 8GB model whilst mine is the 16GB model) and her upgrade worked first time without any problems. There are some other people reporting similar problems, but I think we are in the unfortunate minority. The good thing is that Google were helpful in sending me a replacement phone and getting me back up and running again.

Android 5 looks great. Was it worth the hassle of the upgrade?
I don’t think that the new version of Android has any killer must have features, but as someone that loves technology it’s great to have the latest version of Android.


Also see QI Wireless charger for Nexus phone

Halloween Scary Pi-Ano – Raspberry Pi and Makey Makey keyboard

October 31st, 2014

This Halloween I created an indoor halloween light effect using a Raspberry Pi and a PIR sensor. Unlike previous years my children weren’t really involved in making this one, which is because my 9 year old daughter decided to create her own Raspberry Pi based Halloween Project.

Raspberry Pi and Makey Makey Pi-ano

She has created a Raspberry Pi, Makey Makey Pi-ano. It’s a musical keyboard using conductive play-doh shaped into pumpkins and ghosts using a biscuit cutter. The Makey Makey converts the touch contact into a key-press which is passed to the Raspberry pi.

In scratch these key presses are detected and used to play a short sound and light up a LED pumpkin using Scratch GPIO. More details on using Scratch GPIO in presentation mode on the Raspberry Pi.

Take a quick look at the video below (sorry no sound due to the speaker used being very quiet compared to the noise of the Halloween Party we were having in the background).

The LED pumpkin lights are from a shop bought Halloween decoration which I broke apart and soldered on solid core cables to make it easy to plug them into a breadboard. They were then connected to the relevant GPIO ports through a 220 ohm resistor.

I helped with the electronics and setting up the Scratch GPIO communications, but the rest of the programming is all my daughters own work.

The screen uses the HDMIPi screen, which is ideal for this kind of project.

You can download the software scary-pi-ano.sb.
Don’t forget to install Scratch GPIO extensions first.

It’s good to keep my daughter interested in programming. She doesn’t do as much as she did when she was in the Code Club I was running, but she does still enjoy it when we find a project she is interested in. My daughter also edited the video herself using kdenlive running on Linux.

Also see last years Halloween Trick or Treat scarer using the Raspberry Pi

Safely controlling mains electricity using the Raspberry Pi and Energenie Pi-mote

October 26th, 2014


It’s useful to be able to turn mains electricity on using a computer program. Whilst it’s not hard to create an electronic circuit that can switch mains voltages, if not done correctly it can be dangerous. This is where the remote control sockets can be used to create a physical barrier between the low voltage electronic circuit and the dangerous high voltage electricity in the socket. Whilst it would be possible to create a radio transmitter to control the sockets yourself I wanted to keep this simple so that it is something that could be made easily by anyone. In an earlier project Home Automation using the Raspberry Pi I opened up a remote control and used relays to emulate a button press.

Energenie Raspberry Pi remote control board (Pi-mote)

Since I created the circuit by hard-wiring across the buttons on a remote control, Energenie has created a Raspberry Pi add-on board which allows one to switch power sockets on and off using the Raspberry Pi. The board is plugged into the GPIO port of the Raspberry Pi making it easy to send messages using software.

Energenie remote control power socket

I bought the Raspberry Pi add-on board separate to the sockets which were in a pack with a standard remote control. I did hope to use the remote control and the Raspberry Pi to be able to control the same socket. This would allow me to use the Raspberry Pi for timed and/or Internet control, but then a traditional remote when that was convenient. In the sockets that I bought it appears to work with the Energenie Pi board or the remote control, but not both at the same time. I have been informed by Energenie that this should be possible, but I believe that I may have bought an older model of socket which does not support dual-remote controls. Fortunately there is a switch on the remote as well (which is useful if you’ve “misplaced” the remote, and it is possible to overcome the limitation by using the Pi-mote board configured as a virtual remote control (eg. on a mobile phone).

The products currently available from Energenie are sockets or a power strip, whereas some other suppliers also provide light switches which I found useful. The main advantage of the Energenie sockets is that this is the only supplier to provide this as an add-on board for the Raspberry Pi which is much easier and more reliable than hacking a remote control.

One thing about the Energenie remote controls is that I believe that all the remote controls (including the pi-mote) are registered using a unique identify code. Whilst this prevents having multiple controllers for each socket it does have the advantage that a neighbour using the same system cannot accidentally interfere with your sockets. I don’t believe it adds true security as it would still be possible to create your own controller board that monitors the wireless signal and then sends the same signals it does protect against accidental triggering. To do so would be pretty difficult and it’s unlikely that anyone would try and spoof a wireless remote control to turn your lights on or off.

I think that the Energenie product is much better than the one I was using before, dual remote feature is useful (included in new models) and it would be even better if there were some more home automation adapters in future (I have been told that there will be an extended range in future).

Adding an aerial

One thing I did do to the Energenie Raspberry Pi board was to add an aerial. Without the aerial the furthest I had it working was about 2 meters which is not particularly useful. The manufacturers state that it can have a range of up to 25 meters through open air. My limited range may be due to interference due to other signals; I do suffer from poor wireless signal strength in my house as well. Soldering a 135mm long piece of wire to the board extended the range considerably, this is easy to do as there is a hole for standard through-the-hole soldering.

Energenie Raspberry Pi power remote board with aerial

Energenie Software

The instructions for the Energenie includes some example python code. The code is not particularly easy to use so instead I used the Pi-remote code python module written by Amy Mather (whilst on work experience with Raspberry Pi foundation). This code makes it very easy to program the Energenie Pi-mote board using Python.

The power control web interface

I created a web interface which uses the python module mentioned above and the Python bottle web framework. The bottle web framework is a simple way to create a web application with a built in web server rather than needing a separate web server such as Apache.

To install the code first install the python-bottle package. Unfortunately the one supplied with Raspbian is an old version, but it’s easy enough to install using PIP.

sudo apt-get install python-pip
sudo pip install bottle

My web interface code can then be downloaded using

wget http://www.penguintutor.com/software/raspberrypi/pi-power.tar.gz

or: Download pi-power.tar.gz and copy it to the Raspberry Pi home directory.

Unzip the file using

tar -xvzf pi-power.tar.gz

change to the pi-power directory cd pi-power and then run the software using:

sudo ./web-power.py

This will start the web interface and you can then connect to interface using the IP address of the Raspberry Pi in a web browser (use ip addr on the Raspberry Pi to find your IP address). It should be possible to connect from a Raspberry Pi, PC or mobile phone and click the appropriate button to turn the socket on and off.

You do need to register the socket with the controller (if not already done using the Energenie demo code). This may vary with different sockets; for the model I use involved starting with the socket in the off position (press green button until the LED is off) then holding down the green on/off button for a few seconds (until the LED starts flashing) and then using the on button on the remote.

Energenie Raspberry Pi remote on HDMI Pi

The code is dependant upon Ajax, so a fairly recent browser is needed with Javascript enabled.

No security

Please note that there is no security included in the software I created. This means that anyone on the local network (eg. your home wireless network) can turn the sockets on and off. If you only provide WiFi access to your family then the WiFi passkey should be sufficient to protect your local network, but if you intend to make the remote control accessible over an insecure network (eg. the internet) then I recommend that you add an additional authentication step to the code.

Project ideas

As the pi-mote is controlled from the Raspberry Pi it would be possible to add other triggers to switch the sockets on and off. Using other software it would for instance be possible to use sound/voice activation (using an additional microphone) or with additional hardware based on the temperature of the air or of a liquid.

Whilst the pi-mote add-on board does not use all the pins of the GPIO port it does not make it easy to connect any other devices onto the GPIO board if using a standard model A or B. The model A+/B+ would be easier to add sensors as some of the higher GPIO ports could be used. An alternative (that the Raspberry Pi foundation used for a sous-vide project) is to create a PCB with a connector that the pi-mote can be plugged onto.

Summary

Using Engergenie sockets with the pi-mote Raspberry Pi add-on board makes it easy and safe to create a project that switch mains powered devices on and off. It does have some limitations including not being able to easily access the available GPIO ports, but the simplicity of connecting this to the Raspberry Pi is a big plus.

Going Sober for October – What is it really about?

October 15th, 2014

Go Sober

Last time I wrote about my Going Sober for October challenge it was pretty much about what I was doing, but this time it’s more about why I’m doing this and the charity that I’m raising money for.

I’d certainly heard about Macmillan Cancer Support charity and particularly about the Macmillan nurses, but I’ve not had any involvement with Macmillan before joining this campaign. I first heard about it from an advert on the radio and for some reason having a month without drink sounded like a good idea. I don’t see it so much a challenge as it is a test of will power. The reason that I decided to go ahead with the challenge is that the more I found out about Macmillan cancer support the more important I think the organisation is.

I can’t explain it as well as Macmillan does itself and so I suggest you watch this short video, or this slightly longer video on the Macmillan website which explains more about the role of the Macmillan nurses. What I can say is that I’d want Macmillan to be there for anyone I love if they were diagnosed with cancer.

So visit the website, find out more and help support by sponsoring me to keep sober until the end of the month.

Zip World velocity – the worlds fastest zip wire

October 15th, 2014

Zip World velocity is the worlds fastest zip wire and the longest in the northern hemisphere, and it’s in Wales.
The zip line goes across a former slate quarry in Snowdonia.

I visited on the same day as going White Water Rafting.

When we arrived we were weighed and height measured before we were kitted up with a one piece suit, helmet and glasses. We then had a short walk to the first zip line, the Little Zipper, which is 420 meters long and reaches speeds of up to 65km/h.
The reason for the weighing became apparent as we were given different amounts of additional wind resistance (effectively small sales) and instructions about holding our arms out at different points to slow us down before reaching the end.

We were then driven up to the top of the quarry in a truck ready for the Big Zipper which is a massive 1560 meters long and has a top speed of up to 165km/h.

The ride does feel very safe as the harnesses are checked and then cross-checked by another person before each flight.
The launch from the top platform is performed whilst laying in the harness and is released by the operators. This makes it easier for those nervous of going on the zip wire, for me it didn’t have the same adrenaline rush as zip wires where I stepped off a platform such as those at Go Ape! (obviously for safety reasons that is not an option on these zip wires).

The zip wire is very fast, but whilst the initial start feels fast once travelling across the quarry the ground is a long way off so some idea of perspective is lost. You do then realise the speed again when coming in to the end of the zip wire. Flying across on the zip wire is a great feeling and well worth doing.

You also get a free video of the ride. I’ve created an extended version by adding some additional footage from my GoPro camera (included in the video above).

Zip World in Wales

There’s just one complaint about the site and that’s the limited toilet facilities. There is one toilet inside the main building and temporary toilet with one male and one female toilet which did mean a big queue when everyone was wanting to go to the toilet before we got into the harnesses.

The ride is dependant upon the weather, but there are no refunds even if your ride is cancelled up to 24 hours in advance. Instead you would need to re-book within the next 12 months. This is OK if you live within a reasonable distance, but I could see this being an issue for anyone that was looking to do this whilst they were on holiday in Wales and didn’t have an opportunity to do it whilst on holiday, so please check the terms and conditions before booking.

Summary

This is a very long and very fast zip wire and it’s great to be able to say I’ve been on it. It is however expensive for such a short period of time on the zip wire. I’m certainly glad that I had a go, but it’s not something I’d be in a rush to do again.

Book – Mastering the Raspberry Pi

October 14th, 2014


This is the second book that I’ve been the technical book reviewer for, the first being Learn Raspberry Pi with Linux.

When I was contacted by Apress to ask if I’d do the review then I didn’t hesitate to say yes as from the description this sounded like just the sort of book I would be interested in. It did turn out to be the sort of book that I hoped it would be.

About Mastering the Raspberry Pi

Mastering the Raspberry Pi is a book that delves into the inner working of the Raspberry Pi and combines electronics and programming using the Raspberry Pi GPIO port. The projects mainly use inexpensive electronics modules or components and provides the code required to get them working. To give a few examples it includes a real time clock add-on which ensures that the Raspberry Pi can keep time without needing a network connection, a Wii Nunchuck controller which provides an alternative controller to using a mouse and details of how to use the GPIO ports to control devices such as stepper motors.

It has got quite a bit of theory, but also uses fun and interesting projects to make this a practical book as well as a useful reference.

Target audience – not beginners

Mastering the Raspberry Pi book
It’s important to know that unlike many of the other books for the Raspberry Pi this is not a beginners guide for those new to programming. This is not designed for children, although would be suitable for those studying computer science at further / higher education or for someone that has already gained a good understanding of programming.

You don’t need much experience with electronics as it mainly uses pre-built modules or very simple circuits, but some programming experience is essential and preferably some experience in programming in C. This would be a good book for someone that already has experience with higher level programming that wants to learn more about how drivers are written and how to get down to the raw code that communicates with peripherals.

It won’t go as far as teaching you to be a kernel hacker, although it does provide information on cross-compiling your own kernel and it’s certainly a step in the right direction if that is something that interests you.

It also provides a good technical reference to the working of the Raspberry Pi, it’s built in hardware and the GPIO ports. Whilst most of that information is already available from public sources it would take a lot of research to find out the information contained in the book. This can therefore be a big time saver.

Model A and B vs model B+

The one negative comment I have about the book is that it is aimed at the Model A and Model B Raspberry Pi, but there is now a model B+. This is not the fault of the author at all, as the book was just being published as the B+ was announced. The programming doesn’t change much except for the availability of more ports, but it does mean that there are some ports on the B+ that would need to be researched by the user. This is only going to be an issue for a few users and it still gives the basic information that is needed when researching the additional ports, so after following this book you should know enough to find the rest yourself.

Summary

This is not a book for complete beginners, but if you’ve already done a bit of programming and want to go to the next level then could be a good fit. It’s also going to be useful for someone working with electronics hardware for the GPIO that wants to program directly with the GPIO rather than using the standard libraries.

A more detailed description (and option to buy as eBook or physical book) is provided on the Apress website – Mastering the Raspberry Pi

Whitewater rafting at National Whitewater Centre Wales

October 12th, 2014

I have done a lot of kayaking in the past, but until recently I’d never tried whitewater rafting.

We went to the National Whitewater Centre in Wales. The centre is Canolfan Tryweryn on the Upper Tryweryn river near Bala in Wales. After getting changed into a wetsuit, buoyancy aid and helmet we had a short training session / safety briefing on dry land. We then loaded into a mini-bus which drove us to the get in point.

We had a quick recap of the instructions on the river before we reached the rapids. We then followed the instructions from our instructor which involved paddling, holding on and “getting down”, which kept us safely in the raft. We did however get very wet with a complete soaking through one of the falls and paddling back into the stopper to give those in front an extra drenching.

White water rafting at the National Whitewater Centre

We ran the river four times in total each of which involved something different (going backwards / extra drenching / even faster). By the end we were exhausted, but it was a great fun.

I had my own Go Pro camera which I’ve used to put together the video below. It’s worth remembering that the GoPro was attached to the top of my helmet, so if the water looks like it’s getting close to the camera then it was already over all our heads.

English Heritage – Brodsworth at War

October 10th, 2014

I had already visited Brodsworth Hall and gardens taking my children for a day out on a standard day. This was our second visit which was on one of the Brodsworth at War special event days. I took my family along as a member of the English Heritage members panel.

Brodsworth Hall and Gardens - Brodsworth at War special event

The day that we visited was based around the end of the war, preparations for the returning troops and plans for a memorial for the fallen.

I visited with my family including our two children Amelia aged 9 and Oliver aged 4. We arrived during the morning. The gardens were open, but the hall didn’t open until 1pm. That was not a problem as it gave our children time to stretch their legs after the long drive, so we went straight to the children’s play area. The play area includes an old boat, two play boats and a good climbing play area with climbing wall and rope ladders. Unfortunately the old boat was fenced off to allow for repairs, but the rest of the play area was in excellent condition.

Brodsworth Hall children play area

We then had lunch from the tea room, which we ate outside before going into the hall.

We have visited Brodsworth Hall before when the normal theme in the hall is about the history of the Hall and the families that lived there. During the event there was still regular features about the family, but many of the rooms had special features relating to the hall being requisitioned for use as a headquarters for the home guard. Whilst we certainly enjoyed looking around the hall before, this special event was better than the previous visit as the World Wars are something that our children had learned about in school. There was some quiz sheets that the children could fill in as they went around the hall. The quiz was particularly well written as it made it obvious which room the answers could be found it. This avoids the frustration of having to backtrack if you miss a clue. They also made the use of interactive audio exhibits in many of the rooms.

My children also enjoyed learning French knitting thanks to some of the English Heritage volunteers.

Brodsworth at war - Croquet on the lawn

After exploring the hall we played some croquet on the lawn and then explored the large gardens. There was plenty to explore in the gardens including a summer house, a target house and various paths and bridges.

Brodsworth at war - visiting the gardens

There were also several themed activities throughout the day, including music and some theatrical events. These were less appealing to my children, but I enjoyed the one that I watched. The one that I watched involved the vicar and the lady of the house talking about a memorial for those that died during the wall. The acting was really good and it provided a different perspective to the displays in the hall.

Brodsworth at War - discussing the war memorial

Twitter Status - follow stewartwatkiss


UK days out, children and holiday information is also available on the Days Out Diary web site
Linux, LPI and the Quiz / Test Program posts are also available on the Penguin Tutor website
First Aid Information, first aid games and first aid practice test / quiz entries are also available on the First Aid Quiz Web site