*/ ?>

Are you a starter with Croduino? Or a newbie when it comes to electronics? You fancy a specific module, but you don't know how to use it? Don't worry, we have our How To Use series! How to Use is a series of blog tutorials by e-radionica where you will find everything you need to begin working with your favorite modules. Tutorials include technical characteristics, operating principles, instructions on how to connect the module with Croduino and basic coding. Everything else is up to you and your imagination.

Basic features

DHT11 is probably one of the first sensors you will meet. It is included in Croduino set for beginners. It reads temperature and humidity and allows us to handle that information with ease. dht11 Characteristics: Temperature measuring range: 0° - 50° C Humidity measuring range (in air): 20% - 90% Temperature measuring deviation: +/- 2 °C Humiditiy measuring deviation: +/- 5% Voltage: 3V - 5V Current: 100uA(standby), 2.5mA(measuring)

Working principle

Inside the module itself, there are, obviously, 2 sensor types: * temperature sensor: small termistor(type of temperature sensor) soldered on board. * humidity sensor: small pcb soldered to the basic one. It has open (uncovered) copper lines which are close to each other. The more humidity in the air, the more humidity is on the lines themselves and there is less resistance between them (or in case of water - just shows up - that is the reason why sensor starts to read values on 20%; only then it can read resistance). In addition to the two components mentioned, there is another integrated circuit that analyzes the inputs of these two sensors and communicates with Croduino. (if you are really curious about what's inside, you can open the blue case :)) Regarding communication, there is a library which will make using much easier. Namely, it has already summarized all the procedures needed to establish communication. In this tutorial we will use:
  • Croduino Basic
  • DHT11
  • Mini breadboard
  • M-M cables

How to connect module with Croduino

DHT11 Croduino pin1 +5V pin2 A0 pin3 - pin4 gnd Untitled Sketch_bb It is suggested to add a pull-up resistor of 10kOhm.


At this link can find and download Arduino library which simplifies using of the DHT11. You'll be able to find code which writes values of temperature and humidity inside Serial monitor under examples of that library. If you need some help regarding the installation of the library, check out our tutorial about it. After you've downloaded and installed the library, you can use the code below.
#include "DHT.h"

#define DHTPIN A0 // na koji pin je povezan DHT11
#define DHTTYPE DHT11


void setup() {
  Serial.println("DHT11 test!");


void loop() {
  //pričekati par sekundi između svakog mjerenja

  // očitava vlagu u varijabli h te temperaturu u varijabli t
  float h = dht.readHumidity();
  float t = dht.readTemperature();

  if (isnan(h) || isnan(t)) {
    Serial.println("Neuspješno očitavanje senzora! ");

  Serial.print("Vlaga: ");
  Serial.print(" %\t");
  Serial.print("Temperatura: ");
  Serial.println(" *C ");