User Tools

Site Tools


dbrooke_nodes:dbpg

Raspberry Pi with directly connected radio module

Hardware

The RFM69HW and optional BMP085 modules are mounted on a Slice of Pi board. The BMP180 sensor uses the same protocol as the BMP085 and has also been tested.

Connection Summary

Raspberry Pi Pinout

RFM69HW Slice of Pi Notes
NSS SPI_0
MOSI MOSI
MISO MISO
SCK SCLK
GND Connect to GND at end of XBee connector
ANT Connect 1/4 wave wire as antenna
3.3V 3V3
DIO4 G23 Wiring Pi 4 / GPIO23
DIO0 G17 Wiring Pi 0 / GPIO17
RESET G04 Wiring Pi 7 / GPIO04
BMP085/BMP180
GND GND Next to 3V3
+5V 5V0 Some breakout boards use a 3.3V supply
SDA SDA
SCL SCL

Software

Based on daveake's “Basic working receiver” code which I used as a testbed to develop changes to mitigate the effect of interference and now provides a reliable gateway.

Tools and Libraries

Install git and the curl and wiringpi libraries: sudo apt-get install git libcurl4-openssl-dev wiringpi

Repository

https://github.com/dbrooke/UKHASNetPiGateway

An initial download can be done with:

mkdir ~/ukhasnet ; cd ~/ukhasnet && git clone https://github.com/dbrooke/UKHASNetPiGateway.git

Configuration

This is done in the build directory, change to there using cd ~/ukhasnet/UKHASNetPiGateway

The master branch provides gateway functionality without any telemetry from the gateway itself, other than the bootup packet with the location data.

If the Pi is fitted with a BMP085 (or BMP180) pressure and temperature sensor then data from this can be periodically uploaded. This support is enabled by selecting the bmp085 branch: git checkout bmp085

Create a configuration by copying the provided template to nodeconfig.h and editing it to reflect your node ID and location (signed decimal latitude, signed decimal longitude):

cp nodeconfig-template.h nodeconfig.h && sensible-editor nodeconfig.h

The software should then build without errors by typing:

make

Usage

System Configuration

To make sure that the SPI bus is enabled run sudo raspi-config and then select Advanced Options where you should see SPI listed and can enable it. If you have a BMP085/BMP180 sensor fitted then you should also enable the I2C bus.

Manual Start

Access to the SPI bus requires that the program is run as root, so from the build directory run sudo ./gateway

Automatic Start

My preferred method to invoke the program, so that it is started when the system boots and still allows a console to attach to observe its operation, is to start it in a detached screen session from cron.

Install screen on the Pi by running sudo apt-get install screen

The following assumes the use of the default pi account and that the repository was cloned below /home/pi/ukhasnet

Run crontab -e which will open your crontab file in an editor and add the following line at the bottom of the file:

@reboot /usr/bin/screen -dmUS gateway /usr/bin/sudo /home/pi/ukhasnet/UKHASNetPiGateway/gateway

Remote access from Linux

If the name of the system running the gateway is ukhasnet-gw then the following command on a linux desktop system will attach to the running gateway and display its output in a new window:

uxterm -title ukhasnet-gw -e ssh ukhasnet-gw -t screen -d -r gateway

To detach, leaving the gateway running, enter CTRL-A followed by d

dbrooke_nodes/dbpg.txt · Last modified: 2017/01/20 13:10 by dbrooke