Datalogging Examples

Examples of Datalogging Using Microcontrollers

tigoe.github.io
WiFi Datalogging
  Node.js Datalogging Server
  Google Sheets Datalogging Server
Tracking Time
MKR Series Datalogging
Home

This project is maintained by tigoe

Introduction to the Feather M0 Adalogger

In this workshop you’ll be working with the Adafruit Feather M0 Adalogger microcontroller board. This board uses a Cortex ARM M0+, which is the same processor as the Arduino Zero. That means it’s Arduino-compatible, and a very capable processor for datalogging. The Adafruit Guide to the Feather M0 Adalogger is a thorough introduction. This page is a quick-reference only.

Functions of the Board

The Feather M0 Adalogger can read various sensors using its digital and analog inputs and its asynchronous serial and I2C communications pins. It can also read and write from an attached SD card. It can communicate with a personal computer via USB as well. It has a Lithium-Poly (LiPo) battery charger built-in so you can charge a battery while you’re programming, then unplug and run off the battery independently. There’s also a built-in real-time clock that can keep accurate time and two built-in LEDs that you can use to indicate what’s going on.

Below is the pin diagram for the board. Many of the pins have multiple functions. For the purposes of this workshop, the important pins are as follows:

Feather M0 Adalogger pin diagram" align="middle

Adalogger M0 pin diagram. Click here for a more detailed version. For more on the pin functions, see this link.

Setting up the board

To test your board, click the Tools Menu –> Boards option, and choose “Adafruit Feather M0 (Native USB Port)”. Then click the Tools menu –> Port option, and choose the port with “(Adafruit Feather M0)” at the end of it. THen click the File Menu –> Examples option –> Basics –> Blink to open a sketch that will blink the red LED on the board. Click the Upload button from the toolbar and you should see the sketch upload and the red LED will begin to blink.

The Arduino Toolbar" align="middle

(The Arduino IDE toolbar)

Connecting the Sensors

Each of the examples in this repository uses a different sensor with the Feather, and you’ll need to wire the sensor to the board before uploading the code that reads it. Disconnect your board from power before wiring your sensors. Below are the wiring diagrams for each sensor.

Pushbutton

Pushbutton connected to a Feather" align="middle (Pushbutton connected to a Feather. Button output pin is attached to digital pin 5 of the microcontroller.)

Potentiometer

Potentiometer connected to a Feather" align="middle (Potentiometer connected to a Feather. Potentiometer output pin is attached to analog pin 0 of the microcontroller.)

DHT11 Temperature and Humidity Sensor

DHT11 Temp/Humidity sensor connected to a Feather" align="middle (DHT11 Temp/Humidity sensor connected to a Feather. Sensor output pin is attached to digital pin 5 of the microcontroller.)

Code example

Code example - Temp/Humidity Datalogger

Microphone

MAX4466 microphone connected to a Feather" align="middle (Max4466 Microphone connected to a Feather. Microphone output pin is attached to analog pin 0 of the microcontroller.)

Code example - Loudness

Code example - Frequency Meter

Light Sensor

GA1A12S202 Log-scale light sensor connected to a Feather" align="middle (GA1A12S202 Log-scale light sensor connected to a Feather. Sensor output pin is attached to analog pin 0 of the microcontroller.)

Code example - Read Lux

Accelerometer

LIS3DH accelerometer connected to a Feather" align="middle (LIS3DH accelerometer connected to a Feather. Sensor SDA and SCL pins are attached to SDA and SCL pins of the microcontroller.)

Code example - Read g’s

Ultrasonic Distance Ranger

Maxbotix LV-EZ0 Ultrasonic Distance Ranger connected to a Feather" align="middle (Maxbotix LV-EZ0 Ultrasonic Distance Ranger connected to a Feather. Sensor output pin is attached to analog pin 0 of the microcontroller.)

PIR Motion Sensor

PIR motiomn sensor connected to a Feather" align="middle (PIR motion sensor connected to a Feather. Sensor output pin is attached to digital pin 5 of the microcontroller.)

Code example

All Code Examples

There are additional code examples for the se sensors, and for the SD card and real-time clock at this link.