TM1637 7-сегментный светодиодный модуль-дисплей

Содержание

Commands and Usage~

Console/MQTT Commands Description values
DisplayClear Clears the display
DisplayNumber Clears and then displays number without decimal. command e.g., «DisplayNumber 1234». Control , and . can be or (default), can be to (4 or 6), can be (left-most) to (right-most). Command example: This will display: ]]
DisplayNumberNC Display integer number as above, but without clearing first. e.g., «DisplayNumberNC 1234». Usage is same as above. same as above
DisplayFloat Clears and then displays float (with decimal point) command e.g., «DisplayFloat 12.34». Control , and . can be to (default), can be to (4 or 6), can be (left-most) to (right-most). Command example: This will display: ]]
DisplayFloatNC Displays float (with decimal point) as above, but without clearing first. command e.g., «DisplayFloatNC 12.34» same as above
DisplayRaw Takes upto comma-separated integers (0-255) and displays raw segments. Each number represents a 7-segment digit. Each 8-bit number represents individual segments of a digit. Segment a=1, b=2, c=4, d=8, e=16, f=32, g=64 and h (decimal point)=128. To turn on all segments, the number would be 1+2+4+8+16+32+64+128 = 255 For example, the command would display: , , ]…]
DisplayText Clears and then displays basic text. Command e.g., Control and of the displayed text. can be to , can be (left-most) to (right-most) A caret() symbol in the text input is dispayed as the degrees() symbol. This is useful for displaying Temperature (or angle)! For example, the command will display: ]
DisplayTextNC Displays text without first clearing the display. Usage is same as above. same as above
DisplayScrollText Displays scrolling text, upto 50 characters. If is not specified, it scrolls indefinitely, until another Display- command is issued. Optionally, specifying causes the scrolling to stop after the specified number of iterations.Command examples: — causes indefinite scrolling — causes scrolling to stop after 5 iterations
DisplayScrollDelay Sets the speed of text scroll. Smaller delay = faster scrolling. 0 to 15
DisplayLevel Display a horizontal bar graph. Command e.g., will display: 0 to 100
DisplayClock Displays a clock. displays a clock in 12-hour format. displays a clock in 24-hour format. turns off the clock and clears the display 1 or 2 or 0

Урок 23. Подключение сегментного дисплея TM1637 к Arduino.

Сегодня в уроке подключим семисегментный индикатор TM1637 к Arduino. Установим библиотеку TM1637.h и научимся выводить на дисплей цифры и некоторые символы.

Как устроен и из чего состоит модуль TM1637.

Характеристики Индикатора на TM1637: • Напряжение питание: 5,5В • Потребляемый ток 0.2 — 80мА (в зависимости от горящих сегментов) • Градаций яркости индикаторов — 8 • Размеры платы: 42×24мм • Двух проводной последовательный интерфейс (CLK, DIO).

Фото модуля от магазина RobotDyn фронтальный вид.

Фото модуля от магазина RobotDyn вид с тыльной стороны.

Этот модуль собран на драйвере TM1637. • Есть модули красного, синего, зелёного, белого цвета. • Размеры 0,36” и 0,56”

В уроке будем использовать модуль TM1637 0,56”, зеленого цвета.

Возможности модуля TM1637: • Зажигать сразу все знаки или по одному сегменту или символу, • Выводить цифры от 0 до 9 и некоторые буквы. Смотри ниже. • Цифры могут выводиться как с нулями слева, так и без них, • 8 градаций изменения яркости. • Вывод символа в определённую позицию (ячейку).

Отличие модуля индикатора на TM1637 от других – это его компактность, он не дорогой, и управление всего по двум проводам.

Подключение дисплея TM1637 к Arduino

Подключить дисплей можно к любым цифровым пинам Ардуино. В нашем случае будем подключать к Arduino NANO по схеме.

Arduino Nano — TM1637 Module

Arduino Nano — TM1637 Module

Arduino Nano — TM1637 Module

Arduino Nano — TM1637 Module

Установка и настройка библиотеки TM1637.h.

Установить библиотеку TM1637.h можно из менеджера библиотек. Для этого откроем Arduino IDE, перейдем в раздел Скетч-> Подключить библиотеку -> Управление библиотеками.

Затем в строке поиска наберем TM1637. И установим библиотеку Grove 4-Digit Display.

Вы также можете скачать библиотеку TM1637 внизу урока, в разделе «материалы для скачивания».

Настройка библиотеки TM1637 для вывода дополнительных символов.

Для реализации простых проектов, таких как часы, индикаторы и счетчики, этого набора символов достаточно. Я реализовывал часы с выводом температуры и влажности: Arduino часы. Видео 2. Подключаем к Arduino TM1637 и датчик DHT11.

Для отображения температуры использовал символ «С» номер для вывода на индикатор 12и для отображения влажности использовал символ «F» номер для вывода на дисплей 15.

Но для некоторых проектов на Arduino не достаточно данного набора символов. Расширить его достаточно легко, для этого в файле TM1637.cpp библиотеки находим массив TubeTab[] и добавляем нужные коды символов.

Список добавленных символов в файле TM1637.cpp, библиотеки TM1637.

После чего данные символы можно использовать в своих проектах.

Если захочется закодировать свой символ, то можно использовать следующую таблицу:

После кодирования сегментов, установив нужные биты в байте, для сокращения записи можно перевести байт из двоичного в шестнадцатиричный формат, как — b00011110 -> 0x1E.

Пример кода для вывода информации на семисегментный индикатор с драйвером TM1637.

Пример 1. Вывод времени с мигающим двоеточием.

В данном примере выведем 4 цифры на индикатор TM1637, и научимся мигать двоеточием каждую секунду. Данный пример поможет вывести любую цифровую информацию: время, счётчики, показания с датчиков.

Пример 2. Вывод слов на модуль TM1637.

Дополнительные символы добавили в библиотеку, сейчас осталось научиться их выводить. Создадим массивы необходимых слов, после чего по очереди выведем их на дисплей. Данные слова можно использовать при выводе статуса работы устройств. Это пример слов. Вы можете составлять свои слова в соответствии с вашей задачей.

Пример 3. Выводданных с датчиком с символами.

Мы научились выводить цифры и слова на дисплей. Как же сделать динамическое изменение значений на дисплее. При этом добавлять символы для индикации различных данных.

Тут поможет нам посимвольный вывод данных на дисплей. Например, запись tm1637.display(0, 5) выводит первый символ на дисплей 5. Аналогично выводятся остальные 3 символа.

Популярные статьи  Делаем светильник в индустриальном стиле

Для разделения числа на десятки и единицы, для нахождения единиц нужно найти остаток от деления на 10, и для получения десяток нужно число делить на 10.

И после числового значения выведем символ, например, для температуры символ «С».

Пример применим при выводе даты, времени и показаний с датчиков.

Появились вопросы или предложения не стесняйся, пиши в комментарии!

Не забывайте подписываться на канал Youtube и вступайте в группы в Вконтакте и Facebook.

Всем Пока-Пока.

И до встречи в следующем уроке

Обзор семисегментного индикатора на MT1637

TM1637 7-сегментный светодиодный модуль-дисплей

MT1637 это небольшой семи сегментным дисплей с двоеточием в центре, идеальное решения для создания часов реального времени. Часто в различных проектах, необходимо визуально отобразить полученных данные с различных датчиков. Самое простое, это отправить в Serial Monitor или более интересным способом, например через LCD, OLED-, TFT. В статье расскажу, как можно вывести данные на 7-сегментный светодиодный дисплей на микросхеме MT1637.

Технические параметры модуля MT1637

► Модель индикатора: 3642BH; ► Диагональ одного индикатора: 0,36 дюйма;► Тип индикатора: с общим анодом; ► Интерфейс: I2C;► Драйвер: M1637;► Цвет подсветки: красный;► Напряжение питания: 3,3 – 5 В;► Габариты: 43 х 23 х 11 мм;

Общие сведения

На передней части модуля MT1637 установлен четырехзначный 7-сегментным дисплее с двоеточием в центре, на обратной стороне установлена микросхема TM1637 производства Titan Micro Electronics. Сам 7-сегментный дисплей состоит из семи светодиодов, обозначенных буквами: от «a» до «g», которые загораются независимо от друг друга и могут отобразить числа и буквы. Так же, плата совместима с 3,3 — 5 В, никаких дополнительных резисторов или конденсаторов не требуется.

TM1637 7-сегментный светодиодный модуль-дисплей

Назначение контактов:► CLK — вход тактовых импульсов.► DIO — вывод данных.► VCC — вывод для подключения источника питания. ► GND— вывод для подключения источника питания.

Подключение Обзор 7-пигментного дисплей TM1637 к Arduino UNO

Необходимые детали:► Arduino UNO R3 x 1 шт.► 4-разрядный 7-сегментный индикатор часов на драйвере TM1637 x 1 шт. ► Провода DuPont, 2,54 мм, 20 см x 1 шт.

ПодключениеВ примере используем Arduino UNO R3 и дисплей на драйвере TM1637 на последним будем отображать показания. Подключение не сложное, необходимо всего четыре провода, первым делом подключаем вывод CLK (TM1637) к выводу 3 (Arduino) и вывод DIO подключаем к выводу 2 (Arduino), затем подключаем питание VCC к +5В и GND к GND. Так же, приведу схему подключения.

TM1637 7-сегментный светодиодный модуль-дисплей

Программа №1:Для работы скетча необходимо библиотека «TM1637.h», которая не входят в в среду разработки IDE Arduino, нужно дополнительно установить ее, скачать можно в конце статьи.

Clock example: TM1637 4-digit 7-segment display with DS3231 RTC

One of the typical uses for a 4-digit 7-segment display is to show the time. By combining the TM1637 with a real time clock module (RTC), you can easily create a 24-hour clock.

In this example I used this commonly used DS3231 RTC module.

This module communicates with the Arduino via I2C, so you only need two connections to read the time.

The wiring diagram below shows you how you can connect the DS3231 RTC to the Arduino. Note that the TM1637 display is connected in the same way as before.

TM1637 7-сегментный светодиодный модуль-дисплей
TM1637 with DS3231 RTC and Arduino UNO wiring diagram.

The connections are also given in the table below:

DS3231 RTC Connections

DS3231 Arduino
VCC 5 V
GND GND
SDA A4
SCL A5

The following code example can be used to display the time in a 24-hour time format. If your display has a center colon, then this code will make it blink. You can also disable this by removing the last few lines of code.

The first time you upload the code, the RTC will be set to the time that the sketch was compiled.

You can install a coin cell battery on the back of the module, so the time is stored in case it loses power. Apparently the charging circuit of most Chinese modules can possibly overcharge the coin cell battery, so you might want to buy a DS3231 module from Adafruit instead.

The code uses the Adafruit RTC library, which you can download here on GitHub. You can also install it via the Library Manager in the Arduino IDE by searching for ‘RTClib’, or click the download button below:

RTClib-master.zip

Example code

/* Arduino example code to display a 24 hour time format clock on a TM1637 4 digit 7 segment display with a DS32321 RTC. More info: www.www.makerguides.com */

// Include the libraries:
#include "RTClib.h"
#include <TM1637Display.h>

// Define the connections pins:
#define CLK 2
#define DIO 3

// Create rtc and display object:
RTC_DS3231 rtc;
TM1637Display display = TM1637Display(CLK, DIO);

void setup() {
  // Begin serial communication at a baud rate of 9600:
  Serial.begin(9600);
  // Wait for console opening:
  delay(3000);

  // Check if RTC is connected correctly:
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }
  // Check if the RTC lost power and if so, set the time:
  if (rtc.lostPower()) {
    Serial.println("RTC lost power, lets set the time!");
    // The following line sets the RTC to the date & time this sketch was compiled:
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    //rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
  }

  // Set the display brightness (0-7):
  display.setBrightness(5);
  // Clear the display:
  display.clear();
}

void loop() {
  // Get current date and time:
  DateTime now = rtc.now();

  // Create time format to display:
  int displaytime = (now.hour() * 100) + now.minute();

  // Print displaytime to the Serial Monitor:
  Serial.println(displaytime);

  // Display the current time in 24 hour format with leading zeros enabled and a center colon:
  display.showNumberDecEx(displaytime, 0b11100000, true);

  // Remove the following lines of code if you want a static instead of a blinking center colon:
  delay(1000);

  display.showNumberDec(displaytime, true); // Prints displaytime without center colon.

  delay(1000);
}

Library Installation

To talk to the TM1637 chip you’ll need to use a library. Avishay Orpaz has written an excellent library for TM1637 displays, the TM1637Display library. This library has several built-in functions that make controlling the display fairly easy. You just specify which number to display and it is handled for you.

To install the library navigate to the Sketch > Include Library > Manage Libraries… Wait for Library Manager to download libraries index and update list of installed libraries.

TM1637 7-сегментный светодиодный модуль-дисплей

Filter your search by typing ‘tm1637‘. Look for the library by Avishay Orpaz. Click on that entry, and then select Install.

TM1637 7-сегментный светодиодный модуль-дисплей

5Управление 7-сегментным индикатором с помощью драйвера TM1637 и Arduino

Существуют и другие драйверы для подключения 7-сегментных дисплеев. Один из них – TM1637. Есть готовые модули, в которых уже присутствует и индикатор, и драйвер, и вся необходимая «обвязка» (резисторы, конденсаторы). Пример – модуль HW-069. В качестве семисегментного индикатора здесь 4-разрядный индикатор 3642BS-1.

Популярные статьи  Поделки из старых джинсов своими руками: техники шитья, мастер-классы для детей и начинающих и фото вариантов оформления

Модуль HW-069 с драйвером TM1637 и четырёхразрядным семисегментным индикатором

Подключение модуля к Arduino предельно простое, т.к. для обмена с драйвером используется интерфейс, очень похожий на I2C. Т.е. необходимо подключить питание от 5 В Arduino, а данные передаются по DIO и тактируются по CLK. Но тем не менее, интерфейс не эквивалентен полностью I2C, т.к. у дисплея нет своего адреса.

Модуль HW-069 с драйвером TM1637 и четырёхразрядным семисегментным индикатором

Как всегда, есть множество готовых библиотек для управления индикатором через драйвер TM1637. Например, библиотека Gyver TM1637 или библиотека Avishay TM1637.

Модуль с драйвером TM1637 работает с Arduino UNO

Эти библиотеки работают прекрасно, и рассказывать, как загружать и устанавливать библиотеку для Arduino не буду: мы это делали уже миллион раз. Мы же не ищем лёгких путей, поэтому попробуем разобраться в работе драйвера TM1637 самостоятельно, верно?

Продолжение следует …

БИБЛИОТЕКА GYVER TM1637

GyverTM1637 v1.4

Библиотека GyverTM1637.h основана на Grove_4Digital_Display, дописана куча удобных методов. Что умеет:

  • Вывод цифр массивом или прицельно
  • Вывод букв из списка доступных (листай ниже) массивом или прицельно
  • Отдельная функция вывода часов и минут (часы без нуля слева, минуты с нулём) 3 разных эффекта
  • Вывод числа от -999 до 9999 с учётом знака
  • Готовая функция бегущей строки
  • Функции смены яркости и состояния двоеточия автоматически обновляют дисплей
  • Функция обновления значения с эффектом вертикальной прокрутки
  • Функция обновления значения с эффектом скручивания (лучше один раз увидеть)

Поддерживаемые платформы: все платы на AVR и ESP

Conclusion

In this article I have shown you how you can use a TM1637 4-digit 7-segment display with Arduino. We also looked at a clock and thermometer example. I hope you found it useful and informative. If you did, please share it with a friend who also likes electronics and making things!

I really like to use these displays to show sensor readings or things like the speed of a motor. With the TM1637Display library, programming the displays becomes very easy, so there is no reason you shouldn’t incorporate one in your next project.

I would love to know what projects you plan on building (or have already built) with this display. If you have any questions, suggestions, or if you think that things are missing in this tutorial, please leave a comment down below.

Note that comments are held for moderation to prevent spam.

Thermometer example: TM1637 4-digit 7-segment display with DHT11 temperature and humidity sensor

4-Digit 7-segment displays are great for displaying sensor readings like temperature, humidity, voltage or speed. In the following example, I will show you how you can display temperature readings on the TM1637 display.

We will be using the popular DHT11 temperature and humidity sensor.

The wiring diagram below shows you how you can connect the DHT11 sensor in combination with the TM1637 display to the Arduino.

Note that the TM1637 display is connected in the same way as before.

TM1637 7-сегментный светодиодный модуль-дисплей
TM1637 4 digit 7 segment display with DHT11 temperature and humidity sensor and Arduino UNO wiring diagram.

The connections are also given in the table below:

DHT11 Connections

DHT11 Arduino
+ 5 V
GND
s Digital pin 4

Note that the order of the pins can be different, depending on the manufacturer.

If you would like to use a 4 pin sensor, check out my tutorial for the DHT11 and DHT22 temperature and humidity sensors.

How to use DHT11 and DHT22 Sensors with Arduino

The example code below can be used to display the temperature readings on the display. It alternates between the temperature in Celius and Fahrenheit, both are shown for 2 seconds.

The function  is used to display the Celsius and Fahrenheit symbols.

The code uses the Adafruit DHT sensor library which you can download here on GitHub. This library only works if you also have the Adafruit Unified Sensor library installed, which is also available on GitHub.

You can also download the two libraries by clicking on the buttons below:

DHT-sensor-library-master.zip

Adafruit_Sensor-master.zip

For more information see my DHT11 with Arduino tutorial.

Example code

/* Arduino example sketch to display DHT11 temperature readings on a TM1637 4-digit 7-segment display. More info: www.www.makerguides.com */

// Include the libraries:
#include <TM1637Display.h>
#include <Adafruit_Sensor.h>
#include <DHT.h>

// Define the connections pins:
#define CLK 2
#define DIO 3
#define DHTPIN 4

// Create variable:
int temperature_celsius;
int temperature_fahrenheit;

// Create degree Celsius symbol:
const uint8_t celsius[] = {
  SEG_A | SEG_B | SEG_F | SEG_G,  // Circle
  SEG_A | SEG_D | SEG_E | SEG_F   // C
};

// Create degree Fahrenheit symbol:
const uint8_t fahrenheit[] = {
  SEG_A | SEG_B | SEG_F | SEG_G,  // Circle
  SEG_A | SEG_E | SEG_F | SEG_G   // F
};

// Set DHT type, uncomment whatever type you're using!
#define DHTTYPE DHT11   // DHT 11 
//#define DHTTYPE DHT22   // DHT 22  (AM2302)
//#define DHTTYPE DHT21   // DHT 21 (AM2301)

// Create display object of type TM1637Display:
TM1637Display display = TM1637Display(CLK, DIO);
// Create dht object of type DHT:
DHT dht = DHT(DHTPIN, DHTTYPE);

void setup() {
  // Set the display brightness (0-7):
  display.setBrightness(0);
  // Clear the display:
  display.clear();
  // Setup sensor:
  dht.begin();
  // Begin serial communication at a baud rate of 9600:
  Serial.begin(9600);
  // Wait for console opening:
  delay(2000);
}

void loop() {
  // Read the temperature as Celsius and Fahrenheit:
  temperature_celsius = dht.readTemperature();
  temperature_fahrenheit = dht.readTemperature(true);
  // Print the temperature to the Serial Monitor:
  Serial.println(temperature_celsius);
  Serial.println(temperature_fahrenheit);

  // Show the temperature on the TM1637 display:
  display.showNumberDec(temperature_celsius, false, 2, 0);
  display.setSegments(celsius, 2, 2);

  delay(2000);

  display.showNumberDec(temperature_fahrenheit, false, 2, 0);
  display.setSegments(fahrenheit, 2, 2);

  delay(2000);
}

Arduino Project – Creating a Thermometer with TM1637 and DHT11/DHT22

The best use of the TM1637 display is to display sensor readings such as temperature, humidity, voltage, or speed. The following project displays temperature readings from DHT11 / DHT22 on the TM1637 display.

If you are not familiar with the DHT11 / DHT22 module, consider reading (at least skimming) this tutorial.

The following wiring diagram shows you how you can connect the DHT11 / DHT22 sensor to Arduino in combination with the TM1637 display.

TM1637 7-сегментный светодиодный модуль-дисплей

The following sketch communicates with the DHT11 / DHT22 sensor and displays the temperature readings on the display. The temperature is displayed in Celius and Fahrenheit at an interval of 2 seconds. The code uses the Adafruit DHT sensor and the Adafruit Unified Sensor libraries, so please install them as well.

Arduino Sketch Thermometer on TM1637 Display

Open your Arduino IDE and go to File > New. A new file will open. Copy the code given below in that file and save it.

This sketch will acquire current temperature readings from the DHT22 sensor and display the updated readings along with the Celsius sign after every second on the TM1637 display.

How the Code Works?

We will start off by including the necessary libraries that are required for this project.

Популярные статьи  Цветок из бумаги «Гармония»

Next, we will define the Arduino pins that we have connected with TM1637 communication pins as well with the DHT sensor.

Then we will define an integer variable that will hold the temperature readings accessed from the DHT sensor.

The following code will create the degree Celsius sign on the display. We defined the individual segments that we want to turn ON. Notice that each segment is set apart by the | whereas digits are set apart by a comma (,).

This is used to define which type of DHT sensor we want to use. You can use this with DHT11 and DHT22 sensors. You should uncomment the line according to the sensor you are using. For example, we are using DHT22 in this tutorial, we have uncommented this. DHTTYPE variable stores the name of the sensor we are using.

This line will create the object of DHT according to our defined pin number and DHT type. We have defined both these parameters previously.

Then we will create an instance of the TM1637Display library called display() and pass the CLK and DIO pins as parameters inside it.

setup()

Inside the setup() function we will set the brightness of the display and initially clear the display. Additionally, we will also initialize the DHT sensor using the begin() method on the dht object.

loop()

Inside the loop() function, we will first access the current temperature reading in degrees Celsius from the DHT sensor and save it in the variable ‘Temperature.’

To check, if the Arduino reads the temperature readings correctly, we can use isnan() function.

Finally, we will display the reading with the degree Celsius sign on the TM1637 display using the following lines of code. It will get updated after every second.

Demonstration

To see the demonstration of the above code, upload the code to Arduino. Before uploading the code, make sure to select Arduino UNO from Tools > Board.

Also, select the correct COM port to which the Arduino board is connected from Tools > Port.

Once the code is uploaded to your board, the TM1637 display will show the current temperature reading in degrees Celsius.

You may also read our other guides on 7 segment displays:

Displaying Temperature Values (Thermometer) on TM1637 Display using Arduino

Now let us move ahead and build a thermometer which will display the current temperature readings acquired from a DHT11/22 sensor. The sensor will be connected with the Arduino board which we will program with the TM1637 4 digit 7 segment display.

The DHT11/DHT22 is a sensor which measures relative humidity and temperature sensor. It provides a calibrated digital output with a 1-wire protocol. DHT sensors are pre-calibrated. We can directly connect them with Arduino to obtain sensor output reading. They are internally composed of a humidity sensing sensor and a thermistor. These two components measure humidity and temperature. We will only access the temperature readings in this TM1637 display project so let us begin.

DHT11/DHT22 Interfacing with Arduino and TM1637 Module

You will need the following components

Required Components

  • Arduino board
  • DHT11/DHT22 sensor
  • Bread Board
  • 10K ohm resistor
  • Jumper wires
  • TM1637 Module

TM1637 with Arduino UNO and DHT22 sensor

  • The first pin for DHT11/22 is the power supply(VCC) pin. Connect it with the 5 volt pin of Arduino which will be common between the VCC of TM1637 module.
  • Data out of DHT11/22 is the pin through which we get temperature samples from the DHT sensor. Connect this pin with D8 of Arduino and also connect the data pin with a 10k pull-up resistor. But you can also use any digital pin of Arduino. A Pull-up resistor is used to keep the data pin high for proper communication between the microcontroller and sensor. You can check the datasheet of DHT11 and DHT22 to get more information about it. DHT22 is also known by the name of AM2302.
  • Third pin of DHT11/22 is not used.
  • Connect the fourth pin (GND) of DHT11/22 to the ground pin of the Arduino board. It is common with GND pin of TM1637 module as well.
  • Additionally, connect CLK and DIO pins of TM1637 with any appropriate digital pins of the Arduino board. We have used digital pin 2 to connect with CLK and digital pin 3 to connect with DIO respectively.

You may also like to read:

  • DHT11 DHT22 with Arduino – Display Readings on OLED
  • ESP32 DHT11 and DHT22 Web Server using Arduino IDE
  • DHT11/DHT22 Web Server ESP8266 NodeMCU using Arduino IDE

Installing DHT11/DHT22 Library in Arduino IDE

Both DHT11 and DHT22 provide the output of temperature and humidity in the complex digital output format which can not be directly read with GPIO pins without writing any technique which can read these output signals. These sensors provide data through a single wire two-way communication protocol. A single process communication consists of 40 bits. But we do not need to worry about the working of these sensors and on which protocol we can receive this data. We have an Arduino library for DHT sensors which can be easily used to get values of temperature and humidity only by calling two lines of functions. We will see later on how to do it. Now let’s see how to install the DHT library in Arduino. This library is provided by Adafruit. Follow these steps to install the DHT sensor library.

We will use the Arduino library manager to install it easily. Open your Arduino IDE and go to Sketch > Include Libraries > Manage Libraries. Type ‘DHT sensor’ in the search bar and install the latest version of the library shown below:

Adafruit also provides libraries for other sensors. So they provided a support package which is used to handle all sensor libraries. We also need to install the Adafruit Unified Sensor library. To install this, paste the Adafruit Unified Sensor search bar and select this option and click on install button.

After installation of the libraries, restart your IDE.

Оцените статью
Денис Серебряков
Добавить комментарии

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!:

TM1637 7-сегментный светодиодный модуль-дисплей
Узоры для вязания спицами » более 1000 схем с описанием
Узоры спицами