Overview
Learn how to build a production-ready data logger that combines multiple sensors with real-time clock timestamps, data filtering, and CSV output. This guide demonstrates the MHRTCSensV2 (Multi-Harmony RTC) sensor for timestamped data logging.What You’ll Build
A complete data logger that:- Records temperature, humidity, and light sensor data
- Adds timestamps to all readings using RTC
- Applies moving average and exponential filters
- Outputs data in CSV format for easy analysis
- Provides serial commands for debugging
Hardware Requirements
- ESP32, ESP8266, or Arduino board
- MHRTC module (pins 4, 5, 6)
- DHT22 temperature/humidity sensor (pin 2)
- Light sensor on analog pin A0
- Serial connection for data output
Complete Example
Understanding Data Filters
Kinematrix provides built-in filters to smooth noisy sensor data:Moving Average Filter
Averages the last N readings to reduce noise:Exponential Filter
Weighted average favoring recent readings:Accessing Filtered Data
Serial Commands
The example supports interactive debugging commands:| Command | Description |
|---|---|
debug | Print detailed sensor information |
time | Display current RTC time |
header | Reprint CSV header |
CSV Output Format
The logger outputs data in CSV format for easy import into spreadsheet applications:RTC Configuration
Setting Date and Time
Formatting Date/Time Output
Advanced Features
Power Monitoring Integration
Add power monitoring to your data logger:SD Card Storage
For persistent data logging, integrate with SD card:Alert System
Add threshold alerts to your logger:Troubleshooting
RTC not keeping time
RTC not keeping time
- Check battery connection on RTC module
- Verify pins 4, 5, 6 are correctly wired
- Set initial time using
setDateTime()after power loss
Sensor readings show NaN
Sensor readings show NaN
- Check sensor wiring and power
- Verify correct pin numbers in constructor
- Ensure sufficient delay between readings (DHT22 needs 2 seconds)
CSV data not appearing
CSV data not appearing
- Verify
logData()is being called - Check
isUpdated()conditions - Ensure sensors initialized successfully
- Increase baud rate to 115200 for reliable output
Next Steps
LED Control
Trigger LEDs based on sensor thresholds
Multi-Platform Development
Deploy your logger to different hardware
Debugging
Advanced debugging techniques
Basic Sensor Reading
Review sensor fundamentals