Categories
Gadgets Geekery Raspberry Pi

Raspberry Pi as an adblock server for iPad, iPhone, Android and anything else on your network

Adblocker without Jailbreak:

On my computer I find using Adblock plus a handy way to speed up surfing and hide invasive pop-up ads.

Annoyingly you can’t install Adblock on an iPad without jailbreaking it – and I’ve yet to come across a way of installing it on Android devices easily without requiring root access.

Fortunately there’s an easy way to install Privoxy on a Raspberry Pi that can block adverts (and do a few other things as well) and that works seamlessly on iOS and more or less anything you attach to your network.

You could run this software on any PC attached to your network – but with the Pi’s low power consumption  (3.5 watts) you can afford to leave it on all the time. Plus you could combine this functionality with a fileserver or an airplay speaker for a bit of extra usefulness.

Setting up your Raspberry Pi for remote control by iPad

Raspberry Pi running as an Adblock for iOS
Nice conversation piece for geeky dinner parties

First step is to prepare an SD card for your Pi – I’ve been using the default Raspbian.

Next step is to boot up the Pi with a screen and keyboard attached, and connected to your home network with an Ethernet cable. This would also work with a wireless connection, but ethernet is a bit simpler, more stable and means the Pi will run happily off a low powered USB adapter (e.g. a kindle power supply). On it’s first boot the Pi will run the config app – if you’ve already run your Pi before you can restart the config app by typing the following into the console:

sudo raspi-config

Make sure you change the default Pi password, and enable SSH in the menu. We’ll be using SSH to control the Pi remotely.

Now find your Pi’s IP address – in the terminal type:

ifconfig

This will give you some information about how the Pi is connecting to the network – make a note of the inet addr – usually 192.168.1.number (I’ll use this notation to refer to this value in the guide)

Next you can connect to your Pi using an SSH client – I’ve been using Remoter Fusion on the iPad (other SSH apps are available but I was using Remoter for something else) note that you will need to purchase SSH support in app which adds £5 to it’s price.

To connect to your Raspberry Pi with Remoter Fusion, click on discovery list -> Add Session Manually. On the Server Type choose SSH.

In the box that says SSH Hostname enter your Pi’s IP address which you found out above:  192.168.1.number then choose Manual – leave the SSH Port setting at 22 and in SSH Username enter your Pi username and SSH Password your Pi password.

Remoter Fusion iPad with Raspberry Pi
Remoter Fusion

Then connect – you might get a warning message (just accept) and then you should be seeing the Linux prompt.

Now you need to change your Pi from having a dynamic IP address (given to it by the router every time it reboots) to a static IP address which will stay the same. In the prompt type:

cd /etc/network
sudo nano interfaces

this launches nano which is a basic text editor – the following settings will depend on your Router – most routers will have a configuration page which will give you this information if you visit their configuration page – usually found on your network by typing 192.168.1.1 into a browser. The following settings worked for the BT Homehub version 3.

auto eth0
iface eth0 inet static
address 192.168.1.number
gateway 192.168.1.254
netmask 255.255.255.0
network 192.168.1.1
broadcast 192.168.1.255

Press control and O and then enter to save, followed by control and X to exit.

You might want to test your settings – either by using the Ping command, or by attaching a monitor / keyboard / mouse directly to the Pi and firing up the web-browser – the Pi should be able to connect to the internet.

Installing Privoxy on your Raspberry Pi

Finally we just need to install Privoxy – with the nice simple:

sudo apt-get install privoxy

then start Privoxy

sudo /etc/init.d/privoxy start

Then you’ll need to setup Privoxy by editing the configuration file –

sudo nano /etc/privoxy/config

This is a long file with lots of options – scroll or do a search with control W and find the listen-address line. Change it to 192.168.1.number:8118

Control O to save in nano then control X to exit.

Restart Privoxy with:

sudo /etc/init.d/privoxy restart

Now on your iPad go to settings -> Wi-Fi -> your network name and then scroll to the HTTP proxy options. Choose Manual and where it says Server type your Pi’s IP address: 192.168.1.number and where it says port type 8118.

Finally go to config.privoxy.org and if it’s all working correctly you should see an enabled message.

Straight out of the box Privoxy started blocking ads for me – you can edit the exact way it does this in the configuration files. So websites like this:

Lots of Adverts
Lots of Adverts

Become websites like this:

After Adblock on iOS
Less adverts. Still rubbish.

You can take this a bit further by turning your Pi into a personal VPN for secure browsing on the go with this Lifehacker tutorial.

Probably an overkill using a Pi for this, but it is handy being able to work on the Pi using an iPad and as I mentioned before there are a few other useful things your Pi could be doing at the same time.

Categories
Geekery Raspberry Pi

How to play the original 8-bit Elite on a Raspberry Pi

Ok, so after my last post about running the Archimedes 32-bit version of Elite on RISC OS on the Raspberry Pi I got a few comments about running the earlier (and more authentic) 8 bit version on modern hardware. So I thought I’d have a bit of a play and try out a few options for running the original version.

Probably the easiest way to get a taste is to run the NES version on an emulator – Elite co-creator Ian Bell describes this as “the best way to re-experience the feel of 8 bit Elite“.

There are NES emulators available for almost any platform – here it is running on my Android 4 MK802 lapdock using iNES. You can download the ROM freely (and legally) from Ian Bell’s website.

Elite running on the iNES emulator on an Android 4 MINI PC
Cobra mk III

If you find the display corrupts you need to make sure it’s set to PAL and not NTSC or ‘auto’ . iNES has a nice function where you can remap keys to the various buttons, which is handy when using an external USB keyboard with the MK802.

It works well- although Elite’s many keys are replicated through combination key presses which takes a bit of getting used to. You can fly, shoot, get shot at, and crash at docking.

As I mentioned in my previous post – it’s rather fun to play Elite on the Raspberry Pi computer – the original BBC B’s spiritual successor, which also shares a creator with Elite.

The Raspberry Pi also has (various) NES emulators available for it – although I’ve yet to find one that can run Elite smoothly and without any issues (consider this a work in progress). However you can emulate the machine where it all started back in 1984:

How to emulate the BBC Micro  (model B) on a Raspberry Pi (model B)

Bridge of the Cobra Mk III image from the Elite user manual
Bridge of the Cobra Mk III – uncanny how the console of a 31st century starship looks a bit like a 1981 microcomputer…

It is possible to run the original BBC B version of Elite using the !BeebIt emulator – this is an emulator that runs in RISC OS.

Compared to the linux and android based emulators available this runs much more quickly since RISC OS is a very lightweight operating system.

To relive the original Elite – I’ve prepared a step by step guide – make sure you do all this on a Raspberry Pi running RISC OS – particularly unpacking the zip files.

First create an SD card running RISC OS or just download the NOOBs installer.

RISC OS uses a 3 button mouse – you’ll need one to access menus using the middle button – applications have a ! at the beginning of their name, and shift-click opens the application folder. There’s more RISC OS info available here.

Note that it also helps to have a standard, full size keyboard.

Then download !BeebIT – of the two versions available I’ve been using Michael Foot’s.

Extract the archive on your Raspberry Pi by dragging and dropping the download file, and then double clicking and dragging the !Beebit application file to a new folder. (Note that RISC OS is very drag and drop orientated).

Next you’ll need some BBC ROMs – the ROMs download on Michael Foot’s page contain both the OS2 and DFS ROMs you’ll need:

Download

Open up this archive as before – this will contain a !Beebit application icon – just drag and drop this over the !Beebit application you extracted earlier. (Application files on RISC OS are folders containing the program and needed files – by dragging and dropping the ROM file you are just adding the files you need)

Double click !BeebIT to run – it should appear on your icon bar. If you get any errors for missing ROMS, check the steps above or try downloading them individually. f12 will exit the emulator back to the RISC OS desktop.

Download BBC Micro Elite extract and set the type to DFSImage (the icon should change to a floppy disc) – to do this click the middle (menu) button on the file > File ELITEBBC/SDD > Set type and change “Data” to “DFSImage”.

