Datalogging Examples

Examples of Datalogging Using Microcontrollers

View the Project on GitHub tigoe/DataloggingExamples

Sensor-based Data Logging Using Microcontrollers

There are several ways to save data from a sensor attached to a microcontroller. If you’re connected to a personal computer, you can simply send the data from the controller to the personal computer serially, and save it to a file. If you’ve got an SD card attached to the microcontroller, you can save the data to the SD card. Or, if you have access to the internet and a device that can connect to a server, you can save the data to a server.

This site contains a number of data logging examples I’ve written for different workshops on the topic over the years. The most recent examples reflect my most up-to-date practices, of course.

2022: Notes on Timestamps

Notes on real-time clocks in Arduino and the JavaScript Date API. These are useful in tracking time on a client or server.

2021: WiFi HTTP and MQTT Dataloggers

This tutorial, written for a personal project using Arduino Nano 33 IoT boards, shows you how to connect to a server to log data. It includes a node.js-based server script example, and a Google Sheets script that can take HTTP requests, along with two Arduino examples using the WiFi libraries and the ArduinoHttpClient library. There’s also an example of how to do this with MQTT.

2019: MKR Series Examples

In 2019 I started writing examples for the MKR series of Arduinos, which are based on the SAMD21 ARM M0+ processor. The built-in realtime clock on the MKR boards, along with other features, make them my current favorite for datalogging. This overview provides an introduction and some links to examples.

2016: Brown Institute for Media Innovation Workshop

I presented a workshop at the Brown Institute for Media Innovation at Columbia University. These examples are from that workshop. In this workshop, you’ll find examples of how to use a Feather M0 Adalogger from Adafruit.com to read data from sensors and save to an SD card.

2012: Citizen Science Cybersummit Workshop

I presented an introductory workshop at the Citizen Science Cybersummit in London in 2012. These examples are from that workshop. In the examples from that workshop, you’ll find examples on how to read a DHT11 temperature and humidity sensor and log data in three ways: