Interactive comment on “ Open-source Arduino-derived data loggers designed for field research

• After the paragraph on power consumption, we have added this paragraph: “As a result of our desire to minimize power consumption, which is especially important for field deployments in remote regions, we decided not to include on-board telemetry. Off-board radio (e.g., RFM95, XBee), mobile phone (e.g., Particle Electron, Particle Boron), or satellite (SPOT, Iridium) telemetry packages could be added through the exposed digital interfaces on the ALog data logger. However, such additions would require their own significant power paths, including rechargeable batteries, charge controllers, and solar panels, thus negating much of the low-power benefit of the ALog BottleLogger design. Other designs – including the MayFly data logger (Hicks et al., 2015), which includes an XBee header and firmware support for radio telemetry (Aufdenkampe et al., 2017), and direct logging by Adafruit Feather or Particle internet-of-Things (“IoT”) boards, so long as data can be telemetered and timestamped rapidly enough that the lack of an accurate on-board real-time clock is not a problem – are good options where data return and not power consumption is the variable to optimize.”

monitoring (Tauro et al., 2018).What the community still lacks, however, is an extreme-low-power, modular, and lightweight single-board data logger that is easy to use and whose code and hardware designs are well documented and freely available.
We answered this need by developing the "ALog" (Arduino Logger), a small, lightweight, and low-power data logging system that is a fraction of the cost of conventional proprietary systems.Hardware advances alone cannot produce an effective standalone measurement platform, so we paired our new designs with custom-built firmware libraries and software that streamline data-logger programming.We iterated development and field testing from 2010 to present, and deployed each round of prototypes in rugged environments, including glaciers, tundra, the high alpine, and wetlands (Wickert, 2014;Tauro et al., 2018;Saberi et al., 2018).Here we present a suite of modern open-source data loggers and the principles that guided their development.

Design
ALog data loggers were designed as an integrated set of hardware, software and firmware (Figure 2).Together, these layers of the embedded system and its interfaces enable low-power data collection.The hardware includes a set of subsystems to manage power, data storage, timekeeping, sensor interfacing, and connections to computers (for testing, clock setting, and programming).This hardware is tightly integrated with the "ALog" firmware library, which manages low-level utilities (power, boot sequence, fail-safes), on-board hardware (the clock and data storage systems, through their own libraries), and a library of sensor commands.The full system is programmable through the Arduino integrated development environment (IDE), which is designed for use by beginner programmers and therefore lowers the barrier to entry for environmental monitoring.All hardware designs and code for the fully open-source ALog system are available at https://github.com/NorthernWidget.Core firmware and software are licensed under the GNU General Public License (GPL), which requires that all derivatives of the ALog remain open-source, and hardware is released under the Creative Commons Attribution Share-Alike license.
To design the ALog series of data loggers, we followed the approach taken by the popular Arduino project (Barragán, 2004;Banzi and Shiloh, 2014) in order to maintain compatibility with open-source standards.We designed the circuitry (hardware) using EAGLE, an electronic schematic and board-layout program that is freely available for non-commercial use and is a de facto standard across the open-source community.We wrote the data logger software in the Wiring/Arduino variant of C++ (Barragán, 2004), using an object-oriented framework that abstracts the low-level core components of embedded hardware programming (e.g., writing bits to registers) into intuitive functions to read, write, and operate a microcontroller.The programmable core of the ALog is compatible with Arduino, enabling the use of its extensive firmware libraries and IDE.
Multiple examples are bundled with the ALog library, which is fully documented using doxygen (van Heesch, 2008) (see the Reference Manual in the Supplement).

Hardware
The ALog series comprises three main data loggers (Figure 1): the ALog BottleLogger 2.2, ALog BottleLogger 3.0, and ALog Shield 2.2 (Table 1).The ALog BottleLoggers are standalone units that we designed for field research; version 3.0 has performance upgrades, whereas version 2.2 uses less power and fewer components.The ALog Shield 2.2 functions as an entry point for the global community of Arduino users (Buechley and Eisenberg, 2008;Cressey, 2017) to develop their own scientific data logging capabilities.It nests atop a standard Arduino board (Barragán, 2004;Banzi and Shiloh, 2014), such as the Arduino Uno.The power consumption of this pair is too high for field deployment, but together these form a benchtop prototyping system that is compatible with the ALog firmware.The Supplement contains the electrical schematics and circuit board layouts for all three data loggers.
The ALog series of data loggers contain six critical subsystems (Figure 2): power, timekeeping, data storage, sensor interfaces, input/output (I/O), and the microcontroller core.The high-efficiency power system permits multi-year deployments on a single set of primary alkaline batteries (Table 1).A high-accuracy real-time clock keeps time, regulates logging intervals, and is temperature-compensated to reduce drift to ±0.432 seconds per day.Data are written to Secure Digital (SD) cards for low-cost, 10 high-volume storage.Screw terminals connect sensors and other peripherals to the ALog, where they link to the appropriate interfaces on the microcontroller.The ALog communicates with and is programmed by a computer via a USB-serial converter that links the computer's USB interface with the universal asynchronous receiver-transmitter (UART) of the microcontroller.
Each ALog is built around a reprogrammable 8-bit AVR microcontroller (Wollan et al., 1998;Bogen and Wollan, 1999).While a simple design decision, using an SD card instead of internal memory has multiple advantages.The up-to-32 Gb of data storage permitted by the open-source interface library Greiman (2016) allows data to be written in human-readable comma-separated ASCII format.Removable storage limits the time that the box must be opened and exposed to the elements, and also allows SD cards to be swapped in the field.We chose standard large-format SD cards because they include space to write physical notes and because smaller cards are more easily lost in the field.

