Modest Maker Files
Introduction to Arduino and DC Circuits

Last Update: 8/22/2022

Part II: Environmental Monitoring with Arduino

YouTube playlist with introduction here

Parts list for following chapters here (in development)

Code included in chapter description where applicable.

Chapter 1: Arduino for Environmental Monitoring - Introduction

Pending Introduction

Chapter 2: Arduino - Flow Detector

In this chapter, we will demonstrate a simple circuit for detecting the presence or absence of water with an Arduino and an inexpensive water sensor.

Flow detector Sketch

Chapter 3: Arduino - Datalogging

Summarizes how to use an Arduino to log environmental data to an SD card.

Datalogging sketch

Chapter 4a: IOT - Introduction

Continuing on the theme of environmental monitoring, I’ll now introduce a bare bones circuit that can log data to an Internet of Things website known as Thingspeak using cellular networks. This video summarizes hardware requirements and explains the code which can be modified for your own purposes.

FONA_BarebonesLCD_rev1 sketch

Field test data

Chapter 4b: Flow Induced Photo Demo

Summarizes how to set up an Arduino to sense flow and take a photo

snapShotClip sketch

waterSnapLCD_sketch

Sample Photo

Chapter 5: Air Quality Monitoring at LAX

While vacationing in California, I brought along a PMS5003 sensor to measure air quality in a neighborhood that borders the Los Angeles International Airport (LAX). Check out this video for details on how to build your own particulate matter monitor with datalogging capabilities. This video includes a summary of a 21-hour test of this hardware in a neighborhood adjacent to LAX.

PMtest_sketch

LAX_data

Sensor Manual

Chapter 6: Solar Powered REM

Demonstrates build for solar powered enclosure for FONA

Electronics baseplate template

FONA_bareBonesLCD_rev1

Chapter 7: INA219 Arduino Datalogger

This video summarizes how the INA219 is used for current monitoring, and then demonstrates a circuit for measuring the current draw of your own Arduino inventions. The demonstration clarifies how to wire the INA219 into your circuit.

CurVoltPowerLCD

Chapter 8: Field-Worthy Water Sensor / H2O Stage Detector

Arduino and Processing sketch for use with a hardened water sensor for field deployments. The use of PVC to elevate the sensor above ground also helps you determine when a certain stage has been triggered.

waterSense

Chapter 9: Using an Arduino with a Tipping Bucket Rain Gauge

Demonstrates how to integrate an Arduino with a tipping bucket rain gauge to include a remedy for filtering out noise in the reed switch. In this example, I use an Adafruit ProTrinket, but this can be done with any variant of an Arduino (i.e. Arduino UNO)

tippingBucketCode

Chapter 10: Testing LoRa Transmission in Rangelands

During a visit to install at satellite-enabled REM at a stormwater detention feature in southern Arizona, we test the range of a LoRa radio purchased from Adafruit. First minute describes location; test starts at about minute 1:06. Details regarding original urban setting tests and source for code in this video: https://youtu.be/Zw_LA3nDAkc

LoRa Radio Code

Chapter 11: Remote Environmental Monitoring with the HACH AS950 Autosampler

This video summarizes details on how to integrate a HACH AS9520 autosampler with a remote environmental monitor (and other hardware) described in this playlist. If you have ever wanted to integrate your own flow detection hardware with a commercial autosampler, this video may give you some ideas on how to do the same.

barebones_ROCKBLOCK_REV3g.ino

Chapter 12: Coding a ProTrinket to work with the HACH AS950 and RockBLOCK modem

This video summarizes details on how to code a ProTrinket to interface with a HACH AS9520 autosampler, a flow detector, and a RockBLOCK modem. See chapter 11 for background.

barebones_ROCKBLOCK_REV3g.ino

Chapter 13: Demonstration of Satellite Telemetry for Stage Monitoring

This video demonstrates the use of an Adafruit ProTrinket to drive a RockBLOCK modem and Maxbotic Ultrasonic Sensor for monitoring the stage of remote rivers, washes, and even stock tanks using Creative Commons hardware. Thanks to Sean Keane-- our agency intern-- for developing this code which is NOT posted since it has not been commented or cleaned up and is a bit difficult to follow. I’ll post a cleaned-version of this sketch as soon as I have a chance to test.

Chapter 14: Solar-Powered Ultrasonic Sensor with Satellite Telemetry

Background video for grantee for solar powered deployment of what’s presented in Chapter 13. Respective code is here-- circuit and flow will be described in a future video.

ROCKBLOCK_RANGE_REV1C.ino

Chapter 15: Remote Flow Detection - Lessons Learned

In this video, I summarize general mistakes made in in one of my REM field deployments. I then discuss challenges in using a cheap water-detector sensor to trigger an interrupt pin on a 5V ProTrinket. The voltage signal from the sensor bench-tested fine, but was to low to trigger in the field, likely due to poor connections. This led me to do a little research on micro-controller voltage logic levels in order to understand sensor limitations and pairing requirements.

Chapter 16: REM-Autosampler Deployment - Lessons Learned

This video summarizes an satellite-enabled REM deployment that is driving an autosampler both for sample collection and remote notification of sample collection. This is a field deployment of what’s shared in chapters 11 and 12 to include lessons learned and improvements. This deployment in this chapter uses the respective code:

barebones_ROCKBLOCK_REV3g.ino

Chapter 17: Mobile Air Quality Monitoring with the PMS5003

This video shows a PMS5003 coupled with a data-logger and GPS for mobile air quality monitoring, logging, and mapping. For this first demo, I just take a walk/ride around Tucson to see what kind of air quality dynamics I might capture on a nice day in October. The associated sketch is also writing data to an SD card and includes a time stamp. I'll demonstrate the data logging and update the sketch with GPS capabilities in an upcoming video.

PMtest_SD_LCD_MEGA.ino

Chapter 18: Remote Flow Detection Through Satellite Telemetry

In this video, I’ll explain how to use the Iridium satellite network for flow detection in remote areas with no cellular coverage. This is done by driving a RockBLOCK modem with a 3V microcontroller coupled with an inexpensive water sensor.

satREMsketches

Chapter 19: Remote Flow Detection Through Cellular Telemetry

In this video, we'll amend code from our Introduction to the Internet of Things to detect flow in remote areas where cellular coverage is available. This demonstration uses the Feather FONA with the same water sensor described in Chapter 18. I'll conclude with a summary of how to build a sensor hangar. For background, I recommend you review this video first: https://youtu.be/aJVEDw1Hm1g .

cellREMsketches

 

Chapter 20: Ultrasonic REM Deployments

In this video, I'll share the hardware, software, and lessons learned associated with two field installations for the hardware demonstrated in Chapter 13: Demonstration of Satellite Telemetry for Stage Monitoring.

Hardware and software licensed under Creative Commons.

Hans Huth, Sean Keane, Carl Hooper, Dr. Ron Tiller, and the Arizona Department of Environmental Quality provided the hardware, ideas, and weekend support for these experiments. Please acknowledge if you use respective resources for your own private or commercial purposes.

Our sincerest thanks to Xerocraft for your ideas and support:https://www.xerocraft.org

ROCKBLOCK_RANGE_REV1c.ino

Thanks for additional documentation and improvements realized and shared by Carl Hooper (Cochise County, Arizona), posted here with his permission:

Change Command Instructions: For changing telemetry parameters remotely.

MaxBotix MB7092: Condensed datasheet on ultrasonic sensor

ROCKBLOCK_RANGE_REV1f: This is the ROCKBLOCK_RANGE_REV1c.ino sketch modified to improve calibration frequency on measurements. Carl is turning the ultrasonic sensor on-and-off during averaging so that sensor self-calibrates for each measurement. I have not tested this, but am sharing his code for those who may wish to experiment. I will test this shortly for comparison.

XL-MaxSonar-WR_Datasheet: Highlighted ultrasonic sensor specifications.

New video posted by Carl regarding his own applications and deployment: https://www.youtube.com/watch?v=dQkyMa1zof8

Chapter 21: Weather Monitoring with an Arduino

In this video, I'll demonstrate three simple Arduino sketches to talk to a wind vane, a tipping bucket rain gauge, and a cup anemometer. The sketches will be derived from the Argent Data System library written by John Cape for interfacing with Argent's Wind / Rain Sensor Assembly. This video includes updates to the chapter 9 summarizing tipping-bucket rain gauge sensors.

Links of interest:

Wind / Rain Assembly

ADS library for interfacing an Arduino with assembly

chapter21code - compressed file with following sketches:

Arduino sketches explained in video:
/arduino/1_weatherVane/
windDir_AngleConditional_rev1 - returns angle based on direction
windDir_CardinalConditional_rev1 - returns cardinal direction based on direction
/arduino/2_tippingBucket
rain_Debounce_mod4h - modify debounce constant based on sensor used
rain_RC_Schmitt_mod4 - use with hardware remedy for bounce filtering
/arduino/3_anemometer
anemometer_rev1 - use with cup-type anemometer

