Raspberry Pi 2 Setup

Here is a quick guide to setting up a Raspberry pi 2 (OS, Wifi etc) using a pre loaded NOOBS Raspian OS on a Micro SD card.

I ordered the Raspberry Pi 2 Model B WiFi Pack from Wiltronics.

      This Raspberry Pi 2 Model B WiFi Pack includes a Raspberry Pi 2 Model B computer, durable clear case, a power adaptor, a USB WiFi antenna, an HDMI cable and an 8GB micro SD Card with NOOBS OS loaded.


Plug in a keyboard, mouse, wifi, HDMI and power and you are good to go.

I had to check my old guides to refresh myself:

1. Select Raspian and press enter

2. Press Y

3. Wait for the install to complete.



4. The Pi will ask to reboot (this is what it looks like)

5. The first program that will run is the Raspberry Pi Configuration.

6. I tried to expand the file systems but my card was already expanded.

7. I followed the prompts to change the device password




8. I reviewed the Internationalisation Options

9. Change Locale.

10. tip use space to deselect UK and select em_AD.UTF-8 UTF-8.

11. em_AD.UTF-8 UTF-8

12. Select Australia.

13. Select Sydney

14, Under Advanced change the Hostname (computer name)

15. I entered “sipi02”.

16. I selected Enable SSH (remote login)

17. Select Finish and Yes to reboot.


18. After the raspberry Pi rebooted I could login with the user name “pi” and my new password

19. If you are new to Linux and are not sure of any Terminal commands (like DOS commands) check out this Linux Commands Cheat sheet from http://linoxide.com/linux-command/linux-commands-cheat-sheet/

Linux Commands Cheat Sheet
Linux Commands Cheat Sheet

Booting up the GUI desktop.

20. GUI Desktop

You can type “Startx” to start the Raspian Desktop.

21. Desktop

The Pi Desktop is easy to use and navigate.







22. Internet Check

I plugged in in a spare USB TP-Link TL-WN821N wireless adapter, followed the wireless setup and verified I had a network connection by typing the following commands.

ping www.google.com


I did indeed have an internet connection.

23. Update/Upgrade

I dropped back out of X and ran the following commands to update the Pi’s firmware and software.

sudo apt-get update
sudo apt-get upgrade
sudo reboot

Then after reboot.

sudo rpi-update
sudo reboot

This took a while to download and install 130MB of data.

24. FTP Server

I setup an FTP server.

25. I2C Tools

Installed i2c-tools and configuring it. Troubleshooting here.

Added the following to “/boot/config.txt”


sudo apt-get install python-smbus
sudo apt-get install i2c-tools

26. Installed Python2 GPIO

sudo apt-get install python3-rpi.gpio

27. MoPI (Dual Power supply board)

Setup my MoPi

sudo apt-get install simbamond

FAQ’s here, here and here.

I did things a bit out of order and I think I needed to power up the MoPi/Pi from batteries (and no mains power) for 2iC to detect. But all is god, I can power up and shutdown my Pi from 6xAA batteries.



28. Install Python Camera module

sudo apt-get install python3-picamera

29. Python

Installed Python PIP

sudo apt-get install python3-pip

30. Monit System Monitoring

Installed Monit System Monitoring Web server to keep and eye on the MoPi from a web server (config here)

sudo apt-get install monit

More info here https://www.the-hawkes.de/monitor-your-raspberrypi-with-monit.html

31. Temperature Sensors

Add temperature sensing service to Monit (guide here)

sudo apt-get install lm-sensors

32. NGINX Web Server, PHP and Perl

Ok, now I am going to install a web server (NGINX, PHP and Perl) using this guide http://youtu.be/I_2yGGPus90

sudo -i
apt-get update
apt-get install nginx php5-fpm php5-cgi php5-cli php5-common libfcgi-perl

33. Python and raspberry Pi GPIO Pin Library

sudo apt-get install python-dev
sudo apt-get install python-pip
sudo pip install RPi.GPIO

33. Witty Pi – Realtime Clock and Power on/off scheduling board. Good review here.



wget http://www.uugear.com/repo/WittyPi/installWittyPi.sh
sudo sh installWittyPi.sh

