☀ How to Build an Arduino Data Logger ☀

A data logger is a device that records sensor information at regular intervals over a period of time so that information can analized an understanding of phenomenon that are hard to observe directly. THIS PAGE is a consolidated set of links to the different Arduino-based logger tutorials that we’ve released over time, with some commentary to put them in context.  (OR  you can jump directly to the latest logger build instructions)

The hardware side of the Arduino platform is a circuit board built around an Atmel AVR microcontroller with connections broken out so you can physically attach wires to it more easily. It’s really the integrated development environment (called the IDE) that makes programming the Arduino so easy for beginners. The IDE handles a lot of messy details when converting code you’ve written to run on that little chip.  Because those low level details are taken care of, you can run essentially the same program on many different flavors of Arduino hardware – even if they look different different physically.

An Uno-based  basic data logger, with no soldering required.  As the instructor, you can assemble this logger very quickly with pre-made jumpers but we found the connections were too easily knocked loose by clumsy students, so it's worth taking the time with them to put stiff solid core wires in place.

Most people who are just discovering Arduino start with the UNO. It’s a relatively large board, and robust enough for the physical handling you see in a classroom situation.  We have posted several tutorials for the UNO  with the hope that that teachers will use this material as the basis for their own beginner-level lessons.  UNO’s don’t run very long on batteries, but they are a fantastic platform for learning programming and electronics.

  1. Arduino UNO Data Logger for Beginners
  2. Adding Sensors (& Modules) to an Arduino Data Logger
  3. Display ‘Live’ Sensor Data from an Arduino with the Serial Plotter
  4. Simple Arduino Logger code w Sleep & RTC wake-up
  5. Build your own Arduino Starter Kits for the Classroom
  6. Ideas for your Arduino STEM Curriculum

The plotter tutorial is probably the most important one in the set for teachers. The serial plotter built into the IDE makes it possible to view sensor output in real time simply by adding one print statement to the code. This generates a graph live on screen by sending the ‘printed’ numbers over the USB and the graph axes are generated ‘automatically’. Nothing I’ve used before lets you do classroom demos so easily.

MasonsSensorPottingThe drawback of larger format Arduinos is that they are built for ease of use, rather than being optimized for low power operation. Dataloggers often have to run for several years on one set of batteries so we use smaller Pro-Mini style boards that are more power efficient. There are some differences between Arduino models in terms of pin locations and operating voltage, but once you have an UNO-based logger recording sensor data,  you should be able to transfer that code into to a Pro-Mini based build with few (if any) changes to the programming.  This gives you a development path, where your prototypes get smaller and more energy efficient as your skills improve, with some people reaching the point of using raw processors from the AVR family to create custom sensors. Or if your code grows large enough to exceed the memory on a ProMini, you can switch to a board with a larger 1284P processor.  

Our first Pro Mini based loggers went into service in 2014. These were built with a generic wiring plan that used inexpensive components from the Arduino hobbyist market:

In 2018  we published our first academic paper:  A Flexible Arduino-Based Logging Platform for Long-Term Monitoring in Harsh Environments   This open-access publication is free to download, and describes real world deployments that show how modifying both the logger assembly and the housing enable us to monitor very different aspects of groundwater flow with the same type of sensor. The “modules & jumper wires” approach makes it easy to change components to create these unique prototypes; tailored to different research questions. Extensive code libraries published by the Arduino community simplify the addition of sensors and other groups are now taking advantage of this flexibility; extending the 3-module design with new housings & sensor configurations.

For an idea of how this tool could be used in an educational context, see our post about testing plant stress with a normalized vegetation index.

In 2019: As part of our commitment to science education, we’ve developed a simplified version of the logger from that paper which uses pre-made Dupont connectors to reduce the assembly time to about 1.5 hours. Dr. Beddow’s instrumentation class has been building 3-module loggers for several years now, and their feedback informed this new layout which enables a variety of student projects via the breadboard, while keeping within the time constraints of a typical lab schedule. Youtube videos explain the assembly in detail and the new logger program starting point provides a functional temperature & light level logger without adding any extra sensors.  DIY sensors like this will soon become a standard part of the earth & environmental science curriculum, and we hope this new build supports other STEM educators who want to add Arduino based experiments to their teaching portfolio. 

