Smart Communities with IoT and onem2m Layer

A multi-node Architecture for communities where nodes are monitored and controlled from a centralized message queue system. [prototype]

Smart Communities with IoT and onem2m Layer

Things used in this project


Hardware components

1 DFRobot TDS SEN0244
1 DFRobot Digital Temperature & humidity sensor (With Stainless Steel Probe)
1 NodeMCU ESP8266 Breakout Board
1 DC motor (generic)
1 Linear Solenoid, 12 VDC

Software apps and online services


Arduino IDE



Hand tools and fabrication machines


3D Printer (generic)


Soldering iron (generic)


Solder Wire, Lead Free



An increase in Population increases the number of Highrises and it has been very difficult for people to manage the resources of these apartments (Like Water, Electricity, HVAC, Fire Safety, Security, etc). Currently, many of these highrises have been hiring 3rd party consultancies to manage the resources. These agencies are very costly to hire and are not easy to manage and monitor on regular basis.


We propose to have end-to-end node connectivity for data and control using the oneM2M layer and a centralized message queuing for control and inter-operations between different node types. As this is a prototype for a bigger picture of many nodes and control types we are choosing to select a particular type of node to understand and validate the scope of the current implementation, which will also act as a proof of concept for this idea.



Hardware Selection


This project requires a low-powered, reliable, and widely available yet cost-effective Wifi network to connect to the cloud. We will be using an ESP module with a built-in wifi module for connectivity. Currently, TDS meters and Flow monitoring is done from the node. For control, we are using a node with a relay control for a water motor.


Currently planning and implementation are in process so the final data and the specifics will be updated soon.


12 V DC Motor is used to intake water from the water storage container to an internal container. Then the TDS & temperature sensors are set into the internal container. After this procedure the, Solenoid is used to hold the water while the TDS and temperature values are determined. It is also used to drain the water out of the container. During this, the TDS and temperature value of the water are determined and are further sent to OneM2M.

This process is performed is to be performed every few hours.




Software Ideology


The idea is to use oneM2M as one of the middleware layer. The features of OneM2M used are:


GroupingSubscriptionCommunication protocolSecurityDiscovery 

We are planning to use Django to control the node management and the message queuing for actions. An idea for code generation for creating custom actions from data used from OneM2M.






Arduino IDE 1.8.5 or Eclipse IDE (Version Neon along with "Eclipse C++ IDE for Arduino 2.0" plug-in)Postman (Optional)


1. Issue and IOT solution


1.1. The Challenge:


Smart buildings are all about giving you more control—in this case, control over the building’s environment and operations. The results produced by these actions are tangible, and incredibly beneficial for your occupants, your profitability, and the Earth’s environment. It’s no wonder that 70% of organizations intend to increase their investment in smart building technology in the near future.


1.2. Our Solution:


Smart buildings use Internet of Things (IoT) devices—sensors, software, online connectivity-to monitor various building characteristics, analyze the data, and generate insights around usage patterns and trends that can be used to optimize the building’s environment and operations.


1.3. How it works:


Placing water quality sensors around the buildings. when activated these nodes will send to controller ESP32. TDS Voltage, Uncompensated TDS value, Compensated TDS value, Water Level values at regular intervals of every minute. Each controller is registered on the infrastructure node in the main server. The data with then be treated by a ESP8266, calculating the risk. The post request will then send the rule to switch on/off light (the frontend part) for display.


To send post request to nodeMCU used celery. It allows to send messages from application to a message queue which Redis message broker, and then the celery worker will pick up these messages and execute them within its worker process.



1.4. Results:


This will give the user to manage resources more efficiently and will be updated at any risk. The calculation of sensor values will be display in onem2m and at any risk node will be activated and turn on the alert light.




Functionality of the Server


When the server is started, the following functionalities are launched:


7.5.1. Discovering


The app will look for all the Nodes presents in the Infrastructure Node, and will store them in a database :

His Application Entites,His Containers. 

7.5.2. Subscription


The app will subscribe to container discovered previously according to all the sensors specified in infrastructure.

Each sensor will post on each corresponding node in onem2m.


7.5.3. Listening


After having subscribed, the app will listen for each subscription sector as, TDS Voltage, Uncompensated TDS value, Compensated TDS value, Water Level.After receiving a request, the app will store in the database the new event, depending on what kind of data is transmitted, there can be additional events (e.g send rule alert for turn on light).On the other hand, the app keeps a relation between the database and the http client. The client will ask for data to be displayed and returns the data.



Future Scope


As it is a prototype of sending data through post request, In future all can be done with help an UI interface. The data will also be calculated and analytics can be shown in a dashboard.




Download the project


You need to download worker-node with the following link :




Hardware Block Diagram



Architecture Block Diagram


The flow for how the arrangement of necessary entities is defined.



Hardware schematic



OneM2M resource tree



Hardware Architecture



Data Architecture



Implementation of onem2m Water-Quality


The article was first published in hackster, October 31, 2022


author: Leo Francis, ushasri mogadali, Noopur Kalambe, Nagesh Walchtwar, Andreas Kraft, Miguel Angel Reina Ortega, Bob Flynn, Wonbae Son, SeungMyeong Jeong

All Rights