![Logo Progetto](https://raw.githubusercontent.com/Alessandro-Cavaliere/Modbus2Chain/MC_BE_BC/./app/assets/LogoProgetto.png)
Modbus2Chain is an IoT project that uses the Modbus protocol to acquire environmental data from sensors and send it securely to the blockchain via a TCP
connection. This choice was made because Modbus TCP
is very popular for implementing IoT communications in industrial environments, due to its wide adoption, compatibility with Ethernet networks, adequate security and real-time communication capabilities
To achieve the goal of creating an efficient system for collecting and sharing critical environmental data, the project uses a number of technologies:
- The Modbus protocol back-end and device management is implemented in
Python
, using themicropython-modbus
library for communication with sensors. - The blockchain that is used is
Hyperledger Fabric
, a framework for creating highly scalable and modular enterprise blockchains. Hyperledger Fabric provides a secure and reliable platform for logging and sharing critical data, enabling easy permission management and enhanced data privacy. - The user interface is developed in
React
, a JavaScript framework for creating responsive and dynamic user interfaces.
The system workflow begins with the collection of environmental data from sensors using the Modbus TCP protocol. The acquired data is then sent to the Python back-end, which processes it and sends it to the Hyperledger Fabric
blockchain using the APIs made available by the framework. The blockchain guarantees the integrity and immutability of data, which can be easily shared with other authorized users.
⬇️Below, a graphic diagram of the workflow in order to make it easier to understand and interact between the different components of the system⬇️.
![ArchitectureDiagram](https://raw.githubusercontent.com/Alessandro-Cavaliere/Modbus2Chain/MC_BE_BC/./app/assets/ArchitectureDiagram.png)
Thanks to Modbus2Chain, it is possible to create an efficient system for collecting and sharing critical environmental data, guaranteeing their security and integrity through the Hyperledger Fabric
blockchain. Furthermore, thanks to the use of modern technologies such as React
and Python
, the project is highly flexible and easily scalable to meet the needs of any IoT application.
Being an exam project, for pure study purposes, very simple and easily configurable IoT devices were used, connected to each other on a breadboard.
The IoT devices are also connected to a slave
device (MCU) (in our case a Raspberry Pi Pico W
), which allows us to manage the Modbus TCP
requests arriving from our master (a BeagleBone Black
) and save the data on Modbus registers (HREGS
Holding Registers and COILS
registers were used in our project).
For more details on Modbus registers you can consult this simple guide: Modbus_Registers
⬇️Below is a photo of the connections made⬇️.
If the temperature exceeds a certain threshold, the buzzer (Crowtail Buzzer 2.0
) sounds intermittently for a certain period, lighting up the red LED simulating an alarm.
If movement is detected through the sensor (HC-SR501 PIR
), the yellow LED lights up and it is possible, through other configurations present, to ensure that at the moment of a detection, the buzzer sounds, simulating another type of alarm, based on the movement, in fact.
The temperature and humidity sensor (DHT11
), however, is always active, continuously monitoring temperature and humidity, whose values are saved in the registers (or notarized if the user chooses to do so, on the blockchain).
Temperature and humidity data are assumed as hypothetical critical data to be made immutable on the blockchain and to be monitored continuously.
For the correct functioning of the application, READMEs are linked below to the respective sections. Read all the READMEs carefully to avoid making configuration errors.
For detailed instructions on setting up and using the Back-End and the Blockchain network of this application, please refer to the Back-End & Blockchain README.
For detailed instructions on setting up and using the Front-End of this application, please refer to the Front-End README.
For this project, a summary presentation
was also created of what this project is about, what technologies were used, the security criteria and more.
To view the presentation pdf (in Italian) download it directly from here ➡️ Presentation
As already mentioned, this project was developed purely for study purposes for the exams of the IoT Security and Data Security course. The following project does not have a real application function in corporate or industrial contexts, the study which was carried out and demonstrated aims to develop software that combines two very important technologies (blockchain and IoT) and uses cutting-edge security criteria for the security of a hypothetical application that handles sensitive data and critical information.
Furthermore, a new communication for us (Modbus) was tested, which allowed us to understand its mechanisms and critical issues. We decided to use Modbus because it is the standard for industrial communication protocols, mainly used in industrial automation to connect programmable logic controllers (PLCs).
- Modbus Definition
- Modbus Registers - 1
- Modbus Registers - 2
- Modbus TCP Overview
- MicroPython Overview
- MicroPython Modbus Library
- Beaglebone Black Docs
- Raspberry Pi Pico Docs
- Hyperledger Fabric Docs
- Hyperledger Fabric SDK - Python
- Fabric SDK Python Wiki
- Fabric SDK Python Docs
- Go Installation for Chaincode
- Docker Overview
- Installation of Docker Images for Hyperledger
- OpenSSL Download
- Flask User Guide
- React User Guide