Raspberry Pi: Difference between revisions
Line 74: | Line 74: | ||
== Field deployment == | == Field deployment == | ||
Since the RPi Model B rev2 only uses 3 watts of power, and due to its small footprint, low cost & easy drop-in replacability, it's ideal for use as a field datalogger run from a battery in harsh environments where you'd be loathe to leave an expensive laptop. Since it uses a standard Linux toolchain with 30000 prebuilt packages, and encourages Python as a primary programming language, it is easy for anyone with general UNIX experience to set up without specialist skills working with exotic embedded hardware and a wealth of help is available on the Internet. | Since the RPi Model B rev2 only uses 3 watts of power (and the Model A only uses 1.5 watts), and due to its small footprint, low cost & easy drop-in replacability, it's ideal for use as a field datalogger run from a battery in harsh environments where you'd be loathe to leave an expensive laptop. Since it uses a standard Linux toolchain with 30000 prebuilt packages, and encourages Python as a primary programming language, it is easy for anyone with general UNIX experience to set up without specialist skills working with exotic embedded hardware and a wealth of help is available on the Internet. | ||
=== Rugged/waterproof case === | === Rugged/waterproof case === |
Revision as of 09:43, 12 April 2013
GRASS on the Raspberry Pi
The Raspberry_Pi is a small computer about the size of a deck of cards. It runs on a low power ARM processor similar to one used in a smart phone or tablet. Technically it's a ARM v6 SoC chip originally designed for use in a set-top TV box, meaning the general purpose CPU is rather slow, but it can handle full screen 1080p graphics without problems. It is designed for tinkering and is very cheap: US$25-35 depending on the model.
The Pi runs Linux and a popular distribution for it is Raspian, a rebuild of Debian testing which supplies builds for ARM v4 and ARM v7 but not the v6. Running the official Debian build for v4 will work, but not take full advantage of the chip.
Installing
Since GRASS is a standard package in Debian, installation on a running Pi system is very easy. At a terminal prompt, become root, then:
apt-get install grass grass-doc grass-dev
This will also bring in all of the user documentation and the development environment needed to install GRASS AddOns.
GRASS will work fine on very slow hardware with limited RAM, especially for raster maps. It was after all originally designed in the 1980s when computers were much less capable than they are today. To keep RAM use low keep you region rows x columns small, and vector features to a minimum. Typical use with the older (and smaller) Spearfish dataset should work very smoothly.
Compiling
If you are interested in working on GRASS development or trying out experimental features in GRASS 7, Yann Chemin has put together some instructions on how to compile GRASS 7 on the RPi. This was done on an older Model B unit with 256MB RAM; newer revisions of the board
How-to:
- Use Raspbian as your SD card image
- Start the Raspberry PI with that SD card
- You will be presented with a (non-graphical) start menu:
- - Extend the File system to the fill the SD card
- - Overclock to 900MHz (needs 1V power more) or more (1GHz possible)
- - Set up ssh server if you want to connect remotely
- - Go ahead to load the Debian LXDE interface
- Open a terminal, and enter these commands to update your Raspian OS and install the standard GRASS 6.4 packages with all required dependencies:
sudo apt-get update sudo apt-get dist-upgrade --assume-yes sudo apt-get install grass-dev
Next fetch the latest GRASS development source code:
sudo apt-get install subversion svn checkout https://svn.osgeo.org/grass/grass/trunk grass7_trunk
- cd into grass7_trunk
- Download and install the required build dependencies (like libcairo-dev for wxgui, etc). If you have the deb-src lines active in your /etc/apt/sources.list file, this is easily done with a single command:
sudo apt-get build-dep grass
- Lower the job priority of the build Terminal session so that the rest of the RPi will still be usable during the build:
renice +17 -p $$
- Get your config options right, here's a working example but you should adjust to suit your needs:
CFLAGS="-ggdb -march=native -Wall -Werror-implicit-function-declaration" \ ./configure \ --with-tcltk-includes=/usr/include/tcl8.5 --with-cairo \ --with-motif --with-python=/usr/bin/python2.6-config \ --with-readline --with-cxx --with-odbc --with-sqlite \ --with-freetype --with-freetype-includes=/usr/include/freetype2 \ --without-postgres --with-proj-share=/usr/share/proj \ --with-wxwidgets=/usr/lib/wx/config/gtk2-unicode-release-2.8 \ --with-geos \ 2>&1 | tee config_log.txt
- For help with the configure options run this command:
./configure --help | less
If you are building without GUI support (text only mode) you can leave off Motif, Tcl/Tk, possible Freetype (although that allows for background graphics rendering), and wxWidgets.
- Run make to build it. (The first time it will take loong !)
make
- And finally install to /usr/local/:
sudo make install
Field deployment
Since the RPi Model B rev2 only uses 3 watts of power (and the Model A only uses 1.5 watts), and due to its small footprint, low cost & easy drop-in replacability, it's ideal for use as a field datalogger run from a battery in harsh environments where you'd be loathe to leave an expensive laptop. Since it uses a standard Linux toolchain with 30000 prebuilt packages, and encourages Python as a primary programming language, it is easy for anyone with general UNIX experience to set up without specialist skills working with exotic embedded hardware and a wealth of help is available on the Internet.
Rugged/waterproof case
The RPi does not come with a case, you'll have to put something together yourself.
The classic DIY field gear solution to this is to get a small Pelican Case, and drill some holes in the lid where you mount some waterproof bulkhead connector fittings with silicone sealant, or install pass-through cable glands.
- ... but since it already has mounting holes on the PCB you could just mount it with rubber offsets to a backing plate cut to the interior size of your waterproof case.
Heat dissipation should not be a major issue in most deployments.
Connecting with a GPS
Software
Install the gpsd Raspian package. This can also feed time into ntpd, the standard UNIX time keeping deamon; this can be important as the RPi does not have a built in real time clock. (see RPi forums for how to connect one via the GPIO pins)
Hardware
You can plug in a RS-232 or TTL level serial connection to the GPIO dual-inline header pin block on the board.
You can plug a GPS which communicates via USB directly into one of the RPi's USB ports, but if the GPS uses the USB port for more than just communication (i.e. to power or recharge it) you'll want to use a powered USB hub.
AdaFruit technologies (and probably many others) sells a bare-board GPS kit for the RPi.
Using as an automated datalogger
You can use the RPi connected to monitoring devices to automatically poll and collect data via the GPIO pins on a regular schedule via standed UNIX cron jobs.
GRASS can be run non-interactively in text mode, without the GUI (see GRASS Batch Jobs), and so beyond a simple datalogger your remote RPi can perform full data processing, creation of finished real-time maps and data plots, and serve via FTP or a web page running in the background. A USB WiFi dongle or packet modem can be connected to either push the data back to your home base, or stay online ready for queries.
To save power, pair with a low power Arduino board (like the Ultra Mini 8) with a timer on it if you wish to save power by having the system boot, perform a measurement, and send off the results, before shutting itself back down for another hour of <1mA sleep. In this way a small solar panel and a 6v or 12v sealed lead-acid battery (plus a 5v regulator) can keep the unit running indefinetly.
- AdaFruit technologies (and probably many others) sells a kit with a solar panel and a rechargable cellphone-style Li-Ion battery for the RPi.
Using as a field entry device
It will work, but maybe the task is more suited for a jailbroken Android Tablet dual-booting into Linux? See also the Android build of gvSIG mini, another OSGeo project.
- See this blog post for instructions on using a daylight readable e-Ink display (in this case a Kindle) as a small monitor which is actually usable in sunshine.
Tips
Due to low RAM, avoid running other software when using the wxGUI, especially when launching it.
See also
Historical screenshots of portable-GRASS running on iPAQ and handheld computers