Raspberry Pi: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
(→‎See also: + cat: android)
 
(One intermediate revision by the same user not shown)
Line 120: Line 120:
It will work, but maybe the task is more suited for a jailbroken Android Tablet dual-booting into Linux? See also the [http://f-droid.org Android build of gvSIG mini], another OSGeo project.
It will work, but maybe the task is more suited for a jailbroken Android Tablet dual-booting into Linux? See also the [http://f-droid.org Android build of gvSIG mini], another OSGeo project.


* [http://www.itworld.com/hardware/351299/kindle-and-raspberry-pi-join-forces-wireless-terminal-hack 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.
* [http://www.raspberrypi.org/archives/3621 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 ==
== Tips ==
Line 134: Line 134:
[[Category: Hardware]]
[[Category: Hardware]]
[[Category: Embedded]]
[[Category: Embedded]]
[[Category: Android]]
[[Category: Installation‏‎]]
[[Category: Installation‏‎]]
[[Category: Tutorial]]
[[Category: Tutorial]]

Latest revision as of 21:21, 25 October 2013

GRASS running in the LXDE desktop environment on a Raspberry Pi

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, an ARM v6 rebuild of Debian's "testing" line, 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 type:

sudo 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 your region rows x columns small, and vector features to a minimum. Typical use with the older (and smaller) Spearfish dataset should work very smoothly. The GUI can be computationally expensive, so you might consider changing the default GUI to the more lightweight Tcl/Tk version(s), or setting the default to text mode with the g.gui module. For example:

GRASS> g.gui text
<text> is now the default GUI

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 come with 512MB RAM.

If you simply want to compile and build your own add-on modules for GRASS 6.4, all you need to do is install the grass-dev package and you're ready to go; you don't need the full GRASS source code for that. (although it is useful for reference)


How-to download, configure, compile, and install GRASS 7.svn on the RPi:

  • Use Raspbian as your SD card image
  • Start the Raspberry Pi with that SD card
  • You will be presented with a text-based 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
  • Once you are through all that and it has booted to the LXDE desktop, 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.7-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, wxWidgets, and possibly Freetype (although that allows for background graphics rendering).

  • 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 easy access to 30000 prebuilt software packages, and encourages Python as a primary programming language, it is easy for anyone with general UNIX experience to set up with the aid of a wealth of help available on the Internet; no specialist skills working with exotic embedded hardware is needed.

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 side where you mount some waterproof bulkhead connector fittings with silicone sealant, or install pass-through cable glands. Make the power button a red light-up one with a molly_guard to make it look professional. :o)

... 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, with micro-second accuracy; this can be important as the RPi does not have a built-in real time clock. (see RPi forums for how to connect to a RTC via the GPIO pins)

Hardware

For NMEA 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, data plots, and finished auto-generated PDF reports, then serve these via FTP or a web page running in the background. An ethernet connection, USB WiFi dongle or VHF radio 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. You can have 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