Double click on the image file to run.

Once in !BeebIT type *!BOOT (on my keyboard the @ was *)

then enjoy!

The classic loading screen
The classic loading screen

Have a go at playing with the settings – you can choose a high quality display mode, or set CPU speed to Full Speed. If you’re feeling a bit more adventurous !BeebIt also emulates the Master 128 which ran a full colour version of Elite which is similar to the NES version – you’ll need to download the correct ROMs but all the info is included in the !BeebIt help file (middle click on the !Beebit application App.> ‘!Beebit’ >Help)

Commander Jameson
Commander Jameson

The easiest way to save your progress is to hit f12 to return to the desktop and then the middle button on the !Beebit emulator icon to then choose Save >Save as snapshot. Dragging the snapshot file back to the !Beebit icon will reload your game in the same state you left it. Note for some reason double-clicking on the snapshot icon to load it won’t work.

If you’re interested in Elite you can read a bit more about the 32-bit version of the game in my previous post – or check out the Elite Dangerous Kickstarter which is collecting pledges for a 21st Century version.

Categories
Geekery Random Raspberry Pi

Elite – making a game that looks as good as the box art

This week it’s been announced that one of the original creators of the classic 8 bit video game Elite is seeking funds to launch a version updated for the 21st century.

I grew up playing Elite – originally on a BBC B and then a few years later on it’s 32 bit successor the Archimedes, it was brilliant, addictive and years ahead of it’s time.

Elite was a 3d space exploration game which featured open-ended play – you could explore the galaxy, play as a trader, bounty hunter or pirate in your quest to gain enough kills to be ranked as ‘Elite’ (starting from ‘harmless’ and working your way through ‘mostly harmless’, ‘dangerous’ and other often amusingly named ranks). Elite rewarded good acts like hunting down pirates, and punished bad behaviour – if you became a pirate yourself your legal status changed to wanted and you attracted the attentions of bounty hunters and ultimately the police. With the occasional mission for the galactic navy thrown in for good measure, Elite had the qualities that would make games like Grand Theft Auto a success – many years in advance.

BBC B Elite (Master version)

One of the things I used to wonder playing Elite, was whether or not computers would exist in the future that could actually depict the game as it was featured on the beautiful box art:

Elite Box art
Beautiful 1980’s sci fi art

The Sci-Fi art of the 1980’s is easily possible with todays’ computing power. Although there were sequels to the original Elite (Elite II, Frontier) none of them captured the playable spirit of the original – something that will hopefully be addressed in the update which promises “joyous immediacy”. If you can’t wait until 2014, I’ve prepared a short guide on how to play Elite on (what is arguably the modern day successor to the BBC B) the Raspberry Pi:

How to play Elite on the Raspberry Pi

It’s quite easy to just download an emulator on any modern PC or Mac and play Arc Elite – regarded as the best version of the original game. For a bit of fun I thought I’d have a go at running Elite on my Raspberry Pi.

For starters you need to be running RISC OS – this is a lightweight operating system originally developed by Acorn back in the 80s to run on the first generation ARM chips – this runs incredibly quickly on the Raspberry Pi. You can run various emulators (for example the Sinclair Spectrum) on the Linux Raspberry Pi build, but I’ve found these tend to run quite slowly.

First download RISC OS from the Raspberry Pi website and copy it to an SD card (or you can purchase a ready-made card from RiscOS open – it’s only £10, and worth it to support their very handy work! )

Because Arc Elite was originally written for ARM 2 and ARM 3 machines, it won’t run on the ARM 6  chip in the Raspberry Pi – but don’t worry you can emulate the older hardware using ArcEm – which is available from: http://arcem.sourceforge.net/ 

Update: there is an issue transferring archived files between PC/Mac (which I’m writing this on) and RISC OS – which causes the filetype to be incorrect (StrongArm will open when you try to run !ArcEm) To fix this:

Open the original zip file on the Raspberry Pi in RISC OS, unpack !ArcEM
next re-download the !ArcEm archive: http://sourceforge.net/projects/arcem/files/arcem/1.50-alpha/arcem-1.50-alpha2-riscos.zip/download
open that in RISC OS using !sparkFS – then drag the unarchived files over your original copy (this preserves the ROM files you need)

!ArcEm should now run – if Elite gives you problems download the original archive:
http://www.iancgbell.clara.net/elite/archive/a/b5052410.arc

Sorry about this – I’ve ordered a copy of the nutpi pack which includes the full copy of !SparkFS – i’ll recreate the zip archive so everything will work more simply in future!

Run !ArcEm, then open the HostFS drive on the desktop – Elite, along with the Dark Wheel Novella and User Manual are all available on there.

Arc Elite running on the Raspberry Pi
It’s a bit stretched on my screen, but smooth and playable!

It runs as smoothly as I remember, and is very playable – I’m still rubbish at docking though. On my lapdock display the screen was stretched – it might be worth experimenting with different settings to see what works best for you.

Interestingly there were a lot of 16 bit Amiga and Atari games converted to run on the Archimedes – so for anyone interested in emulating old games this should work for those as well. ArcEm is still under active development, so it’s well worth checking out.

If you enjoy playing Elite as much as I have, (and are suffering from I-didn’t-pay-for-this-amazing-game guilt) please help fund the next version on Kickstarter.

*the files I’ve used to do this were freely available from these sources:

ArcElite

http://www.iancgbell.clara.net/elite/arc/index.htm

RiscOS 3 Rom

http://home.tiscali.nl/~jandboer/ (in the support2.zip archive)

ArcEm

GPL licensed

http://arcem.sourceforge.net/

Categories
Arduino Gadgets Geekery Raspberry Pi

Raspberry Pi + Arduino + 8×8 LED Matrix + Python = Raspberry Pi LED display

The other week at work we launched a petition to support lifesaving Aid using a Jumbotron display, so I’ve been inspired to have a go at building a (very) mini version using my Raspberry Pi and an Arduino.

This is a handy way of getting your Pi to display information from any Python app you may have written – so you could use it to make a new email notifier, flash up messages from twitter, or if you’re using your Pi as a server without a monitor – status update messages. I’m interested in using it as a ‘now playing’ message board for an email controlled spotify jukebox I’m working on (more updates to follow).

There are lots of ways you could achieve this – it’s certainly possible to drive LED displays directly from the Raspberry Pi GPIO pins, but this is method is easy to do as it uses off the shelf kits, provides a bit of soldering practice, and an opportunity to learn a bit about Arduinos, Python and serial communications. As with a lot of Arduino projects once you’ve got the hand of how things work you could easily build a cheaper version using only the parts you need. Plus these are my first steps getting an Arduino to do something more interesting than flash a single LED on and off.

I’ve been using a standard Arduino Uno which is available for around £20, and the LED Matrix Shield v.1 from Ciseco which is £5 – this is a Arduino add on board that sits on top of the Arduino. The Matrix shield is fun to put together and good for practising soldering, as a lot of the parts aren’t particularly heat sensitive.

Setting up the Arduino

The instructions that come with the Matix shield are a bit basic – for a much better step by step how to check out this tutorial which I found in the forums.

LED matrix shield Ciseco
LED matrix shield sat on top of an Arduino Duo

Next step is to prepare the Arduino with the code you need it to run. Unlike the Nerdkit microcontroller I mentioned in a previous post the Arduino has a nice user friendly graphical front end – the downside to this is that it runs quite slowly on the Raspberry Pi. I used my Mac to upload the code to the Arduino – just remember to connect it directly to the USB ports on your Mac and not via a USB hub.

First you’ll need to add frequencytimer.h to your Arduino Library – there are instructions on how to install libraries here and you can download frequency timer here.

Then you’ll need to download 8x8LEDMatrix written by Andy Lindsay who has all sorts of other interesting Arduino / Pi stuff on his blog.

The script includes a 5×7 font file which you can experiment with to get the display to show different characters. Compile and upload this to your Arduino to check that everything’s working properly.

