Tag Archives: Temperature

Temperature & humidity sensor DHT11 interface with Arduino

DHT11 is a cheap & easy option for temperature & humidity measurement for DIY projects & beginner experiments. It is likely suitable for domestic environment control, weather monitoring unit & gardening/farming monitoring stations. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, gives output as digital signal which can be connected to Arduino digital IO pin directly. The only drawback of DHT11 is slow response for updated values. You can download DHT11 datasheet from here.

Technical Specifications

  • Operating Voltage: 3V to 5.5V DC
  • Current consumption: Measurement 0.3mA, standby 60μ A
  • Accuracy: At 25℃, ± 2℃ & ± 5% RH
  • Sampling period: more than 2 seconds
  • Measurement Range: 20-95% RH & 0-50℃
  • Resolution: 8 Bit for temperature & 8 Bit for humidity
  • Response time: 6 to 15 seconds for humidity & 6 to 30 seconds for temperature.

The DHT11 measures relative humidity which means the amount of water vapor in air vs. the saturation point of water vapor in air. At the saturation point, water vapor starts to condense and accumulate on surfaces forming dew. The saturation point changes with air temperature. Cold air can hold less water vapor before it becomes saturated, and hot air can hold more water vapor before it becomes saturated.

Connections

DHT11 module available in market is having 3 pins, actually sensor is having 4 pins but module designed to connect with arduino easily by removing 1 pin which is not required (Few makers sell module with 4 wire). Connections shown in diagram is as below:

(Colors are mentioned for reference only, Refer pin numbers & connect wires carefully)

Test Code

You can download this code from here.

How this code works: As mentioned in code, pin no. 7 is defined as DHT11_PIN variable. In setup loop, baud rate is assigned at 9600 to read DHT11 values on serial monitor available in Arduino IDE software. Next loop is written to move DHT11 values in variable and print on serial monitor. Just copy the code and paste in Arduino IDE, set your Arduino board & COM Port, upload it, here you go with values on serial monitor. So, it is too easy to get temperature & humidity using DHT11 sensor. For further expansion, you can connect LCDs, OLEDs to display and can send data wireless using HC-05 Bluetooth sensor and many more wireless options.

I hope this tutorial will be helpful for basic temperature & humidity measurement. In future you can interface LCD and wireless interfaces with this type of sensors. Give your feedback about this tutorial in Contact, Your feedback will be appreciated.

Subscribe BYB on FacebookTwitterInstagram & Telegram for latest updates.

LM35 temperature sensor interface with Arduino

LM35 is a precision IC temperature sensor which gives an output proportional to the temperature in °C. The operating temperature range is from -55°C to 150°C.  Compared to thermistor, LM35 can measure temperature more accurately hence better for Arduino projects. The LM35’s low output impedance, linear output, and precise inherent calibration make interfacing to readout or control circuitry especially easy & useful in may applications like power supplies, battery management, temperature control appliances etc. LM35 sensor can easily interface with Arduino.

Features

  • No Calibration Required: Calibrated Directly in Celsius (Centigrade)
  • Linear scale: Linear + 10-mV/°C Scale Factor (Non-linearity Only ±¼°C Typical)
  • Good accuracy: 0.5°C Ensured Accuracy (at 25°C)
  • Operating range: Rated for Full −55°C to 150°C Range
  • Cheaper: Low-Cost Due to Wafer-Level Trimming
  • Operating voltage: Operates From 4 V to 30 V
  • Current consumption: Less Than 60-μA Current Drain
  • Low Self-Heating: 0.08°C in Still Air (0.1°C Max.)
  • Low-Impedance Output: 0.1 Ω for 1-mA Load

(For more detail, click here for datasheet)

Connection with Arduino

LM35 has 3 pins, +Vs (1) & GND (3) for power supply and OUT (2) which gives analog output. It consumes approximately +5VDC. The output pin provides an analog voltage output that is linearly proportional to the Celsius (centigrade) temperature. Pin 2 gives an output of 1 millivolt per 0.1°C (10 mV per degree), So to get the degree value in Celsius  voltage output to be divide it by 10.

Arduino Code

You can download this code from here.

How this code works: Arduino will read temperature from LM35 on analog pin in line temp = analogRead(tempPin);. The reading received on analog pin is actually millivolts scaled from 0-5000mV for 0-5VDC which need to be converted in Celsius in line  temp = temp * 0.48828125;. In this, 0.48828125=(+Vcc*1000/1024)/10 Where +Vcc is the supply voltage +5V, 1024 is 2^10, value where the analog value can be represented by Arduino the actual voltage obtained by Voltage_Get/1024. 1000 is used to change the unit from V to mV & 10 is a constant as each 10 mV is directly proportional to 1 Celsius in LM35. So (5.0 * 1000 / 1024) / 10 = 0.48828125. Rest of the lines are to print temperature reading on serial monitor. Upload the code in Arduino, open serial monitor & get temperature reading from LM35 at every one second.

In further expansion to this you can add LCD to display values & relay & make temperature control equipment. I hope this tutorial will be helpful for temperature measurement in your Arduino projects. In future I will upload more tutorials with LCD and such sensor interfaces with Arduino. Give your feedback about this tutorial in Contact, Your feedback will be appreciated.

Subscribe BYB on FacebookTwitterInstagram & Telegram for latest updates.