Preventing dnsmasq from running as a daemon (service) on a Raspberry Pi

Some time ago, I wrote a post about running a Raspberry Pi as a home infrastructure server (DNS, DHCP, TFTP, etc.). Now my Synology NAS is doing that for me (well, the DNS and DHCP at least – TFTP is less critical as my Cisco 7940 IP Phone just sits there taking up desk space most of the time) so I don’t need the Pi to provide those services.

Unfortunately, when I migrated DNS and DHCP a few months ago, I just stopped the service with sudo service dnsmasq stop so, after a power outage last week, when the Pi came back up, so did dnsmasq – and having two DNS/DHCP servers on the network produced some strange results (as might be expected…).

So, to do the job properly, I ran sudo nano /etc/default/dnsmasq and changed the ENABLED=1 line to ENABLED=0. That should prevent dnsmasq from running as a service but leaves the configuration intact if I ever need to bring it back online.

A quick sudo reboot and sudo service dnsmasq status is all that’s needed to check that dnsmasq stays disabled.

dnsmasq, not running

Restart a Raspberry Pi Zero with a paperclip

One of the “limitations” of a Raspberry Pi is that it doesn’t have an on/off switch. That’s not really a problem – once it’s shut down, a power cycle to the socket (switch on/off) will allow it to boot up but there is another way (ignoring the purchase of expensive in-line power switches*, or daughter boards to make the Pi pick up an infra-red remote control signal).

Alex Eames blogged details to fit a reset switch to a Raspberry Pi (which I may well do) but what about the Raspberry Pi Zero? My son uses one of these plugged into our TV to practice his Python programming and it’s plugged into a USB wall socket so a power cycle restarts several USB devices or alternatively, cables need to be pulled.

Well, a bit more reading led me to the idea of shorting GPIO pins 5 and 6, and then some experimentation showed me all I have to do it touch pin 5 with a bent paperclip to turn on the Pi!

So, shutdown as normal from the OS. And startup with a “hotwiring” trick!

I’ve since found that the Pi Zero can also be started by shorting the two pins labelled “Run” next to GPIO 37 and 39 (connect the pins and then disconnect again) – so it’s also possible to fit a switch in a similar manner to Alex Eames’ advice for the full-size Pi.

One thing to be aware of if a switch is fitted is that it can be used to turn on the Pi but shouldn’t be used to turn it off as it just kills the power and could lead to software corruption or even hardware damage.

 

*Incidentally, whilst writing this post I came across an inexpensive in-line USB switch. I haven’t tested one but some might find it useful, with the same caveat as the DIY option…

Raspberry Pi FTP server

I’ve been trying to resurrect my SIP-connected Cisco 7940 as part of a review of our home telephony arrangements. In order to do this, I’ve had to configure the TFTP capabilities on my home infrastructure server (i.e .my Raspberry Pi). Previously, I’d served the phone configuration from a Windows TFTP server (long since gone) and the phone had just kept going with the old settings. Now, with configuration changes required, I’ve started to use dnsmasq for TFTP as well as DNS and DHCP (actually, that had always been configured, but without any files on the Pi to serve from TFTP)!

So, how to easily transfer the files? FTP to the rescue. I followed the Pi My Life UP guide to install vsftpd on my Pi, which meant using the following commands:

  1. Update packages and install vsftpd:
    sudo apt-get update
    sudo apt-get install vsftpd
  2. Edit the vsftpd config with sudo nano /etc/vsftpd.conf, making sure it has the following entries:
    anonymous_enable=NO
    local_enable=YES
    write_enable=YES
    local_umask=022
    chroot_local_user=YES
    user_sub_token=$USER
    local_root=/home/$USER/ftp
  3. Create the folder to use for FTP and set the permissions:
    mkdir /home/pi/ftp
    mkdir /home/pi/ftp/files
    chmod a-w /home/pi/ftp
  4. Restart the FTP service with sudo service vsftpd restart.

After this, I could easily upload the files I needed to the folder that I’m serving TFTP from (/home/pi/ftp/files) – although for some reason the FTP server was listening on port 22 (not 21), and then distribute my new phone configuration…

Raspberry Pi infrastructure server (DNS, DHCP, TFTP)

A long time ago, I used to run real servers at home – I had a Compaq Prosignia 300 for a while and then a Compaq (or maybe it was an HP) Proliant DL380 running in my garage. Then, a few years back, I stopped running my own mail server and put all of the infrastructure services onto a low-powered PC running Windows Server (working alongside a NetGear ReadyNAS Duo). Recently, I found I didn’t even need Active Directory (I have unmanaged devices and cloud services these days) so I started to switch over onto a Raspberry Pi.  Each move made a huge difference to my electricity bill but I’ve had some mishaps too. I accidentally turned off the Pi and corrupted the flash memory (oops), then recommissioned the previous server. Then, I accidentally killed the power on that too and it’s not come back up (could be the PSU, or the motherboard – but whichever it is it’s unlikely to get fixed) so last Saturday night, I found myself bringing the Pi back into service as a DNS, DHCP and TFTP server – partly to improve my Internet access speeds and partly to back up my Windows Phone (that will be the subject of another blog post).

