예술
뷰티 및 웰니스
공예
문화 및 역사
엔터테인먼트
환경
음식 및 음료
역공학
과학
스포츠
기술
웨어러블
Data-Logging Thermometer
Ed

작성자

Ed

14. 8월 2026FI
2
0
0
0
0

Data-Logging Thermometer

A thermometer that writes every reading to a microSD card as CSV, so the record survives after the power goes. A waterproof DS18B20 probe on the 1-Wire bus, a microSD shield on SPI, an Arduino Uno in between. The probe is sealed in a stainless tube, so it can go into soil, a fermenter, a fridge or a stream with no further packaging. Accuracy is the sensor's own: plus or minus 0.5 degrees Celsius between -10 and +85 degrees Celsius, over a full range of -55 to +125.
초급
2 hours

안내

1

Solder headers to the microSD shield

Solder the stacking headers to the microSD shield.

  1. Seat the headers in the shield from the top.
  2. Tack one pin at each end first, then check the header sits square before doing the rest.
  3. Give each joint about two seconds of heat.
A dull, blobbed joint on an SPI line reads cards intermittently — which looks like a bad card, not a bad joint.

이 단계의 재료:

microSD ShieldmicroSD Shield1

필요한 도구:

Ryobi ONE+ RSI18-0 Cordless Soldering IronRyobi ONE+ RSI18-0 Cordless Soldering Iron
2

Wire the probe — pin by pin

Stack the shield on the Uno, then wire the probe on the breadboard.

  1. Probe red → Arduino 5V
  2. Probe black → Arduino GND
  3. Probe yellow (data) → Arduino D2
  4. 4.7 kΩ resistor between D2 and 5V

The shield already uses D11 MOSI, D12 MISO, D13 SCK and D8 as card select. Leave those four alone.

The 4.7 kΩ pull-up is not optional. The 1-Wire bus is open-drain: without it the bus never rises and every reading comes back -127.

이 단계의 재료:

Temperature Sensor - Waterproof (DS18B20)Temperature Sensor - Waterproof (DS18B20)1
Arduino Uno R3 SMDArduino Uno R3 SMD1
Resistor Kit - 1/4W (500 total)Resistor Kit - 1/4W (500 total)1 키트
Breadboard - ClassicBreadboard - Classic1
Jumper Wires Premium M/M 20 AWG - 15.5 cm (Pack of 10)Jumper Wires Premium M/M 20 AWG - 15.5 cm (Pack of 10)1
3

Power it, and decide how it will run

For setup and for reading the serial monitor, the USB-B cable from the computer both powers the board and carries the upload.

To leave it logging away from a computer, feed 7–12 V into the Uno's barrel jack instead, or a regulated 5 V into the 5V pin. Do not do both at once.

The card only receives what was written and closed. Pulling power mid-write loses at most the sample in flight, because the sketch closes the file after every line.

이 단계의 재료:

USB-B CableUSB-B Cable1
4

Format the card

Format the microSD card as FAT32.

The Arduino SD library cannot read exFAT, which is what cards larger than 32 GB are formatted with from the factory. A card that 'does not work' is nearly always this.
5

Upload the logging sketch

Install OneWire and DallasTemperature via Library Manager. SD and SPI ship with the IDE. Select Tools → Board → Arduino Uno, then Upload.

temp_logger.inoarduino
// Data-Logging Thermometer
// DS18B20 (1-Wire, D2) -> Arduino Uno -> microSD Shield (SPI, CS on D8)
// Appends one CSV line per reading: millis,celsius

#include <OneWire.h>
#include <DallasTemperature.h>
#include <SPI.h>
#include <SD.h>

const int  ONE_WIRE_PIN = 2;      // DS18B20 data. Needs a 4.7k pull-up to 5V.
const int  SD_CS_PIN    = 8;      // Card select on the SparkFun microSD Shield
const unsigned long INTERVAL_MS = 10000;   // one sample every 10 s
const char LOG_FILE[]   = "templog.csv";

OneWire oneWire(ONE_WIRE_PIN);
DallasTemperature sensors(&oneWire);

void setup() {
  Serial.begin(9600);
  sensors.begin();

  if (!SD.begin(SD_CS_PIN)) {
    // Card absent, not FAT32, or CS on the wrong pin. Stop rather than
    // pretend to log -- a logger that silently writes nothing is worse
    // than one that refuses to start.
    Serial.println(F("SD init failed: card absent, not FAT32, or wrong CS pin"));
    while (true) { }
  }

  // Write the header once, only if the file does not exist yet.
  if (!SD.exists(LOG_FILE)) {
    File f = SD.open(LOG_FILE, FILE_WRITE);
    if (f) { f.println(F("millis,celsius")); f.close(); }
  }
  Serial.println(F("logging to templog.csv"));
}

void loop() {
  sensors.requestTemperatures();
  float c = sensors.getTempCByIndex(0);

  if (c == DEVICE_DISCONNECTED_C) {
    // -127 means the bus never went high: almost always the missing pull-up.
    Serial.println(F("no sensor -- check the 4.7k pull-up between D2 and 5V"));
  } else {
    File f = SD.open(LOG_FILE, FILE_WRITE);   // FILE_WRITE appends
    if (f) {
      f.print(millis());
      f.print(',');
      f.println(c, 2);
      f.close();          // close == flush; a power cut loses at most this sample
    } else {
      Serial.println(F("could not open log file"));
    }
    Serial.println(c, 2);
  }

  delay(INTERVAL_MS);
}
6

Verify against a known point

Put the probe in a stirred ice-water bath — ice and water together, not ice alone.

  1. A correct DS18B20 settles at 0.0 °C ± 0.5.
  2. A constant -127 means no sensor on the bus: pull-up missing or data on the wrong pin.
  3. A constant 85.0 is the sensor's power-on default — it was read before its first conversion finished.
Calibrate against a known point before trusting any logged series. An uncalibrated log is a graph of nothing.

재료

7

필요 도구

1
예상 총액
₩1,134

CC0 퍼블릭 도메인

이 블루프린트는 CC0로 공개되었습니다. 어떤 목적으로든 자유롭게 복사, 수정, 배포 및 사용할 수 있습니다.

제품 구매를 통해 메이커를 지원하세요. 판매자가 설정한 메이커 커미션 을 받거나, 이 블루프린트의 새로운 반복을 만들어 연결로 포함시킬 수 있습니다.

토론

(0)

로그인 하여 토론에 참여하세요

댓글 로딩 중...