Hlavní stránka > arduino > Arduino – teploměr

Arduino – teploměr

30.03.2016 (9,110 zobrazení) Komentuj Přejdi na komentáře

První zapojení Arduina, které “vytváří hodnoty :D”. Použil jsem Arduino Uno, DHT22 a display 1602A.


Potřebné součástky:

Do začátku uvedu zdroje, ze kterých jsem čerpal:
Návod pro display
Návod pro DHT22

Schéma pro zapojení displaye (popis)


Schéma pro zapojení DHT22 (popis)


DHT22 jsem zapojil na PIN 8.


Kód programu:

1602a LiquidCrystal Library

Demonstrates the use a 16x2 LCD display. The LiquidCrystal library works with all LCD displays that are compatible with the Hitachi HD44780 driver. There are many of them out there, and you can usually tell them by the 16-pin interface. This sketch prints "Hello World!" to the LCD and shows the time since the sketch started, in seconds.

The circuit:

* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* 10K variable resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)

// include the library code:
#include <LiquidCrystal.h>
#include "DHT.h"

#define DHTPIN 8 // what pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)

// Initialize the library with the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
// set up the LCD's number of columns and rows
lcd.begin(16, 2);

void loop() {
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
// Read temperature as Celsius
float t = dht.readTemperature();

if (isnan(h) || isnan(t)) {
lcd.setCursor(0, 0);
lcd.print("SENSOR ");
lcd.setCursor(0, 1);
lcd.print("ERROR ");

lcd.setCursor(0, 0);
lcd.print("Vlhkost: ");
lcd.print(" %\t");

lcd.setCursor(0, 1);
lcd.print("Teplota: ");
lcd.print(" *C ");



P1260680 P1260684  P1260687

Categories: arduino Tags: , ,
  1. January 5th, 2017 at 15:43 | #1

    C’est interessant de trouver comme ce genre de postes.

IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)

What is 12 + 5 ?
Please leave these two fields as-is: