Updated 2022-01-11 !
During my update of the cables
going from the batteries, to the distribution panel and engines, I stumbled
over the Victron SmartShunt(VSS). We had a 15 year
old Mastervolt battery monitor but it didn't feel "true" and it wasn't at
the right place in the boat. So instead of moving the old shunt we bought a VSS.
Introduction
The VSS don't have any display but can be used, standalone via Bluetooth, with the VictronConnect app which is
available for different OS.
Cables
To get the serial data, to the SK server, the most straightforward way is
to buy the Victron USB interface cable, and connect it to the computer running the Signal K server.
Here we will check out two DIY ways to connect to a Raspberry
Pi(RPi) but please note !! that these solutions don't have galvanic isolation as the Victron cables have.
Victron have different products with the VED interface and they have
different logic levels. For the VSS it's 3,3 V so it matches the RPi
inputs.
Using a "standard" USB to serial console cable you do the connection as follows. The VSS pin numbers are found in
the picture above. If you want to validate this cable, check below at Cable check.
|
VSS pin
|
USB cable color
|
|
Gnd, 1
|
GND, Black
|
|
TX, 3
|
RX, White
|
Another way is to use a "direct cable" connected like this
|
VSS pin
|
RPi pin
|
|
Gnd, 1
|
GND, 9
|
|
TX, 3
|
RX, 10
|
The cable could be a JST PH 4Pin cable.
USB cable
After Connecting the USB cable it will probably appear as "/dev/ttyUSB0". Check with
dmesg | grep tty
Direct cable
Per default the RX/TX pins, on any Raspberry Pi, are setup as a serial
console. This means that you can use the USB console cable, mentioned above,
to
log on from almost any computer, which have an USB port, to the RPi. We have to disable this function with
3. Interface options =>
I6 Serial Port Enable/disable shell
messages on serial connection
Would you like a login shell to be
accessible over serial? => No
Would you like the serial port
hardware to be enabled? => Yes
The serial login shell is
disabled
The serial interface is enabled => OK
Shutdown with "sudo shutdown now", connect the 2 cables, boot up and check with
dmesg | grep tty
probably it will appear as "/dev/ttyS0"
Check the output
In both cases you have to set the port baud rate, matching the output from
the VSS, with
stty -F /dev/ttyXX 19200
the "ttyXX" should be exchanged with what you got above. Then check the data with
cat /dev/ttyXX
and you will see something like
PID 0xA389
V 13515
VS -12
I -453
.........
Send to Signal K
Direct attached VSS Via the SK Appstore install "@signalk/vedirect-serial-usb" and configure it via "Plugin Config".
Using the SK "Data Browser" check the data.
Remote VSS
In our boat the batteries are in the aft part and the SK server
is ahead. So the solution was to place a Raspberry Zero W(RZ), at the VSS,
avoiding long cables. The shunts serial output connects, with a "Direct
cable", to the serial input on the RZ.
With "socat"
There are several solutions to send the data from the RZ to the SK server
but the solution, with the smalest footprint, is to use "socat" and forward the data via UDP.
Install "socat" with "sudo apt install socat" and test the output from VSS with
socat /dev/ttyS0,b19200,raw,echo=0,crnl -
Interrupt the command with Ctrl +c and then issue the
command
socat -u /dev/ttyS0,b19200 UDP-SENDTO:zest:8888
where "zest" is the hostname of the target SK server. Configure the plugin on the
target SK server to receive UDP at the right port number and check the data
in "Data Browser".
If you want this command to be working in the background, autostart at boot
and restart if it fails I really recommend using systemd. Check
this post
and search for "Autostart with systemd" where you get some hints for the
setup.
With Signal K
Another way could be to set up a complete SK server on the RZ with the use of the "@signalk/vedirect-serial-usb" plugin. When the RZ is setup it will automagically appear, at the target SK server, where you use that suggestion to set upp the connection.
Please note that Node.js 16 have to be installed via binaries on the RZ. Check below.
With Node-Red
The flow part with the "ADS 1015" node is from this post.
Cable check
A loopback test will check the mentioned cable. Connect the RX(white) and the TX(green), cable to each other and in a terminal window issue the receive command
socat /dev/ttyUSB0,b19200,raw,echo=0,crnl -
In another terminal window issue the send command
echo "Test data" > /dev/ttyUSB0
If you receive the text in the listen window you have succeeded and the cable is OK.
This test also applies to testing the "direct" port on the RPi and then doing a connect between between the GPIO pin 9 and 10.
Node.js 16 on Raspberry ZW
Hints .....
https://nodejs.org/dist/
https://nodejs.org/dist/latest-v16.x/
wget https://nodejs.org/dist/latest-v16.x/node-v16.14.0-linux-armv7l.tar.gz
tar -xzf node-v16.14.0-linux-armv7l.tar.gz
node-v16.14.0-linux-armv7l/bin/node -v
v16.14.0
cd node-v16.14.0-linux-armv7l
sudo cp -R * /usr/local/
node -v
npm -v
rm node* -rf
Comments
* 1.9 Gb on the SD card
* 60 % RAM
What is important is the "map remote self to local self setting".
I have some questions / comments:
1) I made the cable myself with an UART to USB, but I didn't connect the 5V pin as the Blue Solar Charger seems to get its power from the solar panels and produces 5V on the JST 5V pin. But in the night, of course, it switches off and I cannot get the values from the blue solar charger. DO you think I can connect the Blue Solar 5V pin to a 5V power supply (for instance the raspi zero power so it could work even with no sun?
2) I couldn't make the pi zero recognize the serial port when I powered the Raspberry on the first USB port and plug the UART on the second USB port. After hours trying everything, I just powered the pi zero on the 5V GPIO pin and plug the UART in the first USB port, and it worked immediately.
3)I have a Victron Blue solar 75/50. There are some values I can see in the victronconnect App on my cell phone that don't appear in the Signalk server (for instance solar current, and all the victron settings etc.). Is it because the plugging doesn't implement them or that these values are available on request from the victronconnect app, or something else? For instance, the app is able to show the history of the charging, so where are these values???
4) What exactly are the YIELD values displayed by the pluggin, and more generally is there a reference document of the Blue Solar values?
Cheers!
1-2/ I had no problems, with any of the described solutions, receiving data from the shunt.
3/ Use Slack to ask questions regarding the plugin
4/ There is a link above for the VED protocol, it maybe helps ?
Post a Comment
Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !