Category Archives: Raspberry Pi

Raspberry Pi wi-fi cheat

Or ‘how to stop worrying and love WiFi’ or how to get WiFi if nothing else works – read on:

I’m calling this a Wi-Fi cheat – with the Raspberry Pi – Motorola lapdock combination I’ve been having problems getting the Edimax micro wireless adapter to work. I think it’s a power issue – the adapter gets quite hot when plugged into the USB ports on the lapdock, and I get a lot of errors on bootup – so here’s a solution:

vonets Wi-Fi bridge

It’s a Vonets VAP11G WIFI Bridge – powered off the USB on the lapdock it works fine. It doesn’t support n wireless, just b and g but it is quick enough for iplayer, most normal software installation and web surfing. I’ve had no problems getting online with my BT homehub. It’s bulkier than most of the cheap WiFi dongles available and at about £17 a little bit more expensive, but once set up it provides a portable ethernet connection to more or less anything you plug it into.

It’s handy having something to use around the home – particularly for Linux distributions where setting up WiFi is a bit complicated, or for operating systems that don’t support WiFi yet like Risc OS.  The newest release of Raspian has addressed a lot of these issues though so I’d recommend trying that first and using this as a last resort.

The bridge itself is configured through a windows app available from the Vonets site, so you’ll need a PC on hand to switch access points, and the software isn’t available for Mac or Linux.

Edit: TheSov on Reddit has suggested this: Asus WL-330N 5-in-1 150Mbps Wireless Mobile Router which is much better (supports n and has web based configuration), but twice as expensive.

Update: there is a python app for configuring the wifi bridge available here.

Raspberry Pi + ModMyPi case + Motorola Atrix Lapdock = Raspberry Pi Laptop

Much has already been written about using the Motorola Atrix Lapdock (essentially a portable HDMI monitor with a built in powered USB keyboard, trackpad and hub) coupled together with a Raspberry Pi. The Pi being powered by a micro USB makes it a suitable candidate for using it as a low powered portable computer.

You can still pick up a Motorola Atrix Lapdock for a lot less than it’s original £300 or so selling price, although I’ve noticed that prices have started to creep up – expect to pay between £60-£80 for one. There is a newer Motorola Razr Lapdock available which I believe uses the same ports, so hopefully these very useful devices will continue to be produced and supported in the future.

This week my ModMyPi case finally arrived – it’s an injection moulded click together case which is beautifully made –

ModmyPi case

I have already hacked together a cable to connect the lapdock and pi together – but I wanted to make a more portable and neater version. Plus using an HDMI micro adapter would provide a mount to hold the Pi in place, in the same way that a phone would be docked:

Here's the pi laptop mount

The lapdock provides a USB micro male, and HDMI micro male connector (note – micro not mini!). The USB provides power and data over 4 wires, and the HDMI video and sound. To marry this to your Pi you’ll need to take the power connection to a male micro USB plug, and data to a male USB plug. Most people who’ve done this modification have also broken the power connection to the data plug as a precaution. In my version, I’ve included a power switch to make it easy to turn the Pi on and off – opening the lid of the Lapdock also cycles the power. Obviously this is all entirely at your own risk.

Here’s my wiring diagram:

Wiring diagram

To do this you’ll need in addition to the Lapdock:

Edit: I’ve noticed that some of the items are listed as being out of stock – the crucial thing to search for is HDMI micro female and micro USB female to get the connectors you need  for the lapdock.

  • A micro HDMI female to HDMI male adapter / MicroHDMI = HDMI “D type” (also available on ebay)
  • Optional: this HDMI adapter pack came in useful as well
  • A micro USB female to male adapter (these are surprisingly difficult to find – ebay is often your friend here)
  • A regular USB female to Male cable (or you could use a micro USB male to USB male cable – I wanted the flexibility to use different lengths of cable)
  • A switch (Maplin or ebay) two or three pin on / off – just not momentary.
  • Something to use as a wiring box – the HDMI adapter holds the Pi in place quite nicely, so you could just wrap a bit of insulation tape round everything. I made a box out of a plastic screwdriver holder that came from poundland)
  • A wire stripper – these ‘automatic’ wire-strippers work well
  • Soldering iron and solder (soldering isn’t too hard, but a lot of people are put off by the idea of it – a bulkier but soldering iron free alternative would be to use terminal blocks)
  • Craft knife
  • Epoxy glue or (better) some Sugru to hold everything together

First off you need to get the two micro adapters to fit together – check with the lapdock and carefully trim away the surrounding plastic until they both fit together. Then glue the two adapters together, whilst they’re plugged into the lapdock. Be very careful not to glue them to the lapdock itself. Then expose the wires from the micro USB adapter – you might have to trim into the plug itself to do this. USB cables consist of red, black, white and green cables sometimes with a metal sleeve around them – you can cut the sleeve away and discard it. Be careful not to go through any of the wires themselves.

Here’s the underside of the adapter – showing the two trimmed plugs side by side, glued together with epoxy Edit: I’ve now used Sugru to hold this together – the wires from the USB adapter on the left feed into the box where all the connections are made:

underside of the adapter

Then cut your usb cable in half and expose the individual wires. Strip the ends of all your wires together. Then solder them together as per the diagram above. The power USB cable needs red and black connected – the data USB cable needs white, green and black connected. Put the switch on the red wire between the lapdock and USB power cable.

Once everything is soldered together, you can give it a quick test by plugging in the Pi to the lapdock. If everything goes ok, once the lid is open and you can boot and test the keyboard. If it doesn’t work, check the connections and that the HDMI adapter is fully plugged in.

The final result is the Pi sitting on the lapdock behind the screen.

For extra neatness you could always mount the switch on the case itself and route all the cables internally, but there you go – a practical portable Pi Laptop you could just chuck in a bag and take with you, and that doesn’t alter the lapdock in any way.

Raspberry Pi Laptop

Thanks to Chipmonger on the Pi forums for the source of the cables and Arc Software for the wiring diagram.

Update: a few tweaks

After a few weeks of use I had a few connection issues with the wires inside the adapter and the quality of the epoxy – so I resealed the unit with some Sugru self-setting moldable rubber and resoldered the connections – the Sugru also helps to avoid the potential of short circuits.

I’ve also swapped the modmypi case for the more colourful Pibow case – this is a little bit larger than the modmypi case so I needed to use a right angle HDMI adapter to get it to fit. The Pi now sits at an angle between the lapdock and the desk – thus:

Lapdock with Pibow

And finally I’ve added a Edimax EW-7711UAN USB wifi adapter (with lovely antenna) which now works out of the box with the latest (September 2012) version of Raspbian.

Updated update:

Yes this works with a Pi Zero – you can easily power the Pi and connect the keyboard and pointer using the USB rather than Power / USB port on the zero.

Control your Mac with a sonic screwdriver

I recently got very excited about the news that a company is working on a Dr Who Sonic Screwdriver remote control – a device that translates your over excited wavy gallifreyan gestures into channel changing activity on your tardis scanner or home television.

Hang on, I'll just bypass the door/system password/monster/macguffin

This got me thinking about possible ways to control a computer using a sonic, and how I might go about building an infra-red detector for my Raspberry Pi.

But it seems I don’t need to do this: there’s a cheaper and more versatile device already available –  a Sonic Screwdriver Wii-Remote (for about 7 quid) from amazon

To get this working on a Mac you just need to download a program called Darwiinremote

Switch on Bluetooth, click on discover device, and hey presto! you have a sonic controlled mac. You can map the device to any key or use it as a mouse. Powerpoint presentations will never be the same again. The only thing it’s missing is the sonic sound effect – although I have a broken sonic screwdriver which I’m going to have a look at to see if it can be a suitable donor. Next step is to try and get this working on a Raspberry Pi which could work nicely as an IR emitter for sonic controlled home / tardis automation.

Fortunately there are already a few bluetooth project related posts in the Raspberry Pi forums and IR control is possible already with the Arduino, so I’m quite optimistic. I’ll post results on here.