Luckily, I had the notes from last time I did it – but they hadn’t made it into a blog post yet, so I’d better record them in case I need to do this again…
Assuming that the Raspberry Pi is running Raspbian, the following commands should be entered from command line (e.g. LX Terminal):

  • sudo nano /etc/network/interfaces (to set up static IP – in this case 192.168.1.10 on a class C network):
    #iface eth0 inet dhcp
    iface eth0 inet staticaddress 192.168.1.10
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    gateway 192.168.1.1
  • sudo nano /etc/resolv.conf (to set the DNS server address – 8.8.8.8 will do if you don’t have one):
    nameserver 8.8.8.8
  • sudo ifdown eth0 (take down the Ethernet connection).
  • sudo ifup eth0 (bring it back up again).
  • ifconfig (check new IP settings.)
  • sudo apt-get install dnsmasq (install the Dnsmasq network infrastructure package for small networks)
  • Optionally, sudo apt-get install dnsutils (to get utilities like nslookup and dig). Unfortunately, this is resulting in bash: dig: command not found (I’m pretty sure it worked when I did this a year or so ago but, for now, I’m managing without those tools.
  • sudo service dnsmasq stop (stop the Dnsmasq service)
  • sudo nano /etc/dnsmasq.conf (edit the Dnsmasq config) – these are the settings I changed (all others were left alone) – the original version of the file includes full details of what each of these mean):
    domain-needed
    bogus-priv
    no-resolv
    server=212.159.13.49
    server=212.159.13.50
    server=212.159.6.9
    server=208.67.222.222
    server=208.67.220.220
    server=8.8.8.8
    local=/home.markwilson.co.uk/
    expand-hosts
    domain=home.markwilson.co.uk
    dhcp-range=192.168.1.100,192.168.1.199
    dhcp-host=00:1d:a2:2f:20:f9,192.168.1.199
    dhcp-option=3,192.168.1.1
    dhcp-option=6,192.168.1.10
    dhcp-option=42,192.168.1.1
    dhcp-option=66,192.168.1.10
    dhcp-option=66,boot\pxeboot.com
    dhcp-option=vendor:MSFT,2,li
    enable-tftp
    tftp-root=/home/pi/ftp/files
  • Optionally, add some static entries for fixed IP items on the network with sudo nano /etc/hosts:
    192.168.1.1 router
    192.168.1.10 raspberrypi
  • sudo nano /etc/resolv.conf (set the DNS server address again – to use the local server):
    nameserver 192.168.1.10
  • sudo service dnsmasq start (start the Dnsmasq service)
  • View client leases with cat /var/lib/misc/dnsmasq.leases.

A few more notes that might be useful include that pinging short names may need a trailing . .
Other blog posts that helped me in creating this include:

(I haven’t actually tested the TFTP functionality – I need it for my Cisco 7940 phone, but need to recover the files from the old server first).

Now, all I need is a UPS for my Pi – and it looks like one is available (but I’m waiting for the new version that can keep the device running a while on battery power too…)

Hardware lineup for 2014

For the last few years, I’ve written a post about my “hardware lineup” – the tech I use pretty much every day (2011, 2012, and 2013). This year, Dan Delaney reminded me when he borrowed the idea (and I originally stole it from someone else…) so here’s the belated 2014 line-up…

Car: Volkswagen Tiguan 2.0 TDI Sport

I’m still enjoying my current company car even as it approaches its 2 year anniversary and am actively working to keep the mileage down as I may buy it at the end of the lease. Whilst I might be able to get a deal on a second hand Q7 or Toureg, this was specced up the way I wanted it  including a retractable towbar and I’m more than happy. Verdict 8/10. Hold (tied into a 3-year lease).

Phones: Apple iPhone 4S and Samsung Galaxy S3 Mini

Windows Phone 7.8 was a disappointment and the lack of apps for the Windows Phone platform means I’ve gone back to iOS for my personal phone (second-hand from the SmartfoneStore), although I hope to jailbreak it to get some of the features that are missing for me in iOS 7. Meanwhile, my company iPhone 3GS has been replaced with an Android model (the Samsung Galaxy S3 Mini), which is infuriating in many ways but at least lets me get experience of working with the other dominant mobile platform. (iPhone) Verdict 7/10. Hold – something new is too expensive. (Galaxy Mini) Verdict 5/10. Not mine to sell!

Tablet: Apple iPad 3G 64GB

Apple iPadMy iPad never replaced a laptop as a primary computer but it’s still great as a Kindle, for catching up on social media content, and for casual gaming (read, occasional babysitter and childrens’ amusement on long car journeys). I was disappointed to have to pay to replace it after the screen developed a fault, but there’s no reason to trade up yet, especially since we bought a touch PC for the family (read on). If anything, I might consider a smaller tablet (maybe a Google Nexus 7 or a Tesco Hudl). Verdict 5/10. Hold, although it’s getting old now.

Everyday PC: Fujitsu Lifebook P702 (Intel Core i5 3210M 2.5GHz, 8GB RAM, 320GB hard disk)

This PC is my main computing device and is a small form-factor replacement for the previous Lifebook I used.  I like it, but a BYOC scheme would be more likely to leave me buying a competitor’s PC. Just as well we only have CYOD! Verdict 7/10. Still hoping for a BYOC scheme at work but not holding my breath.

Family PC: Lenovo Flex 15 (Intel Core i5 4200U 1.6GHz, 4GB RAM, 500GB hard disk)

Lenovo Flex 15When it eventually arrived, I set this PC up with Windows 8.1, Office 2013 and an account for everyone in the family.  It’s been a huge hit – the kids love it and I find it really useful to have a PC in the kitchen/family room.  I’m glad I held out for a touch screen – Windows 8 is so much better with Touch – but I should possibly have got something with a bit more memory… Verdict 8/10. A bit underpowered but a good balance between price and form factor.

Netbook: Lenovo S10e (Intel Atom N270 1.6GHz, 2GB RAM, 160GB hard disk)

Lenovo IdeaPad S10Rarely taken out of the drawer – only used when I want to play with Linux (Ubuntu) or upload some new code to the Arduino. Verdict 2/10. Not worth selling, so keep for tech projects.

Digital Cameras: Nikon D700 and Coolpix P7100

Nikon D700Nikon P7100Although I’ve fallen out of love with photography, I’m sure I’ll get back on the wagon some time. A full-frame DSLR is still my favourite format and the D700 will be with me for a while yet. Indeed, it’s more likely that I would buy some new lenses and a flashgun before I replace my camera body.  Newer bodies offer video but I don’t miss that, and the low light performance on the D700 is pretty good. The P7100 continues to function as my carry-everywhere camera (it lives in the car), offering entry-level DSLR levels of control in a small package, although it’s not as responsive as I’d like and I increasingly tolerate using the iPhone instead (poor camera, but always with me). (D700) Verdict 9/10. Hold. (P7100) Verdict 6/10. Hold.

Photography PC: Apple MacBook MB062LL/B (Intel Core 2 Duo T7500 2.2GHz, 4GB RAM, 750GB hard disk)

Apple Macbook White (late 2007)My MacBook is getting old and, although I upgraded to a 750GB disk, I’m struggling with disk space whilst 4GB of RAM is starting to feel a bit light for big Photoshop jobs but new Macs are expensive. Still too expensive to replace, but as long as I’m not doing much photography, this will last a while longer… Verdict 4/10. Hold.

Media: Samsung UE37ES6300 Smart TV

Samsung UE37ES6300Our late-2012 technology purchase, this replaced an aging (c1998) Sony Trinitron 32″ widescreen CRT and Internet-connected television is now an integral part of my family’s media consumption habit with my children watching more iPlayer content than live.  The software is a little “buggy” but it does the job – as a half decent TV it’s more than adequate and I’m thinking of getting a 22″ version for the den (when we build one…) Verdict 9/10. Hold.

Media: Apple Mac Mini MA206LL/A (Intel Core Duo 1.66GHz, 2GB RAM, 120GB hard disk)

(+ iPad, iPhone 4S, various iPods, Altec Lansing iM7 iPod speakers, Samsung UE37ES6300) Apple Mac MiniNo change here since last year and I still haven’t re-ripped my CDs after the NAS failure a couple of years ago (although the Dell server I bought a few years ago has come out of retirement in preparation for that task). We bought a Yamaha PSR E-343 music keyboard for my son this Christmas so this PC may be brought back to life with Garage Band or as a media server as it takes up almost no space at all. Verdict 6/10. Hold.

Gaming: Microsoft Xbox 360 S 250GB with Kinect Sensor

Microsoft Xbox 360sI don’t play this as much as I should but my sons make more and more use of it, and bought me a copy of FIFA 2014 for Christmas, so the Xbox is starting to get a lot more use. No plans to replace it with a newer model though. Verdict 7/10. Hold.

Servers and Storage: Raspberry Pi, 2x Netgear ReadyNAS Duo, various USB HDDs

The Raspberry Pi has replaced my atom-based infrastructure PC, whilst one ReadyNAS is used to back up my work and the other has still not been recovered from its multiple disk failure a couple of years ago.  I still need to consolidate the various USB hard drives onto the  3GB Seagate Backup Plus Desktop drive and sort out the various cloud-based services that I use. (Raspberry Pi) Verdict 10/10. What’s not to like about a computer that costs just £25? (ReadyNAS Duo) Verdict 5/10. RAID failures mean I’ve lost confidence.

Other tech: Arduino Uno, Canon ImageFormula P-215 document scanner

I’m still occasionally playing around with electronics using an Arduino – although I need to do more with this. I’m also slowly regaining control over my filing using the document scanner (and it’s very cathartic shredding old documents!) (Arduino Uno) Verdict 10/10. Inexpensive, with loads of scope for electronic prototyping and a thriving community for support. (Canon P-215) Verdict 9/10. Impressive scanner, although a little on the expensive side.

Potential new toys: Nest learning thermostatLego Mindstorms

Just as last year, I still have my eyes on home automation and tech toys but budgets (and other hobbies) mean they are unlikely to become real for a while yet.  A smart watch is a possibility too… just waiting for the right one…

RasPi Wi-Fi

Way back in the autumn of 2012, I was getting all excited about my Raspberry Pi. I even hacked around to get it working over Wi-Fi but never got around to publishing the post!  So, a year and a bit later, here are a few notes based on some links I recorded at the time. Your mileage may vary (the Raspberry Pi has come a long way since then and I was running Debian Squeeze rather than Raspbian) but if you’re having difficulties getting RasPi Wi-Fi to work, hopefully some of this will help.

The Wi-Fi adapter that I used was an Edimax EW-7811Un nano USB adapter which I seem to recall I originally purchased from Maplin before returning it when I realised it was much less expensive online.  There are some good notes on the Raspberry Pi verified peripherals list that may help (much better than when I was working on this in 2012).

Tomasz Miklas’ post provided a ton of information on configuring the operating system to work with the adapter, as did this guide on elinux.org.  If you have trouble with the Realtek drivers, there’s a post that may help – you might want to read it in conjunction with these notes on the Raspberry Pi forums.  I also found that I had to use the sudo bash scriptname.sh command, rather than just sudo scriptname.sh. The final resource I found in my notes was Mr Engman’s “idiots guide” to RTL8188CUS Wi-Fi setup.

So, there you have it – ingredients but no method, I’m afraid.  I also found that the WiFi reliability depended on which other peripherals were plugged in to the RasPi (for example I use a cheap mini wireless keyboard and mouse set from Maplin) and I had some success with a powered USB hub (a Logik LT4HUB10).  Since then, I’ve switched over to a 1500mA power supply from The Pi Hut but am not sure it’s made much difference.

Book review: Getting started with Raspberry Pi (so what exactly is it for?!)

A few weeks ago, we were visiting friends who have a teenage son. He’d received a Raspberry Pi for Christmas but was struggling to understand what to do with it.  You see, he’d loaded Raspbian, fired up Scratch, etc. – but still had a pretty big question: what could he do on the Raspberry Pi that he couldn’t already do on his Windows laptop?

That made me stop and think. You see, for as much as I think the Raspberry Pi is a fantastic device for low-cost computing – and a great entry point for those who have a TV but not a PC;  many UK families already have at least one PC – indeed I used to think I was in the minority with my assortment of computing devices but even non-geek friends have multiple laptops (kids need them for school work, parents for their professional work), smartphones/tablets, and games consoles.

So what can the Raspberry Pi do that a PC can’t?  For starters, the GPIO pins mean it’s (potentially) easier to interface with other hardware. Secondly, the lower price point means that, if you blow one up, it’s less of a problem than a PC.  Also, as someone whose computing education started out with logic gates and boolean algebra, it allows one to get a lot closer to core computing principles – you can directly interact with a Pi in a way that’s not possible (or at least not as simple) with modern PCs.

That didn’t help my friends’ son much – although I did help to configure their router to allow him to run a Minecraft server, which scored me a few Brownie points…

Even so, I decided to buy a book to investigate further – partly with my friends’ issue in mind but also out of interest for myself. The book I selected was Getting Started with Raspberry Pi (Make: Projects/O’Reilly) by Matt Richardson and Shawn Wallace and it really is a pretty good introduction.  In a handful of easy-to-read chapters it skims the surface of getting up and running, understanding some Linux essentials, Python, Scratch, interfacing with other boards like Arduino, basic I/O, and working with webcams and Internet resources. Plenty of food for thought, to develop ideas for new projects (I still want to explore options to control a train set with some sort of Pi/Arduino setup when I find the time…). It doesn’t go deep, but nor should it – as one Amazon review says “You will need to be comfortable with computers in general, but if you’re, say, happy installing software on your standard Windows machine, you’ll be fine”.

I’ll be handing my copy over to my friends’ son – to see what a 15 year old makes of it… in the meantime, if you’re struggling to see the purpose of a Raspberry Pi (except as a small, inexpensive general purpose computer), this book might help to generate some ideas.

Hardware lineup for 2013

For the last couple of years, I’ve written a post about my “hardware lineup” – the tech I use pretty much every day (2011, 2012) and I thought I’d continue the theme as we enter 2013.

In these times of austerity, there’s not a lot of scope for new geek toys (some more camera lenses would be great, as would a new MacBook) but there’s no harm in a bit of aspiration, and it’s always interesting to take a look back and see how I thought things would work out and how that compares with reality.

So here’s the tech that I expect my life will revolve around this year…

Car: Volkswagen Tiguan 2.0 TDI Sport

My company car was replaced in April (a nice 40th birthday present) and the Volkswagen Tiguan I drive will be with me for at least 3 years. Whilst there are plenty of more capabile 4x4s and the space afforded by a 7-seater might be nice at times, “the Tig” has been great – my family all love the high riding position, my wife is happy swapping between this and her Golf (she should be – they are practically the same underneath the covers!) and, whilst I miss some of the refinement of my Audi, I get a lot more for my money with the Volkswagen.  Putting a retractable towbar on this car has created new possibilities too, allowing me to use a 4-bike towbar-attached carrier for family cycle trips.

Verdict 8/10. Hold (tied into a 3-year lease).

Phones: Nokia Lumia 800 and Apple iPhone 3GS

Apple iPhone 3GSNokia Lumia 800My initial enthusiasm for the Nokia Lumia 800 waned considerably, after Microsoft announced its Windows Phone 8 plans and the handset lost 60% of its value overnight.  That means I won’t be trading it in for a new model any time soon and, depending on whether Windows Phone 7.8 ever makes it out of the door, I might consider looking at options to run Android on the (rather nice) hardware instead.  Still, at least we got an update a few months ago that, finally, enables Internet Sharing on Lumias (Windows Phone 7.5 supported this capability, but the Lumia 800 firmware did not).

I still have an iPhone 3GS provided by my employer (and my iPad) to fall back on when apps are not available for Windows Phone (i.e. most of the time) and, whilst I’m unlikely to get another smartphone from the company, I am considering a second-hand 4S to replace this as the 3GS is getting a bit long in the tooth now…

(Lumia) Verdict 5/10. Hold, under duress.
(iPhone) Verdict 3/10. Not mine to sell!

Tablet: Apple iPad 3G 64GB

Apple iPadMy iPad never replaced a laptop as a primary computer but it’s still great as a Kindle, for catching up on social media content, and for casual gaming (read, occasional babysitter and childrens’ amusement on long car journeys). I was disappointed to have to pay to replace it after the screen developed a fault, but there’s no reason to trade up yet and there’s still nothing that comes close to the iPad from a media tablet perspective (except newer iPads).

If anything, I might consider a smaller tablet (maybe a Google Nexus 7 or an Amazon Kindle Fire) but and Apple’s decision to stick with a 4:3 screen ratio on the iPad Mini means I have little interest in that form factor (it’s almost the same hardware as my current iPad, albeit in a smaller package). If I were to get a new tablet, it’s more likely to be something that could really be a laptop replacement – perhaps a Microsoft Surface Pro? We’ll see…

Verdict 7/10. Hold, although it’s getting old now.

Everyday PC: Fujitsu Lifebook S7220 (Intel Core 2 Duo P8400 2.2GHz, 4GB RAM, 160GB hard disk)

Fujitsu Lifebook S7220This PC is my main computing device. I’d love a ThinkPad, but the Lifebook is a perfectly capable, solid, well-built notebook PC, although I frequently find myself running out of memory with the number of tabs I have open in a typical browsing session! A recent hard disk failure meant my free space dropped (my 250GB drive was replaced with a 160GB one) but it’s due for replacement soon.

I’ll be looking for a smaller form-factor device to reduce the weight of my work-bag – at least until BYOC becomes a possibility (an ultrabook, Surface Pro, or a MacBook Air would be nice, but not available to me on the company’s catalogue).

Verdict 6/10. Unlikely to be with me for much longer now, although still hoping for a BYOC scheme at work.

Netbook: Lenovo S10e (Intel Atom N270 1.6GHz, 2GB RAM, 160GB hard disk)

Lenovo IdeaPad S10Yet again, this device has hardly seen the light of day. Usurped by the iPad, it now runs Ubuntu and is only ever used for tech projects (e.g. uploading software to my Arduino). My kids have one too but even they are frustrated by the small screen and tend to use my wife’s notebook PC instead.

Verdict 2/10. Not worth selling, so keep for tech projects.

Digital Cameras: Nikon D700 and Coolpix P7100

Nikon D700Nikon P7100I still love my DSLR and the D700 will be with me for a while yet. Indeed, it’s more likely that I would buy some new lenses and a flashgun before I replace my camera body.  Newer bodies offer video but I don’t miss that, and the low light performance on the D700 is pretty good, even 2 years after launch.

The P7100 continues to function as my carry-everywhere camera (it lives in the car), offering entry-level DSLR levels of control in a small package, although it’s not as responsive as I’d like.

(D700) Verdict 9/10. Hold.
(P7100) Verdict 7/10. Hold.

Photography PC: Apple MacBook MB062LL/B (Intel Core 2 Duo T7500 2.2GHz, 4GB RAM, 750GB hard disk)

Apple Macbook White (late 2007)My MacBook is getting old and, although I upgraded to a 750GB disk, I’m struggling with disk space whilst 4GB of RAM is starting to feel a bit light for big Photoshop jobs but new Macs are expensive.

Still too expensive to replace, I think this will last another year, at least…

Verdict 4/10. Hold.

Media: Samsung UE37ES6300 Smart TV

