Tech Enabled Field Studies, Third Edition

The latest from Carte Diem Press is a Third Edition of this popular book from Tom and Roger on field studies includes the technology and how to information to implement into many settings. The 3rd Edition includes drones, programming, Raspberry Pi, and updated workflows… and an online companion.

We created this resource for educators who want to do research with learners –typically classroom teachers working with their students in Earth Systems or Environmental Science, Geography, or History.  The book would also be useful to those running outdoor education or field research programs for students of all ages; however, as the title suggests, we do focus on tech-enabled methods, tools, and analysis.  Most of the content assumes that the research will be conducted outside or “in the field”. We believe it will provide powerful justification to include these projects in your classes. we believe this volume would make a great addition to any reference library on field research techniques.

Order at GISetc. >>

A Raspberry Pi IoT to collect and post field data

This is the third blog post in a series that uses the Raspberry Pi as an Internet of Things device to collect environmental data (with a DHT22 weather sensor) and post the data in real-time to an ArcGIS Online feature service.  The post below is a highly synopsized version of a chapter in the forthcoming third edition of the book, Tech-enabled Field Studies.

Begin by setting up a Raspberry Pi with the DHT22 sensor..  See The Pi Becomes a Data Collector

Use the Pi’s command prompt to make the following installations and configurations:

  1. pip3 install virtualenv
  2. virtualenv datalogger
  3. cd datalogger
  4. source bin/activate datalogger
  5. pip3 install Adafruit_DHT
  6. pip3 install pandas
  7. pip3 install arcgis – -no-deps

Note: Step 6 above (Pandas) may take several minutes. The above steps create a virtual environment in Python called datalogger and install three libraries into that environment including a streamlined ArcGIS API for Python.  When you call the weather script below, you will need to reference it from this environment, described below.

Continue the set-up by:

  • Configuring the ArcGIS Online service as described in the previous blog post, A Time-aware Geo Data Bucket.
  • Download the sample Python file that reads data from the DHT22 and posts to ArcGIS Online. The Python file is here or download/clone the entire project here.  be sure to update the python file with your information, as described in the file.
  • Put the Python file in your datalogger directory to help you remember that it must be run from that environment.  Once you have added your data to the python script and have the ArcGIS Online service running, you can run the script by using the command:
    • /home/pi/datalogger/bin/python3

The service does have a date/time attribute and the service can become time-aware.  Once the service is added to a map, you may also choose a symbology that you prefer.

Finally, on the Pi, you may choose to set-up a Cron job to schedule the script execution on a reoccurring basis.  Do a quick Google search to find tutorials on how best to do this.  Enjoy!




A Time-aware Geo Data Bucket

A CSV spreadsheet file can become the basic building block of a Feature Service, capable of holding existing or inbound data.  Follow the steps below to create a simple time-enabled GIS feature service bucket for tracking the weather data you provide to it from users or sensors.

1. Log into your ArcGIS Online publisher account.

2. Upload the sample CSV (wx_start.csv):

  • Click “Content”.
  • Click button, “Add Item”. Select “From My Computer”.
  • Select the sample CSV and fill out metadata.
  • Click “Publish this file as a hosted layer”.
  • Select “Coordinates”.
  • Make sure the date field name shows date field type.
  • Make sure lat and long field names show latitude and longitude field types
  • Set the service to output to your local time zone. (In a later blog post, you will see the python script is set to send UTC time data to the feature class – which is converted to your local on map display).

3. View the feature service Overview page.

  • Find the “Layers” section. Click “Time Settings”.
  • In the pop-up window, click the checkbox, “Enable Time”. Select the first option, “Specific events in time”. Set pull down to “date”.

4. From the feature service Overview page, click “Open in Map Viewer”.

  • In the Change Style panel, make sure button 1 (Attribute to show) is set to “tempF”. Press Done.
  • Save your new map.
  • Hover over the new feature class layer name. Click the “View Options” button (ellipses). Select “Refresh Interval”. Enable the refresh and set to 1 minute (or whatever number makes sense to you).
  • Hover over the new feature class layer name. Click the “Cluster features” button. Enable or disable clustering to your preference. We recommend turning it off, initially.
  • Optional: You may also want to modify the transparency of the symbology, available under the “View Options” (ellipses) button. Select “Transparency”. Optionally, set to 50% initially.
  • Save your map edits.
  • Note: If new data are not showing on the map, click the layer’s “Show Table” button.If all the data is showing in the table, close it.  Then click the layer’s “Show Options” (ellipses) button and select “Disable Time Animation”. You can normally turn time animation back on and the data will appear.

The Pi Becomes a Data Collector

The Raspberry Pi can connect directly to sensors.  From temperature and humidity to light and motion to sound and well beyond, these add-ons can be sold individually or in large kits.  This ability to read and process data from a sensor turns your Raspberry Pi into an instant IoT device – for under $50.

Get a Sensor

In this project, a 3-pin DHT22 sensor with capacitive humidity sensor and a thermistordht22 (for temperature  and humidity) will be used.  If ordering from Amazon you can either get sensors cheap or fast – bur rarely both.  I purchased the $9.99 Gowoops version (2 sensors at $5 a sensor) of the DHT22 and received it in about two days.  I also purchased the $3.68 Sodial version (1 sensor) and received it in about one month. Make sure the sensor you order comes with cables/wires to connect the sensor to the Pi.   If you’re lucky enough to have a MicroCenter or similar store in your city, you might also look there.  There doesn’t appear to be much difference in sensor quality (in my two sensors).  What I paid for was speed of delivery.

Pi Compatibility

The easiest way to connect a sensor to a Raspberry Pi is by using the built-in header, available on current Pi models (except the Pi Zero).  On the Pi 3 B+, the basic GPIOPi3BPlus header is a 2×20 male pin connector panel that is built-in to the Pi’s board (visible on the top edge of the board pictured).  Each pin has an address; some pins are designated for data input or output, others for power, and some are ground.  Connecting the sensor is a matter of getting the three DH22 wires connected to the correct pins.

Generally for this type of project, I would recommend the Pi 3 B+, due to its processor speed and built-in hardware.  A Pi Zero for example does not have a built-in header and one must be soldered in place first.

Connect the Sensor

  1. Turn the Pi off and unplug the power.
  2. Remove the case. Position the Pi’s board so the header sits at the top edge (away from you).  Look at the GPIO header diagram below. Locate pin 1, which is on the left side of your board in the row closest to you.GPIOB-Plus
  3. Connect the 3 colored jumper cables from the sensor to the GPIO.  Cable colors will vary.  Technically, on the header, it doesn’t matter which power, ground, or GPIO pins you use, as long as you know the GPIO number of the data cable.  It will need to be used in your test program.  I recommend:
    1. Power cable: sensor (+) to header pin 1
    2. Data cable: sensor (out) to header GPIO4 (same as pin 7)
    3. Ground cable: sensor (-) to header pin 6
  4. Put the case back on the Pi.
  5. Connect the cables to the DHT22, as noted above.
  6. Plug the power back into the Pi and turn on.

Install the Software

Let’s make sure the sensor is working.  In order to use this or any sensor, you’ll need to install software (a python library) that can read and interpret the data coming from the sensor. In this case, we’ll install the Adafruit_DHT library and then write some short Python code to output the sensor data.

From here, I assume you have any version of Python 3 installed.  It’s installed by default, so unless you removed it, it should be a safe assumption.

Start Terminal. By default, this launches a black window with the bash prompt.  At that prompt, tell Python to add the code to read the sensor data. Text is case-sensitive.

  • pip3 install Adafruit_DHT

The script will download and install software and hopefully give you a confirmation everything went well. Techie note for conda users: The library doesn’t appear to be loaded into the Anaconda cloud.  Download and manually install it (like we did with arcgis, if you need the sensor exposed to your conda environment.

Test the Sensor

You need a Python IDE (integrated development environment), a place to write and run code. While most Pis already have at least one Python IDE, you may find it necessary to download one from: Start menu > Preferences > Recommended Software.

Thonny and Geeny were both pre-installed on my Pi and work fine for this task.  Python 3 IDLE is not advisable for this project. With Thonny open, create a new file and copy/paste the Python code below (or download the .py file from here). github

  • import Adafruit_DHT
  • sensor = Adafruit_DHT.DHT22
  • #This is the GPIO Pin number, not just the Pin number.
  • #This pin in pin 7 but sits in GPIO Pin 4. Use 4 below.
  • pin = 4
  • humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
  • temperature = temperature * 9/5.0 + 32
  • if humidity is not None and temperature is not None:
    • print(‘Temp={0:0.1f}*F  Humidity={1:0.1f}%’.format(temperature, humidity))
  • else:
    • print(‘Failed to get reading. Try again!’)


A few notes on the code:

  • Lines starting with # (hashtags) are comments.
  • The indentation on the two print lines is important. Just tab both lines in one time. This is how Python articulates logic and code “flow” (with tabs).
  • Note the import statement at the top.  This is where the Adafruit library is loaded by Python and starts the magic.
  • Most importantly, note the pin= line. This is the GPIO# not the actual pin #.

This sample script is derived from Adafruit’s script.  I’ve just simplified it a bit but you can find the original here.

If the script runs correctly, the output should look something like:

  • Temp=67.5*F  Humidity=40.1%

Extension Ideas

  • Put a for loop around your code and make it run repeatedly.
  • Put a time.sleep() function in the for loop to space out sampling events.
  • Log your data.
  • Calculate the heat index, based on the temp and humidity data.



ArcGIS on a Pi: Happy Pi Day!

This post describes how to install the ArcGIS API for Python on a Raspberry Pi 3 B+.
Document version: March 14, 2019. Version 1.1 – Tom Baker RPi-Logo

To learn more about the Raspberry Pi, visit

Start with a clean installation of the Raspberry Pi’s Raspbian OS for best results.


  1. Install Berryconda

    Berryconda for Raspberry Pi is the conda environment for Pi. The installer includes Python 3.6.1 at the time of this writing and meets the minimum Python 3.5 requirement of the ArcGIS API for Python 1.6.0.

    1. Download the bash script (.sh file) for from the bottom of the page:
    2. With the file on your Pi, right-click and select Properties. Set permissions to “Only Owner” to execute. Press OK.
    3. Open a Terminal window in the current folder and run the bash script. Start the command with a period and paste the filename. Like (ignore indentation icon):
      • ./
    4. Click through the Terminal prompts to install. Use default settings.
  2. Install Jupyter Notebook

    1. At a Terminal prompt, type:
      • conda install Jupyter
  3. Install the ArcGIS API for Python

    1. Check your python version. Use the Terminal window and type:
      • python –version
    2. Download the arcgis package from the anaconda repository for 32-bit Linux that matches your version of Python (e.g. 3.6). The file name should look something like: linux-32/arcgis-1.6.0-py36h39e3cac_1.tar.bz2
    3. Download from
    4. Note: In our tests, the arcgis file cannot be directly downloaded using conda from any repository.The conda tool fails to find the required “linux-armv71” channel for arcgis.  However, downloading the file and installing from a local path negates the conda installer looking for the arm-specific version of arcgis.
    5. Right-click the package and select “Copy Full Path”.
    6. From a Terminal window, install the package like:
      • conda install /fullpath/arcgis-1.6.0-py36h39e3cac_1.tar.bz2
  4. Test the installation

    1. At a Terminal window, type:
      • jupyter-notebook
    2. When the notebook loads in a browser, create a new Python3 document.
    3. In the document’s first cell, enter the four-line test script below that will draw a map.
      • from arcgis.gis import GIS
      • gis=GIS()
      • map1 =“Palm Springs, CA”)
      • map1


Raspberry Pi Models Tested

To date, we have used the following Pi models with the ArcGIS API for Python and Jupiter Notebooks. Brief comments follow.

Raspberry Pi 3 B+ – Quad-Core BROADCOM 64bit ARMv8 1.2 GHz 1 GB RAM

  • Demo installation above was conducted on this model.  Maps draw responsively with a slight lag on the first request.

Raspberry Pi Zero W v1.1-

  • It took about 5 minutes to run the four line script above.