☀ How to Build an Arduino Data Logger ☀

A data logger is a device that records sensor information at regular intervals so that information can be analyzed to understand phenomenon that are hard to observe directly. THIS PAGE is a consolidated set of links to the many Arduino-based logger tutorials that we’ve released over time, with some commentary to put them in context: 

Jump links to the sections of this page:


An Arduino UNO based logger

The original Arduino platform started as a circuit board built around an Atmel AVR microcontroller with connections broken out so you can attach wires to it more easily. It’s really the integrated development environment (called the IDE) that makes programming an Arduino so easy for beginners. The IDE handles a lot of chip specific changes when compiling code to work with a specific processor.  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 physically. That “hardware abstraction layer” isn’t meant to be the pinnacle of efficiency, but rather to make it as easy to program as possible. That’s what people new to hardware level coding love about Arduino and of course, that’s also what people who know a lot about direct chip programming hate about it.

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 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 can 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. Here are a few tutorials we produced back when we were still using UNO’s for the classroom labs:

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.


A 3-Part Pro Mini Based Logger (w SD card)

MasonsSensorPotting

The 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 capabilities of a Pro Mini, you can switch to a similar board with the more capable 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:


Our 1st Academic Paper

In 2018:  We published our first paper showing data captured with these loggers:  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. A “modules & jumper wires” approach made it easier to change components to create 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.


The 3-Part Classroom logger (‘Solderless’ with Housing)

This ‘solderless’ build was easier for instructors facing the off site challenges of Covid-19 as kits could simply be mailed out to remote students.

In 2020:  We developed a classroom build which uses Dupont connectors instead of soldering and reduce the assembly time to about 1.5 hours. Dr. Beddow’s instrumentation class used these 3-module loggers for several years, and that feedback informed this layout which enables a variety of student projects via the breadboards while keeping within the time constraints of a typical lab schedule. The 3-Module logger code provides a functional temperature & light level logger without adding any extra sensors.
CLICK HERE to see the 2020 classroom logger build tutorial.


A 2-Part logger that Saves Data to EEprom

20231128_e360_schematic_400x240

In 2022:  We refined the logger into a simpler 2-module design by removing the SD card. Sensor data now gets saved to an I2C EEprom and the logger can run more than a year on a Cr2032 coin cell. Data download and logging parameters are set through the serial monitor window in the IDE. This design uses off-the-shelf parts that are globally available and this brings the total cost for a working logger below $10 which is lower than the cost of many sensors. Several students are building & deploying this logger for their research projects.
CLICK HERE to see the 2-Part logger build tutorial from 2022


The e360: A 2-Part Classroom Logger with breadboards

2023 e360 2-Part Logger Assembly

In 2023:  We adapted that 2-module logger for use in the classroom by adding mini breadboards and a 3D printed rail to support them. The whole assembly fits inside a standard 50mL centrifuge tube which is waterproof to several meters depth. This logger has been tested in Dr. Beddows Instrumentation classes where the students did experiments with light, temperature and pressure sensors. The LDR can be calibrated using a BH1750 Lux sensor, while the NTC thermistor can be calibrated with a ‘classroom scale’ method using insulated lunch boxes. The code has been dramatically simplified to make it easier for novice users to add new sensors. This combination may well be as minimal as it is possible to go while still offering students the flexibility to develop their own final projects.
CLICK HERE to see the e360 logger build tutorial.


Sensor & Calibration Tutorials

To truly succeed the Open Science Hardware movement must move beyond technical proof of concept and financial considerations and also transfer working knowledge about sensor calibration, deployment strategies, and data interpretation. We are constantly developing DIY methods to bring inexpensive sensors up to research standards with a special focus on techniques achievable by students that lack access to expensive laboratory equipment:

A hard won lesson from more than a decade of DIY sensor development is that you can never replicate real-world conditions; especially the kind of thermal cycling and vibration you see during weather events. So the first deployment of any new design should really be considered part of beta testing. That initial data might prove useful for the original research, but it’s far more likely the first time series will only show you how to improve your installation and tune your code. Only then do you start getting the information you originally built the logger for. That first data also helps you check that your sensor capabilities are a good match to the system. Natural phenomenon often have non-linear physical hysteresis and characterizing that usually requires many more sensors than you initially thought. Extra units also protect you from data loss if a machine dies and you’ll need multiple records for comparison later on when those sensors eventually develop some kind of error due to contamination, drift, etc. Even commercial equipment fails up to 27% of the time so its a good rule of thumb that important installations require 3x sensor redundancy. Things that tend to fail most relate to moisture/leaks, parts that physically move, and exposed wires that get chewed on by animals. If you put a new toy in some animals environment, they will play with it! So you must hide everything or ‘something’ will mess with your installations enough to bump-disconnect the batteries.


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.

A stacked screw terminal build (from 2017) gets zip tied to an end-cap for deployment  inside our 2″ underwater housing.

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 20 μA while it sleeps between readings. We usually removing the ProMini regulator and run from two Lithium AA batteries but replacing the regulator with an MCP1702-3302E/TO is another reliable low-power option if your sensors require more stability in the supply voltage.  Each optimization step adds a a bit more complexity to the logger, but these modifications get you to multi-year deployments comparable to most commercial sensors. Even with the plethora of cheap MCU options available these days, it’s still hard to beat a $2 Pro Mini clone for stand alone applications that need to handle hardware interrupts. Chip based sensors from the hobbyist market rarely last more than 2-3 years outdoors, so sleep currents below 20μA (with sensors) mean that our field loggers can run their entire deployment lifetime on a single set of batteries. With the impact that used batteries have on our environment, that was an important goal for the project.

For surface and ‘shallow’ water sensors we use a shorter DIY housing with fewer parts & faster assembly. Sensor dongles are easily replaced if they fail via the threaded pass-through fittings.

Perhaps the most important thing to understand about building your own dataloggers is that although the parts can be had for less than $30, cost alone is not enough to justify the time you will spend on testing & 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. Dynamically increasing the sampling rate in response to environmental conditions is easy to accomplish when you control the code, but it’s a very expensive option – if it’s even available – in commercial sensors.  It’s often necessary to create unique devices for the specific questions you are working on: we developed our tilt-flow sensors after discovering that none of the commercial sensors worked very well in coastal cave environments with shifting haloclines. This is a common problem in scientific research, and it continues to motivate our ongoing efforts to refine this system. One thing we have not developed is wireless connectivity because it does not work in flooded caves. Even above ground, lost network connectivity is the most common technical problem in all but the most controlled environments.

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.