Now you’ll need to modify Andy’s code to send the text you want your Arduino to display over the serial port. Using a tilda character clears the script (although I discovered you don’t actually need this as the Pi resets the Arduino when it communicates with it on the serial port)

/*
 * Show messages on an 8x8 led matrix,
 * scrolling from right to left.
 *
 * Uses FrequencyTimer2 library to
 * constantly run an interrupt routine
 * at a specified frequency. This
 * refreshes the display without the
 * main loop having to do anything.
 *
 */

#include
#include "font5x7.h"

#define DELAY 80

int incomingByte = 0;   // for incoming serial data
String incomingString; // for the incomming serial data string
char message[] = ""; // define the message

byte col = 0;
byte leds[8][8];

// pin[xx] on led matrix connected to nn on Arduino (-1 is dummy to make array start at pos 1)
int pins[17]= {
  -1, 17, 8, 7, 19, 9, 13, 4, 10, 6, 5, 18, 3, 2, 11, 12, 16};

// col[xx] of leds = pin yy on led matrix
int cols[8] = {
  pins[13], pins[3], pins[4], pins[10], pins[06], pins[11], pins[15], pins[16]};

int rows[8] = {
  pins[9], pins[14], pins[8], pins[12], pins[1], pins[7], pins[2], pins[5]};


void setup() {

  // sets the pins as output
  for (int i = 1; i  0) {

                // read the incoming byte:
                char incomingByte = (char)Serial.read();

                incomingString += incomingByte;

                if (incomingByte == '~') {
                  // using a tilda ~ clears the string

                incomingString = "";

                }

                // check string for command variables

                incomingString.toCharArray(message, 160);



                }





  scrollMsg( message );




}

void clearLeds() {
  // Clear display array
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      leds[i][j] = 0;
    }
  }
}

void setChar(char ch) {

  for (int i = 0; i < 5; i++) {
    unsigned char bt = pgm_read_byte(&amp;amp;amp;(smallFont [(ch-32)*5 + i] ));
    for (int j = 0; j < 8; j++) {
      leds[j][i+1] = (bt &amp;amp;amp; 0x01);
      bt = bt >> 1;
    }
  }
}

void slideChar(char ch, int del) {
  for (int l = 0; l < 5; l++) {
    for (int i = 0; i < 7; i++) {
      for (int j = 0; j < 8; j++) {
        leds[j][i] = leds[j][i+1];
      }
    }
    unsigned char bt = pgm_read_byte(&amp;amp;amp;(smallFont [(ch-32)*5 + l] ));
    for (int j = 0; j < 8; j++) {
      leds[j][7] = (bt &amp;amp;amp; 0x01);
      bt = bt >> 1;
    }
    delay(del);
  }

  for (int i = 0; i < 7; i++) {
    for (int j = 0; j < 8; j++) {
      leds[j][i] = leds[j][i+1];
    }
  }

  for (int j = 0; j < 8; j++) {
    leds[j][7] = 0;
  }
  delay(del);
}


// Interrupt routine
void display() {
  digitalWrite(cols[col], LOW);  // Turn whole previous column off
  col++;
  if (col == 8) {
    col = 0;
  }
  for (int row = 0; row < 8; row++) {
    //    if (leds[col][7 - row] == 1) {
    if (leds[col][ row] == 1) {
      digitalWrite(rows[row], LOW);  // Turn on this led
    }
    else {
      digitalWrite(rows[row], HIGH); // Turn off this led
    }
  }
  digitalWrite(cols[col], HIGH); // Turn whole column on at once (for equal lighting times)
}

Once you’ve uploaded this you can test its working properly by clicking on the serial monitor icon (the magnifier glass on the right hand side) and typing some text – if everything is working OK you’ll see the text appear on your Arduino’s matrix display.

Arduino software
Click on the magnifier icon on the right hand side

Setting up the Raspberry Pi

Now you need to connect the Arduino to the Pi. I’ve used one of the Pi’s USB ports rather than via a USB hub – you could also use the serial pin on the GPIO port to do this as well. Make sure the Arduino is connected before you power up the Raspberry Pi.

