User Tools

Site Tools


DHT 11/12

DHT11 and DHT22 are digital humidity and temperature sensors. You can find some libraries for arduino to interact with the sensors here. Sensors are conected 3-pin. Two pins for power and one for communication with microchip (see picture[source]). DHT22 differs from DHT11 by higher accuracy.

Sensor: Measuring range
DHT11 humidity: (20% - 95%)+/-5% temperature(0°C - 50°C)+/-2°C
DHT22 humidity: (0% - 100%)+/-2% temperature(-40°C - 80°C)+/-0,5°C

Code example:

#include <DHT.h>
#define DHTInput A5
#define DHTTYPE DHT11
void setup() {
float temp;
float hum;
void loop() {
  Serial.print("Teplota ve °C: ");
  Serial.print("Vlhkost v %: ");

TMP 35/36

TMP35 and TMP 36 are analog temperature sensors. Information carrying value is potential which increases lineary with temperature. It is also conected by 3-pins:

  • PIN1 input voltage
  • PIN2 output voltage
  • PIN3 GND

If PIN2 is conected to arduino analog input pin, we can easily measure temperature by conversion to appropriate temperatur scale (see code).

Code[source]-and tutorial for TMP36:

    //TMP36 Pin Variables
    int sensorPin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
    //the resolution is 10 mV / degree centigrade with a
    //500 mV offset to allow for negative temperatures
    * setup() - this function runs once when you turn your Arduino on
    * We initialize the serial connection with the computer
    void setup()
    Serial.begin(9600); //Start the serial connection with the computer
    //to view the result open the serial monitor
    void loop() // run over and over again
    //getting the voltage reading from the temperature sensor
    int reading = analogRead(sensorPin);
    // converting that reading to voltage, for 3.3v arduino use 3.3
    float voltage = reading * 5.0;
    voltage /= 1024.0;
    // print out the voltage
    Serial.print(voltage); Serial.println(" volts");
    // now print out the temperature
    float temperatureC = (voltage - 0.5) * 100 ; //converting from 10 mv per degree wit 500 mV offset
    //to degrees ((volatge - 500mV) times 100)
    Serial.print(temperatureC); Serial.println(" degrees C");
    // now convert to Fahrenheight
    float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
    Serial.print(temperatureF); Serial.println(" degrees F");
    delay(1000); //waiting a second

The advantages of this sensors are low price and small dimensions.

en/temphum.txt · Last modified: 2018/01/29 10:12 (external edit)