One IoT application is a monitoring and control system that connects sensors and actuators to an environment. Measurement data from the sensor can be sent to a cloud server so that it can be accessed by users who want to know a condition or measurement of physical quantities from that environment. The actuator can be controlled in response to the reading of the sensor values obtained from the environment. The important expectation of the system built from IoT is to run communication between the machine and other machines so that the system can provide accurate information. As a consequence, the system can become smarter in decision making. One of the things that is becoming popular now is the availability of increasing and inexpensive electronic hardware and software, for the purpose of building IoT infrastructure that allows it to be applied in many fields such as health, agriculture, industry and transportation.
In writing this independent assignment, the boundaries of the problem need to be raised so that the subjects can be more focused:
- How to design and implement Intel Edison-based hardware as a broker, EPS8266 as a sensor node and Node-RED software as a visualization of measurement data.
- How to send and receive data using Message Queue Telemetry Transport (MQTT) protocol.
Intel Edison is an embedded system that has small computing capabilities designed specifically for the Internet of Things project. This device has an Intel System on Chip (SoC) consisting of dual core, dual threaded Intel Atom CPU at 500 MHz and 32 bit Intel Quark microcontrollers that work at 100 MHz. The SoC on a dual core CPU has several features including 40 GPIOs, 1GB LPDDR3 RAM and 4GB EMMC flash supported by WiFi modules, Bluetooth 4.0 LE and 70-pin connectors to be connected to other devices. In addition, Intel Edison can be programmed using the Yocto Linux Operation System (OS) and is also supported by Arduino Integrated Development Environments (IDE), Eclipse C / C ++, Python and Node.JS. To be more clear, the SparkFun Intel Edison module can be shown in Figure 1.1.
Message Queue Telemetry Transport (MQTT) is a Machine to Machine (M2M) communication protocol based on the publisher and subscriber model where this protocol has a small data packet size (minimum of 2 bytes) so that electricity consumption is also quite small. The MQTT work system consists of three main components, namely publishers, subscribers, and brokers. Publisher has the task of giving a message to a particular topic to the server / broker. While subscribers have the duty to receive a message to a particular topic from the server / broker. Publishers and subscribers can be sensors, actuators and mobile apps, connected to brokers that make communication asynchronous.
Illustration of the MQTT protocol working system can be seen in Figure 1.2, the client subscriber (mobile apps) can receive sensor data sent by the client publisher (sensor node / actuator) so the client subscriber can use the same topic as the topic provided by the publisher client. Likewise, if the sensor / actuator node is given a command to execute an action, the topic given by the mobile client apps must be the same as the topic on the sensor / actuator node.
The advantage of the publish / subsribe system is that between the sending source (publisher) and the data recipient (subscriber) do not know each other because there is a broker between them, where the publisher and client subscribers do not need to be connected simultaneously, for example client subscribers can disconnect after subscribing to brokers and a few moments later the client connects back to the broker and will still receive the delayed data before, this process is called offline mode. The MQTT protocol is widely chosen in making Internet of Things (IoT) solutions because MQTT tends to be easy to use. Examples of brokers that support MQTT include mosquitto, RabbitMQ, HiveMQ, ActiveMQ and others. Meanwhile for hardware that supports IoT there are quite a lot like Arduino, Esp8266, STM32, Raspberry Pi and others.
ImplementationDesign of this system will be explained about the design of 2 sensor nodes using the ESP8266 and Node-RED microcontrollers programmed in Intel Edison microcomputers, namely by simulating temperature and humidity monitoring indoors and outdoors. Microcontrollers can be used to carry out processes including: measurement and control, data retrieval, sending data from the sensor client node to the broker, receiving data from broker to client such as mobile apps or Personal Computer (PC).
In designing this system, the main element in data processing is ESP8266 type micrococrolrolers. This microcontroller has the duty to process DHT22 sensor data through the digital output port of the microcontroller. By using the MQTT protocol, communication between the microcontroller and mobile apps or PC can be done wirelessly. Figure 1.3 is a hardware system design, consisting of two DHT22 sensors that are connected to each ESP8266 wemos microcontroller called the sensor node. The scenario of simulating two sensor nodes has a different function:
- Node 1 is used to measure temperature and humidity in the room (indoor).
- Node 2 is used to measure temperature and humidity outdoors.
The data acquisition design system at Intel Edison broker using the MQTT protocol can receive sensor data from two sensor nodes, then the user can receive sensor data so that sensor measurement data can be stored and displayed on a real time graph. Figure 1.4 shows the design of the program from Node-RED installed on Intel Edison which functions as the interface of two sensor nodes and Edison Intel. Node-RED as a subscriber is given the same topic as the topic published by the sensor node. The payload data format (measurement data from DHT22) from the sensor node is a json data format so that the subscriber (Node-RED) will accept the same data format.
In the program's looping function, the process of sending the payload sensor consisting of reading temperature and humidity data has the format of json. The published topic of MQTT that is used to send data to the server is "sensordht / inside" and "sensordht / outside". Edison Intel that has been installed Node-RED can receive sensor payload by providing the same subscribe topic. Thus the process of sending and receiving payload sensors can run according to the design or integration of sensor nodes and Intel Edison as MQTT servers. Overall, the implementation of the hardware design system can be seen in Figure 1.5.
After testing the hardware which is the integration of the ESP8266 sensor node and Intel Edison microcontroller as the MQTT server, the visualization of measurement data is realized through the Node-RED dashboard. The implementation of the interface software design aims to display measurement data from both sensor nodes (ESP8266 microcontroller) in real time.
There are 4 physical quantities visualized on the Node-RED dasboard, including Tout (outdoor temperature), Tin (indoor temperature), Hout (outdoor humidity), Hin (indoor humidity). Visualizing the entire data on the Node-RED dashboard can be seen in Figure 1.7.
The design of the data acquisition system using the MQTT protocol was successfully tested by integrating the Wemos ESP8266 microcontroller as a sensor node and Intel Edison as a broker. Scenarios from temperature and humidity measurement simulations as an implementation of the whole system have been successfully visualized using Node-RED software. DHT22 measurement / payload data from two sensor nodes has been successfully stored in the influxdb database.
Comments
Please log in or sign up to comment.