Smart City Based on MQTT Using Wireless Sensors

Smart City Based on MQTT Using Wireless Sensors

Monika Bharatbhai Patel (Charotar University of Science and Technology, India), Chintan M. Bhatt (Charotar University of Science and Technology, India), Hamed Vahdat-Nejad (University of Birjand, Iran) and Hardik B. Patel (Epsilon Electronics, India)
Copyright: © 2018 |Pages: 24
DOI: 10.4018/978-1-5225-3805-9.ch009


The internet of things can involve a huge number of connected devices and sensors for the betterment of our lives and businesses. Sensors are the main part of IoT. The main target of this chapter is to develop an IoT-based information observing system for specific areas like home, cities, industries, hospitals, etc. In this system, the environmental data of different elements, for example, temperature, humidity, pressure, should screen and get a redesign with a particular time interval. The authors use Raspberry Pi 3 and MQTT to observe information over a remote area and get an update with it anyplace in the world. They transmit the environmental data to the cloud server sent by Raspberry Pi 3. There, the authors can monitor data in both modes (online and offline).
Chapter Preview


The Internet of Things (IoT), which is based on Machine to Machine (M2M) communication, can possibly change our life. It is based on client-server architecture as well as publish/subscribe transport protocol. Message Queuing Telemetry Transport (MQTT) is a lightweight open source protocol, which is easily implemented in IoT-based applications. It makes it perfect to use an IoT application, implemented system, and M2M devices (Atzori, lera & Morabito, 2010).

The main parts of IoT are sensors and the MQTT protocol. By various sensors we can easily get environmental data and can process them. Using this data, we can make our life more comfortable.

Right now these elements are encountering particular necessities that identify striking topics, such as business and work, economic, energy and water, open security, environment, healthcare, education and open administrations, all of which are, in some frame or another, progressively encouraged and empowered by ICT. Simultaneously, the most recent turbulent worldwide monetary downturn is progressively setting weight on urban areas to cut spending plans. It brings about malicious impacts not just on the upkeep and update of current ICT framework and offices, but additionally on future advancement policies. Notwithstanding, the idea of a “keen city”, additionally known as astute city, data city, advanced city, e-city and virtual city, has been recognized just like a commendable case of a reaction to address the present and future complex difficulties of expanding asset proficiency, lessening emissions, providing sustainable human services administrations for maturing populations, empowering youth and incorporating minorities (Shah & Bhatt, 2014).

Smart sensors are the major aspect of the IoT (Bhayani, Patel & Bhatt, 2016). Once you have real-time data of various environments, then actions can be taken easily into account based on that Wi-Fi based smart connected sensors. With the help of the smart sensors, Wi-Fi module, MQTT protocol and IoT-based various applications, we are making systems that could be used for monitoring sensors data like temperature, humidity, pressures, and altitude of selected areas where the system is placed.

The IoT devices can collaborate with each other without or with human intercession. The IoT involves the things that are implanted in frameworks, and it can possibly change our reality with the assistance of them. The IoT is an assuming part for brilliant urban areas, shrewd frameworks, keen wellbeing checkings, and savvy garments and so on. Each one of these advances of IoT will change the living way of human beings. (Bhatt, Dey & Ashour, 2017)


IoT is a keen system, which associates all things to the web with the final goal of trading data with concurred conventions. In this way, anybody can get to anything, whenever and from anyplace. In the IoT system, things or items are remotely associated with shrewd sensors. (Singh, Rajan, Shivraj, & Balamuralidhar, 2015)

MQTT (Message Queue Telemetry Transport) is a lightweight messaging protocol. It is a broker-based publish/subscribe messaging protocol designed to be simple, open and straightforward to implement. In 1999, Dr.Andy Stanford-Clark from IBM and Arlen Nipper from Arcom invented the MQTT protocol. In MQTT protocol the session layer is used for IoT (Garcia, Espada & Midgar, 2014). The IoT devices are inter-connected with each other using the light-weight MQTT communication. The IoT applications typically use C, Python, Java as well as an MQTT scripting language (Andy Banks, 2012).

MQTT Broker controls the distribution of information (Gibbons, 2017). It stores, forwards, filters and prioritizes public requests from the publisher to the subscriber clients. Client switch between publisher and subscriber depends on the desired functionalities. There are many MQTT brokers available and they are different in their features; they can be set as per our requirements. MQTT brokers are Web sphere MQ, MQTT.js, Apache ActiveMQ, IBM Message Sight, Solaee Message Routers, Apache Apollo, Mosquitto, JoramMQ, HiveMQ, mosca, etc. For some of them, we can also implement additional features (Collina, Bartolucci, Vanelli-Coralli, & Corazza, 2014).

Complete Chapter List

Search this Book: