Tuesday, July 19, 2016

Victron BMV to Emoncms

I wanted to create statistics data from my recently bought Victron BMV-700 battery monitor. Here is a quick how to set this up using Raspberry Pi, Victron VE.Direct USB cable and a simple Python script.

Prerequisites

TheVictron BMV battery monitor needs to be setup correctly according to the installation manual and receiving data and displaying data view-able on the on-board display.

Hardware needed:

  1. Victron BMV-700 battery monitor(702 and 60x should also work, not tested)
  2. Victron VE.Direct to USB interface cable
  3. A computer with Linux installed with internet access (Windows could be used with small adjustments)
    • I use  a Raspberry Pi (1b+) with Raspbian Linux installed
    • It should work with anything that can run Python scripts but I have only tested it on Rasbian.
  4. A battery to monitor :-)

 Software needed

  1.  Python-serial
    • sudo apt-get install python3-serial 
  2. This Python script https://github.com/kogant/vedirect/blob/master/vedirect.py
    • Thanks to Janne Kario for the original script! https://github.com/karioja/vedirect
#Register an Emoncms account
Go to https://emoncms.org/ and click register. (free)

Get the read & write API key









Create dir
#mkdir /opt/vedirect/
#cd /opt/vedirect

copy script there
#/opt/vedirect# wget https://raw.githubusercontent.com/kogant/vedirect/master/vedirect.py

make it executable
# chmod +x /opt/vedirect/vedirect.py

Edit the file and insert Emoncms readwrite API key using your favorite editor (Vim/Pico whatever)

setup cronjob
# Crontab -e
 insert a new line that will make the script run every minute and log the output to syslog (/var/log/syslog)
* * * * * /opt/vedirect/vedirect.py  2>&1 | /usr/bin/logger -t veDirectStats




Check if it runs ok
 Syslog (tail /var/log/syslog)

In Emoncms you will have setup the following inputs:

The "name" will be missing. You can edit the "Names" by looking at the image above or taking a look at the "VE.Direct Text Protocol" documentation here: https://www.victronenergy.com/support-and-downloads/whitepapers

Setup feeds from the input to store the data.
 

Result


Update, It's been running fine now from July to now and still running. There's been not much sun the past month so the voltage is going downvards.

 

2 comments:

  1. you got any further with this am looking at something similar

    ReplyDelete
    Replies
    1. Except for some downtime in my internet provider, it's been working flawlessly since startup but I haven't developed it more then this. I added this http://www.volumerate.com/product/hobbywing-5v-6v-3a-switch-mode-ultimate-bec-ubec-844015149 to run my raspberry from the battery, but that's it :-)

      Delete