Processing sketches for visualizing serial terminal output:
/processing/instrumentEchoText_v1 - use with windDir_CardinalConditional_rev1
/processing/windVaneDirection_v1 - use with windDir_AngleConditional_rev1

analog to digital spreadsheet calculator

Chapter 22: Rainfall Monitoring via Cellular Telemetryy

Here, I summarize tests and remedies for integrating an Adafruit Feather FONA with a tipping bucket rain gage. In particular, I look at the use of interrupts to log rain gage tips for informing telemetry, and highlight challenges and remedies realized over one month of testing. The successful circuit will soon be tested in the field.

chapter22code

Chapter 23: Rainfall Monitoring via Cellular Telemetry - Accuracy Test

This video summarizes a field deployment and accuracy test of the telemetry circuit summarized in Chapter 22: Rainfall Telemetry. Accuracy spreadsheet available for download here.

Chapter 24: Using an Arduino to Quantify the Impact of Mulch on Soil Moisture

Introduction Only: In this experiment, I'll use an Arduino with three humidity/temperature sensors to understand how mulch can help with soil-moisture retention in desert soils. The experiment will involve taking careful surface and sub-surface temperature, light, and humidity measurements using an AM2315 and two SHT10 sensors with an Arduino and datalogger. I'll eventually integrate the experiment with Adafruit's IO platform for reporting status to the Internet of Things over Wifi. This work will also realize new code and testing for projects supported by the Arizona Department of Environmental Quality.

Code available here.

Chapter 25: SHT10 and AM2315 Sensor Comparison for Mulch Experiment

This video compares temperature and humidity data collected by two SHT10 and one AM2315 sensors in an uncontrolled environment as a precursor to the mulch experiment summarized in Chapter 24. The data is logged by a generic Arduino Uno and data logging shield.

Specs for respective sensors which explains some of the variability are posted here:

SHT10: https://cdn-shop.adafruit.com/datashe...
AM2315: https://cdn-shop.adafruit.com/datashe...

The variability in the data is a function of opening and closing a door that facilitates air movement from a swamp cooler through my bedroom. The difference between these three sensors is within tolerance for this particular experiment and sensors.

These are the links for the code and spreadsheet.

Inventory of sensors I'll be playing with is here.

Chapter 26: Posting Temperature and Humidity to AdafruitIO

This is a continuation of the setup for the mulch experiment. I'm interested in posting results to Adafruit's IO platform, so this video demonstrates integration of the AM2315 with an ESP8266 (Adafruit's Feather Form factor: https://www.adafruit.com/product/2821) for the purpose of posting temperature and humidity data to the Internet of Things.

Here is is the link for the code.

Make sure to start with Adafruit's learning section tutorial and example sketch which explains how to set up a config file for your wifi and AdafruitIO settings.

Chapter 27: Huzzah ESP8266 Multi-Sensor Adafruit IO Test

This video summarizes wiring, pin selection, and test results for integration of three temperature/humidity sensors with an ESP8266 (Feather Huzzah) for posting data to Adafruit's IO platform.

Video includes screenshots of resulting dashboard. Circuit is being developed in anticipation of a field test: https://youtu.be/UqYGo72MBUQ).

Results will will guide sensor use by my agency for confirmation of stormwater-flow events associated with autosampler-trigger notifications received via Thingspeak: (https://youtu.be/GW8Rv60IYdI).

NOTE: Fritizing diagrams in video show use of pin 15 as a data pin for one of the SHT10 sensors. Tests shows using this pin doesn't work for this application-- respective SHT10 lead needs to be moved to pin 12 in circuit and code. I'll share updates in my next chapter.

Code in Chapter 29

Chapter 28: SMS Text Demonstration Using Particle Boron and Adafruit IO

TING is dropping support for 2G networks, so I will soon lose the ability to use Feather FONAs for remote environmental monitoring. This video demonstrates that you can use an LTE Particle Boron as a replacement FONAs in some of the projects described in this series. This is done by configuring Zappier to create a "Zap" that responds to a change in your Adafruit IO feed by sending an SMS text using Twillio. In my case, the Zap instructs Twillio to text my cell phone with a link to an Adafruit Dashboard.

UPDATE 7/11/20: In the video, I received my text in just a few seconds after triggering my qualifying feed. That happened because I'm using a trial "Professional" version of Zappier that polls my Adafruit feed every two minutes. When this trial defaults to the free version, the polling interval will fall back to fifteen minutes. In order to maintain a two-minute polling interval, I would have to upgrade to a paid professional account that requires a $49 / month subscription when paid in advance for one year. Otherwise, it's $61.25 billed month-to-month. For comparison-- on Thingspeak, it usually takes 5-10 minutes for a triggering event to register notice on my cell phone. This is something to consider if you have very time-sensitive information you are trying to respond to in the field.

Chapter 29: Temperature-and-Humidity Monitoring - Field Deployment

This video summarizes the build, installation, and lessons learned for an air-and-soil temperature-and-humidity monitoring instrument for an upcoming mulch experiment. The intro summarizes the first 24 hours of data collected and reported to an Adafruit IO Dashboard which is accessible here: https://io.adafruit.com/biod101/dashboards/adeq-multi-sensor-test

These sensors will eventually support effectiveness monitoring for environmental projects funded by my agency, and help augment data collected by remote environmental monitors tied to auto samplers. Code is here.

Brad's book available here: https://www.amazon.com/Rainwater-Harvesting-Drylands-Beyond-Water-Harvesting/dp/0977246442/

Chapter 30: Mulch Experiment - Baseline Conditions Pre- and Post-Monsoon Storm

This video is a continuation of an experiment in using environmental sensors and Adafruit IO to understand the impact of mulch on soil temperature and moisture dynamics. In this video, I establish baseline temperature conditions associated with an uncovered basin before and after an intense two-inch monsoon storm.

Data is being posted to this dashboard: https://io.adafruit.com/biod101/dashboards/adeq-multi-sensor-test

Prior chapters are available here: Mulch Experiment Introduction : https://youtu.be/UqYGo72MBUQ

SHT10 and AM2315 Sensor Comparison for Mulch Experiment : https://youtu.be/26CJEGbRa9g

Temperature-and-Humidity Monitoring - Field Deployment : https://youtu.be/s84G1QhH2bI

Water Harvesting and Mulch Experiment Results
https://youtu.be/kGVjin8qyp0

Experiment is paused as of October 2, 2020 for sensor improvements and better placement for solar charging to avoid dropped dat from failed batteries.

Chapter 31: Remote Flow Detection with Float Sensors and 4G Telemetry

This video summarizes various improvements on remote flow detection that I'll be testing over the following weeks including (1) use of float vs. conductivity sensors in acidic environments; (2) use of a Boron (4G) modem as a replacement for the Feather FONAs; (3) use of Adafruit IO vs Thingspeak for logging data remotely; (4) use of webhooks in the Particle IO ecosystem for sending text messages in response to flow events. This video is mostly focused on (1) with future chapters providing more details on items 2 - 4.

Note: In this demonstration, I am using a Particle Argon for testing. The code and demonstration works identically on both the Argon or Boron, but I have poor cell-phone coverage where I live so development takes place using an Argon (over WiFi). The field deployment that will be shared in the next video will be using a Particle Boron for telemetry using the identical code.

UPDATE 10/15/20: The hardware was deployed on October 7, 2020. Details are shared in the video entitled "Field Installations for Stormwater Monitoring in Mining Districts" available here: https://youtu.be/MMrdiF79B1o .

Recommended background videos:

Flow detection: https://youtu.be/fVsepEiYx9o
Remote sampling part 1: https://youtu.be/GW8Rv60IYdI
Remote sampling part 2:
https://youtu.be/Pykj3gQWkls

Chapter 32: Texting Environmental Data to a Cell Phone

This documentation summarizes how to set up a Particle Boron modem with Twillio and Adafruit IO for (1) posting data to the Internet of Things and (2) sending SMS texts to your cell phone when something interesting happens in the environment (e.g. when stormwater is detected).

This was originally generated to help colleagues set up flow detection with SMS texting in support of stormwater sampling and is being shared in response to comments requesting guidance on how to do this. All confidential and accont details have been deleted from associated PDFs.

The compressed archive is available for download here.

Chapter 33: LoRa Range Tests in Agricultural Settings

While on vacation, I tested telemetry range on the low-power RFM95W LoRa module coupled with an LoRa Feather MO. I'm including the code referenced in the video here.

Chapter 34: Logging Weather Data with an Arduino

This video summarizes multiple tests and lessons learned in using various microcontroller configurations to log weather data to an SD camera card. It summarizes the collection of 230K+ records collected by five different microcontroller-datalogger-RTC combinations using various sensors for monitoring atmospheric conditions during the summer monsoon in Tucson, Arizona (2022). Respective tests include the use Arduino-based data-logging shields coupled with Bosch and DHT22 weather sensors for temperature, humidity, pressure, and elevation.

The original logged data, resulting Excel workbooks, pivot table summaries, and tested code are available as a compressed file here .