УРЛАГ
ГОО САЙХАН БА ЭРҮҮЛ МЭНД
ГАРААР ХИЙСЭН
СОЁЛ БА ТҮҮХ
ҮЗВЭР НААДАМ
БАЙГАЛЬ ОРЧИН
ХООЛ БА УНДАА
УРВУУ ИНЖЕНЕРЧЛЭЛ
ШИНЖЛЭХ УХААН
СПОРТ
ТЕХНОЛОГИ
ӨМСДӨГ ХЭРЭГСЭЛ
Data-Logging Thermometer
Ed

Зохиогч

Ed

14. Наймдугаар сар 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.

Materials for this step:

microSD ShieldmicroSD Shield1 ширхэг

Tools needed:

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.

Materials for this step:

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.

Materials for this step:

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
Estimated Total
$80.00

CC0 Нийтийн домэйн

Энэ загвар CC0 дор гаргагдсан. Та зөвшөөрөл авахгүйгээр хуулах, өөрчлөх, түгээх, ашиглах боломжтой.

Загвараар дамжуулан бүтээгдэхүүн худалдаж авч Бүтээгчийг дэмжээрэй Бүтээгчийн шимтгэл Борлуулагчаар тогтоосон, эсвэл энэ загварын шинэ хувилбар үүсгэж орлогоо хуваахын тулд өөрийн загварт холбоос болгон оруулна уу.

Хэлэлцүүлэг

(0)

Нэвтрэх хэлэлцүүлэгт нэгдэхийн тулд

Loading comments...