35in1 Sensor Kit - Intelligent Temperature Sensors
The set contains two temperature sensors them the measuring values in °C are economical. One misses of it still the air humidity in %. Both transfer the measuring values about a digital Eindraht protocol in the Arduino.

Temperature and humid sensor DHT11

The sensor misses the temperature with an exactness from ± 2°C and the relative air humidity with an exactness from ± 5%. Both measuring values will transfer in each case in a data package about an Eindraht protocol in the Microcontroler.

The Arduino as well as the sensor DHT11 have an Open-Collector exit also as an entrance can be used. Of the Pullup built-in in the Arduino opposition is used together. To initiate the transference switches of the Arduino the exit for then at least 18 ms on LOW and switches the Pin to entrance. If the sensor recognises this signal LOW by the Data Pin, he begins the transference of the data. He switches the Data Pin as an exit and lays this for 80 µ see on LOW and then again for 80 µ see on HIGH. Afterwards 40 data follow bits. Around the data bits is to be distinguished for 0 bits the exit 50 µ see on LOW and 28 µ see on HIGH during him for 1 bit 50 µ see on LOW and 70 µ see on is high. 40 data bits split themselves on 5 bytes. Humidity high byte, humidity Low byte, temperature high byte, temperature Low byte and test sum.

But one must implement no fear the control of the Arduino port not himself, in addition already there exists a ready library which one can integrate into own programme.

There are two libraries for the Arduino and one for the ESPx. I have decided on the SimpleDHT.

Circuit and test programme:

We connect the Data-Pin of the DHT11 with Pin 2 in the Arduino. However, every other Digitally Pin can be also used.


//Integrate first the library

const byte dataPin = 2; //Data pin of the DHT11

SimpleDHT11 dht11;

void set-up () {
//to spend start of the serial interface around measuring values
Serial.begin (115200);

void loop () {
Serial.println ("=================================");
Serial.println ("measuring values of the DHT11");
//read of the values
byte of temperature = 0;
byte wets = 0;
//we examine whether a mistake it appeared
int err = SimpleDHTErrSuccess;
err = dht11.read (dataPin, &temperatur, &feuchte, ZERO);
if (err! = SimpleDHTErrSuccess) {
Serial.print ("mistake while reading from the DHT11. Mistake = ");
Serial.println (err);
} else {
Serial.print ((int) temperature);
Serial.println ("°C");
Serial.print ((int) wets);
Serial.println ("%H");
//wait 1.5 see of The DHT11 make 1 measurement / see
delay (1500);


To the testing one can breathe on, for example, the sensor, this should raise the temperature and particularly the dampness.

Temperature sensor DS18B20

An intelligent temperature sensor him the measuring values about an Eindraht protocol is also transmitted to this temperature sensor in °C. In contrast to the DHT 11 only the temperature misses of the DS18B20 this, however, with a higher exactness. The exactness amounts ± 0.5 °C in a temperature area of from-10 to 85 °C. The measuring time amounts 0.75see with 12 bits of resolution.

In contrast to the DTH11 the Eindraht protocol is substantially more adaptable. Every sensor has an unequivocal standard number, so that arbitrarily many sensors in the same Eindraht coach can be pursued. There are also other sensors them the same protocol use which can be headed then everybody over a coach.

About a searching command can investigate of the Microcontroler after the initialization which sensors in the coach are connected. Die unequivocal standard number includes also information to identify the type of the sensor around him. To the selection of the values the standard number must be sent always first, so that only one of the sensors books the coach.

Eine other specific feature of the DS18B20 is to be won the possibility the inside required electricity supply from the data line (parasitärer mode), so that only one 2 wire wiring is required.

Of course are available for the DS18B20 also Arduino libraries, namely one for the Eindraht protocol and next for the temperature sensor.

Circuit and test programme

For the circuit we use, in addition, a 7 segment display 4digit-display to indicate the temperature.

For the display we also need a Library:




//Pins for temperature sensor

const byte of coach = 2;

//Pins for display

const byte of tact = 8;
const byte of data = 9;

//Authorities for the libraries

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

//To store Array around device addresses
DeviceAddress addresses;

TM1637Display registers (tact, data);

//global variables for deficit sign in the display

const uint8_t minus [] = {0x40};
const uint8_t plus [] = {0x00};

void set-up () {
//begin serial interface
Serial.begin (115200);

//We determine the Anzah of the sensors in the Eindraht coach
sensoren.begin ();
Serial.print (sensoren.getDeviceCount (), DEC);
Serial.println (" sensors found.");

//Now we check whether the coach in the parasite's era mode is
Serial.print ("Parasitärer a mode is ");
if (sensoren.isParasitePowerMode ()) {
Serial.println (ONE);
} else {
Serial.println ("FROM");

//Now we check whether one of the sensors in the coach a temperature sensor is
if (! sensoren.getAddress (addresses, 0)) Serial.println ("No temperature sensor available!");
//addresses register
Serial.print ("address: ");
printAddress (addresses);
Serial.println ();

//Now we still put the desired resolution (9, 10, 11 or 12 bits)
sensoren.setResolution (addresses, 9);

//To the control we select the value again
Serial.print ("resolution = ");
Serial.print (sensoren.getResolution (addresses), DEC);
Serial.println ();

//Now we switch on the display
anzeige.setBrightness (0x0f);

//function zumDrucken of the temperature of a sensor
void printTemperature (DeviceAddress deviceAddress)
float tempC = sensoren.getTempC (addresses);
Serial.print ("temperature C: ");
Serial.print (tempC);
Serial.print (" temperature fa: ");
Serial.println (DallasTemperature:: toFahrenheit (tempC)); //Changes the value in Fahrenheit

//for the display we put the right portent
//and spend the value three-place from position 1
if (tempC<0) {
anzeige.setSegments (below, 1.0);
//for negative temperatures we must turn around the value
anzeige.showNumberDec (round (tempC*-10), true, 3.1);
} else {
anzeige.setSegments (plus, 1.0);
anzeige.showNumberDec (round (tempC*10), true, 3.1);

void loop () {
Serial.print ("vintage temperature...");
sensoren.requestTemperatures (); //To select Commando around the temperatures
Serial.println ("Ready!");

//Now the data are economical
printTemperature (addresses);

delay (1000); //we wait 1 see

//to print function around a sensor address
void printAddress (DeviceAddress addresses)
for (uint8_t i = 0; i < 8; i)
if (addresses [i] < 16) Serial.print ("0");
Serial.print (addresses [i], PRACTICE WITCHCRAFT);

Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. Install ESP32 now from the board manager
  2. Lüftersteuerung Raspberry Pi
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1
  4. ESP32 - das Multitalent
  5. OTA - Over the Air - ESP programming via WLAN