Giter VIP home page Giter VIP logo

bigrom26 / modbus-mqtt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from snitundil/modbus-mqtt

0.0 0.0 0.0 21 KB

Python implementation of Modbus TCP + MQTT. Data can be read/written from a remote MQTT client to/from multiple MODBUS slaves. Slave IDs can be updated, new slaves can be added and register number can be selected by the remote user. This general implementation can be modified for various IoT applications.

Python 100.00%

modbus-mqtt's Introduction

modbus-mqtt

Python implementation of Modbus TCP + MQTT. Data can be written to/read from multiple MODBUS slave devices from a remote MQTT client.

This code includes a reg_config option which allows the end user to select the registers to be used while writing and reading data.
This code also includes a slave_config option which allows the end user to assign slave IDs to existing devices or add new devices with their own slave ID.
Data read/write to these slaves can be done from a remote MQTT client connected to an online MQTT server.
Hence this implementation allows for the use of multiple MODBUS TCP slaves whose slave IDs can be changed or new slaves added and register number to be used for each slave can also be configured by the user. Data read/write can be done from a remote client. Usage is as explained below.

The implementation consists of 3 inter-dependent programs :

  1. modbus_server.py - The pymodbus Modbus TCP server which reads/writes modbus data from slaves.

  2. modbus-mqtt_client.py - This is a pymodbus Modbus TCP client and a paho-mqtt MQTT client which receives requests (read/write) from remote MQTT client from the MQTT broker and sends requests (read/write) to the modbus server. If it is a read function, it sends the read data back to remote client through the MQTT broker.

  3. mqtt_remote_client.py - This is the user end from where requests are sent to read/write slave data into respective topics n MQTT broker and this is received by modbus-mqtt_client which is subscribed to the those topics.

Applications :

The code is a general implementation of Modbus TCP and MQTT which can be modified and used for various IoT applications.
An example would bean energy monitoring system for a home or office. To do this, one could run modbus_server.py and modbus-mqtt_client.py on a Raspberry Pi connected to one or more slave Modbus sensors. The data of the sensors can be accesed remotely by running mqtt_remote_client.py (with slight changes to read data at regular time intervals) on a remote personal computer and an IoT Dashboard can be used to visualise the data.
Various applications like this can be implemented with slight adjustments to the code.

modbus-mqtt's People

Contributors

snitundil avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.