I have to remind myself that I’m 33 sometimes.

Dad-Tech: Wooden Raspberry Pi prototype board

This year for father’s day I bought my Dad a Raspberry Pi – as I was lucky enough to grow up in a house filled with computers,  it was nice to return the favour!

He’s working on a project to drive a solenoid-activated pipe organ using the GPIO pins on the Pi. To this end he’s started on a wooden Pi case and prototype board – since most breadboards come with a sticky-backed plastic mounting pad it’s nice to have something to mount them on, and keep everything tidy.

Here’s version 1:

Prototype Raspberry Pi development board

(I’m trying to encourage him to keep a blog of his progress!) 

And here’s the board varnished with the breadboard in position (and some very tidy cabling from the GPIO pins)

Raspberry pi development board with breadboard and some LEDs

 Ultimately these should be available to buy on ebay, he also makes excellent clocks.

Play Zork on the Raspberry Pi

If you’re looking for a bit of old-school text adventure nostalgia, you can play Zork (and many other classic text adventures) on the Raspberry Pi. Some of my earliest memories were of playing text adventure games on the clicky-clacky keyboard of the BBC Micro – in particular Twin Kingdom which featured early AI characters who would come and annoy you.

Zork was one of the original adventure games, written back in the 70s by a team who went on to form a company called Infocom, creator of numerous computer game hits of the 80s and 90s. It was an extension of the crystal cave adventure game, written for the colossal PDP10 computer.

Zork spawned numerous sequels, and arguably inspired a whole genre of ‘interactive fiction’. Today there are many interactive fiction titles you can download and play, and it’s even possible to create your own using the Inform programming language.

You can play Zork using a piece of software called Frotz – this is a ‘Z-Machine’  (the Z referring to Zork) which compiles and plays Z-code or story files. The beauty of the Z-machine approach is that the same story files can be played on almost any computer.

To get started you can download Zork 1-3 for free from the Infocom site here. Just download the zip files and extract them to a directory on your home folder.

And to play on the Raspberry Pi, enter the terminal and type:

sudo apt-get install frotz

To download Frotz, then once you’ve downloaded some inform files you can start them with the command:

frotz ZORK1.DAT

and that’s it!

Frotz is fairly self explanatory, you can save and restore game files, and use all the usual ‘look at mailbox’ ‘talk to dwarf’ ‘take key’ type commands.

Tip: if you’re using the X desktop you can navigate to the folder containing the Zork1.dat file by using the file manager and selecting open this folder in the terminal from the menu. This saves typing the cd/long/directory/structure stuff.

If you get stuck there’s a map of the Zork empire from 1979 here.

Next step is to create a Raspberry Pi text adventure game, perhaps along the lines of ‘Waiting for Pi?’

Raspberry pi XBMC media server (nearly)

One of the exciting possibilities of the Raspberry Pi is using it as a media server – potentially providing a cheap as chips way of watching online video at home (for almost the same cost as a PS3 game) or serving as a cost effective video booth for displaying content. I suspect this is one of the factors that lead to the excitement of the Raspberry Pi’s launch and the 600,000 or so pre-orders.

Raspbmc running on my lego pi
Raspbmc running on my lego pi

I’ve used XBMC before on low-end systems – it works quite well on the (now ancient) Asus EEEpc 701 and I originally installed it on an old Xbox 1 – which soon became it’s most used feature. 

I’ve recently been playing with a version of XBMC for the Pi called Raspbmc created and maintained by Sam Nazarko, an 18 year old student from London, and it’s impressive. I’ve been able to play 720p video from YouTube and Vimeo smoothly. So I thought i’d post up some instructions in case anyone wants to give it a try.

For starters I’m using a Mac as my main PC, and my Raspberry Pi is connected to a Samsung TV via a HDMI to DVI adapter. The following worked for me!

I’ve been using a Samsung 8 GB class 6 card from Amazon which seems to work fine.