Samsung UE37ES6300My most recent technology purchase, this replaced an aging (c1998) Sony Trinitron 32″ widescreen CRT and has given us back a lot of space in the living room! I’ve been really impressed with the Smart TV functionality (more on that over the next few days) and Internet-connected television is now an integral part of my media consumption habit.

In time, it may be joined by a sound bar (to improve the experience when watching films) but at the moment the TV’s built in speakers will have to make do.

Verdict 9/10. Hold.

Media: Apple Mac Mini MA206LL/A (Intel Core Duo 1.66GHz, 2GB RAM, 120GB hard disk)

(+ iPad, Lumia 800, iPhone 3GS, various iPods, Altec Lansing iM7 iPod speakers, Samsung UE37ES6300)

Apple Mac MiniNo change here since last year – except for the addition of a Smart TV – and I still haven’t re-ripped my CDs after the NAS failure a couple of years ago. I still haven’t bought the music keyboard and this PC’s role as a multimedia PC for the office with Spotify, iPlayer, etc. has been replaced by a Smart TV in the living room.

It may not be the most powerful of my PCs but it may be brought back to life as a media server as it takes up almost no space at all.

Verdict 6/10. Hold.

Gaming: Microsoft Xbox 360 S 250GB with Kinect Sensor

Microsoft Xbox 360sI don’t play this as much as I should to make full use of it but the arrival of BBC iPlayer and the death of our DVD player promoted the Xbox to be our living room  media centre, at least until the Smart TV arrived (and the two still complement each other). My sons are reaching the age where they play games too now, so the Xbox is starting to get a lot more use.

Verdict 9/10. Hold.

Servers and Storage: Atom-based PC, 2x Netgear ReadyNAS Duo, various USB HDDs

The Atom-based PC still provides infrastructure services for the home, whilst one ReadyNAS is used to back up my work and the other has still not been recovered from its multiple disk failure a couple of years ago. I recently bought a 3GB Seagate Backup Plus Desktop drive to replace an assortment of smaller USB hard disks and am preparing to supplement this with suitable cloud storage as we become more and more reliant on our digital assets.

Verdict 6/10. Hold.

New toys from 2012: Arduino Uno, Raspberry Pi, Canon ImageFormula P-215 document scanner

At the end of my 2012 post, I mentioned a few potential purchases and I did pick up one of the first Raspberry Pi computers, which is a fantastic hobby/educational machine to use with or without my children.  I also started to play around with electronics using an Arduino – which is great fun – and I hope to be doing more with both of them this year (more Raspberry Pi postsmore Arduino posts).

I’m slowly regaining control over my filing with the aid of a dedicated document scanner. It doesn’t matter to me that it’s portable, but the fast duplex scanning to PDF and multiple sheet handling (with very few mis-feeds) is a huge step forward compared with the all-in-one printer/scanner/copier I have in my home office.  Mine was an “Amazon Warehouse Deals” purchase (which saved me a few pounds) and the advertised condition suggested it may have a scratch or two but it seems to be in perfect condition to me. It will certainly be a big part of my push to digitise much of my paperwork this year.

(Raspberry Pi) Verdict 10/10. What’s not to like about a computer that costs just £25?
(Arduino Uno) Verdict 10/10. Inexpensive, with loads of scope for electronic prototyping and a thriving community for support.
(Canon P-215) Verdict 9/10. Impressive scanner, although a little on the expensive side.

Potential new toys: Nest learning thermostat, Romotive Robot, Lego Mindstorms

Of course, as a geek, I have my eye on a whole host of potential purchases and these were two that took my fancy in last year’s post, plus one more that I’ve had my eye on for a while (may be something for the kids to get and Dad to play with?).  In all honesty, I’m not sure that I’ll be buying much at all this year, but anything I do is likely to be in the general electronics, robotics and home automation field.

Raspberry punnets

Much as I like the rawness (is that a word?) of the naked Raspberry Pi, it does feel like it would be very easy for me to break and, with huge waiting lists to get a replacement as demand massively outstrips supply, I really don’t want to break mine. Consequently, I decided that a some sort of case would be appropriate (a punnet?).

Punnet v1.0 (or maybe it was v0.1) was the brainchild of freind and neighbour Jon Cowell, who took a plastic box that had originally been used as packaging for a set of business cards (I’m told that Graze boxes work well too) and used a Dremel multitool to cut out holes for connectors. I also had a few spare business card boxes so, after an evening in Jon’s garage, I had a case for my Pi – and very happy with it I was too!

Unfortunately, I also have a penchant for shiny things and, at around the same time as Jon and I created Punnet v1.0, I saw a Raspberry Pi blog post highlighting Paul Beech’s Pibow. You can learn more (and place an order) on the Pibow website and, whilst I’ve noticed that the price has gone up slightly since I bought mine it’s still great value.

I had a chuckle at the the Ikea-inspired instructions and my son had fun putting it together.

My Piböw has arrived :-) Love the IKEA-inspired instructions
@markwilsonit
Mark Wilson

