Využívané inteligentní systémy – porovnaniDHT11
DHT11 digital temperature and humidity sensor is a composite Sensor contains a calibrated digital signal output of the temperature and humidity. The sensor includes a resistive sense of wet components and an NTC temperature measurement device, and connected with a high-performance 8-bit microcontroller.
Picture 1: DHT11 with pins description (from left to right)
Low cost ~ 5$
3.5-5.5V DC power and I/O
2.5mA max current use during conversion (while requesting data)
Good for 20-80% humidity readings with 5% accuracy
Good for 0-50°C temperature readings ±2°C accuracy
No more than 1 Hz sampling rate (once every second)
Digital signal output, and precise calibration
Long distance signal transmission
DHT22 output calibrated digital signal. It utilizes exclusive digital-signal-collecting-technique and humidity sensing technology, assuring its reliability and stability. The sensing elements are connected with 8-bit single-chip computer.
Every sensor of this model is temperature compensated and calibrated in accurate calibration chamber and the calibration-coefficient is saved in type of program in OTP memory, when the sensor is detecting, it will cite coefficient from memory.
Picture 2: DHT22 with pins description (from left to right)
Low cost ~ 10$
3.3-6V DC power and I/O
2.5mA max current use during conversion (while requesting data)
Good for 0-100% humidity readings with 2-5% accuracy
Good for -40 to 80°C temperature readings ±0.5°C accuracy
No more than 0.5 Hz sampling rate (once every 2 seconds)
4 pins packaged and fully interchangeable
Long transmission distance (20m)
Calibrated digital signal & Extra components not needed
Summarize all the criteria we can see – DHT11, compared to the DHT22, is less precise and smaller. But on the other hand, DHT11 works in a smaller range of temperature/humidity, the sensor measures the temperature in the range from 0o? to 50o?, which makes its use impossible outside the building. Moreover, DHT11 relative humidity accuracy is ±5% RH , compared with DHT22 ±2% RH.
Based on the information above, I decided, I will use DHT22 sensor to reach all the goals of my project with the highest accuracy.
ESP32-DevKitC V4 is a small-sized ESP32-based development board produced by “Espressif”. Most of the I/O pins are broken out to the pin headers on both sides for easy interfacing. Developers can connect these pins to peripherals as needed. Standard headers also make development easy and convenient when using a breadboard.
Picture 3: ESP32-DevKitC V4 with ESP32-WROOM-32 module soldered
USB-UART BridgeMicro USB Port5V Power On LED
EN (Reset button)
Boot (Download button)
The board supports various ESP32 modules, including ESP32-WROOM-32.
ESP32-WROOM-32 is a powerful, generic Wi-Fi+BT+BLE MCU module that targets a wide variety of applications, ranging from low-power sensor networks to the most demanding tasks, such as voice encoding, music streaming and MP3 decoding.
Picture 4: ESP32-WROOM-32 module (front and back)
Protocols: 802.11 b/g/n (802.11n up to 150 Mbps)
Frequency range: 2.4 GHz ~ 2.5 GHzBluetooth Protocols: Bluetooth v4.2 BR/EDR and BLE specification
Radio: Class-1, class-2 and class-3 transmitter
HardwareRecommended operating temperature range: –40°C ~ +85°C
Operating voltage/Power supply: 2.7 ~ 3.6V
IPv4, IPv6, SSL, TCP/UDP/HTTP/FTP/MQTT
Node MCU ESP-32S
The NodeMCU ESP-32S is one of the development board created by NodeMcu to evaluate the ESP-WROOM-32 module. It is based on the ESP32 microcontroller that boasts Wifi, Bluetooth, Ethernet and Low Power support all in a single chip.
Picture5: Node MCU ESP-32S with ESP32-WROOM-32 module soldered
Digital I/O Pins (DIO): 28
Wi-Fi: IEEE 802.11 b/g/n/e/iFlash Memory: 4 MB
Operating Voltage: 3.3V
Operating Temperature: -40 to +125 ºC
Network Protocol: IPv4, IPv6, SSL, TCP / UDP / FTP / HTTP / MQTT
In general, these microcontrollers do not have significant differences. The quality and price of each module are also on the same level. For the project I decided to choose Node MCU ESP-32S because there is more open sources and instructions (Connect, Register, Virtualize and Program) given, than for ESP32-DevKitC V4.
NODEMCU Lua IoT ESP8266 Wifi Controller Board v3
NodeMCU is a small board, based on the cheap ESP-12 Wi-Fi module containing a single-chip ESP8266 Wi-Fi SoC. The NodeMCU is an open-source firmware and development kit that helps you to prototype your IOT product within a few Lua script lines. The ESP-12 is one of the available modules containing an ESP8266 chip; it is becoming more and more popular because of its integrated Wi-Fi PCB antenna and shield.
Picture6: NODEMCU Lua IoT ESP8266 Wifi Controller Board v3
Low cost ~ 6$
FEATURES: The Development Kit based on ESP8266, integates GPIO, PWM, IIC, 1-Wire and ADC all in one board. Power your development in the fastest way combination with NodeMCU Firmware!
USB-TTL included, plug & play
10 GPIO, every GPIO can be PWM, I2C, 1-wire
FCC CERTIFIED WI-FI modul?Coming soon?
Witty Cloud / GizWits – ESP8266
The Witty Cloud (also named GizWits) development board is interesting in the fact that it consists by design of two separate modules, with each module having a USB connector. Once programmed, only the upper part may be used fully functionally as programmed by you.
Picture 7: Witty cloud development board
If you tear those modules apart you end up with – the upper module
the upper module
Picture8: Upper Witty Cloud module
holding on the upper side:
– a photo resistor
– a WIFI antenna
– a multi-color LED
– a blue LED (between the multi-color LED and the corner of the ESP8266 module)
– the ESP-12 module
holding on the lower side:
– a button
– a voltage regulator
– a micro USB port
– with its only function to accept a power source
– and the pins to plug into a breadboard
the lower module with components on the upper side only
Picture9: Lower Witty Cloud module
– two buttons
– the left one to set the system into flash mode, the right one to reset the system (Obviously both modules must then be assembled).
– the CH340G UART chip
– a micro USB port accepting a power source as well as data exchange with another device
– two female header connectors to connect with the second Witty Cloud module
The most interesting thing in the design of Witty Cloud / GizWits – ESP8266 module is that it consists of two separate boards: the controller board itself and the auxiliary one used for firmware and communication with the computer. Firmware included. Do not necessary to connect USB-UART.
Moreover , the board comes with a CH40 micro USB module to program it.
Specifications and price of these microcontrollers are about the same.
In my opinion the Witty Cloud / GizWits – ESP8266 is more comfortable to work with , than NODEMCU Lua IoT ESP8266 Wifi Controller Board v3.
MESSAGE QUEUING TELEMETRY TRANSPJRT (MQTT) PROTOCOL
The Internet of things (IoT) is the network of physical devices, vehicles, home appliances, and other items embedded with electronics ,software,sensors,actuators, and connectivity which enables these things to connect,collect and exchange data.
At the end of the 1990s, engineers from IBM and Arcom were looking for a reliable, lightweight, and cost-effective protocol to monitor and control a large number of sensors and their data from a central server location , as typically used by the oil and gas industries. Their research resulted in the development and implementation of the Message Queuing Telemetry Transport (MQTT) protocol.
Considering the harsh environments in the oil and gas industries, an extremely simple protocol with only a few options was designed, with considerations for constrained nodes, unreliable WAN backhaul communications, and bandwidth constraints with variable latencies. These were some of the rationales for the selection of a client/server and publish/subscribe framework based on the TCP/IP architecture.
Picture10: MQTT Publish/Subscribe Framework
An MQTT client can act as a publisher to send data(or resource information) to an MQTT server acting as an MQTT message broker. The MQTT server (or message broker) accepts the network connection along with application messages, such as Temp/RH data, from the publishers. It also handles the subscription and unsubscription process and pushes the application data to MQTT clients acting as subscribers.
The application on the right side of the picture is an MQTT client that is a subscriber to the Temp/RH data being generated by the publisher or sensor on the left. This model, where subscribers express a desire to receive information from publisher , is well known.
With MQTT client can subscribe to all data(using a wildcard character) or specific data from the information tree of a publisher. In addition, the presence of a message broker in MQTT decouples the data transmission between clients acting as publishers and subscribers. In fact, publishers and subscribers do not even know (or need to know) about each other. A benefit of having this decoupling is that the MQTT message broker ensures that information can be buffered and cached in case of network failures. This also means that publishers and subscribers do not have to be online at the same time.
MQTT control packets run over a TCP transport using port 1883. TCP ensures an ordered, lossless stream of bytes between the MQTT client and the MQTT server.
MQTT is a lightweight protocol because each control packet consists of a 2-byte fixed header with optional variable header fields and optional payload.
MQTT Message Format
MQTT contains a smaller header of 2 bytes .The first MQTT field in the header is Massage Type, which identifies the kind of MQTT packet within a message. Fourteen different types of control packets are specified in MQTT version 3.1.1. Each of them has a unique value that is coded into the Message Type field. Note that values 0 and 15 are reserved. MQTT message types are summarized in Table 1.
Table1: MQTT Message Types
MQTT Brokers Compare
Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 3.1 and 3.1.1 and support for the proposed MQTT v5, which introduces scalability and protocol improvements is under way.
Mosquitto is lightweight and is suitable for use on all devices from low power single board computers to full servers.
The MQTT protocol provides a lightweight method of carrying out messaging using a publish/subscribe model. This makes it suitable for Internet of Things messaging such as with low power sensors or mobile devices such as phones, embedded computers or microcontrollers.
The Mosquitto project also provides a C library for implementing MQTT clients, and the very popular mosquitto_pub and mosquitto_sub command line MQTT clients.
The Mosquitto broker is part of the Eclipse IoT Working Group, “an industry collaboration of companies who invest and promote an open source community for IoT.”
Easy to setup
Easy to use
Verified clients Pub/Sub including NODEMCU,NANO/ESP8266
Easy Integration with Node-Red flows
Mosquitto – the most common, really lightweight, MQTT broker written in C. For Windows and Mac there are official versions, source codes are also available there. You can also get source codes from GitHub.
VerneMQVerneMQ is first and foremost a MQTT publish/subscribe message broker which implements the OASIS industry standard MQTT protocol. But VerneMQ is also built to take messaging and IoT applications to the next level by providing a unique set of features related to scalability, reliability and high-performance as well as operational simplicity.
To achieve these goals VerneMQ is designed from the ground up to work as a distributed message broker, ensuring continued operation in the event of node or network failures and easy horizontal scalability. The underlying technology is a proven telecom grade technology stack providing a rock solid foundation for systems that must be in continuous operation around the clock. It’s also able to make efficient use of all available resources as a basis for easy vertical scalability.
VerneMQ uses a master-less clustering technology. There are no special nodes like masters or slaves to consider when the inevitable infrastructure changes or maintenance windows require adding or removing nodes. This makes operating the cluster safe and simple.
MQTT Protocol SupportDurable Subscriptions on Topics
ACL based Authorization
SSL/TLS Support and Certificate based Authentication
Detailed instructions for installation and use
Flexible plugin and integration options
VerneMQ is 100% open and free to commercial modification and re-use
ConclusionVerneMQ is a relatively new MQTT broker written in Erlang (this language is very popular in the message broker world because its distributed and soft real-time capabilities). VerneMQ has all the features that we were looking for. Clustering, TLS 1.2, complete MQTT 3.1.1 implementation and authorization with database. It can be easily extended with Lua scripts, has a relatively nice documentation and a very helpful developer team on GitHub.
RabbitMQ is an open source message broker software (sometimes called message-oriented middleware) that originally implemented the Advanced Message Queuing Protocol (AMQP) and has since been extended with a plug-in architecture to support Streaming Text Oriented Messaging Protocol (STOMP), Message Queuing Telemetry Transport (MQTT), and other protocols.
The RabbitMQ server program is written in the Erlang programming language and is built on the Open Telecom Platform framework for clustering and failover. Client libraries to interface with the broker are available for all major programming languages.
RabbitMQ is the most widely deployed open source message broker.
Supports multiple messaging protocols
Pluggable authentication;authorizationsupports TLS and LDAP
Lightweight and easy to deploy in public and private clouds.
multiple exchange type
ConclusionRabbitMQ is a very popular message broker written in Erlang that has support for MQTT among other protocols through a plugin. TLS support is there, clustering is fine, authorization cannot be done using a database directly but you can create an HTTP REST wrapper over your database and that can be used as an authorization backend. The problem with RabbitMQ is the MQTT support itself. This broker supports the AMQP protocol natively, the MQTT implementation is missing some important features such as QoS2. Quality of Service level 2 ensures that a message is received exactly once. This is very important in some cases, for example when commands are sent from the IoT platform to the devices or actuators. Lost or duplicate commands can cause serious problems in these scenarios so QoS2 is a must.
1 Aosong Electronics Co.,Ltd: Digital-output relative humidity ; temperature sensor/module DHT22, page 2-4, Online.
2 Aosong Electronics Co.,Ltd: Temperature and humidity module DHT11 Product Manual , page2-3, Online.
URL https://akizukidenshi.com/download/ds/aosong/DHT11.pdf3 ESP32-DevKitC V4 Getting Started Guide, Online.
4 ESP32-WROOM-32 Datasheet ,page 6-7, Online.
https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32_datasheet_en.pdf5 NodeMCU ESP-32S
6 Witty Cloud / GizWits – ESP8266 Development Board
7 Arduino NODEMCU Lua IoT ESP8266 Wifi Controller Board v3
8 Eclipse Mosquitto™
URL https://mosquitto.org/9 VerneMQURL https://vernemq.com/10 RabbitMQURL https://www.rabbitmq.com/