Raspberry Pi Setup

What is the Raspberry Pi?

The Raspberry Pi is a cheap computer designed by the Raspberry Pi Foundation (UK registered charity) to help kids build knowledge and experience in the computer Science, engineering and programming fields. Read more here: http://www.raspberrypi.org/about and here http://en.wikipedia.org/wiki/Raspberry_pi )>.


My Raspberry Pi Setup

The Raspberry Pi is a very forgiving device to get started on, first you plug in your power (mine was a USB cable), SD card. keyboard, mouse, monitor (HDMI) and turn it on. My SD card was empty and nothing booted so i..

  • Downloaded NOOBS (Off-line Installer:) http://www.raspberrypi.org/downloads
  • Installed SD Card Formatting Tool: https://www.sdcard.org/downloads/formatter_4/eula_mac/
  • Performed an overwrite Format on my SD card.
  • Copied the contents of noobs13.zip to the Pi.
  • Booted the pi (with hdmi, kbrd and mouse plugged in).

Basic Commands

How to safely shutdown the OS.

    sudo halt

How to update all os packages

    sudo rpi-update (Sorry I had “dpi-update” before)
    sudo apt-get update && sudo apt-get upgrade

Setting up a FTP server (so you can upload files to the Pi from another PC).

    sudo apt-get install proftpd
    Restart the FTP Service:
    sudo service proftpd restart

Networking Setup

