กลับไปหน้ารวมไฟล์
deek-robot-datalogging-shield-tutorial-for-mega-98dc22-en.md

A lot of people seem to get a Deek-Robot datalogging shield and expect it to work easily on a Mega2560. But it doesn't work with the normal SD library, so they have to ask for help on the forum. Turns out that it is not hard at all to use this shield on a Mega2560.

Start by connecting pin A4 to pin 20, and pin A5 to pin 21 using two jumper leads. Then install the RTClib library through the library manager.

RTClib library

Then upload the DS1307 example code from the RTClib example code.

Find the ds1307 example from RTClib

That should set the time chip to the compile time.

Next, download and install https://drive.google.com/file/d/1T5GEPMKtLjfiJvdL_DHEbsTk9sAIzThP/view library.

Then upload the Datalogger example located under SD.

Datalogger example under SD

You will then need to change lines 49 - 53 from this:

 if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
while (1) ;
}

to this:

if (!SD.begin(10, 11, 12, 13)) {
Serial.println("Card failed, or not present");
// don't do anything more:
while (1) ;
}

You will need to do this in every code that you write if it uses this Datalogging shield.

This Datalogging shield does not work with SD cards that are larger than 2 gigabytes. It also does not work with micro sd card adapters.

If anyone finds that this does not work, please post in the comments and I will help you ASAP!

EXPANDED TECHNICAL DETAILS

Advanced Storage & Timekeeping

This tutorial optimizes the use of the Deek-Robot Shield specifically for the high-pin-count Arduino Mega.

  • Combined Shield Utility: Integrates a MicroSD Card slot for storage and a DS1307 Real-Time Clock (RTC) for timestamping.
  • Buffer Logic: The Arduino Mega's large SRAM is used to "Buffer" sensor data before writing to the SD card, reducing power consumption and wear on the flash memory.

Field Reliability

  • Timestamped Logs: Every data entry is saved as a row in a .CSV file with an exact millisecond timestamp, making it ready for professional scientific analysis.

ข้อมูล Frontmatter ดั้งเดิม

title: "Deek-Robot Datalogging Shield Tutorial for Mega"
description: "For anyone struggling with using their deek-robot datalogging shield on a Mega (not ADK)."
author: "cowboydaniel"
category: ""
tags:
  - "data collection"
views: 2450
likes: 0
price: 1120
difficulty: "Easy"
components:
  - "1x Arduino Mega 2560"
  - "1x Deek-robot Datalogging Shield"
tools: []
apps:
  - "1x Arduino IDE"
downloadableFiles: []
documentationLinks: []
passwordHash: "a576798c5998ef24f140e462b8d66d8f7b8b8be31b075fb5bad1e6ef94256800"
encryptedPayload: "U2FsdGVkX1/cxaRNcFI3uxfDL627ONBSUOVPNcnGD3v/KmD5OYL0L41i4PJwKyzkbEQ8uBxPTPAtBTxc+cxQ5g+Wh+Io76N0IJtr7C8Gu9A="
seoDescription: "Learn to set up Deek-Robot Datalogging Shield on Mega. Essential guide for troubleshooting and data logging."
videoLinks: []
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/deek-robot-datalogging-shield-tutorial-for-mega-98dc22_cover.jpg"
lang: "en"