The Adafruit Feather M0 Adalogger is a versatile and portable development board that integrates the power of a microcontroller with the convenience of data logging. Based on the ATSAMD21G18 ARM Cortex M0 processor, it offers a rich set of features including an onboard microSD card slot for data storage and a real-time clock (RTC) for time-stamping data. This makes it an excellent choice for projects requiring data collection, time-sensitive operations, or portable instrumentation.
Pin Number | Function | Description |
---|---|---|
1 | GND | Ground |
2 | BAT | Battery positive voltage (3.7-4.2V LiPo) |
3 | EN | Enable pin for the 3.3V regulator |
4 | USB | USB power (5V from host computer) |
5-14 | Digital Pins | Digital I/O, PWM output, or interrupt detection |
15-20 | Analog Pins | Analog inputs or digital I/O |
21 | AREF | Analog reference voltage |
22 | SCK | SPI clock |
23 | MISO | SPI Master In Slave Out |
24 | MOSI | SPI Master Out Slave In |
25 | SDA | I2C Data |
26 | SCL | I2C Clock |
27 | RX | UART Receive |
28 | TX | UART Transmit |
29 | RST | Reset pin |
30 | 3V | 3.3V output from the regulator |
Powering the Board: The Feather M0 Adalogger can be powered via USB, a LiPo battery, or an external power supply. Ensure that the power source is within the specified voltage range.
Connecting Peripherals: Connect sensors and peripherals to the appropriate pins. Use digital or analog pins based on the requirements of the peripheral.
Data Logging: Insert a formatted microSD card into the slot for data logging. Use the onboard RTC to timestamp your data.
Programming: The board can be programmed via the Arduino IDE. Select "Adafruit Feather M0" from the board manager.
Q: Can I power the Feather M0 Adalogger with a 5V supply? A: Yes, you can power it through the USB connection with 5V, but do not apply 5V directly to the 3.3V pin.
Q: How do I set the time on the RTC? A: You can set the time on the RTC using the Arduino library for the RTC chip. Refer to the example code provided by Adafruit.
Q: What is the maximum size of SD card supported? A: The Feather M0 Adalogger supports SD cards up to 32GB formatted as FAT16 or FAT32.
Below is an example code snippet for initializing the RTC and SD card on the Adafruit Feather M0 Adalogger. This code is written for use with the Arduino IDE.
#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include <RTClib.h>
RTC_PCF8523 rtc;
const int chipSelect = 10; // SD card CS pin
void setup() {
Serial.begin(9600);
// Initialize the RTC
if (!rtc.begin()) {
Serial.println("Couldn't find RTC");
while (1);
}
// Initialize the SD card
Serial.print("Initializing SD card...");
if (!SD.begin(chipSelect)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");
}
void loop() {
// Create or open a file and write data to it
File dataFile = SD.open("datalog.txt", FILE_WRITE);
if (dataFile) {
DateTime now = rtc.now(); // Get current time
dataFile.print(now.unixtime()); // Write the time to the file
dataFile.print(", ");
// Write sensor data here
dataFile.println("Sensor data");
dataFile.close(); // Close the file
} else {
// if the file isn't open, pop up an error:
Serial.println("error opening datalog.txt");
}
delay(1000); // Wait for 1 second before the next loop
}
Remember to wrap the code comments as needed to limit line length to 80 characters. This example assumes you have the necessary libraries installed and that you have set the correct board and port in the Arduino IDE.