I had issues with a raspberry Pi that was already on my network (a Pi driven 24/7 webcam that was built by the awesome Brisbane Storm Chasers, my camera uploads images to the http://webcams.bsch.au.com/index.htm weather cam network for my http://www.twitter.co/2340weather twitter feed.

How to change the Pi’s name:

    sudo hotname SiPi01

Change the Pi’s name permanently:

    sudo nano /etc/hostname
    sudo nano hosts

    tip: change to SiPi01

Check network Interfaces:

    cat /etc/network/interfaces

How to check the network connection:



    sudo reboot

I also wanted my ADSL router to give the SiPo01 the same IP every time. so I followed this guide to set a Static IP.

    This ended up being my config.

Keyboard Setup

I noticed my keyboard setup was set to UK and # symbols were not working. This allowed me to reset the keyboard to whatever region I wanted.

sudo dpkg-reconfigure keyboard-configuration
sudo reboot
sudo raspi-config

Sound Stuff

Enabling audio on the 3.5mm audio jack (not HTML sound).

I followed this guide: http://www.raspberrypi-spy.co.uk/2013/06/raspberry-pi-command-line-audio/

    How to install an easy mp3 player called mpg321: http://www.include.gr/debian/mpg321/

      Quick Summary:
      sudo apt-get install mpg321

    How to Play a MP3 file.

      sudo mpg321 -g 50 RogerWaters-FletcherMemorialHome.mp3

    How to turn the volume up:

      alias volu='sudo amixer set PCM -- $[$[amixer get PCM|grep -o [0-9]*$|sed 's/%//')+10]%'

    How to set command line aliases to type the stuff above for your when you type “volup.”

      sudo nano ~/.bash_aliases

      Add the following lines:

      # increase volume by 5%
      alias volup='sudo amixer set PCM -- $[$(amixer get PCM|grep -o [0-9]*%|sed 's/%//')+5]%'

      # decrease volume by 5%
      alias voldown='sudo amixer set PCM -- $[$(amixer get PCM|grep -o [0-9]*%|sed 's/%//')-5]%'

      Now you can type “volup” and “voldown” to change the volume.

First BASH Script

Make a folder for scripts to live in.

    mkdir /usr/bin/simon

Change to the new scripts folder.

    cd /usr/bin/simon

Make a script file.

    sudo nano testScript001

Make the script file executable.

    bash -x testScript001
    First Script Contents

      I wont bore you with details line by line but the script outputs a few system variables, tests the internet connection, downloads a file the exits.


      printf "Hello, $USER\n"

      OS_TYPE=$(uname -o)
      printf "OS Type: $OS_TYPE\n"

      OS_VER=$(uname -r)
      printf "OS Version: $OS_VER\n"

      CPU_TYPE=$(uname -m)
      printf "CPU TYPE: $CPU_TYPE\n"

      _IP=$(hostname -I) || true
      if [ "$_IP" ]; then
      printf "IP: $_IP\n"

      printf "BASH Version: $BASH_VERSION\n"

      printf "Today's date: $DATE\n"

      echo "Pi Updtime:"
      printf "\n"

      printf "Testing Internet Connection (https://www.websitenameremoved.com):\n\n"
      # ping -q -t 10 -w1 -c1 https://www.websitenameremoved.com
      wget -q --tries=2 --timeout=20https://www.websitenameremoved.com/
      if [[ $? -eq 0 ]]; then
      printf "Internet appears online.\n\n"

      if [ -f $TMP_FILE ]
      echo "Deleting old temp files.."
      sudo rm ./simple_text_file.txt
      printf "Downloading file from the internet.\n"
      sudo wget https://www.websitenameremoved.com/test/simple_text_file.txt
      if [ -f $TMP_FILE ]
      printf "File downloaded ok.\n"

      printf "Internet appears offline, unable to download files."

      printf "Goodbye\n\n"

    All you do to run the script is type the following.

    • sudo ./testScript001

Setting the script to run every 15 minutes

    sudo nano /etc/crontab

    Add the following line at the end of crontab to run the script every 15 minutes:

      # */15 * * * * root /usr/bin/simon/testScript001

Misc Commands

Viewing the startup script (that executes after each user logs in)

    sudo apt-get install mpg321

Installing a Webcam Driver

    sudo apt-get install fswebcam

      Capturing a Webcam Image:
      /usr/bin/fswebcam -r 960x720 -d /dev/video0 /home/pi/webcam.jpg

Quest to learn to build and program electronics

I have decided to create another blog category on my personal blog to throw information and progress while expanding one of my earliest childhood interests “electronics”. Like many other kids I looked at electronic XMAS toys and wondered how they really worked inside. This resulted in me grabbing the nearest screwdriver (pointy knife) and opening the toy with much vigour and excitement. Often I would break something and I would forgot what order to reassemble it in and the toys would never be the same again (remote control semitrailer and electronic battle ship game comes to mind, sorry mum). But one the toys was opened my mind went nuts, I could see batteries, motors, lights, fans, wires and funny coloured bits (resistors and capacitors) power thingies etc.

When I was a child I remember my grandads sheds (he had a few as he moved house every 6 years or so), sometimes my granddad was in his shed fixing something (mower blades or tools). He always had neatly arranged tools and boxes of stuff and jars with nuts and bolts. I had a great time playing in his sheds and searching for things to do and play with. I want to pass on my fascination of electronics and programming to my kids in a similar environment to my grandads shed and also automate my home and make some cool gadgets along the way.

Part of my quest to learn electronics (for real) was triggered by my desire to fill my 3yo son’s (and soon to be 2nd child) minds with knowledge, wonder and a more than basic knowledge in STEM (Science, Technology, Engineering and Maths), electronics can help teach a fair bit of this as well and hands on experience. Also learning electronics is a kind of stress reducer, work/home demands are always changing but electrical knowledge all but stays constant (apart from miniaturization of components).

I find it quicker to do date calculations in code in excel so I am sure I will be able to program the electronics with ease but I have no doubt it will be an uphill battle teaching this old dog all the ins and outs of electronics (the right way). I will be hitting google a fair bit when it comes to searching for information and schematics and I would lie to share that with kids and older tinkerers.


With a second child on the way I need a non-time consuming hobby to use to distract my 3yo when bubby 2 and mummy need a rest and to read up on in the small hours when I am putting baby to sleep.

Learning Goals:

  • Learn basic Electronics (components and theory).
  • Learn to program a Raspberry Pi
  • Create and control basic electronic circuits, read sensors, move mechanical objects and talk to the internet.
  • Learn to scale down code and hardware to the Arduino‎ platform.
  • Fix household items.

Physical Goals:

  • Create a battery powered Arduino circuit to install in the greenhouse to auto mist in hot weather from tank water). Report on temperature, and humidity.
  • Create a 100% automatic weather station that uploads details about temperature, humidity, barometric pressure, wind speed, smoke detectors, wind gusts, dew point, solar exposure, cloud cover, rainfall, soil moisture etc (how: many cheap sensors and custom circuits).
  • Create a battery powered automatically arming home security system with cameras, sensors (pressure, line of sight intrusion detection, magnetic car detection in the driveway, sonic, movement, infrared etc), sms and email alerts with offsite image backup.
  • Home automation (air conditioner on/off, watering system, wild bird seed deployment, rain cover, water tank level reporting, smoke detector (inside and out) remote bushfire protection (recycling roof sprays) etc) (how: many cheap sensors and custom circuits).
  • Remote control grey-water diverted from the shower (how: waterproof remote and 80mm solenoid to divert flow).
  • Auto detect and count bird species at the bird feeder (how: webcam and image processing).

  • Automatic home brew temp system for my dad.
  • Weather cam for my mum.
  • Fun kids projects, remote control robots.