Everything installed for me.

sudo shutdown -r now

On reboot I noticed warning on boot up about GPIO pin conflicts with my MoPi. Maybe the MoPi and Witty Pi are clashing? I changed GP17 on the Witty Pi and rebooted. I still had a conflict so I set GP4 on the Witty Pi to also be custom. After a reboot I still had MoPi warning.


I am now researching how to redirect the GOI pins that the Witty Pi uses.

Do’h, I just realised that the Pi is powered by Mains USB on the pi and the MoPi warning may just be a warning about the MoPi not controlling the external power. I removed the mains power ad instead connected up the MoPi to a 9v DC supply.


I reset the Witty Pi pins to their defaults and powered up the Pi via the Pi MoPI power button. All MoPi warnings have gone. Now to resume the WittyPi setup.

I will possibly use the MoPi to power down the Pi when battery gets low and use the Witty Pi to boot up the Pi every day and to use the Realtime clock.

tip: Make sure the folder you install witty pi to is spelled exactly like “%HOME%/wittyPi” and not “%HOME%/WittyPi”. My daemons would not start because it way looking for “/home/pi/wittyPi” and not “/home/pi/WittyPi”.

Now I configured the Witty Pi’s time.

sudo ./wittyPi.sh

34. SD Card Check

Ok run the following command to get the location of your boot filesystem


Now run this command to check your boot disk (replace the boot disk with the one identified above).

fsck -fy /dev/mmcblk0p5

You may notice potential corrupted files and fixes from the output above.

sudo dosfsck -w -r -l -a -v -t /dev/mmcblk0p5

Also run a check after reboot.

sudo shutdown -F -r now

You can run these commands to review any errors.

cat /var/log/fsck/checkfs
cat /var/log/fsck/checkroot

35. Filesystem Update
sudo apt-get update
sudo apt-get upgrade
sudo reboot

Then after reboot.

sudo rpi-update
sudo reboot

35. SD Card Backup

Type “distil list” to show your connected disks. My Pi is “disk5”

diskutil list
/dev/disk0 (internal, physical):
0: GUID_partition_scheme *500.3 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_CoreStorage Macintosh 10.9 HD 499.4 GB disk0s2
3: Apple_Boot Recovery HD 650.0 MB disk0s3
/dev/disk1 (internal, virtual):
0: Apple_HFS Macintosh 10.10 HD +499.0 GB disk1
Logical Volume on disk0s2
/dev/disk5 (external, physical):
0: FDisk_partition_scheme *7.9 GB disk5
1: Windows_FAT_16 RECOVERY 858.8 MB disk5s1
2: Linux 33.6 MB disk5s3
3: Windows_FAT_32 boot 62.9 MB disk5s5
4: Linux 7.0 GB disk5s6

Clone the SD Card (this command has no feedback so please wait).

sudo dd if=/dev/disk5 of=/Users/simon/Backup/SiPi02/Jan3rd2016.dmg

Eject the SD Card

sudo diskutil eject /dev/rdisk5

How to restore a Disk Image to the SD Card.

diskutil unmountDisk /dev/disk5
sudo dd if=/Users/simon/Backup/SiPi02/Jan3rd2016.dmg of=/dev/disk5
sudo diskutil eject /dev/rdisk5

36. No back to reading the MCP3008 Analog to Digital Converting chip.

The following commands were taken from this video.

wget https://github.com/Gadgetoid/py-spidev/archive/master.zip
unzip master.zip
cd py-spidev-master
sudo python3 setup.py install

Enable SPI at boot (video guide here)

sudo rasps-config
advanced options
Enable: Yes, Yes Finish
sudo reboot

Note:I completed the code above but my python script could not see spider (it was if the module was not installed. This resolved it.

cd ~
sudo git clone git://github.com/doceme/py-spidev
cd py-spidev/
sudo python setup.py install



Part 3 (convert data):

Part 4 (advanced):

Part 5 (humidity sensor)

Comfast CF-WU755P WIFI

This guide may help me: https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=109919&p=755521

I might try this guide: https://blog.samat.org/2014/12/15/realtek-8188eu-based-wi-fi-adapters-on-the-raspberry-pi/