Skip to main content

A new modpoll tool for modbus communication

Project description

ModPoll - A new modpoll tool for modbus communication

pipeline status License Downloads

Learn more about modpoll usage at documentation site.

Motivation

The initial idea of creating this tool is to help myself debugging new devices during site survey. A site survey usually has limited time and space, working on-site also piles up some pressures. At that time, a portable swiss-knife toolkit is our best friend.

This program can be easily deployed to Raspberry Pi or similar embedded devices, continuously polling data from the connected modbus devices, you can choose to save data locally or forward uplink to a MQTT broker for easy debugging, the MQTT broker can be setup on the same Raspberry Pi or on the cloud. On the other hand, a smart phone (Android/Iphone) can be used to visualize collected data and control the devices remotely via the same MQTT broker.

Moreover, you can also run this program on any PC or server with Python 3 support. One common use case is to deploy the program onto a server and keep it running as a gateway, i.e. polling data from local Modbus devices and forward to a centralized cloud server. In that sense, this program helps to bridge between the traditional world of fieldbus network and the modern world of IoT edge/cloud infrustructure.

This program is designed to be a standalone tool, it shall work out-of-the-box. If you are looing for a modbus python library, please consider the following two great open source projects, pymodbus or minimalmodbus

Installation

This program is tested on python 3.6+.

  • Install with pip

    The package is available in the Python Package Index,

    pip install modpoll
    

    Upgrade the tool via pip by the following command,

    pip install -U modpoll
    

Basic Usage

  • Connect to Modbus TCP device

    modpoll --tcp 192.168.1.10 --config examples/modsim.csv
    
  • Connect to Modbus RTU device

    modpoll --rtu /dev/ttyUSB0 --rtu-baud 9600 --config examples/scpms6.csv
    
  • Connect to Modbus TCP device and publish data to MQTT broker

    modpoll --tcp modsim.topmaker.net --tcp-port 5020 --config examples/modsim.csv --mqtt-host iot.topmaker.net
    
  • Connect to Modbus TCP device and export data to local csv file

    modpoll --tcp modsim.topmaker.net --tcp-port 5020 --config examples/modsim.csv --export data.csv
    

Please refer to documentation site for more configures and examples.

Notes: some of the examples use our online modbus simulator at modsim.topmaker.net with standard 502 port, it helps user to quickly test the functions of modpoll tool.

Run in docker

A docker image has been provided for user to directly run the program,

docker run helloysd/modpoll --help

To load local configure file, you need to mount a local folder to the container volume, for example, if the child folder examples contains the config file modsim.csv, we can mount it using the following command,

docker run -v $(pwd)/examples:/app/examples helloysd/modpoll --tcp modsim.topmaker.net --config /app/examples/modsim.csv

The other way is to load configure file from a remote URL, for example,

docker run helloysd/modpoll --tcp modsim.topmaker.net --tcp-port 5020 --config https://raw.githubusercontent.com/gavinying/modpoll/master/examples/modsim.csv

Credits

The implementation of this project is heavily inspired by the following two projects:

License

MIT © Ying Shaodong

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

modpoll-0.3.6.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

modpoll-0.3.6-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file modpoll-0.3.6.tar.gz.

File metadata

  • Download URL: modpoll-0.3.6.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.8 CPython/3.6.15 Linux/5.4.109+

File hashes

Hashes for modpoll-0.3.6.tar.gz
Algorithm Hash digest
SHA256 fea16e1da9a861177f3f7d0efe1f1106a0c567f689f72f57b82792be3923de3e
MD5 55dd9bef6eac18acd8d064c4406431e6
BLAKE2b-256 53f2e062456490e03a8f6bb52bb74b28868c322fc178d2242b67847387033149

See more details on using hashes here.

File details

Details for the file modpoll-0.3.6-py3-none-any.whl.

File metadata

  • Download URL: modpoll-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.8 CPython/3.6.15 Linux/5.4.109+

File hashes

Hashes for modpoll-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 553ab781d5a17b177cf9e66709c20b85dabd60cb1b80b03612ba390caf8f4100
MD5 233cd43758da57cda400f5cae12e8547
BLAKE2b-256 ec7773314849a56639cd5d50276c85842afebf6c71b2a403eb46cc988bf6f062

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page