Setting up for a Raspberry Pi and or Arduino is about $100 each, much less than gold clubs.
Raspberry Pi Board.


Choices of Arduino boards and bits.


Sensors are dirt cheap on ebay (about $3 each) and are often compatible with the Raspberry Pi and Arduino boards.


I already have a Raspberry pi and Arduino and have started my quest, watch this space.

iOS v Android (after 1 week of Android use).

iPhone 4 to GS3

I have been an Apple iPhone fanboy for a while now. Ever since my wife purchased me an iPod Touch (1st generation). I was hooked to the simplicity of downloading apps, swiping to change screens. Opening, minimizing applications and switching between full screen apps is simple on iOS. I have spent a bucket load on the Apple App store.

Android has always been around, mostly on the cheaper phone and tablet devices but lately I have noticed more and more high end android devices in the hands of not so tech savvy friends.

Now I am developing applications for mobile devices, I cannot ignore the more than capable Android platform. I downloaded and gave the Android SDK a go but ran screaming from the command line driven emulators http://www.kogan.com/au/ from google. I ordered a Samsung Galaxy S 3 from http://www.kogan.com.au and gave myself a few weeks to get used to the android. Here are my opinions so far.

First Impressions:

The Samsung Galaxy S 3 has a large screen, something that iPhone users have been craving for a long time. The camera is very impressive


Although most of the major apps I was wanting (Twitter, WordPress, Dropbox, Chrome, 2Do, 1Password etc) were available on the Google Play store I found the apps lacking key features that are available on iOS.

WordPress does not have an option to resize an images before upload, 2Do does not have dropbox sync feature, 1Password cannot write data back to your password store, the Android camera app does not allow me to click a dark part of a photo and trigger more light into the camera as well as the iPhone does. The GS3 has a fantastic camera but I want more control of the camera in low light.

Talking to friends with iPhones they are saying I found this app to do ____ and this app to do ____. Androids app store seems to be a dumping ground for apps that are half-baked/converted or cheap apps with loads of ad banners. Most android users (that are not nerds) are running the default apps and a few apps from the phone vendor (Telstra quota graphs). The fact that Android apps stay hidden under an Apps menus is not good for prompting people to play around with customising their phone

I also had to dig deep to find a good virus scanner (something iOS users don’t have todo) as well as a data usage app. Loads of apps were available for free but most were rubbish or reported to redirect users to polish search engines.