Sensor Tutorials:
There are many sensor tutorials the site, and
we are constantly developing new methods for calibrating inexpensive sensors to research standards: 

You can search for all the other material on this site via the search box on the upper right hand corner. In addition, progress summaries are shown there for some of the instruments I’m currently working on. Below that you will find a very long list of links to other Arduino projects that I found helpful or interesting. If you get stuck on something, leave a comment on the related page of this blog or post your questions to the forums at Arduino.cc – especially if you are trying to build something for your own research using a sensor I have not worked with yet.  Arduino.cc is by far the best resource available for beginners, and I always start my searches there.

Advanced builds for underwater research:

Cave Pearl data loggers

An underwater DS18b20 temperature sensor chain with 24 nodes and MS5803 pressure sensor. This build uses the 2″ PVC housing for deployments below 5m. DIY underwater connectors join interchangeable ‘sensor segments’ to each other and to the the logger body.

This project is somewhat unique in that we are simultaneously developing the system for use in educational and research settings.  The field units get deployed in flooded cave systems for years at a time, and that required the development of an underwater housing with waterproof connectors so that sensors can be placed at the end of long cables.  This housing is assembled from PVC plumbing parts and has has survived multi-year deployments below 20m in salt water.  The core of logger is built from the same modules as the student version, but these are re-arranged to fit inside the 2″ pipe housing, and all the connections are soldered to make them more resilient to rough treatment on deployment dives. 

We’ve also been developing methods to add 5110 LCD & OLED display screens using the lowest possible amount of power & system memory.

The stacked screw terminal build gets mounted on an end-cap for deployment  inside our 2″ underwater housing.

Classroom builds usually draw between 200-250 μA while sleeping between readings, but the lion’s share of that is for the SD card (70-100 μA) and the DS3231 RTC (90 μA)  which is compounded by the poor efficiency of the default MIC5205 regulator. Using a mosfet to cut power to the SD card, and forcing the RTC module to run from the backup coin cell usually brings the 3-module core below 30 μA sleep current between readings. Removing the Promini regulator and running from two Lithium AA batteries can bring that down below 20 μA, but replacing the regulator with an MCP1702-3302E/TO is another reliable low-power option if your sensors require a stable supply voltage.  Each optimization step adds a more complexity to the logger, but these three modifications get you to multi-year deployments comparable to commercial sensors – while still being something a you can build from off-the-shelf modules. Chip based sensors from the hobbyist market rarely last more than 3-4 years, so sleep currents in the 30μA range (with sensor attached) mean that our field loggers often run for their entire deployment lifetime on a single set of AA batteries. With the impact that used batteries have on our environment, that was an important goal for the project.

For ‘shallow’ water deployments we use a simpler DIY housing with fewer parts & faster assembly.

Perhaps the most important thing to understand about building your own dataloggers is that  though the parts can be had for less than $30,  cost alone is not enough to justify the time you will spend on testing & sensor calibration.  If you can buy a pre-made logger that does the job you need for less than $100, then that’s probably the way to go.  A better reason to build your own loggers is to improve the quality of your data because you have complete control over the sampling/averaging methodology used at the code level. And it’s often necessary to configure custom sensor(s) for the specific questions you are working on.  For example, we developed our tilt-flow sensors because none of the commercial sensors worked very well in coastal cave environments. This is a common problem in scientific research, and it continues to motivate our ongoing efforts to refine this DIY logger system.

It’s also a lot of fun to build ‘things that do things’ because it requires the use of both your mind and your hands with reasonable skill.  Environmental monitoring then lets you connect that effort to the real world in a way that is both useful and rewarding.