DS18B20 digitaler Temperatursensor - Produktvorstellung - AZ-Delivery

In this video, we would like to introduce you to the DS18B20 temperature sensor. We offer the sensor in three versions: as a single sensor for soldering, as a sensor on a board, and as a protected sensor with cable. The technical specifications of both variants are presented as part of the video. In addition, we show several sample circuits to show how the sensors can be used and how the cabling works.

! Attention: If the video is not displayed for you, you should check your cookie settings. You have to accept all cookies so that the video is visible!

Here you will find the presented sensors:

DS18B20 Digital temperature sensor

DS18B20 Digital stainless steel temperature sensor with 1m cable

DS18B20 Digital stainless steel Temperature sensor with 3M cable

DS18B20 Breakout with a circuit board


Wiring DS18B20 unplacerated:

Code DS18B20 unplacerated:

/*
    ___ _____        ____       ___                      
   /   /__  /       / __ \___  / (_)   _____  _______  __
  / /| | / / ______/ / / / _ \/ / / | / / _ \/ ___/ / / /
 / ___ |/ /_/_____/ /_/ /  __/ / /| |/ /  __/ /  / /_/ / 
/_/  |_/____/    /_____/\___/_/_/ |___/\___/_/   \__, /  
                                                /____/   
 Product, data sheet and Pinout at:
  https://www.az-delivery.de/

 Project: DS18B20 circuit
 Date: 02/2022

*/
#include <OneWire.H>
#include <Dallast temperature.H>

const intimately temp sensor=26;
/*
 If there is an error 'void direct modeinput (uint32_t)'
 Install an earlier version of OneWire
*/
OneWire OneWire(temp sensor);
Dallast temperature sensor(&OneWire);

// display
#define Screen_Width 128
#define Screen_height 64
#include <Adafruit_gfx.H>
#include <Adafruit_ssd1306.H>
Adafruit_ssd1306 display1(Screen_Width, Screen_height, &Wire, -1);

void set up() {
  Serial.Begin(115200);

  display1.Begin(Ssd1306_switchcapvcc, 0x3c);
  delay(100);
  
  sensor.Begin();
}

void loop() {
  
  sensor.Request temperatures(); 
  float tempc = sensor.Gettempcby index(0);
  float tempf = sensor.ghettic index(0);     
  Serial.print(tempc);
  Serial.print("ºC");
  Serial.print(tempf);
  Serial.print("ºF");
 
  display1.Clear display();
  display1.SettextSize(1);
  display1.SettextColor(White);
  display1.setcursor(15, 10);
  display1.print("DS18B20 Sensor");
  display1.setcursor(15, 25);
  display1.print("Temp:"+String(tempc)+"C");
  display1.setcursor(15, 40);
  display1.print("Temp:"+String(tempf)+"F");
  display1.drawrect(0,0,128,64,SSD1306_White);
  display1.display();
  
  delay(2000);
}

Wiring three DS18B20 unpleasant:


Code three DS18B20 unplacerated:

/*
    ___ _____        ____       ___                      
   /   /__  /       / __ \___  / (_)   _____  _______  __
  / /| | / / ______/ / / / _ \/ / / | / / _ \/ ___/ / / /
 / ___ |/ /_/_____/ /_/ /  __/ / /| |/ /  __/ /  / /_/ / 
/_/  |_/____/    /_____/\___/_/_/ |___/\___/_/   \__, /  
                                                /____/   
 Product, data sheet and Pinout at:
  https://www.az-delivery.de/

 Project: 3x DS18B20 circuit
 Date: 02/2022

*/
#include <OneWire.H>
#include <Dallast temperature.H>
#define Temperature_Precision 12
const intimately temp sensor=26;
/*
 If there is an error 'void direct modeinput (uint32_t)'
 Install an earlier version of OneWire
*/
OneWire OneWire(temp sensor);
Dallast temperature sensor(&OneWire);
Submissive dress one, two, three;
float tempc1, tempc2, tempc3;

// display
#define Screen_Width 128
#define Screen_height 64
#include <Adafruit_gfx.H>
#include <Adafruit_ssd1306.H>
Adafruit_ssd1306 display1(Screen_Width, Screen_height, &Wire, -1);

void geSensensorresolution(){
 sensor.set resolution(one, Temperature_Precision);
 sensor.set resolution(two, Temperature_Precision);
 sensor.set resolution(three, Temperature_Precision);
 Serial.print("");
 Serial.print("Device 0 Resolution:");
 Serial.print(sensor.tresolution(one), Dec);
 Serial.print();
 Serial.print("Device 1 Resolution:");
 Serial.print(sensor.tresolution(two), Dec);
 Serial.print();
 Serial.print("Device 2 Resolution:");
 Serial.print(sensor.tresolution(three), Dec);
 Serial.print();

}

void Getsor address(){
 IF(!sensor.tattaddress(one, 0)) {
  Serial.print("Unwhols to Find Address for Device"); }
 IF(!sensor.tattaddress(two, 1)) {
  Serial.print("Unwhol to Find Address for Device 1"); }
 if(!sensors.getAddress(three, 2)) {
  Serial.println("Unable to find address for Device 2"); }

  Serial.print("Device 0 Address: ");
  printAddress(one);
  Serial.println();
  Serial.print("Device 1 Address: ");
  printAddress(two);
  Serial.println();
  Serial.print("Device 2 Address: ");
  printAddress(three); 
}

void printAddress(DeviceAddress deviceAddress) {
 for(uint8_t i = 0; i < 8; i++) {
 if(deviceAddress[i] < 16) Serial.print("0");
 Serial.print(deviceAddress[i], HEX);
 }
}

void printResolution(DeviceAddress deviceAddress) {
 Serial.print("Resolution: ");
 Serial.println(sensors.getResolution(deviceAddress));
}

float printData(DeviceAddress deviceAddress) {
 float tempC = sensors.getTempC(deviceAddress);
 Serial.print("Temp: ");
 Serial.print(tempC);
 Serial.print(" C");

 Serial.print(" | Sensoradresse: ");
 printAddress(deviceAddress);
 Serial.println();
 return tempC;
}


void setup() {
  Serial.begin(115200);

  display1.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  delay(100);
  Serial.println("3xDS18B20 auf einem Pin auswerten.");
  sensors.begin();
  Serial.print(sensors.getDeviceCount(), DEC);
  Serial.println(" gefunden.");
  Serial.print("Parasite power ist: ");
  if(sensors.isParasitePowerMode()) {
    Serial.println("ON");
  }
  else {
   Serial.println("OFF");
  }

  getSensorAdresses();
  getSensorResolution();

}



void loop() {
  

  Serial.print("Request...");
  sensors.requestTemperatures();
  Serial.println("fertig");
  tempC1 = printData(one);
  tempC2 = printData(two);
  tempC3 = printData(three);
  delay(1000);


  display1.clearDisplay();
  display1.setTextSize(1);
  display1.setTextColor(WHITE);
  display1.setCursor(15, 10);
  display1.println("Sensor1: "+String(tempC1)+" C");
  display1.setCursor(15, 25);
  display1.println("Sensor2: "+String(tempC2)+" C");
  display1.setCursor(15, 40);
  display1.println("Sensor3: "+String(tempC3)+" C");
  display1.drawRect(0,0,128,64,SSD1306_WHITE);
  display1.display();
  
  delay(2000);
  
}

          

Lascia un commento

Tutti i commenti vengono moderati prima della pubblicazione