It also seemed to go down well at last weekend’s Milton Keynes Raspberry Jam. So that was Punnet v2.0.

Another option would be to build a case out of Lego but the chances of my boys letting me raid the Lego box to take parts on a semi-permanent basis (even the Lego that dates back to my own childhood) is best described as slim. Thankfully, you can buy a kit of Lego parts to build a Raspberry Pi case, based on a design from a 12-year old Scout called Biz.

Alternatively, for those with a flat-screen monitor that’s not fixed to the wall, SK Pang’s VESA mount for Raspberry Pi looks interesting. Who needs an iMac when you can fix a Raspberry Pi to the back of a cheap monitor, eh?!

A beginner’s guide to getting started with Raspberry Pi (#RasPi)

I’ve written before on this blog about my experiences getting started with Raspberry Pi (attempt 1 and attempt 2) but, in my post about the inaugural Milton Keynes Raspberry Jam this morning, I highlighted something that became very apparent within the assembled group of Raspberry Pi enthusiasts at Bletchley Park:

“It’s all to easy to forget that, although the current version of the Pi was intended for developers in preparation for a broader educational release, it’s been massively popular with 350,000 boards shipped (and on target for a million by the end of the year!). Add to that, the Raspberry Pi foundation is 20 guys and girls who don’t get paid and who have day jobs – that’s a very limited resource pool to support an awful lot of people! Even so, the Raspberry Pi is not necessarily the most user-friendly experience for those who are not used to hacking around in a command line interface […]”

With that in mind, this blog post is intended as a basic guide for those who don’t have 20 years of experience working in IT, or are not bedroom coders, but do fancy getting stuck in to creating new and exciting things with a small and inexpensive computer. Regular readers may find that I explain things in more detail than usual but I’m assuming the audience are complete beginners when it comes to using a Raspberry Pi and that they do not spend their time geeking out with bits of hardware or bytes of software. If I’ve missed anything – or made some invalid assumptions – please leave a comment on this blog post, or tweet me (@markwilsonit) but please bear in mind that I have a day job too (so my response might not be immediate) and I can’t answer every single question about getting started with a Raspberry Pi!

What’s in the box – and what else do I need?

At its most basic level, the Raspberry Pi is a single board computer. Some distributors may sell bundles with mice, keyboards, etc. but many people will just get a board like the one shown here:

That means there are some essentials to buy:

  • A 5V power adapter with a micro-USB type B connection (I use the one that came with my mobile phone but not all phones have these):
  • A USB keyboard – i.e. a keyboard with a USB type A connection like the one below:
  • A USB mouse (if you want to run a graphical user environment – i.e. one that is not just text-based)
  • An SD card with an operating system. I recommend that beginners start out with one that comes pre loaded, for example with Raspbian Linux.  If you are going to “roll-your own” then that can be more complex and my earlier post based on Debian “Squeeze” might help but that’s a lot more technical and certainly outside the scope of this basic guide.
  • A television or digital computer monitor with either an RCA component, DVI, or HDMI input. VGA will not work. See below for details of what these connections look like.
  • A cable to connect to the Raspberry Pi to the television or computer monitor. The type of cable will depend on the type of connection.
    • RCA cables look like this (normally red and white are used for audio and yellow is used for video, but it doesn’t really matter – the cables are identical):
    • DVI cables look like this (the picture shows the “male” format, with the pins sticking out – the “female” version has holes and is normally found on the back of a computer):
    • HDMI cables look like this:

      You can also get a cable to connect from HDMI to DVI (and a connector to connect two “male” DVI cables) – these are not expensive and are what I use with my Raspberry Pi.
    • VGA connectors look like this (these are very common on both old and new monitors but the Raspberry Pi does not have a VGA output):
  • An Ethernet cable with an RJ45 connection to connect to your home broadband router/modem (Wi-Fi on the Raspberry Pi can be tricky – a cabled connection is often easiest to start with) – often these are supplied by your ISP with the router/modem:
  • Some headphones or speakers with a 3.5mm stereo TRS connection (if you want to hear any sound from your Raspberry Pi):

You might also want to buy a case for your Raspberry Pi but that is by no means essential.  Many people will already have the components listed above but if you need to buy them, they shouldn’t be too expensive.  Probably the most expensive parts are the keyboard and mouse but I picked up a wireless mini keyboard and mouse from Maplin today for £14.99 and they worked out of the box with my Pi.  You might also want to get a powered USB hub if you plan to use more than two USB devices (for example if you want to plug in a webcam, a USB flash drive, or a hard disk).

Putting it together

All of these components are different sizes and shapes so should be pretty easy to plug in. It doesn’t matter which of the two USB plugs are used for the keyboard and the mouse but this diagram (from the Raspberry Pi Foundation’s quick start guide) should help:

Just make sure that the power is coming directly from a 5V supply plugged into the mains and don’t be tempted to run a cable from a USB socket on a PC!

The operating system

Remember that I said I wasn’t going to show you how to prepare your Raspberry Pi with an operating system? There are other guides on the Internet (the Raspberry Pi website is a good place to start) but I strongly recommend you buy an SD card with Raspbian pre-loaded.

If you don’t know what an operating system is, don’t worry – it’s the software that runs on a computer when you turn it on and performs basic functions like driving the screen, keyboard, etc. (like Microsoft Windows on most PCs or Mac OS X on Apple Macintosh computers). Modern operating systems tend to include other functions, like web browsers and media players. Other applications can then be installed on top of the operating system to carry out more specialised tasks (like a word processor, an image editing package, or communications software like Skype).

Raspbian is a Linux operating system – that means that it is freely available (although some organisations might charge for supporting Linux distributions) and that the operating system is similar in many ways to a system called Unix that has been around for over 40 years and is used on many computer systems all over the world.

Logging in and getting going

After all of the “peripherals” (screen, keyboard, etc.) have been plugged in and the power has been switched on, you should see some characters appear on the screen and a prompt to login.

At the login prompt (which will say something like raspberrypi login: followed by a flashing _ cursor) type the username pi and press the Enter key, then type raspberry and press  Enter at the password: prompt.

Once you are logged in, the prompt will change to pi@raspberrypi:~$ followed by a flashing _ cursor. This is username@machinename so you can see that your user is pi and the computername is raspberrypi.

These are the default username and password settings but you really should change the password to something that only you know (I’ll tell you how to do this in a moment).

The first time you start your Raspberry Pi (the first “boot”, as us geeks like to say), your Pi will prompt you for some setup information. It’s important to select the options to expand_rootfs (expand the operating system to use the whole of the memory card) and change_pass (change password).

If you ever need to run this setup programme again, then the command to type is:

sudo raspi-config

Press  the  Enter key after typing the command (and for any other commands in this blog post). Then, just follow the instructions on screen.

Many people will find the command line interface (text-only, also called a CLI) unfriendly, so you can load a graphical user interface (GUI) to see something a little more familiar, driven by a mouse, and with applications in windows. To do this, the command is:

startx

This will slow down the Raspberry Pi a bit but it should be OK. There is a status indicator towards the bottom right of the screen (a green/black bar graph) that shows how busy the Raspberry Pi is. There are many applications pre-installed on the Raspberry Pi, accessible via the start menu (just like on Windows) and you can download others from the Internet (I’ll leave that for now – there’s plenty to get started already pre-loaded in Raspbian). Here are just a few ideas to get going with your Raspberry Pi:

  • You could try some programming in Scratch, or Python.
  • Or if that sounds a bit much for now, just browse the Internet (the browser is called Midori).
  • And, if you need to run any more commands from the CLI, then you can launch an application called LXTerminal.

Updating your Raspberry Pi

Before I sign off, it’s probably worth mentioning some commands that might be necessary to update the software on your Pi. Before I do that, I’ll explain something else – remember the command to run the Raspberry Pi Configuration Utility?

sudo raspi-config

The sudo part of this is worth remembering. Your username on the Raspberry Pi (pi) is what we call a standard user. It runs with a lower level of permissions to prevent any unintended consequences from running applications that might change the configuration of your system. When we want to make deliberate changes, we use sudo to run a command as a super user (like an  administrator in Windows or Mac OS X).

So, to update the software on the Raspberry Pi, run:

sudo apt-get update
sudo apt-get upgrade

APT is the Advanced Packaging Tool – so apt-get is getting details of available software. update downloads details of the available packages (a “resync”). upgrade is updating the operating system.

Finally, there is a tool called rpi-update that can be used to update the firmware (that’s the really low-level code that drives the components on the Raspberry Pi board, underneath the operating system).  This isn’t installed by default and is written by a programmer called Hexxeh.  You can find more details on Hexxeh’s blog and download rpi-update with these commands:

sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update
sudo chmod +x /usr/bin/rpi-update

This will download the  rpi-update program and then change the permissions so that it can be executed (run) on the local computer. I found that I also needed to install git before I could use rpi-update:

sudo apt-get install git-core

Then type:

sudo rpi-update

to update the firmware on your Raspberry Pi.  Generally you will only need to do this if you are having problems getting something to work.

Wrapping up

So, we’ve seen:

  • What you need to buy/find to get your Raspberry Pi working.
  • How to logon to a Raspberry Pi running Raspbian and how to get past the command line and into a more familiar (graphical) environment.
  • Some basic commands to keep your Raspberry Pi up to date.

If you want to learn more, check out the Raspberry Pi Foundation website and there are also other resources available on the Internet. You could also read a book like Meet the Raspberry Pi by Gareth Halfacree and Eben Upton.

Acknowledgements

Much of the information in this post is from a talk given by Peter Onion (@PeterOnion) at the Milton Keynes Raspberry Jam, with additional input from Rob Bishop (@Rob_Bishop) of the Raspberry Pi Foundation.

The illustrations used are taken from Wikipedia and elsewhere as follows:

Due to the licensing conditions of the images listed above, this blog post (but not the rest of this website), is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.