The Seeed Studio XIAO Logger HAT is a compact and versatile data logging module designed specifically for the Seeed Studio XIAO series of microcontrollers. It features an onboard SD card slot for data storage, a real-time clock (RTC) for precise timekeeping, and multiple sensor interfaces to facilitate environmental data collection. This HAT is ideal for applications requiring reliable data logging, such as environmental monitoring, IoT projects, and scientific experiments.
The following table outlines the key technical details of the Seeed Studio XIAO Logger HAT:
Parameter | Specification |
---|---|
Manufacturer | Seeed Studio |
Part Number | XIAO Logger HAT |
Dimensions | 21 x 17.5 mm |
Power Supply Voltage | 3.3V (via XIAO microcontroller) |
SD Card Slot | MicroSD (up to 32GB, FAT32 format) |
RTC | DS3231 (battery-backed real-time clock) |
Sensor Interfaces | I2C, UART, and GPIO |
Battery Backup | CR1220 coin cell (for RTC, not included) |
Operating Temperature | -40°C to 85°C |
The XIAO Logger HAT connects directly to the Seeed Studio XIAO microcontroller via its pin headers. Below is the pin configuration:
Pin | Name | Description |
---|---|---|
1 | 3.3V | Power supply input (from XIAO microcontroller) |
2 | GND | Ground connection |
3 | SDA | I2C data line (for RTC and sensors) |
4 | SCL | I2C clock line (for RTC and sensors) |
5 | TX | UART transmit line (for external devices) |
6 | RX | UART receive line (for external devices) |
7 | GPIO | General-purpose input/output |
8 | SD_CS | Chip select for the SD card module |
SD
and RTClib
).Below is an example Arduino sketch to log temperature data from a sensor to the SD card with a timestamp from the RTC:
#include <Wire.h>
#include <RTClib.h>
#include <SD.h>
// Define SD card chip select pin
const int chipSelect = 10;
// Initialize RTC and SD card objects
RTC_DS3231 rtc;
void setup() {
Serial.begin(9600);
// Initialize SD card
if (!SD.begin(chipSelect)) {
Serial.println("SD card initialization failed!");
while (1);
}
Serial.println("SD card initialized.");
// Initialize RTC
if (!rtc.begin()) {
Serial.println("RTC initialization failed!");
while (1);
}
if (rtc.lostPower()) {
Serial.println("RTC lost power, setting time...");
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
}
void loop() {
// Get current time from RTC
DateTime now = rtc.now();
// Simulate reading temperature from a sensor
float temperature = 25.0; // Replace with actual sensor reading
// Open file on SD card
File dataFile = SD.open("datalog.txt", FILE_WRITE);
if (dataFile) {
// Write timestamp and temperature to file
dataFile.print(now.timestamp());
dataFile.print(", ");
dataFile.println(temperature);
dataFile.close();
Serial.println("Data logged.");
} else {
Serial.println("Error opening datalog.txt");
}
delay(1000); // Log data every second
}
SD Card Not Detected
RTC Not Keeping Time
rtc.adjust()
function to set the correct time if the RTC lost power.Sensor Data Not Logging
Power Issues
Q: Can I use an SD card larger than 32GB?
A: No, the XIAO Logger HAT supports microSD cards up to 32GB formatted in FAT32.
Q: What happens if the RTC battery is not installed?
A: The RTC will lose timekeeping functionality when the main power is disconnected.
Q: Can I use this HAT with other microcontrollers?
A: The XIAO Logger HAT is designed for the Seeed Studio XIAO series. Compatibility with other microcontrollers may require additional modifications.