question

kristiqn-tachev avatar image
kristiqn-tachev asked

VE Direct UART data with strange encoding

Hello there to all of you!


I am happy to be part of the Victron community!

I am trying to setup a ESP32 with Espruino firmware and connect all to 100/30 Smart Victron Solar controller https://www.espruino.com/ESP32#serial-uart-example

I have connected the rx and tx to ESP32 on D4 and D15 they are Serial UART compatible.

I am reading the information as follow

Serial2.setup(19200, { tx: D4, rx: D15 });

Serial2.on('data', function(data) {
const res = data.split("\r");

console.log("-------------");

console.log(data, res);

});



What i got is different every time when the controller sends a message and it looks like this

PID 0xA056íë÷û›ÊrÕCKJ
V 12690
IÉ¿ÿoCS 0
MPPT 0
OR 0x¿¿ë+%ON
H19 653
H20í½ÿÿk?1
H23 326
HSDS 1²íÿ [
"",
"\nPID\t0xA056\xED\xEB\xF7\xFB\x9B\xCAr\xD5CKJ",
"\nV\t12690",
"\nI\xC9\xBF\xFFo\vCS\t0",
"\nMPPT\t0",
"\nOR\t0x\xBF\xBF\xEB+\x11%ON",
"\nH19\t653",
"\nH20\xED\xBD\xFF\xFFk?1",
"\nH23\t326",
"\nHSDS\t1\xB2\xED\xFF"
]
-------------
PID 0xy¿½¿ï*%‚šÊrÕCKJ
V 12690íë_W 0
CS 0
MPPT 0
OZýïk
LOAD ON
êoûoïJ’J81
H23 326
HSD[ý [
"",
"\nPID\t0xy\xBF\xBD\xBF\xEF*%\x82\x9A\xCAr\xD5CKJ",
"\nV\t12690\xED\xEB_W\t0",
"\nCS\t0",
"\nMPPT\t0",
"\nOZ\xFD\xEFk\nLOAD\tON",
"\nH19\t653",
"\xEAo\xFBo\xEFJ\x92J81",
"\nH23\t326",
"\nHSD[\xFD"
]
-------------

Sometimes PID is missing also

-------------
ï•%0xA056
FW 156
[uÿï•12690
I 0
VPV 82¼í}]%0
Êuÿ½= 6530001
H20 168
H21 ·¿½·7SjEM%12
Checksumíý [
"\x7F\xEF\x95\x11%0xA056",
"\nFW\t156",
"\n[u\xFF\xEF\x9512690",
"\nI\t0",
"\nVPV\t82\xBC\xED}]%0",
"\nOR\t0x00000001",
"\xCAu\xFF\xBD=\t653",
"\nH20\t168",
"\nH21\t\xB7\xBF\xBD\xB77SH\bjEM%12",
"\nChecksum\xED\xFD"
]


Actual picture how see the data coming from the Controller....

screenshot-from-2021-05-24-22-31-37.png
Another thing i cannot understand is how to parse this data what am i missing ?

Thanks in advance!


VE.Direct
2 |3000

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

2 Answers
kristiqn-tachev avatar image
kristiqn-tachev answered ·

I have found the problem !
I am using my Laptop connected to AC and i am powering the ESP32 using the USB. Then i am connecting only using rx/tx to the UART interface but the ground and plus are different so i needed to shunt out the 2 grounds and voalah!! The result looks promising

PID 0xA056
FW 156
SER# *****
V 12630
I 0
VPV 820
PPV 0
CS 0
MPPT 0
OR 0x00000001
ERR 0
LOAD ON
H19 6


So if you are using external power supply for powering ESP32 or ESP8266 or different device be aware that you need to connect both Grounds together in order the data to be accurate !!

Regards to all of you!

2 comments
2 |3000

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

wkirby avatar image wkirby ♦♦ commented ·

Even better idea is to use a digital isolator like SI8422.

0 Likes 0 ·
Show more comments
kristiqn-tachev avatar image
kristiqn-tachev answered ·

Another thing that i found out after processing the data correctly is the following:
screenshot-from-2021-05-25-00-18-24.png


Sometimes the data coming from the Controller is without some fields and Checksum is that expected behaviour ?



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