First was to download the Raspbmc installer – once you get this up and running it connects to the internet and installs Raspbmc. As I’m on a Mac I modified the Raspiwrite script to include a link to the installer. If you open the python script you can either rename one of the existing links or add it as an option. You can use my edit of the Raspiwrite script here (right click and save). 

Raspiwrite is easy to use – make sure you have a blank SD card mounted on your desktop then open the terminal in your mac and type cd – then drag and drop the folder that contains your copy of Raspiwrite onto the terminal – this saves you having to write the full path (just make sure there’s a space after cd).

Then type sudo python raspiwrite.py – it’ll ask you for a password and start the script which guides you through the process. It will take a while to write to the card, so be patient. Go and have a cup of tea, or try baking some cookies.

Once it’s finished writing, you might need to add a config.txt file to the card. I had to use this to get my display working – so for reference if you’re using a Samsung SyncMaster 940MW LCD TV monitor with a HDMI to DVI adapter made by Nikkai the code you need is:

disable_overscan=1
config_hdmi_boost=4

(if you don’t have any display issues you can ignore this bit – if your display blanks after booting it’s worth checking out the threads on the config.txt file on the Raspberry Pi forums)

Then you can put the card in the Pi – either you’ll see the installer or you’ll get a command prompt. You can login to this using root and root, after which you’ll need to use shutdown -h now to shut the system down and reboot.

I think I saw this step as my Pi connects to the internet through network sharing on the ethernet on my mac – when I encounter issues with this, stopping and restarting internet sharing usually works to fix it. When I did this step I found it worked ok for me and booted into the installer – which I was able to leave to do it’s own thing, and then hey presto! Raspbmc is up and running.

It works well – some of the menu transitions are a little bit slow but video plays smoothly at 720p (which is as much as my monitor can handle). I got sound up and running by changing the settings to analog output.

Pretty HD videos to try from youtube are First Orbit which re-creates Uri Gagarin’s flight around the earth, the trailer from BBC’s Planet Earth or on Vimeo the quirky Plan of the City.

You can donate to the Raspbmc project here.

Update: there’s now a new version of the installer script which includes scripts for mac and windows – making these instructions redundant. I have got the iplayer plugin working so i’ll post up instructions on how to do that shortly.

Geeking out with a Raspberry Pi lego case

I like Lego, and I like miniature ARM based low cost PCs, so I’ve combined both with a Lego Raspberry Pi case:

Lego Raspberry Pi Case
Version 2 – slightly taller

I wanted to mount the Pi vertically to show off the intricately beautiful circuit board (and possibly to take up less space, but this thing is tiny!) and I’ve used window bricks that line up with the Pi logo. For my first attempts I tried designing a case using the lego designer – but beware, many of the bricks aren’t available from the pick-a-brick store. I’ve had to use 1×1 tiles stacked in groups of 3 to make the corners, and 2×1 tiles for the top.

This case is 4 bricks wide as the GPIO pins stick out slightly too far to fit with 2 bricks wide. Windows and arch bricks form the holes for the various plugs, with the USB and Ethernet cables emerging from the top. I’ve used the mini USB power supply from Amazon Kindle combined with a remote controlled socket for power.

The latest version has the coloured bricks at the bottom, and more clear bricks at the top to refract the light from the various power / activity indicators. It also stands a little bit taller to allow for the USB mini power plug and a grip to hold the Pi motherboard in place.

Total cost is about £30, but I do have plenty of bricks left over for other Lego projects…

I’ve now recreated the Raspberry Lego design in the Lego digital designer:

RaspberryLego case
It’s a raspberry pi case in Lego

 

I’ve coloured the bricks on the model above since they were easier to see than transparent bricks. Inside the case there’s a little c-shaped hook that the Raspberry Pi sits in. I was able to find all the bricks with the colour-scheme as used in the transparent version of the model in the pick-a-brick store.

Download the lego designer files.

If you’re building this, you need a Pi to hand to check the alignment of the ports – I have fully tested this with a Pi, but you need to build the Lego around it or it’ll get a bit fiddly.