Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Victron MPPT 150|35 RS232 String Parsing for CR1000X


MattB Oct 23, 2020 02:23 AM

Hi,

I have a Victron MPPT 150|35 SmartSolar charge controller and can successfully read the RS232 string in to a CR1000X datalogger via the CPI RS232 port.

I'm just wondering how best to parse the string, as the last character (Checksum value) changes regularly.

The string is 19 lines consisting of a Field Name and assocaited Field Value (field name and value are separated by a Tab).

Please see a complete string below captured via Putty. The string is output from the solar controller at 1Hz with no blank line after the Checksum.

Thanks very much for your help in advance!

Thanks,

Matt

 

PID	0xA058
FW	150
SER#	HQ19358CA84
V	12340
I	0
VPV	20
PPV	0
CS	0
MPPT	0
OR	0x00000001
ERR	0
LOAD	ON
H19	0
H20	0
H21	0
H22	0
H23	0
HSDS	0
Checksum	a

 


nsw Oct 27, 2020 10:41 AM

Have a look at the "SerialInRecord" instruction. This allows you to have a two character start word and separate two character end word, to find the string in-between.

So, your two character start word could be characters could be "PI" (PID sring) and end string word "um". As long as these sets of characters are not foundelsewhere in the outputs from the sensor, this should capture everythig between these characers in to a string variable. 

With a bit of experimentation and trial/error, you should get what you need.


MattB Oct 28, 2020 01:57 AM

Hi nsw,

Thanks veyr much for the information - most appreicated.

I'll try as you suggest.

Thanks again,

Matt


steve.davies Jul 7, 2022 03:17 AM

Hi Matt,

Did you manage to write a program to read/log the MPPT data. I am looking to write a program now and figured I'd reach out before commencing the trial and error phase.

Thanks,
Steve


LeeBaz Jul 28, 2023 03:38 PM

I'm trying to achieve the same thing for a Victron MPPT 100/20.

I took the following code from the Campbel serial example, and have been trying to edit it to get the info that's broadcast from the MPPT using RX on C6.

Currently I'm not getting anything into RawString, what am I missing?

 

Public PTemp, Batt_volt
Public RawString As String * 130, SplitStrings(2) As String * 16, FloatValue, IntegerValue As Long
Public NBytesReturned

'Declare Private Variables
'Example:
'Dim Counter

'Define Data Tables
DataTable (Test,1,-1) 'Set table size to # of records, or -1 to autoallocate.
	DataInterval (0,15,Sec,10)
	Minimum (1,batt_volt,FP2,False,False)
	Sample (1,PTemp,FP2)
EndTable

'Define Subroutines
'Sub
	'EnterSub instructions here
'EndSub

'Main Program
BeginProg
 SerialOpen (ComC5,19200,0,0,50)
' SerialOpen (ComC3,19200,0,0,50)
 Scan (1,Sec,0,0)
 PanelTemp (PTemp,250)
 Battery (Batt_volt)
 'SerialIn (RawString,ComC5,100,"um",130)
 SerialInRecord (ComC5,RawString,"PI",0,"um",NBytesReturned,00)
 CallTable Test
 NextScan
 SlowSequence
 Scan (1,Sec,3,0)
 'SerialOut (Com2,CHR(2)&"1234E+04,1234,abcd"&CHR(13)&CHR(3),"",0,100)
 NextScan
EndProg

 

Thanks!

Lee

Log in or register to post/reply in the forum.