Skip to content

GuillermoElectrico/modbus-logger

Repository files navigation

Modbus-Logger

Log your modbus-rtu device data on a Raspberry Pi/Orange Pi and plot graphs of your data. Its been verified to work with a Raspberry Pi with a Linksprite RS485 shield and Orange Pi Zero with USB to RS485 adapter for reading values from ABB ACS310 anda ABB ACS810. By changing the devices.yml file and making a corresponding [model].yml file it should be possible to use other modbus enabled models.

Add support for ModbusTCP and add bridge RTU to TCP vía ESP8266 and multi Influx_DB databases

Requirements

Hardware

Software

Prerequisite

Installation

Install InfluxDB*

Step-by-step instructions
  • Add the InfluxData repository
    $ wget -q https://repos.influxdata.com/influxdata-archive_compat.key
    $ echo '393e8779c89ac8d958f81f942f9ad7fb82a25e133faddaf92e15b16e6ac9ce4c influxdata-archive_compat.key' | sha256sum -c && cat influxdata-archive_compat.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg > /dev/null
    $ echo 'deb [signed-by=/etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg] https://repos.influxdata.com/debian stable main' | sudo tee /etc/apt/sources.list.d/influxdata.list
  • Download and install
    $ sudo apt-get update && sudo apt-get install influxdb2
  • Start the influxdb service
    $ sudo systemctl start influxdb
  • Create the database (databases are named buckets in influxdb2)
    $  influx bucket create -n db_modbus --org myorg
    or user webui at http://localhost:8086
  • Create a token
    $ influx auth create -o myorg --all-access
    or user webui at http://localhost:8086

*manual installation without apt

Install Grafana*

Step-by-step instructions
  • Add APT Repository
    $ echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
  • Add Bintray key
    $ curl https://packages.grafana.com/gpg.key | sudo apt-key add -
  • Now install
    $ sudo apt-get update && sudo apt-get install grafana
  • Start the service using systemd:
    $ sudo systemctl daemon-reload
    $ sudo systemctl start grafana-server
    $ systemctl status grafana-server
  • Enable the systemd service so that Grafana starts at boot.
    $ sudo systemctl enable grafana-server.service
  • Go to http://localhost:3000 and login using admin / admin (remember to change password) *source

Install Modbus Logger:

  • Download and install from Github and install pip3
    $ git clone https://github.com/GuillermoElectrico/modbus-logger.git
    $ sudo apt-get install python3-pip
  • Run setup script (must be executed as root (sudo) if the application needs to be started from rc.local, see below)
    $ cd modbus-logger
    $ sudo python3 setup.py install
  • Make script file executable
    $ chmod 777 read_modbus_device.py
  • Edit devices.yml to match your configuration
  • Test the configuration by running:
    ./read_modbus_device.py
    ./read_modbus_device.py --help # Shows you all available parameters
  • To run the python script at system startup. Add to following lines to the end of /etc/rc.local but before exit:
    # Start Modbus-Logger
    /home/pi/Modbus-Logger/read_modbus_device.py --interval 60 > /var/log/modbus-logger.log &
    Log with potential errors are found in /var/log/modbus-logger.log

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published