Corresponding author: Ed Baker (
Academic editor: Neil Caithness.
The increasing transformation of biodiversity into a data-intensive science has seen numerous independent systems linked and aggregated into the current landscape of biodiversity informatics. This paper outlines how we can move forward with this programme, incorporating real time environmental monitoring into our methodology using low-power and low-cost computing platforms.
Low power and cheap computational projects such as Arduino and Raspberry Pi have brought the use of small computers and micro-controllers to the masses, and their use in fields related to biodiversity science is increasing (e.g.
The open source hardware movement extends the familiar licences of open access and open source software to physical objects. The aim is to create an ecosystem of projects and products much like the community that develops around open source software. To be open hardware, all materials needed to construct the hardware (schematics, printed circuit board (PCB) layouts, bills of materials) and the software required (on device and ideally to interface with the device) must be released under a permissive '
The introduction of easy-to-use micro-controller devices such as the Arduino brought working with digital electronics to a broader audience. The
The device constructed is intended both as a functional device capable of generating useful environmental datasets and also as a demonstration to the biodiversity community of what is possible using the Arduino system as a base. This project aims to be as easy as possible to construct and use for those with no experience in electronic devices, and for this reason we have steered away from the use of custom PCBs or other materials. The use of a prototyping board rather than a custom PCB also allows for the project to be extended more easily and assembled without soldering. The author would encourage anybody who wishes to release a custom PCB layout for this project to do so.
This project was supported by the European Union funded ViBRANT project (Contract no. RI-261532).
Homepage:
Bug database:
Platform: Arduino / Drupal
Programming language: C / PHP
Operational system: Arduino / Linux (can also run on Windows/OS X)
Type: Git
Browse URI:
Other
The Drupal code and Arduino code are released under the GNU General Public License version 2 or later.
The requirements for the device, and the server software (Drupal) that receives the data were specified as follows:
Be able to record the temperature and humidity at a regular time interval (e.g. every 5 minutes)
Record the data collected to a micro-SD card
Submit data collected automatically and in real time to a Drupal website (using an Ethernet connection)
Have a real time clock (RTC) – the Arduino internal clock counts milliseconds since the micro-controller was turned on, we need to record the actual time of measurement
Use standard and readily-available components
Be able to run off readily-available batteries (e.g. AA) for at least 8 hours
Be able to receive data from a device or more than one device and save it as a Drupal node (content item)
Be able to generate code for the Arduino to assist others in using this software to post data
This project should be useful to a wide range of biodiversity scientists, some possible study scenarios are
using a single device alongside a light, malaise or pitfall trap to collect abiotic data over the study period
using multiple devices to study small climatic differences between different micro-habitats
using devices over a long period to compliment studies on organism phenology
It is hoped that the publication of this device will encourage biodiversity scientists to collaborate outside of their discipline, whether it be with citizen engineers or professional academics. A work by Baker, Bennett and Chesmore (University of York) in 2013 (in prep) expands the concept of using electronic devices from monitoring environments to automated species identification using the acoustics of orthoptera. Where reliable identification of species can be performed by machines, the potential for collecting high quality, high precision and long-term datasets on species abundance alongside environmental variables becomes a possibility.
This project uses standard components which can be sourced from specialist electronics suppliers (e.g.
The data logging device uses the
Several expansion boards are available for the Arduino, which have pins allowing them to attach to the black connectors on the main Arduino board. These expansion boards are known as 'shields' and two different ones have been used in this project. The first, the
By stacking first the Ethernet shield and then the prototyping shield on top of the Arduino Mega the central core of the data logger is formed. This central system controls reading data from the sensors, processing that data into standard units of measurement if needed, then recording them to a micro-SD card and/or submitting them to a website. What we have is a small, low power and low cost Internet-connected computational device. Systems using these components are often used for 'Internet of Things' projects (
The temperature and humidity measurements are made using a DHT22 digital sensor (a digital output sensor sold packaged in plastic housing as
The device uses a battery powered real time clock (RTC) to maintain an internal measurement of Universal Coordinated Time (UTC). The RTC chip used is a standard
The Arduino uses the
In order to set the clock we use the SetTime example sketch that comes with the library (a sketch in Arduino is the source code for the software uploaded to and run on the device). When this sketch is uploaded to the Arduino, it uses the time on the computer programming the Arduino to set the internal clock of the DS1307. Any sketch uploaded after this will be able to request the current time from the DS1307 as long as the Lithium cell is providing backup power. The sketch can be found in the Arduino IDE (once the library has been installed, see above) from File > Examples > DS1307RTC > SetTime. Connect the Arduino to the computer using the USB cable and upload the sketch (program) to the device using the Upload button. The Upload button will compile the sketch and then upload it to the Arduino. As soon as the Arduino has been programmed it will start to run the sketch. As this sketch has no obvious outputs you may wish to open the serial monitor (Tools > Serial Monitor) to view the output. Assuming the hardware has been connected properly (the serial monitor will inform you otherwise) you may then open and upload the other example sketch, ReadTime. ReadTime will output the current date and time, as known to the DS1307, to the serial monitor.
The final non-standard library used by this project is
Finally an LED (light emitting dioide) is attached between pin 9 and ground. This will be used to indicate when a reading is made (single flash) or an error condition (rapid blinking).
Now that the hardware assembly is complete it is time to upload the code from this project's GitHub repository to the data logger using the Arduino IDE. Both the edl.ino and lta_struct.h files must be present for the code to compile and function.
The device uses custom error handling routines using a custom C struct called 'error' defined in lta_struct.h (from this project's GitHub repository). A struct in the C programming language is a collection of variables grouped together under a single name (and accessed via a single pointer). When an error is encountered an instance of error is created including a warning message and an integer representing the severity of the error. The function calling the error then parses the error to the function error_condition(error). This function is responsible for the handling of all errors and has the responsibility of deciding how they should be output or recorded (e.g. if we are logging data to an SD card we can append them to an error log file). The most basic output is flashing the LED indicator in a way that indicates an error has occurred (rapid flashes) and the severity of that condition (the number of flashes in quick succession).
The data logger is now fully functional but would not last long in an outdoor setting. In order to make it more weatherproof we must package the components into a suitable enclosure. There are a number of suitable ABS (Acrylonitrile butadiene styrene) plastic enclosures available, the dimensions of the one used here are 165×125×75 mm. When packaging an electronic device there are considerations to be made about how watertight the case can be. Components such as the humidity sensor must be placed outside of the device, and having some components such as a power switch and LED indicator on the outside will prevent having to unscrew the enclosure too regularly. Each device perforating the enclosure is a possible source of weather failure however, so it will likely pay to keep the number of external controls minimal. Risk can be minimised by choosing weatherproof connectors, and where possible sealing other connections using glue or sealant.
The enclosure will now need to be prepared to receive the device. The Arduino board and battery holder will need to be secured to the enclosure using screws (and the screw mounts in the case) or using self-attaching plastic PCB mounts. Holes will then need to be drilled for the power switch, LED indicator, Ethernet socket and the sensor. The sensor is not circular unlike the other components so will need a hole drilled, and then either expanded using a hacksaw or file to the desired size. The power switch and Ethernet connector (Fig.
The connection between the Arduino's Ethernet shield and the weatherproof Ethernet connection requires a short length of Ethernet cable (Fig.
Until this point it is likely you have been powering the device using the USB interface. Now that it is ready for use as a stand-alone data logger an alternative power source is needed. The Arduino has an in-built power regulator circuit that protects the delicate electronics from damage, and allows it to operate on a range of power supply voltages. It is possible to use 4 or 6 AA batteries to power the device. In order to use the built-in regulator this power must be supplied through the circular power adaptor on the board. This connector has a diameter of 2.1 mm and is centre pin positive. Battery holders with this connector can be purchased (Fig.
A completed device, in an enclosure, is shown in Fig.
The
For a device to submit data to the website it must first be registered: from Configuration > Arduino select 'Add Device' (Fig.
The 'Devices' page (Configuration > Arduino; Fig.
Clicking on the 'Server Info' button will give a page with details the device will need to connect to the website it is being run on. These values, along with a token generated from the same website can be copy and pasted into the Arduino application downloaded from the repository for a quick setup.
Once the code (with modified values based on your server install) is uploaded to the Arduino the device will begin posting data to the server when it is turned on.
The information posted to the website from the device is now standard Drupal content and can be processed using standard Drupal modules. The most useful is likely to be the
This section describes advanced use of the Drupal Arduino module that is not needed if you just wish to build the data logger and use it as described here. However if you wish to use the Drupal module as a tool for recording data from many sensors the 'virtual systems' section may be of use. If you wish to create your own custom Arduino project then the section 'Austomatic code generation' describes how the Arduino Drupal module can help you by generating the Arduino code needed to post to a Drupal content type from your device.
Find the definition of the Drupal content type associated with the device
Generate a list of fields that can be posted to from the device
For numeric fields check for min/max values and identify the smallest Arduino variable type that can be used (to save memory)
Define a C struct in Arduino for holding the required information
Generate an example program that accepts a populated C struct of the type defined above and posts it to the website that generated the code
To use the example code two files should be created in the Arduino IDE. One contains the struct definition and must use the file name ending in. h supplied in the example code. The other is the main application and can have any file name. Example application (Suppl. material
This paper is the result of discussions at the Biodiversity Informatics Horizons conference (Rome, Italy 2013). The author presented a five minute lightning talk
An Arduino Mega board. The board can be powered and programmed using the USB connector (top left) or powered as a standalone device using the circular power connector (bottom left).
The Arduino Ethernet Shield attached to the Arduino Uno. The Ethernet socket (left) and micro-SD socket (right) are indicated.
The Arduino Mega (bottom), Ethernet shield (middle) and prototyping shield (top) stacked as the core of the data logger. Some of the other components of the device are being assembled using the solder-less breadboard on the prototyping shield.
DHT22 digital temperature and humidity sensor in AM2303 package. From left to right the pins are VDD (power supply), DATA, unused and GRD (ground).
Male-Female connecting wires make it easy to attach sensors to the Arduino board while prototyping.
DS1307 RTC and 32.768 kHz crystal.
Tools for manipulating DIL integrated circuit packages such as the DS1307. On the left is an extraction tool which helps to remove DIL packaged chips from a breadboard, on the right is a tool to assist in straightening any bent pins on the package.
Clip for a Lithium coin cell: empty (left) and with cell inserted (right). The clip has pins for insertion into a breadboard or PCB on the reverse.
The setup of the DS1307 real time clock.
Schematic created using Fritzing.
A real circuit created on the prototyping shield.
Weatherproof Ethernet panel mount connector (top) and panel mount toggle switch (bottom).
The enclosure with external components mounted.
Single pole single throw toggle switch (panel mount). LED in LED panel mount. Weatherproof panel mount Ethernet connector. Temperature and humidity sensor mounted through enclosure. The cables are routed and secured using film plastic attached to the enclosure with screws. Sockets for screwing components inside the device.
Custom made short Ethernet cable for connecting the Arduino Ethernet shield to the weatherproof Ethernet connector.
Battery holder for 6 AA batteries with Xmm connector for attaching to Arduino board.
A completed device packaged in a watertight enclosure (with lid removed).
A complete unit monitoring the environment in the Wildlife Garden of the Natural History Museum, London.
The 'Add Device' page for the Drupal module. The user must enter a human-readable name for the device (e.g. "Environment Monitor 1"), the Drupal content type that the data should be stored in, and the user name of a registered user on that site. Posts from the device will be recorded as being made from this user. As the new device is saved a machine-readable token is generated that uniquely identifies the device.
The 'Devices' page lists the devices registered with the website, the token they must use to submit data to this website, the content type that the data they submit should be stored in, the unique user identification of the user the devices will post content as and a link to get automatically generated Arduino code.
Table display of information posted from an Arduino to a Drupal website using the code and hardware described in this paper. The table display uses the Drupal
The code generated by the Drupal module's 'Get Code' functionality showing the full struct definition file (in this case Pond_Monitor_struct.h) and the start of the example code for the main application.
Example Arduino application generated by the 'Get Code' functionality
Data type: Arduino source code
File: oo_5573.ino
Example Arduino struct header file generated by the 'Get Code' functionality
Data type: Arduino source code
File: oo_5574.h