You can test the Pi -> Arduino control with minicom (thankyou http://codeandlife.com/2012/07/29/arduino-and-raspberry-pi-serial-communication/

Install minicom on the pi via the console:

sudo apt-get install minicom

then run minicom and connect it to the Arduino:

minicom -b 9600 -o -D /dev/ttyAMA0

Hopefully everything you type into the console will be appearing on the Arduino Matrix.

Next is to get Python to send data to the Arduino over the serial port. Install the python serial libraries:

sudo apt-get install python-serial

Now you’re ready to write some Python code to control the Arduino’s LED display. I’ve been using the IDLE app on the Raspberry Pi. The following code is a super simple python script that can send some text to the LED Matrix:

import time
import serial

#configure the serial connection

ser = serial.Serial("/dev/ttyACM0",9600)

ser.open()

# add some time delays to stop the Arduino resetting

time.sleep(1.5)

ser.isOpen()

time.sleetp(1.5)

ser.write("Raspberry Pi")

Hit f5 and you should see this:

Arduino LED MAtrix Shield v1.0 IOT Research 2012
Bingo! or whatever you want it to say…

And that’s it – you now have a neat way of controlling an LED display with Python. The LED display always shows the last message it received until it gets a new one.

Update: Cisco – the company who made the lovely shield kit, are now doing a kickstarter for a Pi version with a lot more red or white LEDs that plugs directly into the GPIO. 

Categories
Gadgets Geekery

Mk802 Android 4.0 PC + Motorola lapdock = Android Laptop

I’ve written before about the usefulness of the (now sadly discontinued) Motorola Lapdock as a screen and keyboard/touchpad interface for the Raspberry Pi.

This week I’ve been playing with the Mk802 Android 4.0 PC – which is an ultra cheap A10 Arm powered computer on a stick, and have discovered it works nicely with the lapdock to make a portable Android laptop. You can pick up one of these versatile sticks for about £40 available from amazon or ebay, although you might need to hunt around for the lapdock as they’re now increasing in price (I was lucky to get one for £50 – I’d suggest ebay or looking for one with a non-english keyboard).

The Android 4 PC came with a US 5v power adapter but there’s no need to use it – you can power the mini PC via the mini USB port on the side – presumably if you want to use this with a TV which has a powered USB port you can use the same method.

I used the cable adapter I originally put together for my Raspberry Pi – this converts the micro HDMI on the lapdock to normal HDMI (the android stick has a mini HDMI in so an additional adapter was required) and splits the lapdock micro USB to USB power-only and USB data-only cables. For added convenience there’s a power switch to click the Mini PC on and off – which is handy as the lack of a power switch is one of the Mini PC’s criticisms.

Mini MK802 Android 4 Mini PC fitted to a motorola lapdock convertor
Slightly unwieldy as the adapter was designed for a Raspberry Pi

The setup above is slightly unwieldy as I built the original adapter to fit the Raspberry Pi, but the Mini PC stick itself is very small and light so it doesn’t but a lot of strain on the connectors on the dock itself. There’s a wiring diagram on my original blog post along with a list of parts. It would be quite easy to lighten the assembly above with thinner cables – I kept the original USB female connector to make the adapter more versatile.

All together the resulting Android 4 tablet isn’t bad:

Android 4 mini PC Laptop
Most of the time the wires are hidden round the back

The lapdock’s keyboard is recognised – keys like function-home work and I’ve not encountered any mapping errors. You can also adjust the volume with the keyboard hot keys. The only drawbacks I can see is that all sound comes through the speakers – the lapdock lacks a headphone out socket –  and the overscan adjustment doesn’t quite work – there’s a narrow black border around the screen, although fullscreen video playback works right up to the edges.

The android laptop works well with most of the apps I’ve run with it – the play store is installed by default although google reports it as an ‘unrecognised device’. Some 3d apps don’t work and I imagine other more complicated apps might struggle with the single core 1.5ghz processor – but it does run angry birds.

It is also possible to hack the android mini pc to run other operating systems like Ubuntu – and to upgrade it to android 4 jelly bean, as well as adding support for bluetooth which might solve the headphones issue. It’s not going to replace my Raspberry Pi as an experimental mini PC any time soon, but as a handy web-browser and media player that I can chuck in a bag it’s quite handy.

Update: works with Windows 8 tablets too

I’ve tested the ever-useful Motorola lapdock with a Toshiba encore tablet – connected with a micro USB male to micro USB female cable, and a micro HDMI male to Female cable. The lapdock is recognised, every key works, and I can extend the desktop across both screens.

Categories
Geekery Random Raspberry Pi

Getting a Nerdkit to work with the Raspberry Pi

Most of the things I do on a day to day basis are in relation to building websites and looking at ways to code interesting online actions – one thing I’m interested in however is the idea of the internet of things – smart, connected objects that bridge the gap between the online and actual world. Perhaps one day I’ll even find an ecampaigning application for this.

I just had a go connecting up a Nerdkit with the Raspberry Pi. Nerdkits are similar in some ways to the Arduino boards, although they’re a bit more hands on. Whereas the Arduino is nicely assembled and can be just plugged into a USB port, the Nerdkit comes as a pile of parts, a bit of breadboard and some instructions. What’s exciting about Nerdkits, Arduinos and microcontrollers (MCUs) in general is that they provide a flexible, re-programmable set of ‘brains’ with lots of interesting uses. Think of them as lego for electronics.

The ultra cheap Raspberry Pi makes a nice partner to the Nerdkit, as I’m still slightly nervous about attaching something I’ve put together myself to my shiny Mac. Along with the instructions come a set of makefiles which you compile and upload to the MCU via the USB to serial adapter.

The  Nerdkit is based around an Atmel AVR ATmega168 microcontroller which has it’s own bootloader. Also included are the crystal, various resistors, voltage regulators and a variety of input sensors and output electronics. Putting the whole thing together is very satisfying and has given me a bit more insight into how microcontroller based kits work (and what all the bits on the Arduino board do). One really nice additional feature of the Nerdkit is the lcd display panel, which provides feedback in the form of messages, poetry or temperature readouts – depending on what you program it to do. The example below shows it running as a thermometer (one of the included tutorials). Mounting the whole thing on a bit of board is highly recommended.

Photo of Nerdkit mounted on a board with a Raspberry Pi
Here’s my Nerdkit mounted on a board (an Ikea shelf panel) with power switch

Installing the software as in the user guide works fine -it’s all done in the command line, so there’s no Java based application to worry about –

sudo apt-get install avrdude
sudo apt-get install gcc-avr
sudo apt-get install avr-libc

You can edit the makefiles using Leafpad which is part of the default Raspbian operating system. Connecting the Nerdkit cable to the Pi’s USB port presented no problems either.

I did however run into a small snag – although programs would compile and upload successfully, the display on the Nerdkit was showing just on the top line:

Garbled text display
Not quite working

 A quick hunt through the forums later and I came across the fix – open the Makefile (in the example above it’s the one in the tempsensor directory and the one in the libnerdkit directory), look for the GCCFLAGS line and change the “-Os” flag to “-O0” (letter O, number 0). Then delete the .hex and .o files in both the directory your Makefile is in and the libnerdkit directory. That last bit is vital, I kept missing it.

Then it should work fine:

Normal nerdkit display
Working as it should. It was slightly chilly.

So there you go – my first steps in getting my Raspberry Pi to do a bit more than web surfing. I thought I’d highlight that the Raspberry Pi and Nerdkit work together happily, in case anyone else wants to try it out.

Categories
Gadgets Geekery

MaKey MaKey + Moleskine notebook + Graphite pencil = sketchy controller

As part of my ongoing kickstarter addiction I’ve recently acquired a MaKey MaKey – a sort of universal keyboard adapter gadget based on an Arduino-type microcontroller, that lets you turn virtually anything that conducts electricity into a USB keyboard or mouse.

MaKey MaKey board
It even lights up when you plug it in..

The board comes supplied with a pack of crocodile clips and a nice long USB cable – on the MaKey MaKey website there’s a list of ideas to try (apparently bananas work well as a piano). All you have to do is find something suitably conductive, connect them up with the clips, and away you go.

The simplest interaction is creating a space bar input – this Olympic hurdle game from the ONE Campaign works well as something to try.

I’ve done a bit of experimenting to see what conducts with the aim of making controller doodles in my moleskine notebook. Conductive paint from these guys works – interestingly metalic effect paint and ink doesn’t work (I suspect as the metal is in a suspension).

The easiest and most sketchable I’ve found is using a big chunky graphite pencil like this one KOH-I-NOOR Jumbo Woodless Graphite Pencil 6B available from amazon for a couple of quid:

image of moleskine jump button and MaKey MaKey
hitting the gap between the U and the M creates a space bar press

You have to press quite hard with the pencil to get a good circuit – shorting the gap between the U and the M with your finger is enough to register as a space bar press:

Playing the race against hunger game with a MaKey MaKey
Ignore my score, it’s hard to hit jump and hold a camera at the same time..

So there you are – a sketchable, moleskine portable control interface! (even if it does get a bit smudgy after extended play).

Check out the ONE Campaign race against hunger game here.

Categories
Gadgets Geekery Random 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.

Categories
Geekery Random Science Fiction

To boldy crowdsource, where no-one has crowdsourced before

Here’s an idea: if everyone who watched the last Star Trek film donated a couple of dollars would it be enough to fund a real space ship?

Right now on Kickstarter you can sponsor a cube sat (starting at one dollar) which is a tiny 10cm x 10cm x 10cm satellite (potentially) hitching a ride on a forthcoming falcon rocket launch. For your dollar, you get to sponsor 10 seconds of the mission and can tweet from spaaace! –  for a bit more you get to take a couple of photos using the cube-sat’s camera. Sadly there’s no space laser option.

Edit: Skycube has managed to hit it’s target! raising $116,890 of it’s goal. The team will be publishing updates at www.skycube.org

Here’s an exceptionally nerdy video from the project organisers: no it’s not an episode of the Big Bang Theory

The backers are aiming to raise $82,500 for their project to be successful – small change compared to some recent projects on kickstarter. Space-wise it’s a relatively low key mission – the sat is destined to whirl around the earth a few times, and then deploy a giant balloon to commit tidy suicide in a fiery re-entry through the Earth’s atmosphere.

This got me thinking pointlessly about how the cost of sending stuff into space would compare with the revenues from the Star Trek films. There’s a handy blog here with adjusted values.

Once you’ve got over the shock that the highest grossing Star Trek film was the really boring one, here are a few Star Trek films, and what they could have paid for*:

The average takings for a Star Trek film are about 151 million dollars.

43 million dollars will buy you a Russian Angara rocket:

56 million a (probably) more reliable Falcon 9 rocket:

94 million was what Star Trek V took.

105 million dollars will buy you a complete 3 seat Soyuz mission.

160 million dollars a nice ION drive powered SMART1 probe around the moon (or Search for Spock)

700 million dollars will send a car sized probe to Pluto (New Horizons)

820 million dollars buys Some nice Mars rovers. So here’s a really very exciting video about landing a Ford Transit sized rover on a distant planet:

1.7 billion dollars = is what all the Star Treks put together took.

9 billion = the UK trident nuclear missile programme.

12 billion = Skylon reusable shuttle: (ok this is semi-fictional, but the video pitch is narrated by Brian Blessed, which in itself is lovely)

And finally 43 billion buys you a shiny space shuttle programme.

So there you go. Space is terribly expensive. Still, the UK government could probably fund an entire space programme, make a lot of Star Trek films, and still have a lot of change over for nice things if it just cancelled it’s nuclear weapons programme.

Or the UK could even buy about 3 mars rovers for the cost of the Nimrod MR4 spy plane which was cancelled before entering service.

Where was I again? oh yes Kickstarter.

*Please take this with a big huge pinch of salt. I’d be upset if Wrath of Khan had never been made. Not so upset if they hadn’t bothered with The Final Frontier or Nemesis.

 

Categories
Gadgets Geekery Raspberry Pi

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.