Raspberry Pi

I received my first Raspberry Pi 2 for Christmas and I'll put notes to myself on this page.

At the moment I have a Virtual Machine running on my Windows 10 box that gathers instrumentation data from my attic and crawlspace. It's a PITA to have to down the virtual machine every time Windows 10 wants to re-boot because of patches. Another factor is the fact that VMware is trying to do away with their free version of VMware Player.

Since the Virtual Machine is Linux based on the Debian distribution and the Raspberry Pi runs a version of Debian, it should be easy for me to re-install everything on the Raspberry Pi and avoid the frequent shutdowns due to the Windows 10 host. I'm also much more comfortable with Debian and PHP than I am with programming the Arduino. Also, when I want to make changes to the Arduino, I have to remove the device from the data closet and hook it up to the PC for programming. With the Raspberry Pi, I can do a SSH session remotely.

I started by downloading Raspbian Jessie Lite from https://www.raspberrypi.org/downloads/raspbian/. I do not need or want a stupid GUI interface sucking up memory and CPU cycles. This Pi will be located in the data closet with access only via IP. I download and installed Win32 Disk Imager from http://sourceforge.net/projects/win32diskimager/ and used it to burn the Jessie Lite image to an 8 GByte SSD card.

Here's a handy tip: WIN32 Disk Imager will not only burn image files to the SSD card, it will also read an SSD card and create an image file. It's very handy to make backup images as you develop your code. It takes a while to read and burn a large image, but infinitely better than starting over.

I powered the Raspberry Pi with an old cell phone charger and connected the Pi to a small flat screen TV connected to the HDMI port. A USB keyboard and an Ethernet connection to my network were the only other connections. As the Pi booted I was presented with the very familiar initial installation of Debian.

I proceeded with the initial install of a LAMP server (Linux - Apache - MySQL - PHP). Everything went as expected. I like PHPMyAdmin to manage the MySQL server, but had problems with the install so I use HeidiSQL instead.

As I started to install packages, I quickly ran out of space on the SD card. I knew I couldn't have filled a 8 GByte SD card, but after a little Google searching, I discovered that the image only used about 2 GBytes of space and left the remainder as unused space. From a command prompt, run "raspi-config" and the very first option is to expand the file system so the entire SD card is utilized.

Once the initial install is done and SSH is installed, all access is via Putty. No more TV screens or monitors are necessary.

Even though my data closet has plenty of Ethernet connections, I wanted the option of moving the Raspberry Pi data collector to other locations in range of my wireless router. After a little research, I chose the USB wireless adapter TP-Link TL-WN722N, about 11 bucks from Amazon. Getting the adapter to work with my router took a while, but Google came to my aid again and I found out the trick was to modify \etc\network\interfaces with the following:

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
allow-hotplug eth0
iface eth0 inet manual

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ap-scan 1
wpa-scan-ssid 1
wpa-ssid "Your SSID Goes Here"  <<<<<<<<<<
wpa-proto RSN
wpa-pairwise CCMP
wpa-key-mgmt WPA-PSK
wpa-psk "Your Passphrase Goes Here"  <<<<<<<<<<

Be sure to change the SSID and Passphrase to match your router. My router uses WPA2-PSK so if your router uses another authentication method, your results will vary.

It is not necessary to modify /etc/wpa_supplicant/wpa_supplicant.conf.

Note: I use DHCP for everything. I find that using DHCP reservations is easier than static IP addresses.

At this point the Raspberry Pi is a direct replacement for the Virtual Machine.

Since the Pi has plenty of I/O connections, in the future I will connect the Temperature / Humidity sensors directly to the Pi and retire the Arduino. 


I created a Raspberry Pi image running the Mosquitto MQTT Broker. I'll have to start ordering more Raspberries and start rolling out my environment.