The GS3 is quite capable hardware wise when compared to my iPhone 4 (http://smartphones.venturebeat.com/compare/45-245/Apple-iPhone-4-8GB-vs-Samsung-Galaxy-S3), the GS4 has a quad-core 1.4Ghz processor/iPhone dual core 1Ghz. The GS3 has 1GB or ram/iPhone 512MB etc but the Samsung feels sluggish.

For example activating the drop down menu sometimes takes three tries, the keyboard in many apps tales 2 seconds to appear, trying to get text input to be ready in Chrome takes 2-3 clicks. I often have to end tasks to get more than 90-MB memory free. I can’t say I have tested the 3D yet on the android but I would imagine it would be OK.

Often bring up photos fails to render icons (even though I copy off photos every few days and have 4Gb free). I can keep 8 months of photos on my iPhone and not have performance issues. Recording 720P videos is great on the GS3 but the file sizes are massive, I would like an option to trim or resize the size of a video before sending like on iOS but I guess Google want me to upload to Google + and Google YouTube instead.

Most things on the iOS side are fast and responsive, I know from developing iOS apps that Apple send notifications to all apps when memory is getting low, i you fail to free memory your app can be closed to free memory for the active app, android do not seem to do this.

Android Problems:

Finding my way around Android settings menus can be a bit painful, trying to uninstall and app or finding out what is taking up 3GB or my 16GB phone, reporting 3GB of miscellaneous files is not good enough. The default Samsung and Android software seems to take up 5GB or the 16GB too.

Another problem with the android is the evolving nature of the android platform means major changes in menus from 4.0 to 4.1.2. This is not a problem for tech savvy people but it is for ma and pa who want to follow on screen setup guides for stuff.

What Android do well:

Android widgets are great, nothing better than placing interactive dynamic widgets amongst app icons. Animated backgrounds are good too but really just eye candy.

The Swiftkey adding for Android is a must, having a bigger screen does not make your typing any easier.

There are loads os ways to customise it check out http://mycolorscreen.com for examples.

Has the phone helped me debug apps for Android:

Yes and No. testing apps on a real device is priceless but I am starting to believe that iOS is 95% profit and 5% problems for developers and Android is 95% of problems and 5% of profit but I will plug away as I don’t think Android will be going away anytime soon.


I hope Apple do not stay in the doldrums for long as Android seems half-baked. I have always tried to swap PC computer part manufacturers to keep competition alive 9e.g buying Seagate or Western Digital hard drives or AMD or Nvidia video cards. Look at what has happened to Intel processors now that AMD have officially given up the performance race with intel (desktop processors from Intel have stayed about the same speed for the last 2 years).

Outstanding Issues Log:
– I sent myself a Richtext formatted message from Outlook 2013 with 2 pictures in it and the android cant view the images (they are just black).
– The GS3 image browser sometimes fails to load images at all until the phone is rebooted.
– I cant get custom ringtones working: http://www.androidcentral.com/adding-your-own-custom-sounds-android
– Android File Transfer does not connect to my device (error “could not connect to device, try reconnecting or restarting your device”): http://www.android.com/filetransfer/
– Samsungs “Kies” App for managing my GS3 (iTunes like program) is a joke.
– After installing the official Android Androif File transfer App, Kies fails to load. Uninstalling Android File Transfer fails to fix Kies.
– Cant play music with the Music Player (or winamp) after inserting a SD card and moving pictures and music there. I setup the default location for these locations, most apps don’t read the new locations from the settings. VLC does scan the SD card but it is not stable.
– Trying to add a mobile number to a contract or consolidate contacts is near impossible with the default contacts app.
– When the GS3 was below 5% battery I shutdown the device. Moments later I plugged it into power and powered the device back on but was presented with a battery icon for at least 15 minutes.
– Trying to get text input into a URL bar on Google Chrome required at least 4 presses and or at least 3 seconds for the textbox to receive focus.

Managing and sorting photos from multiple digital devices

Sorting the masses of digital photos can be a real pain and often this task is given the lowest priority. Phones and cameras can easily capture family events and consume more and more storage every month. Memory cards in cameras do not offer infinite storage so at some point you need to sort your photos.
The majority of my photos come from iPhone, I do no dare allow iTunes to automatically sync my photos to the iTunes Cloud mostly because Apples iCloud is just not big enough for all of my photos.
I prefer to move my photos from phones and cameras to a folder on my PC where I can sort them, delete crap photos, edit and touch up and merge them onto sub folders like “Holidays\2012\Hamilton Island” or “Holidays\2012\Sydney”. Once I sort all of the photos into sub folders I then sync them back to my mobile devices as required.

Here is my standard photo sorting process.

Step 1: Move Files from Digital Cameras/Phones to a Local Drive

First I move all of the photos and videos from my phone and digital camera into a single folder (sub folder for each device) on my local computer (e.g “M:\Downloads\_Pictures_To_Sort\_PhotosFromiPhone2012-09-03\Simon\DCIM).

My M:\ Drive is my main data drive, the “Downloads” folder reminds me it has come from somewhere, the “_Pictures_To_Sort” folder reinforces to me that this is the master copy of photos and I need to sort them. The “\_PhotosFromiPhone2012-09-03\Simon” folders are sub folders that indicate where the photos came from and from what device.

Tip: if you sync an iPhone with a Mac but want to copy files from your iPhone as a file system just plug your iPhone into a Windows PC and after a few minutes the file system for your phone will appear.

Step 2: Renaming Photos (appending text to prevent conflicting names from different devices).

One downside of phones/cameras is the photos are often named “IMG_0001.jpg”, “IMG_0002.jpg” etc, this naming convention is great until the device or camera is reset and the naming convention reverts from say “IMG_2438.jpg” back to “IMG_0001.jpg”. This can be a real pain in a disaster recovery situation or when merging photos from multiple devices. I strongly recommend you batch rename the filenames and append unique device/date text after the filename (but before the file extension), this will protect files being deleted if you ever merged two folders together.

I use a program called Advanced Batch Converted (http://www.batchconverter.com/register.shtml) to bulk rename and resize my photos. Advanced Batch Converted allows me to append text to filenames, resize images, add watermarks, rotate and enhance photos. This program pays for itself after it renames its first few thousand images.

Before I open Advanced Batch Converted I create a new sub folder called “1” (1 is my equiv of a temp folder) in the folder of Images that I am about to batch rename, I then move any MOV videos into the 1 folder as Advanced Batch Converted does not convert MOV’s. I will manually add the text to the MOV filenames.

From Advanced Batch Converted program I click the File then Batch Mode menu, Add the few hundred images that I want to rename, Tick the rename box and enter “$_simoniphonesep12”(or other random string you want) into the new filename box. Advanced Batch Converted will keep the start of the filename (the $ indicates the original filename is to be still used. The file extension is automatically moved to the end of the new appended text). I then click Options after the output format and ensure that the image quality if $100%. I set the Output folder to a newly created subfolder called “.\1”.

Step 3: Sorting Photos (events and places).
After each photo and video is renamed in each of the sub folders in the DCIM folders from each device I can then start merging photos into categories. I usually sort photos into sub folders that describe the person/place or event. Where lots of photos are expected for one person/place/event I will add a month or other descriptor (e.g “Garden_2012a”, “Garden_2012b” etc) to try and limit the contents to less than 2000 photos as any more will often slow down a mobile devices when viewing large number of photos.

This process can take a long time but it offers the most reward as you can then sort your images into groups that can be then be easily synched to different devices later. Most Phones and Tablets have limited storage space and sorting your photos into smaller groups allows you to synced/de-synced categories as required.

Step 4: Delete bad photos and duplicates.

Today I have sorted 23GB of photos from 3 devices from 1~3 years old. If I did not delete blurry or duplicate images I would be just wasting space and time

Step 5: Rotate any images.
I then rotate images that are 90 or 180 degrees, this enhances the viewing pleasure on mobile devices later.

Step 6: Back up the photos

Before moving images to other computers I copy the master images to a folder where I will burn the photos/videos to DVD as they sit now. I also back up photos online to http://www.crashplan.com

Step 7: Scale Down Images

If you are only going to be viewing the images on a TV, phone or mobile device I would recommend you scale down the images resolution with Advances Batch Converted to a smaller size (e.g 1280×1024). This can save up to 70% of the final size. The smaller the images the more you can fit on a mobile or tablet device. Before you scale down images consider backing up the images first or printing the images you want at high resolution.

To scale down images using Advanced Batch Converted first open Advanced Batch Converted then click File then Batch Mode, then add the images you want scaled down then tick rename and type “$_sm” (this will append “_sm” to the filename giving you an indication that it is a reduced file size).

Click “Use Advanced Options” then click Options then tick resize then set the desired maximum resolution (e.g 1280×1024). Create a folder called “1” under the current folder before shrinking the images. ADC will auto shrink the images for you. When complete delete the bigger copies if you have backed up the high res images elsewhere.

Step 8: Copy the photos to the final destination
Once the photos are sorted I copy them to the final destination. I use a Windows PC to sort the photos but I move the photos to a Mac mini/other to then sync to my Devices. I then rename the “M:\Downloads\_Pictures_To_Sort” folder to “M:\Downloads\_Sorted_Pictures_Burn_To_Backup_DVDs”, this will remind me to burn the pictures to DVD’s and then delete them from the “M:\Downloads” folder.

Then I import the photos into iPhoto and then sync the new photos to devices with iTunes.

New Programming Blog Category

I have decided to add a blog category for programming, yes computer programming. Programming is a very creative and fun thing to do. You could program a website, program a bath file to manage your files or program a software program to read you the outside temperature.

Far too many school students are leaving school having studied programming but could not explain 5 computer variable types. That would be like asking a keen cook to name 5 cooking ingredients that you could use in a sweet and savoury dish.

Over the next few months please join me on a journey for basic programming.


  • Programming basics.
  • Different types of programming.
    • Windows Software Programming.
    • Webpage programming.
    • Database programming.
    • iPhone/iPad and Android Programming.

I will hope to demonstrate programming using as much free software as possible. Worst case you may require a personal website but that is a cheap as $5 a month (via a host like http://www.jumba.com.au/hosting/personal).

Show me the programming posts.

Automatic Online Backup

If you do not already have automatic online encrypted backup maybe you should. http://www.crashplan.com/ offer a program for Mac or Windows that automatically backs up files that you select (Just install, tick then forget). You can access your backed up files from mobile devices too. they have a 30 day free trial too: Download.

Getting Started Guide:

[embedplusvideo height=”418″ width=”695″ standard=”http://www.youtube.com/v/fy62DxQGarM?fs=1″ vars=”ytid=fy62DxQGarM&width=695&height=418&start=&stop=&rs=w&hd=0&autoplay=0&react=1&chapters=&notes=” id=”ep8693″ /]

Crashplan Hands On Review: 30 minute video going through each step.

[embedplusvideo height=”418″ width=”695″ standard=”http://www.youtube.com/v/OjtWYOhPATA?fs=1″ vars=”ytid=OjtWYOhPATA&width=695&height=418&start=&stop=&rs=w&hd=0&autoplay=0&react=1&chapters=&notes=” id=”ep8543″ /]