raspberry_pi_ledIn this post I will take you through the fairly simple task of getting your Raspberry PI to control an LED via the GPIO interface, the task is simple however it lays a great foundation of knowledge for any further projects where you want to interface with an external electronic device.

So the first step is to install some software on to the Raspberry PI operating system via terminal or a remote SSH session. We actually want to install “wiringPi” however to do that we are going to use the very popular version control tool “git”, which should explain the following commands.

1. Software Setup

First we will install the core software required for git to work:

sudo apt-get install git-core

Next it’s aways best to ensure that our device is on the lastest version of software, so we will do an update and upgrade, depending on how long until you last did this it could take a while, coffee anyone?

sudo apt-get update
sudo apt-get upgrade

Ok so your back after the software update, now we are going to download the latest release of wiringPi;

git clone git://git.drogon.net/wiringPi

Now go into the directory and just double check with the pull command that you have all the required files.

cd wiringPi
git pull origin

Now time to build the software with a command that’s fairly easy to remember:


For the physical setup you will need an LED of your preferred colour, a small 270 ohm resistor and some wire to connect everything together. I would recommend using a breadboard as well it makes all this cabling and prototyping far easier to setup and tweak.

Below is a very simple diagram on how to setup your circuit.



So now it’s time to make a really simple script, paste the following into your terminal session:

gpio mode 0 out; while true; do gpio write 0 1; sleep 1; gpio write 0 0; sleep 1; done

Note: Control + C will exit the program.

Let us know how you got along in the comments below, I will be adding another guide soon on how to get a few LED’s all working.

Raspberry PI Web Cam

Raspberry PI Web Cam

The Raspberry PI is perfectly equipped to turn your USB based web cam into a fully functional IP web cam that you can have lots of fun with, from there you could use tools such as Python to make your project more unique, im having a go at counting passing traffic.

If your wanting to something a bit more simple you could just have a web cam that can be access from anywhere with an internet connection, which is what you will end up with at the end of this guide.

Your shopping list…
  • Raspberry Pi with an OS installed
  • USB Powered HubAmazon UK – Amazon US
    • Important; This one worked for me, however it’s not worked for others, you will find this is the case with a lot of the powered USB hubs, research before buying.
    • We need a hub because the camera’s draw more power than the Raspberry Pi can actually provide, you see the same with some keyboards and USB dongles.
  • Web Cam

You could also look at an external power back and WiFi if you want to make it mobile, a few people have put these in a garden or somewhere without a static power/network source.

1. Get the software ready

To start with we’re assuming that you have a working Raspberry Pi on a local network with internet access, the next step is to update your Pi ensuring that you have the latest software and drivers installed.

sudo apt-get update
sudo apt-get upgrade

Next it’s time to install the software, and we’ll be using a fairly light weight application called Motion, this will do a few things for us including accessing the USB camera, getting the images, and streaming them via a built in web server. As the name suggests it will also track and trigger events on motion detected in the video frames (more on that later).

sudo apt-get install motion
2. Plug in your web cam

So now the software is on there it’s time to plug in the web cam and ensure that everything is working, ensuring that you plug it into the powered hub, and then into the PI. Otherwise the webcam will not get enough power to turn on.

When plugged in type the “lsusb” command, you should see a line there with your web cam manufacture, that proves that you have the basic connectivity working.

Bus 001 Device 002: ID 04ea:1142 Microsoft Corp.
3. Configure the software
sudo nano /etc/motion/motion.conf

In here there are a few basic changes that you need to perform:

  • Daemon = OFF to ON
  • webcam_localhost = ON to OFF

You can change other settings but it’s recommend you don’t take more than 2 frames, and you been the default frame pixel size, for stability.

4. Start the software

To ensure that the motion service will actually start as a daemon we need to change another configuration setting, so enter the following:

sudo nano /etc/default/motion

Then change the value “start_motion_daemon=no” to “yes”

Finally you can start the motion service to stream the web cam images

sudo service motion start
Quick Example Image

Quick Example Image

Then after about 30 seconds browse to the new web interface, which should be at the below URL (where is your Raspberry PI’s IP address)

5. Final Tweeks

Web Port

You could change the web interface port to 80 (from the default 8081), so that you can just browse to the IP address without having to put :8081 at the end, it’s really simple to do, just:

sudo nano /etc/motion/motion.conf

And then change “webcam_port 8081” to “webcam_port 80”, save the file, and restart the motion service.

sudo service motion restart

Port Forwarding

Final suggestion is enable port forwarding on your home broadband router to the Raspberry PI on port 80, that will mean you can access the web cam from anywhere in the world. There are too many routers in the word to explain how to do it here, but I am sure you will find some help on Google, if not please just leave a comment.

Warning; If you give it internet access via port forwarding this does take up quite a bit of bandwidth, and anyone can see your webcam feed, so only show what you want people to see 😉


Well the last few days have been interesting for me, here is a brief overview of what went on.

the old rubish design

The Old Design

Bodged together

A lot of my blog posts are cobbled together in around 10-20min with a bit of effort put in but nothing really too taxing, in one of my latest posts I decide to write a brief list on “30 cool ideas for your Raspberry PI project”. As you can see in the screenshot it was a fairly boring bullet point list of 30 things with links to external sites where you can read up in more detail on a project of choice.

Well after a few days the traffic started coming in from Google and I was quite content with my new blog post, while trawling through Google Analytics I noticed a bounce rate of around 90% for that page, well that sucks! First page on Google for “Raspberry Pi Ideas” but no one wants to actually read the content.

The website had also been submitted to a few social sites with similar disappointing interest, however to be honest I completely understand why! only one other up-vote on the screenshot below:

Old Hacker News

Revamp time!

So the plan was to revamp the page and see how that affected the bounce rate, basically I got some pictures for each of the 30 things and put them in a clean and simple HTML table, it did look considerably better for only a few minuets more work, how about another screen shot for comparison? Ok there you are at the right.

the updated design

The new design, with pictures!

As I finished updating the layout I decided to resubmit the page to one social news site (hackernews), then monitored the traffic using Google Analytics real time to get a better idea of what people are doing.

Two active visitors, Ten, Thirty, cool people are actually looking at the content now and not bouncing straight away to another site!…. Eighty visitors now, Two Hundred active visitors…. What’s going on here??

Well it turns out people did like the new design/layout even though the underlying content was exactly the same, and I was now on the front page of hacker news, peaking around number 3 and averaging around number 6 most of the time.

New hacker news


Everything Broke when the internet arrived

Over the next few hours I was battling trying to keep the server online, I might go into this a bit further in another post once I get some more metrics. However the basics are that CloudFlare (CDN function) didn’t really help because it was PHP based CPU load that was killing me, not throughput. W3cache using a Memcache backend really saved the day, NewRelic is awesome for monitoring my configuration change effects in real time, and finally CDN77 has 100GB of free bandwidth which is also nice when you need some help ?

Even More traffic now…

Just as the site was back on it’s feet people started flooding in from Twitter, Reddit (Raspberry_Pi) and also Google +1, people actually use Google +1 well that was news to me! Actually it’s just edged out reddit for the second spot in Social traffic sources.

Another thing I have noticed, while the hackerne.ws traffic is fairly dependant on been on the front page it appears Reddit and Google are much more stable (so far), I expect this is because they have less churn of stories in their respective sections.

reddit post

The site has now been fairly stable since the recent changes, and there is still a steady flow of traffic from some of the sources.

48 hour visits

48 hour social breakdown

(Stats for last 36 hours only)

  • Put more effort into design, people like nice pictures and layouts
  • CloudFlare + Nginx isn’t a solution on a slow server, get caching on there (memory not disk)
  • CDN’s don’t really help with CPU usage too much
  • As always, keep your solution simple (Memcache > Varnish)
  • Will do a more technical post soon!
  • Front page of Reddit for a few min
  • Front page of hackernews for 24 hours+

If you got this far, please don’t forget to comment or even vote on HN or Reddit, Thank you 🙂


Quite a few netgear devices come with a hidden page that you can browse to, this will then enable Telnet access on the device. However it looks like on the DGND3700 this page has actually been removed from the code base. Fortunately there is still a way to enable Telnet access to this router.

1. What you will need:
  • Download: Telnet Enable Netgear
  • Windows Machine, download the file here
  • PC on the same LAN as your router
  • Administrator rights on your local machine
2. Setup
  1. Now you have downloaded the file from step one, extract it, and place the enclosed .exe on your desktop.
  2. Open up a command line window
    1. Hold the windows and ‘r’ key
    2. Type in the window ‘cmd’
    3. Press enter
  3. In your command window enter the below command, and look for the physical address (MAC Address) for your router (normally
    1. arp -a

Screen Shot 2012-12-24 at 18.05.08

3. Enable telnet

Run the below command to enable telnet, don’t forget to change the IP and Physical address to match your setup.

telnetEnable.exe A021B78B0DC4 Gearguy Geardog
  1. telnetEnable.exe – is the script name
  2. – your router IP address, as you use to manage via the web interface
  3. A021B78B0DC4 – Your physical address, from step 2
  4. Gearguy – The default user, case sensitive!
  5. Geardog – The default password, case sensitive!
3. Login

You can telnet from your current window, by using the below command:


Or if you plan on doing a lot of work on the router I would suggest downloading a client like PuTTY

If your propmeted for a username or password use the ones mentioned in step 3.

Happy Hacking!

Screen Shot 2012-12-24 at 18.20.08


Screen Shot 2012-12-23 at 13.26.05The Raspberry Pi has many great features straight out of the box,  unfortunately WiFi is not one of them, in this guide I’ll show you how I WiFi equipped my Raspberry PI for only a fiver.

We will be assuming that you have a head less setup (without a monitor) so the guide should work for everyone, either via SSH (remote) or via a local terminal session if you do have a monitor.

Also its worth noting that some WiFi adapters will require a powered USB hub between the Raspberry PI and the USB module, the one used below doesn’t due to it’s power consumption assuming you don’t have anything else drawing large currents from the USB power.

1. What you will need…
  • Raspberry Pi, with Wheezy
  • Internet Connection (via the ethernet port to begin with)
  • WiFi network to test on
  • USB WiFi Dongle, either of the below work:
2. Update the OS

There are so many times you will run into a bug when installing something new and find out that it would have worked if your system was up to date, taking no risks here so get your system updated

sudo apt-get update
sudo apt-get upgrade

Due to the RAM/CPU power on the Pi’s, this might take a while, brew anyone?

3. Reboot

Power down the device, install your WiFi USB module and turn it back on.

4. Setup the interface configuration
sudo nano /etc/network/interfaces

Normally your base configuration will look something like this

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Assuming you have a DHCP server on your LAN (normally your DSL/Cable router) use the following configuration, your SSID and password will be put in the wpa_supplicant.conf later on in this guide.

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

If you don’t have a DHCP server, or if you want to just statically assign the IP address you can use the following, however update the IP, Netmask and Gateway to match your network.

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
5. Setup the WPA configuration

Finally you will want to edit the WPA configuration as below, don’t forget to update it for your SSID and WPA password!

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
pairwise=CCMP TKIP
6. Final Reboot

Ok that should be it, do a final reboot remove the wired ethernet cable and your IP should automatically come onto the network as a normal WiFi device.



This device should work out of the box, if for any reason it doesn’t you will want to do the following:

sudo wget http://dl.dropbox.com/u/80256631/install-rtl8188cus-latest.sh -O /boot/install-rtl8188cus-latest.sh
sudo /boot/install-rtl8188cus-latest.sh

Now go back to step 3 and try again.


Run the below command, you should see your WiFi device there? If not there could be an issue with the hardware, try it in another PC…


You should see a line that looks like this:

Bus 001 Device 005: ID 0bda:8189 Realtek Semiconductor Corp. RTL8187B Wireless 802.11g Network adapter.
Still got issues?

Leave a comment and i’ll get back to you 🙂

Our Sponsors