R.Pi B+ BoadSo (somewhat late to the party, but anyway), I came up with a project I could use a Raspberry Pi for. Off to Amazon I went, and purchased this starter package (select the ULTIMATE kit), which I highly recommend. Everything you need, all in one place. I’m assuming you either bought this kit, or have the things you need, which I will also call out in case you’re a masochist and plan to try to assemble all this stuff by yourself.

Take note that I’ll be updating this post as I discover more stuff about the Raspberry Pi I think is worth sharing; so you might want to bookmark it and come back again from time to time. I’ll try and make it worth your while.

To start, you will require the Pi B+, a storage card with NOOBS on it, a power supply, a wired USB keyboard, a wired USB mouse, an ethernet cable, a free port on your network router or network switch, an HDMI cable and an HDMI capable monitor.

No, there’s no other way. You need the monitor, keyboard and mouse. Sorry. Not my fault. Everything I listed except the network cable, keyboard, monitor and mouse is supplied in the kit I linked to just above. As well as a lot of other really cool stuff. Hint. Hint.

Plug the keyboard and mouse into two of the USB ports, and the monitor into the HDMI port using the supplied HDMI cable in the kit. Then plug the supplied storage card with NOOBS on it into the storage card slot on the underside of the Pi. Turn on the monitor. Now plug in the supplied power supply to the Pi, and NOOBS will start.

Install the raspian OS. Follow and obey the prompts. Make sure you configure the details under the ADVANCED menu item as well as the ones in the initial menu. This process is easy, but will vary depending on what you want. I specified that the Pi boot to the command line, and that the GPU could only have 16 (megabytes) of memory; this leaves all of the rest for application and operating system use, which, generally speaking, is a Good Thing. But if you plan to use the GUI (ever — including typing startx later), this is probably not enough. All the other options are, I think, pretty obvious. When the install is complete, the Pi will reboot.

When the reboot is complete, log in at the keyboard. The user name is “pi” and the password is “raspberry

To start, enter these commands at the shell prompt:

cd /etc/network
sudo nano interfaces

1: replace the “dhcp” keyword with the “static” keyword.

2: add this line, using your own fixed network address, which needs to be below the first address your router supplies via DHCP (probably below 100 — I used 50.) Assuming your LAN is at 192.168.1.XXX:


3: add this line:


4: add this line, modify if required for your own LAN addresses:


5: press control-O to write the interfaces file back to the drive with these changes

6: press control-X to exit the nano editor

7: Plug your ethernet cable into the Pi (you’ll see activity lights at the ethernet socket)

8: Restart the Pi:

sudo shutdown -r now

…When the Pi has finished rebooting, go to a shell at another machine, and type:

ssh pi@

You’ll probably be asked if it’s ok to add the encryption fingerprint – it is, go ahead. Then you’ll be prompted for the password, which is “raspberry

That’s it — you’re up and running. You can dispense with the keyboard, monitor and mouse now.

Shut the Pi down and turn off the power before messing with the cabling, though. It’s all too easy to hurt electronics that are operating. The shutdown procedure is detailed next.

To end the SSH shell, simply type:


Console Auto Blanking and Powerdown of HDMI monitor

The Pi defaults to blanking the monitor and then a little while after that, shutting the monitor off. I despise that. Perhaps you do too. To turn it off:

cd /etc/kbd
sudo nano config

Change the blank time to zero:


Change the DPMS power down to zero:


Press Control-O to save;

Press Control-X to exit.

Restart the Pi:

sudo shutdown -r now

Fixed. :)

Basic survival

To stop the pi from the command line, use this:

sudo shutdown -h now

To restart after that, you’ll have to turn off power to the board, then re-apply it. Note that you should shut down and remove power any time you change any cabling, even USB connections, unless the Pi is installed in a case. This is very likely to save your Pi from damage. PC boards without protective cases are extremely vulnerable to shorts, static and physical damage, particularly when operating power is applied. So be safe rather than sorry!

Now to add the best thing EVER for running around in a *nix system, Midnight Commander. To install it, type these lines:

sudo apt-get update
sudo apt-get install mc

Once it’s installed, type mc to run it.

Some tips to make midnight commander your bit… er, yours. Type mc Then, go to the options menu (F9) and select always pause after run. This is so you can see the results of commands you run. Then select “Use internal Editor” (you can thank me later.) Then go to the bottom of the options menu and save your settings. Ok, now find a text file, press F4 to edit it, then press F9 for the menus here, again select the options, turn OFF “Fake Half Tabs” and set the tab size to 4 This is ideal for Python. You do want to use Python, right? Now save the options here (these options are just for the editor.)

Ok, all done! No, just kidding. Why would it be that easy? Now exit the editor if you’re still in it (F10) and mc too (also F10), and then type sudo mc and repeat all of the above steps. Why? Because when you sudo, you’re now root, not “pi”, and so all the defaults for the root user are used, instead of yours. So you need to set these too.

Ok, now you’re really done. Learn how to use the internal mc editor (F4), you’ll be glad you did. :)

Have fun!

Setting up a Web Server

This is the way I set up a web server. I find it completely adequate; if you use a web server like I do (apache, python, sqlite3) then this setup will be useful to you. I should add that I write all my own CGI in python, not perl or php, and I use sqlite3 as my database, not mysql or PostgreSQL. You may have different requirements, in which case, skip this.

sudo apt-get update
sudo apt-get sqlite3
sudo apt-get apache2 -y

At this point, going to the IP of the pi with a web browser should show you the page at /var/www/index.html

And off you go.

Pi Face board

Real world interfacing for the Raspberry Pi

Real world interfacing for the Raspberry Pi

If you’re like me, and not only want the Pi but also the ability to mess with the real world, the Pi Face board will be of great interest. The good news is, it’s really inexpensive and the thing is so easy to use you won’t even believe it. Real world connections are great, too — quality screw terminals.

The Pi Face board provides two fairly robust SPDT relays, eight open-collector digital outputs, eight pulled-up digital inputs that detect being grounded, eight LED indicators connected in parallel with the digital outputs, and four momentary-press buttons connected in parallel with the first four digital inputs.

The bad news is, the Pi Face won’t fit on top of the Raspberry Pi B+. Nope. Seriously. Don’t make me elaborate. So, in order to actually use it, when you order it, make sure you also order a GPIO extension header (one of three things in the linked product package), with one end male, and the other end female. Otherwise there will be Frowns and other Bad Things.

Installing the Pi Face board

So, now that you’ve got the extension header carefully installed, and the Pi Face carefully installed on top of that, is it going to work? Oh, no, not on your life. :) Pressing onwards…

First, sudo nano (edit) the /etc/modprobe.d/raspi-blacklist.conf file, and make sure there is a ‘#’ character at the beginning of the correct blacklist line. It will look like this when you’re done:

# blacklist spi-bcm2708

Then save the file back.

Next, you need to create a script file called “installpf.txt” in your home directory, and then run it. Here’s the script:

sudo apt-get install -y python-dev python-gtk2-dev git
pushd ~/
git clone https://github.com/thomasmacpherson/piface.git
pushd piface/python
sudo python setup.py install
sudo piface/scripts/spidev-setup

Once the file’s been created, type this in your shell:

sudo apt-get update
cd ~
bash installpf.txt

…then wait while lots of stuff gets installed.

When that’s done, restart the Pi:

sudo shutdown -r now

Finally, once you reboot, type this at a shell prompt:

python /usr/share/doc/python3-pifacedigitalio/examples/blink.py

Is there a light blinking on the Pi Face board? If so, you did everything right, and you’re good to go. If not… shut down, power down, check the physical connections carefully for alignment and shorted connections, then restart and try that last line again. Still no go? Then you missed a step here. Go over them again. won’t hurt to do any of this more than once.

The specs for the relays on the Pi Face say that the relays are good for 240v at up to ten amperes. Great, right? Weeeell… don’t get too excited. On this page, we find that they say the limitations of these relays as used in the Pi Face are 20 vdc maximum, and 5 amps maximum. I don’t know why. Could be poor PCB design, or some other problem — or maybe they just don’t want you connecting live AC to the board (which was exactly what I bought the thing to do… arghhh…)

Well, ok. Sheesh. So anyway, here’s yet another board to add to your heap of stuff, a 2-channel relay board that is actually rated for what the relays can do, and requires small enough drive so you can provide it from the Pi.

Of course, if you do that, you’re going to need these, too, because the drive connectors on this relay board are just little pins. It never ends, I suppose.

Whyfor no WiFi?

Sadly, headless WiFi operation with a static link has turned out to be unreliable. When the Pi loses its WiFi connection, it doesn’t come back. In a headless configuration, that in turn means you have to reboot it, and when you can’t give it a proper shutdown command, that means you’re risking your data with an unplanned, unstructured, unsafe power-down.

So something must be done or headless, wireless operation is a bust (until they fix the WiFi drivers so they work properly and re-acquire the static link automatically.)

I’ve worked up somewhat of a ‘watchdog’ fix, but I’m still testing and refining it.

Until I post the fix, I do not recommend trying headless, wireless operation without a fixed ethernet connection as well.

If, on the other hand, you still have a wired connection too, you can get in there
and restart the Pi manually, fiddle with the WLAN settings, or just use the wired connection to talk to it as otherwise required.

20140927: 01:49 MST — tests are going well. Upon loss of network connection, my fix brings it back without (so far) requiring a forced reboot. I’ll probably post the fix towards the close of this weekend unless I run into something else.

If you grabbed that kit I pointed out, you’ll note that there’s a USB WiFi dongle in there. So, if you’d like your headless Pi to become a headless, wireless Pi, here’s how to proceed.

First, shut down:

sudo shutdown -h now

Then power down your Pi, and insert the WiFi dongle into an available USB port. Re-apply power, and give the Pi time to boot.

Given the bare board situation, I don’t like to plug things in while handling the board. Too easy to pop the storage card out, or otherwise screw up, perhaps damaging the Pi. It’s not expensive, but after all this work… yeah, you get me. Shut down, then power down.

Now SSH in from another machine using the static IP you hopefully have set it up at. If not, go find out the DHCP assigned IP in a shell…

hostname -I

…then SSH to that. For me, it is:

ssh pi@

Then log in using your id and password (defaults are pi and raspberry)

Update the system, then grab wicd-curses:

sudo apt-get update
sudo apt-get install wicd-curses

Once that’s all finished, start it up:

sudo wicd-curses

First thing to do is hit P (that’s a capital P) to access the Preferences for wicd-curses, and at the top, in the Wireless Interface field, enter (or verify as already there): wlan0 then press F10 to save.

If wicd-curses locks up on you, just open another shell, log in again, and start it again with sudo wicd-curses. It locked up on me several times, but no harm done. Otherwise continue. This could have been because of my WiFi dongle, my configuration, or just bugs in wicd-curses; I’m not pointing fyngyrz. Just be aware I ran into this, and you may as well.

Press R (capital R) to re-scan the wifi networks. Yours should appear. If not, repeat the above steps.

Select the desired network using the down-arrow

Edit its parameters by pressing right-arrow

In wicd-curses, you select and de-select checkboxes using the space bar. Move from item to item using up-cursor and down-cursor.

I set mine up as static, using Google’s DNS servers. I used the address right next to the static wired address,

Assuming you’re also using a based network, The netmask should be, the gateway should be and two of the three DNS entries should be and

At this point, you press F10 to save.

Now you need to edit the system WiFi setup. wicd doesn’t set everything you need. So:

First: sudo nano /etc/network/interfaces

Then add these lines (Items in red require YOUR settings):

auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
wpa-passphrase WiFiPASSWORD
wpa-ssid WiFiNAME

And comment out these lines:

#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp

Finally, save the interfaces file, and reboot the Pi:

sudo shutdown -r now

After the reboot, you should be on the air. Test by opening a shell on another machine, then typing:

ssh pi@

If the connection comes up, you’re good. If not, log in via the ethernet connection, then repeat and check the above steps. They do work, with the caveats about your network addresses possibly being different and wicd-curses crashing / locking up and having to restart it, and using your own password and network name kept in mind.