Online monitor for Victron BMV-600S and BMV-602S: Installation and code

In this post I'm going to explain how to install my online monitor for Victron BMV-600S and BMV-602S battery monitor. To use it you need to connect your BMV to a computer, read this post to know how to do: “Connect Victron BMV battery monitor to a computer”.

Requeriments:

  • Computer running Linux, Mac or Windows.
  • Python 2.7(Python 3.X not working)
  • PySerial installed.
  • Web server with PHP and MySQL.

The software consist in two parts, a Python script that receive data from serial port and a web PHP app that show data and record it in a MySQL database.

  1. Download the software from github: http://github.com/jepefe/bmvmonitor
  2. Extract files from zip.
  3. Copy “Serial scripts” folder to the computer connected to the BMV
  4. Run bmv_mon.py script in this way to be sure you are receiving data from the BMV:
  5. python bmv_mon.py -p /dev/ttyUSB0 -j #(replace “ttyUSB0” to correct device or “COMX” for Windows)
  6. If all is going well you will get something similar to this:
    {"FW": "211", "ALARM": "OFF", "SOC": 78.0, "H10": 41, "BMV": "600S", "TTG": 5103, "I": -3.314, "H11": 29, "H12": 0, "CE": -116.175, "AR": "0", "V": 24.095, "H8": 29801, "H9": 2.18881944367398, "RELAY": "OFF", "H2": -116.175, "H3": 0.0, "H1": -259.107, "H6": -8832.716, "H7": 18.677, "H4": 1, "H5": 0.0}
  7. Copy the “Web server” content to the desired folder in your web server, we will use bmvmon/ for this tutorial.
  8. Import database.sql to your MySQL server.
  9. Edit bmvcfg.php to match your configuration, don't forget to set timezone for accurate records.
  10. Go back to the PC connected to the BMV and run bmv_monitor.py in this way:
    python bmv_mon.py -p /dev/ttyUSB0 -j -c -i3 -u http://YOURSERVER/bmvmon/regstatus.php -tYOURTOKEN #Replace “-i3” with the read interval(in seconds) and the token you have set in bmvcfg.php

Now you can go to your browser, access to monitorbmv.html and check that data is being displayed.

Categories

Renewable energy
comments powered by Disqus