5
We achieved minimal power consumption -a key system feature -while simplifying power supply options.To minimize power consumption, we implemented an aggressive "sleep" cycle, utilized a lower-speed (8 MHz) crystal to set the processor clock speed, and powered the ALog using an either an unregulated power supply (BottleLogger 2.2) or a step-up-step-down (buck-boost) converter with a high-efficiency switching architecture (BottleLogger 3.0).Power may be supplied by primary 4 Hydrol.Earth Syst.Sci.Discuss., https://doi.org/10.5194/hess-2018-591Manuscript under review for journal Hydrol.Earth Syst.Sci. Discussion started: 7 December 2018 c Author(s) 2018.CC BY 4.0 License.alkaline cells -commonly available across the globe -or through a solar panel, rechargeable battery (typically lithium-ion), and charge controller.When powered by 3 AA alkaline batteries in series and awake (logging) for one second per minute, the ALog BottleLogger 2.2 can run for 2 years and the BottleLogger 3.0 can for 1 year (Table 1).In addition, any ALog may be powered over USB, and a diode array prevents short circuits between USB and external power supplies.

Microcontroller
ALog data loggers are designed for versatility in the field.Each ALog weighs only ∼50 g, a result of its design that uses solidstate components mounted on a circuit board (Table 1).This low weight and associated small size, along with the stability of solid-state electronics, help users carry ALog data loggers into the field and reduce the chance of damage if they are dropped.
All onboard electronics are rated to function between −40

Firmware
We built a firmware library (see supplementary design files) that streamlines ALog programming through a modular twocomponent architecture.The first is a set of utilities that manage logger core functionality.The second is a library of functions that communicate with and record data from sensors (Table 2).This separation prevents users from altering the code that manages core logger functions when adding or editing sensor functions.We classify this code as "firmware" rather than "software" because it is uploaded to the microcontroller as a semi-permanent set of instructions that exists in program memory until it is externally wiped and replaced.The ALog library is written in in the Wiring/Arduino variant of C++, which is the standard for open-source microcontrollers (Barragán, 2004;Banzi and Shiloh, 2014).It maintains compatibility with any standard Arduino-based device in order to ensure that the ALog firmware can support the open-source community even in the absence of ALog hardware.This library is then imported, and its core "ALog" class instantiated, within an ALog program (Arduino "sketch") that is uploaded to the data logger.
The core-utilities portion of the library manages its power and logging cycle, and interfaces with the user, SD card, and real-time clock.The firmware reduces power consumption by a factor of 150-625 from an "always-on" state (Table 1) by instructing the system to spend most of its time in a low-power "sleep" mode in which all non-essential systems are either shut down or put into low-power modes themselves.Errors during the logging cycle are caught by the watchdog timer, which reboots the ALog if it hangs and writes a time stamp to a file to help in uncovering the source of the error.The user interface comprises status and sensor messages passed to the serial monitor as well as a set of status messages flashed by the LED.The sensors component includes both private utility functions for standard operations (e.g., calculating standard deviations, solving the voltage-divider equation) and public functions that link each analog or digital sensor interface to the ALog and record data.Sensor functions are modular and written following a standard inputs-processing-outputs template.Outputs are written to the SD card as plain text ASCII data and header files, and print to a serial monitor if the data logger is connected to a computer.Current support exists for a broad range of off-the-shelf sensors (Table 2), many of which are inexpensive.Users examples included with the ALog library as a guide, users write a set of instructions that prescribe which sensors should be 10 read and how often data should be recorded (Figure 3).This sketch is then compiled and uploaded to the ALog as firmware.

Software
Arduino sketches to program the ALog may be written and uploaded using the Arduino IDE (Banzi and Shiloh, 2014), which evolved from Processing (Reas and Fry, 2007) and Wiring (Barragán, 2004).The Arduino IDE contains an interface to auto- The ALog clock is set via the USB-serial connection using a digital handshake programmed within the ALog library.Two options to set the clock are available: a command-line serial interface program written in Python and a graphical program written in Processing (see supplementary design files).Both methods interact with the ALog immediately upon boot-up (see Figure 3).

Field deployment
ALog development evolved iteratively over more than seven years of lab design and field deployments (Figure 4).ALog data loggers have been deployed in the high alpine (Niwot Ridge, Colorado, USA), the high desert (Quebrada del Toro, Argentina), coastal wetlands (Wax Lake Delta, Louisiana, USA), subalpine valleys (Gordon Gulch, Colorado, USA), tropical mountains (Chimborazo, Ecuador), continental lacustrine regions (Minnesota, USA, and Ontario, Canada), and on large glaciers (Kennicott Glacier, Alaska, USA) (Wickert, 2014;Armstrong et al., 2016;Tauro et al., 2018;Saberi et al., 2018).During these deployments, the ALog recorded data from weather stations, glacier ablation monitoring stations, thermistors, stream gauges, soil moisture probes, pressure transducers for water levels in wells, subsurface temperature profilers, and frost-heave gauges; a full list of sensors for which firmware has been developed is in Table 2.These field deployments tested the ALog data logger in humid and dry environments, onshore and offshore, and in temperatures that ranged from −30 We highlight two hydrologically relevant example deployments performed at Volcán Chimborazo, Ecuador, following on the work of La Frenierre (2014) and La Frenierre and Mark (2017).In the first deployment, we measure weather conditions; in the second, we measure glacier ablation and its drivers.In both cases, the ability of the ALog to communicate with multiple sensors from different manufacturers allows these stations to record relevant data to better understand mountain hydrology in the glacierized Andes.
On the arid eastern side of Volcán Chimborazo, we installed an ALog BottleLogger connected to sensors for wind speed (Inspeed Vortex anemometer), wind direction (Inspeed e-Vane), and solar radiation (Kipp and Zonen CMP3 pyranometer linked with our in-house-designed instrumentation amplifier).We affixed these sensors and the ALog BottleLogger to an existing structure that was used to measure rainfall and temperature using a proprietary data-logging system (Figure 4a) (La Frenierre, 2014;La Frenierre and Mark, 2017).Figure 4e demonstrates a co-variance between wind speed and solar radiation that may relate to land-surface heating and contribute to greater evapotranspiration.
We installed a prototype automated ablation stake on Reschreiter Glacier on the more humid eastern flank of Volcán Chimborazo (Figure 4b).We designed this automated stake to measure both the atmospheric factors that drive snow and ice ablation and the amount of snow and/or ice melt that occurs.Atmospheric variables include temperature (Figure 5b), measured using a CanTherm epoxy-embedded thermistor paired with a reference resistor, and humidity, measured with a TE Connectivity HM1500LF sensor; both of these sit within a solar radiation shield.Distance to the snow and ice surface is measured using a MaxBotix ultrasonic rangefinder (Figure 5a) (see Wickert, 2014), which is paired with a digital inclinometer to check and   correct for station tilt as the ablation stake gradually melts out of the snow and/or ice (Figure 5a).This station, here programmed to record data every five minutes, dramatically increases ablation data density beyond traditional methods, which incorporate daily to weekly field surveys of snow and/or ice surface elevation change around ablation stakes.Furthermore, by including on-stake temperature measurements, we are able to compute at-stake melt factors for degree-day melt models, which are significant for both glaciological and water resources research (Saberi et al., 2018).

4 Discussion
The paradigm of global change research has been one of scientists studying, reporting, predicting, and communicating how human activities impact the environment (Syvitski et al., 2009;Foley et al., 2011;Pelletier et al., 2015;Tauro et al., 2018), followed by the broader public responding with plans to better manage Earth's environment and natural resources.In order to develop the ALog, we reversed this flow of information by drawing on open-source hardware, firmware, and software designs 10 from the public to develop a scientific tool (Cressey, 2017).The open-source electronics movement movement has grown 11 Hydrol.Earth Syst.Sci.Discuss., https://doi.org/10.5194/hess-2018-591Manuscript under review for journal Hydrol.Earth Syst.Sci. Discussion started: 7 December 2018 c Author(s) 2018.CC BY 4.0 License.rapidly as part of the "maker revolution", in which individuals develop new technology and share their designs (Anderson, 2012;Buechley et al., 2008;Libow Martinez and Stager, 2013;Hut et al., 2016).We predict that building atop a broad and popular base platform will increase public accessibility to and interest in scientific measurements, and improve the support for and longevity of the data logger technology.
The ALog is part of a community of open-source tools for scientific research (Harnett, 2011;Pearce, 2012;Cressey, 2017) that includes both sensors (Keeler and Brugger, 2012;Barnard et al., 2014;Fatehnia et al., 2016;Hut et al., 2016) and automated data loggers (Fisher, 2012;Hund et al., 2016;Beddows and Mallon, 2018).Of these, the ALog BottleLogger designs have the lowest power consumption (Table 1).Their screw terminals easily communicate with any sensor via multiple methods of analog and digital communication, and their fully integrated and documented firmware (Figure 2) reduces end-user coding to a few lines.These features have been included individually in other firmware and hardware designs (Aufdenkampe et al., 2017;Hund et al., 2016), but the ALog incorporates all of these into a single streamlined system.All hardware schematics and software are regularly updated and available from GitHub in formats that can be read by free software.These design decisions are essential to building a broad and active user base that can work collectively to increase environmental monitoring across the globe using high-quality open-source technologies.

Conclusions
We developed the "ALog" system of open-source data logging hardware and software, built compatibility for a wide range of sensors, and tested the design extensively in the field.Multiple design iterations over more than seven years of development led to decreased power consumption, improved field usability, and a simple library-based system to streamline programming into one-line function calls.We founded the ALog upon community-developed open-source hardware, firmware, and software.By making our work open-source, we expand the reach of community-developed technology and ensure continued development of these data loggers to allow more advanced, usable, and powerful open-source field instrumentation, compatible with the Wiring/Arduino standard.These tools, and future advances based on our open-source designs, have the potential to shape the future of automated data collection in the field.In so doing, they will continue to help scientists and members of the broader community measure and understand our changing world.

Figure 1 .
Figure 1.Photos of the ALog series of data loggers.(a) The ALog Shield, which nests atop a standard Arduino board.(b) The ALog BottleLogger 2.2.(c) The ALog BottleLogger 3.0; the battery and SD card holders are on the reverse side.

d
10-bit analog I/O also functions as digital I/O.

5
may add additional sensor support to the ALog library with help from a function template (supplementary design files) and documentation (supplementary reference manual).Users may then contribute their code for additional sensor support to the main ALog repository, thereby increasing the reach of open-source instrumentation.To program ALog data loggers, users import the ALog library into an Arduino sketch and instantiate the ALog class.Using

Figure 3 .
Figure3.Flowchart of ALog operations.This set of steps is prescribed by the firmware.Not pictured is the watchdog timer, which resets the data logger, returning it to the "boot" step, if it hangs for more than 8 seconds.

Figure 4 .
Figure 4. Example ALog deployments.(a) Weather station with anemometer, pyranometer, wind vane, thermistor, and tipping-bucket rain gage, to measure high-desert climate parameters.(b) Glacier monitoring station with look-down ultrasonic sensor, thermistor, and relative humidity sensor, to monitor ablation and its drivers.(c) Downloading field data by copying and pasting an ASCII text file from the SD card.
(d) Look-down ultrasonic sensor as a simple stream gauge; despite the destruction of the monitoring system in a historic flood event, the data on the SD card were still able to be recovered.(e) Solar radiation and wind speed covary at the station in (a); wind speed lags radiation, indicative of surface-heating-driven convective winds in this high-altitude arid environment.

Figure 5 .
Figure 5. Automated ablation stake (Figure 4b) data.(a) Inclinometer output as the snow and ice melt, eventually causing the ablation stake to tilt and fall over as pictured in the cartoon drawings.(b) Temperature (gray) and cumulative positive-degree days (black).(c) Vertical distance from the ultrasonic rangefinder to the surface as single-time measurements (gray semi-transparent points) and a daily moving average (black line).The roll-over indicates the point at which the ablation stake tilt begins to dominate the signal, and until this point, ablation (i.e., increasing distance) generally tracks the positive-degree-day line.
a Including

-set GUI Clock-set CLI
Firmware" includes all of the code that runs on the AVR microcontroller."Software" runs on the user's computer.Dashed lines indicate temporary connections (e.g., during programming), whereas solid lines indicate permanent connections and dependencies.Dotted lines within boxes contain information on components of larger systems.Lines in gray indicate features that are included only on the BottleLogger 3.0; gray-shaded boxes denote features that are incorporated into the BottleLogger designs but for the ALog Shield are supplied by a standard IntegrationFigure 2. Flowchart of ALog hardware, firmware, and software."Hardware" includes the generalized subsystems of the physical ALog."Arduino.ADC: analog-digital converter; EEPROM: non-volatile variable memory that holds values after a power reset; I 2 C, SPI, UART, interrupt, analog: communications protocols; GUI: graphical user interface; CLI: command-line interface.5 Hydrol.Earth Syst.Sci.Discuss., https://doi.org/10.5194/hess-2018-591Manuscript under review for journal Hydrol.Earth Syst.Sci. Discussion started: 7 December 2018 c Author(s) 2018.CC BY 4.0 License.

Table 2 .
Measurements and sensors currently supported by the ALog; support for additional sensors may be added to the open-source ALog software library, following the _sensor_function_template example (see the design files and reference manual in the Supplement).