I have a Victron BlueSolar MPPT which has both bluetooth and VE.Direct port.
It would be very cool if I could connect this to my Pi 4 and feed data into the SignalK server for displaying on some Gauges.
Has anyone done this already? Which would be the best way to get the data into the pi.. Bluetooth or VE.Direct cable?
Many thanks for any help or advice you can give
Paul
(2020-12-07, 09:35 PM)Pyxis Wrote: [ -> ]I have a Victron BlueSolar MPPT which has both bluetooth and VE.Direct port.
It would be very cool if I could connect this to my Pi 4 and feed data into the SignalK server for displaying on some Gauges.
Has anyone done this already? Which would be the best way to get the data into the pi.. Bluetooth or VE.Direct cable?
Many thanks for any help or advice you can give
Paul
I believe this has already been done. I do this with my battery monitor and a VE.Direct cable to my RPi. Check for Victron plug-ins in SignalK. Find which one looks like it will work best, install it, and go from there. There is also an Srne-to-SignalK plug in I'm trying with a different (none Victron) charge controller, but so far, I'm not getting data into the plug-in. It's down the list a ways, so not important enough to deal with yet.
Steve
Also doing the same with the USB cable and the mentioned plugin. I don't think its possible with Bluetooth (happy to be proved wrong on this) as when I tried the Pi wouldn't pair with the smartshunt even before I tried any SignalK stuff.
(2021-03-16, 08:11 PM)Boatingbaileys Wrote: [ -> ]Also doing the same with the USB cable and the mentioned plugin. I don't think its possible with Bluetooth (happy to be proved wrong on this) as when I tried the Pi wouldn't pair with the smartshunt even before I tried any SignalK stuff.
Am I right in thinking you need some sort of device (RPi) running Victron Venus ?
ie you cannot just connect a cable between the MPTT charger and the OpenPlotter Rpi and expect SignalK to flow ?
(2021-03-22, 07:00 PM)SCarns Wrote: [ -> ]I don't know about bluetooth. With the VE.Direct cable, you just plug it in, assign the USB port in the Serial App, activate the plugin and it works. Here's my data being served to WhilhelmSK: http://nauticarazi.com/wp-content/upload....45-AM.png
Steve
So the VE.Direct cable is plugged into your battery monitor, not the charge controller ?
The reason I ask is that, if I ever get back to my boat, I plan to fit a Victron Smart Solar MPTT and wondered if anything other than the VE.Direct cable was necessary to get SK out to Openplotter ?
(I dont have a Victron battery monitor or shunt - Ive made my own)
(2021-03-22, 08:10 PM)affinite Wrote: [ -> ]So the VE.Direct cable is plugged into your battery monitor, not the charge controller ?
The reason I ask is that, if I ever get back to my boat, I plan to fit a Victron Smart Solar MPTT and wondered if anything other than the VE.Direct cable was necessary to get SK out to Openplotter ?
(I dont have a Victron battery monitor or shunt - Ive made my own)
I have an arduino nano doing that, just one wire from the smart solar ve direct, TX. Only 4 data fields so far, but useful. The smartsolar ve direct is 5v so no voltage stepdown needed. Well worth thinking about a smart shunt if you spend a lot of time onboard away from mains power, the smartshunt talks to the mppt so it knows when to go to float based on battery info, otherwise it goes to float too early and the batteries never get fully charged.
Code:
#include <SoftwareSerial.h>
#include <ArduinoJson.h> //Must be version 5, not 6.
SoftwareSerial mySerial(10, 11); // RX, TX
String Data = "";
unsigned long currentMillis;
unsigned long timer1_Millis = currentMillis;
String input_flag = "mppt";
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(57600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// set the data rate for the SoftwareSerial port
mySerial.begin(19200);
mySerial.println("Hello, world?");
}
void loop() { // run over and over
currentMillis = millis();
if (currentMillis - timer1_Millis > 5000)
{
if (input_flag == "mppt") {
input_flag = "smartCharger";
// Serial.println(input_flag);
}
else if (input_flag = "smartCharger") {
input_flag = "mppt";
// Serial.println(input_flag);
}
timer1_Millis = currentMillis; //reset timing
}
if (input_flag == "mppt") {
while (mySerial.available())
{
char character = mySerial.read(); // Receive a single character from the software serial port
Data.concat(character); // Add the received character to the receive buffer
// if (character == 10)
if (character == 10)
{
int myindex = Data.indexOf("\t");
String dataType = Data.substring(0, myindex);
String dataValue = Data.substring(myindex + 1);
if (dataType == "V") { //battery voltage
sendSigK("lx.mppt.voltage", dataValue.toFloat());
// Serial.println(dataType + ":" + (dataValue));
}
else if (dataType == "I") { // output current
sendSigK("lx.mppt.current", dataValue.toFloat());
// Serial.println(dataType + ":" + (dataValue));
}
else if (dataType == "VPV") { // panel voltage
sendSigK("lx.mppt.panel_voltage", dataValue.toFloat());
// Serial.println(dataType + ":" + (dataValue));
}
else if (dataType == "CS") { // charger state.Off 0, Fault 2, Bulk 3, Absorption 4, Float 5
sendSigK("lx.mppt.state", dataValue.toFloat());
// Serial.println(dataType + ":" + (dataValue));
}
Data = "";
}
}
}
}
void sendSigK(String sigKey, float data)
{
DynamicJsonBuffer jsonBuffer;
String deltaText;
// build delta message
JsonObject &delta = jsonBuffer.createObject();
//updated array
JsonArray &updatesArr = delta.createNestedArray("updates");
JsonObject &thisUpdate = updatesArr.createNestedObject(); //Json Object nested inside delta [...
JsonArray &values = thisUpdate.createNestedArray("values"); // Values array nested in delta[ values....
JsonObject &thisValue = values.createNestedObject();
thisValue["path"] = sigKey;
thisValue["value"] = data;
thisUpdate["Source"] = "ESP32";
delta.printTo(Serial);
Serial.println();
}
/*
PID 0xA04C - product ID
FW 130 - firmware versiomn
SER# HQ1621FRG7Z - Serial number
V 13140 - Voltage mV
I 0 - battery current
VPV 0 - Panel voltage
PPV 0 - panel power
CS 0 - charger state
Off 0
Fault 2
Bulk 3
Absorption 4
Float 5
ERR 0 - error code
LOAD OFF - load output state
IL 0 - Load current
H19 9419 - Yield total Kwh
H20 1 - Yield today Kwh
H21 11 - Max power today W
H22 0 - yield yesterday
H23 0 - max power yesterday
HSDS 120 - day sequence number (0-364)
Checksum g
* */
(2021-03-22, 08:46 PM)PaddyB Wrote: [ -> ] (2021-03-22, 08:10 PM)affinite Wrote: [ -> ]So the VE.Direct cable is plugged into your battery monitor, not the charge controller ?
The reason I ask is that, if I ever get back to my boat, I plan to fit a Victron Smart Solar MPTT and wondered if anything other than the VE.Direct cable was necessary to get SK out to Openplotter ?
(I dont have a Victron battery monitor or shunt - Ive made my own)
I have an arduino nano doing that, just one wire from the smart solar ve direct, TX. Only 4 data fields so far, but useful. The smartsolar ve direct is 5v so no voltage stepdown needed. Well worth thinking about a smart shunt if you spend a lot of time onboard away from mains power, the smartshunt talks to the mppt so it knows when to go to float based on battery info, otherwise it goes to float too early and the batteries never get fully charged.
Code:
#include <SoftwareSerial.h>
#include <ArduinoJson.h> //Must be version 5, not 6.
SoftwareSerial mySerial(10, 11); // RX, TX
String Data = "";
unsigned long currentMillis;
unsigned long timer1_Millis = currentMillis;
String input_flag = "mppt";
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(57600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// set the data rate for the SoftwareSerial port
mySerial.begin(19200);
mySerial.println("Hello, world?");
}
void loop() { // run over and over
currentMillis = millis();
if (currentMillis - timer1_Millis > 5000)
{
if (input_flag == "mppt") {
input_flag = "smartCharger";
// Serial.println(input_flag);
}
else if (input_flag = "smartCharger") {
input_flag = "mppt";
// Serial.println(input_flag);
}
timer1_Millis = currentMillis; //reset timing
}
if (input_flag == "mppt") {
while (mySerial.available())
{
char character = mySerial.read(); // Receive a single character from the software serial port
Data.concat(character); // Add the received character to the receive buffer
// if (character == 10)
if (character == 10)
{
int myindex = Data.indexOf("\t");
String dataType = Data.substring(0, myindex);
String dataValue = Data.substring(myindex + 1);
if (dataType == "V") { //battery voltage
sendSigK("lx.mppt.voltage", dataValue.toFloat());
// Serial.println(dataType + ":" + (dataValue));
}
else if (dataType == "I") { // output current
sendSigK("lx.mppt.current", dataValue.toFloat());
// Serial.println(dataType + ":" + (dataValue));
}
else if (dataType == "VPV") { // panel voltage
sendSigK("lx.mppt.panel_voltage", dataValue.toFloat());
// Serial.println(dataType + ":" + (dataValue));
}
else if (dataType == "CS") { // charger state.Off 0, Fault 2, Bulk 3, Absorption 4, Float 5
sendSigK("lx.mppt.state", dataValue.toFloat());
// Serial.println(dataType + ":" + (dataValue));
}
Data = "";
}
}
}
}
void sendSigK(String sigKey, float data)
{
DynamicJsonBuffer jsonBuffer;
String deltaText;
// build delta message
JsonObject &delta = jsonBuffer.createObject();
//updated array
JsonArray &updatesArr = delta.createNestedArray("updates");
JsonObject &thisUpdate = updatesArr.createNestedObject(); //Json Object nested inside delta [...
JsonArray &values = thisUpdate.createNestedArray("values"); // Values array nested in delta[ values....
JsonObject &thisValue = values.createNestedObject();
thisValue["path"] = sigKey;
thisValue["value"] = data;
thisUpdate["Source"] = "ESP32";
delta.printTo(Serial);
Serial.println();
}
/*
PID 0xA04C - product ID
FW 130 - firmware versiomn
SER# HQ1621FRG7Z - Serial number
V 13140 - Voltage mV
I 0 - battery current
VPV 0 - Panel voltage
PPV 0 - panel power
CS 0 - charger state
Off 0
Fault 2
Bulk 3
Absorption 4
Float 5
ERR 0 - error code
LOAD OFF - load output state
IL 0 - Load current
H19 9419 - Yield total Kwh
H20 1 - Yield today Kwh
H21 11 - Max power today W
H22 0 - yield yesterday
H23 0 - max power yesterday
HSDS 120 - day sequence number (0-364)
Checksum g
* */
Looks good.
That another job on the task list then ...