question

bara avatar image
bara asked

API in local machine to determine the charge of battery in percentage of device.

Hi,

I want using the interface MK3-USB (VE bus to USB) to connect a multiplus (24I500I10) periphéral. I want to compute the charge of battery in percentage using an API in a local machine (kiosk) without network (airoport constraint).

It exists the VRM API but the problem is the impossibility to connect a remote server using the victron-connect application.

In an other side, I found this document (https://www.victronenergy.com/upload/documents/Technical-Information-Interfacing-with-VE-Bus-products-MK2-Protocol-3-14.pdf) that describe the interfacing with VE-but product MK2-protocol. In this case, we must use commands to get the device information. Is there a command th get the charge of battery in percentage?

Is there an api (java, c, ... etc) to compute these information ?


Thank you in advance.

Best Regards,

MK3
1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Alexandra avatar image Alexandra ♦ commented ·

@BARA

There are white papers on interfacing with Victron products. You will need to browse them to see if there is any thing you can use.

https://www.victronenergy.com/support-and-downloads/technical-information


https://www.victronenergy.com/live/ccgx:modbustcp_faq#gx_modbus-tcp_manual


0 Likes 0 ·
3 Answers
bara avatar image
bara answered ·

Hi,

Thank you Alxendra for your response.


Question 1: do you have idea how to use the MK2-Protocol (the commands) to compute the charge of battery?

Question 2: I suppose that we can the charge of battery with modbus-tcp feature. Do you have examples to compute the data (the charge of battery or volting, .. ect) from the multiplus periphéral?

Thank you in advance.

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

nickdb avatar image nickdb ♦♦ commented ·

Add a GX, then you can query it via MQTT or use node-red to extract the info you are looking for. The internal battery monitor isn't the most accurate, so consider a shunt.

The vebus is really only for internal comms between the relevant systems, though some users have built interfaces to it, but it isn't common.

0 Likes 0 ·
bara avatar image
bara answered ·

Hi,

I have found the solution. It's described in the pages 10, 11, 21 and 22 (section CommandGetRAMVarInfo) and in the document [1]. Examples are done in Appendix 1 and 2.

For compute the charge in percentage from the DC-voltage.

1- the scale and offset information of the DC voltage :

- we pass the command :

=> 05 FF ‘W’ 36 (04 00) 6B

<= 09 FF ‘W’ 8E (X0X1 X4X3) 8F (XX XX) <checksum>

<Sc> is a signed 16-bit value

Scale := Abs(Sc)

If (Scale ≥ 0x4000)

Scale := 1 / (0x8000 – Scale)

where Sc = (X4X3 X1X0) is the extracted value in the response

<Offeset> is a signed 16-bit value.


2- the DC info frame. Extract the DC-voltage value.

- we pass the command :

=> 03 FF ‘F’ 00 B8

<= 0F 20 (XX XX XX XX) 0C (X0X1 X4X3) (XX XX XX) (XX XX XX) XX <checksum>

assume x (X0X1 X4X3) is the (16-bit) value of a RAM variable :

DC-voltage value := Scale * (x + Offset).


3- Finaly, we deduce the charge in percentage from the DC-voltage value and the DC-voltage-min (to define).


Best Regards.

References:

[1] - Microsoft Word - Interfacing with VE Bus products - MK2 Protocol 3 14.docx (victronenergy.com)


2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

dognose avatar image
dognose answered ·

What are you going to do with that information, if the device has absolutely no network connection to the outside world?

locally, on the gx device itself, you can use dbus to get the SoC:

root@einstein:~# dbus -y com.victronenergy.system /Dc/Battery/Soc GetValue
100

you can use this for some sh-scripts, but ofc. requires "a little" knowledge on scripting there.

More complex stuff can be achieved through python, but there we are moving from "scripting knowledge" to "be a programmer" ;)

edit: Ah, you didn't mention a gx-device. Sorry, then this doesn't apply. Leaving it here anyway.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Related Resources

Additional resources still need to be added for this topic