Codey OnlineLibreria di componenti Arduino ed ESP32 › DS18B20 waterdichte probe temperatuursensor 1 m cable
DS18B20 waterdichte probe temperatuursensor 1 m cable
Sensori

DS18B20 waterdichte probe temperatuursensor 1 m cable

Il DS18B20 è un sensore di temperatura digitale in una sonda impermeabile con cavo da 1 m. Comunica tramite l’interfaccia 1-Wire ed è comunemente usato per misurare liquidi, aria esterna o altri ambienti in cui il sensore deve essere protetto dall’umidità.

Larghezza: 22.1 mm

Pinout — DS18B20 waterdichte probe temperatuursensor 1 m cable

Pin Segnale Descrizione
VDD power Positive supply for the DS18B20 probe, typically 3.0–5.5 V.
DQ data 1-Wire digital data line; requires a pull-up resistor to VDD.
GND ground Ground return for the DS18B20 temperature probe.

Schema di cablaggio di esempio — DS18B20 waterdichte probe temperatuursensor 1 m cable

Da A Filo
board:5V x1:VDD red
board:GND x1:GND black
board:D2 x1:DQ green

Codice Arduino di esempio — DS18B20 waterdichte probe temperatuursensor 1 m cable

Questo esempio è stato scritto e verificato in compilazione per arduino-uno. Codey Online lo adatta a qualsiasi altra scheda supportata.

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

const uint8_t ONE_WIRE_BUS = 2;

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

void setup() {
  Serial.begin(9600);
  while (!Serial) {
    ;
  }

  sensors.begin();
  Serial.println("DS18B20 temperature sensor example");
}

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

  if (temperatureC == DEVICE_DISCONNECTED_C) {
    Serial.println("Sensor not found or disconnected");
  } else {
    Serial.print("Temperature: ");
    Serial.print(temperatureC);
    Serial.println(" C");
  }

  delay(1000);
}

Componenti correlati

18650 Battery Shield with USB-C Charger and 5V Boost Converter

18650 Battery Shield with USB-C Charger and 5V Boost Converter

2.4 inch OLED Display I2C 3.3V

2.4 inch OLED Display I2C 3.3V

3.5 inch TFT LCD Shield

3.5 inch TFT LCD Shield

50kg Load Cell Weight Sensor

50kg Load Cell Weight Sensor

Crea il tuo progetto Arduino o ESP32 con l'AI

Descrivi cosa vuoi realizzare. Codey Online scrive il codice, disegna lo schema di collegamento, lo compila e programma la tua scheda direttamente dal browser.

Inizia gratis