Water Temperature Sensor (DS18B20)
The DS18B20 is a digital temperature sensor that is addressed via a 1-Wire bus. It can measure temperatures from -55°C to +125°C and is waterproof. It is therefore ideal for measuring water temperature.
warning
To use the sensor with the senseBox you need the 1-Wire adapter. You can purchase it here.
Water Temperature Sensor
Connection

Die Komponente wird am I2C Port angeschlossen.
Programming (Arduino)
Software Library
To program the sensor in Arduino you need to install the software libraries OneWire and DallasTemperature.
Code
This code reads the temperature from the sensor and outputs it to the serial interface.
#include <senseBoxIO.h>
#include <OneWire.h> // http://librarymanager/All#OneWire
#include <DallasTemperature.h> // http://librarymanager/All#DallasTemperature
#define ONE_WIRE_BUS 1
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
float getWaterTemp(){
sensors.requestTemperatures();
sensors.getTempCByIndex(0);
}
void setup() {
Serial.begin(9600);
sensors.begin();
}
void loop() {
Serial.print("Wassertemperatur: ");
Serial.print(getWaterTemp());
}
Programming (Blockly)
In Blockly you can read the sensor with the following block: