Installation - mo-dgc/Tent-Controller GitHub Wiki

Hardware

Quick note on serial

With the Raspberry Pi 3, /dev/ttyAMA0 has been "stolen" from the GPIO header and an inferior secondary has been substituted in it's place. /dev/ttyAMA0 is a hardware serial port (UART) and high performance which is why it was nabbed for the Bluetooth. The new secondary port is pretty flaky, and there are numerous horror stories out there about it. For this project as I have no plans for Bluetooth, so I've swapped them back using the pi3-disable-bt overlay. All code will use the /dev/Serial0 reference, so if you're ok using the inferior mini UART, go ahead and remove the overlay, but if your system has a high CPU, then your serial communication with the XBee will become unreliable.

Using default:

$ ls -l /dev/serial*
lrwxrwxrwx 1 root root 7 May 22 19:24 /dev/serial0 -> ttyS0
lrwxrwxrwx 1 root root 5 May 22 19:24 /dev/serial1 -> ttyAMA0

Using swapped:

$ ls -l /dev/serial*
lrwxrwxrwx 1 root root 7 May 22 19:24 /dev/serial0 -> ttyAMA0
lrwxrwxrwx 1 root root 5 May 22 19:24 /dev/serial1 -> ttyS0

Wiring Diagram

Raspberry Pi XBee
1 - 3.3v 1 - VCC
8 - TXD0 3 - DIN
10 - RXD0 4 - DOUT
* - Ground 10 - Ground

I did up a quick Pi Hat for this, but you can also find pre-made hats. All depends on what your setup is going to be. I planned on using this in a small case with just the official touch screen. This hat will work with both series 1 and 2 XBee radios, along with any other radio that uses the same form factor. Here's the hat that I threw together for this:

@TODO: Get pic of our hat

Parts list:

Of course, shop around and get the best price you can, these are just two that I commonly buy prototyping stuff from. At the time I wrote this wiki page, total cost of the above items came out to $13.80 for parts.

Install Raspbian to SD Card

First thing you need to do is to download Raspbian Jesse Lite. They have instructions for installing this on the site, so I will not recreate those instructions here. If you are curious, you can look here to see how I do this on my Mac.

Zeroconf Networking

The install script will install Avahi-daemon. This allows you to navigate to your raspberry pi via http://[hostname].local in your web browser. Depending on your OS you may need to install some software to make this work. Please look here for instructions: https://learn.adafruit.com/bonjour-zeroconf-networking-for-windows-and-linux/overview

Configure SD card for headless first boot

If you don't want to hook up a keyboard and monitor to your Raspberry Pi, you can use the following instructions to get your Pi booted and on your wireless network. By default, SSH is disabled due to security concerns.

  1. Insert the SD card so it is mounted on your system. On my system, this is mounted at /Volumes/boot
  2. Create wpa_supplicant.conf in /boot
    update_config=1
    ctrl_interface=/var/run/wpa_supplicant
    network={
    	scan_ssid=1
    	ssid="PutYourWirelessSSIDHere"
    	psk="PutYourWirelessPasswordHere"
    }
    
  3. Create blank file named ssh in /boot
    touch /Volumes/boot/ssh
    
  4. Eject the SD card, insert into your RPi and boot it up.

Setting up your Raspberry Pi

Your Raspberry Pi should be able to boot up and join your wifi automatically. You can use an application such as Fing to discover the IP address of your Pi.

  1. Log into your Pi, either remotely via SSH, or locally if you have a monitor and keyboard attached.
  2. Run raspi-config and CHANGE PASSWORD, set locales, timezones, etc and reboot.
  3. Install git.
    sudo apt-get update
    sudo apt-get install -y git
    
  4. Clone the Tent-Controller repo:
    git clone https://github.com/mo-dgc/Tent-Controller.git
    
  5. Run the installer script. This script will automagically update your system, install needed components, and configure our application:
    ~$ cd Tent-Controller
    ~/Tent-Controller$ ./install.sh
    

Installing on Ubuntu

  1. Log into your Ubuntu box.
  2. Install git.
    sudo apt-get update
    sudo apt-get install -y git
    
  3. Clone the Tent-Controller repo:
    git clone https://github.com/mo-dgc/Tent-Controller.git
    
  4. Run the installer script. This script will automagically update your system, install needed components, and configure our application:
    ~$ cd Tent-Controller
    ~/Tent-Controller$ ./install.sh