Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

MPPT Solar Controller

Communication protocol
MPPT Solar Controller communication protocol February 2018

Catalog

1 INTRODUCTION..........................................................................................................................2

1.1.1 Starting mark..............................................................................................................2


1.1.2 Addr............................................................................................................................2
1.1.3 Command ID..............................................................................................................2
1.1.4 Data item.................................................................................................................... 2
1.1.5 Data length................................................................................................................. 2
1.1.6 Data:optional,Some instructions include the return of the data (as required).....2
1.1.7 Check..........................................................................................................................2
1.1.8 Data type specification...............................................................................................2

2 ADDR...............................................................................................................................................3

3 COMMAND LIST..........................................................................................................................3

4 COMMAND ITEM LIST.............................................................................................................. 3

5 DATA region................................................................................................................................... 4

6 COMMAND ACKNOWLEDGE..................................................................................................4

7 DETAILED DESCRIPTION OF DATA ITEMS.........................................................................5

7.1.1 Run state data............................................................................................................. 5


Table 9-1 breakdown information details........................................................................... 5
7.1.2 Battery parameters..................................................................................................... 5
7.1.3 Run log....................................................................................................................... 6
7.1.4 Sampling parameters..................................................................................................7
7.1.5 Load parameter...........................................................................................................7
7.1.6 RemotControl parameters.......................................................................................... 8
7.1.7 Protection parameters.................................................................................................8
7.1.8 Equipment information.............................................................................................. 9
7.1.9 Temporary data storage.............................................................................................. 9
7.1.10 Information on power generation and electricity consumption...............................9
7.1.11 Table 9-1 breakdown information details.............................................................. 10

8 RELEVANT DATA DESCRIPTION:......................................................................................11

9 SOME EXAMPLES OF COMMAND:...................................................................................14

1/16
MPPT Solar Controller communication protocol February 2018

1 Introduction
Communication protocol requirements
1. data arrangement: low in the left, high in the right
2. the entire packet length is not more than 120 bytes.

Starting Addr Command Data item Data Data Check


mark ID length (optional)
device device
type addr
1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 0~120 byte 1 byte

1.1.1 Starting mark


It is necessary. Each packet needs to start with the start flag as the data packet.
1.1.2 Addr
It is necessary. The address is used to indicate the object that the packet is sending, used
in the multimachine communication. The device type is used to indicate the target device
type of the communication. 0x00 represents all devices. The device address is used to
indicate the address of the communication equipment. 0x00 represents any address, that
is, the broadcast address. The recipient parses the packets only when the broadcast or
address is consistent with its own address.
1.1.3 Command ID
It is necessary. The command ID is used to define the behavior of the current packet. (see
detailed list of commands).
1.1.4 Data item
It is necessary. The region is used to define the operating object of the current command.
The general operating object is the data structure, but it is not limited to the data structure.
1.1.5 Data length
It is necessary. The length of data defined here refers only to the length of the data region
following it, and does not contain the check domain.
1.1.6 Data:optional,Some instructions include the return of the data (as required).
1.1.7 Check
It is necessary. The verification region is to verify the correctness of the data packet. The
value of the check region is equal to the addition of the bytes and then the lower bytes of
the data of all other domains of the packet, and then the inverse plus one.
1.1.8 Data type specification
U16 -- 16bit Unsigned char
S16 -- 16bit Signed char
U32 -- 32bit Unsigned char
S32 -- 32bit Signed char
U16 and S16 data formats: low bytes in front (left), high bytes in the back (right);
U32 and S32 data format: low words in front, high word after; low bytes in front, high

2/16
MPPT Solar Controller communication protocol February 2018

bytes in the back;


For example, sending data 1234 and converting to hex to 0x04D2, then transmit 0xD2 at the
time of transmission, and transmit 0x04;
For example, sending data 123456789 and converting to hex to 0x07 5B CD 15, then the data
sequence is: 0x5B 0x07 0x15 0xCD;

2 Addr
Device type Describe
0x00 all
Device Addr
0x00
0x01

3 Command list
Command ID Describe
0x00 CMD_ACK, acknowledge command
0x01 CMD_GET, Get some data item commands
0x02 CMD_SET, Set some data item commands and need to reply
0x03 CMD_SET_NO_RESP, Set some data item commands without a reply
0x04 CMD_NACK, No acknowledge command
0x05 CMD_EXEC, Carry out a particular action and need a reply
0x7F CMD_ERR,A command or parameter that can not be identified

4 Command item list


Describe Data item number Remarks
db_ChgSts 0 Controller running state
db_BatParam 1 Battery parameters
db_Log 2 Operation log
db_parameters 3 sampling parameters
db_LoadParam 4 Load parameters
db_ChgDebug, 5 Debug
db_remoteControl 6 Control
db_ProParam 7 Protection parameters
db_Information 8 Product information
db_TempParam 9 Temporary data storage
db_EngSave 10 Power generation information

3/16
MPPT Solar Controller communication protocol February 2018

5 Data region
For different commands, the format of the data region is different and is defined as follows:
Command ID value Describe
CMD_GET 0x01 The data region is necessary, and the first, second byte is the
high and low offset. The low third, fourth is the length of the
whole column of the data (the length of the word).
CMD_SET 0x02 The data region is necessary, and the first, second byte is the
high and low offset, and the following data is the data to be set,
the length of which can be obtained from the data length
domain.
CMD_SET_NO_RESP 0x03 Data format is the same as CMD_SET, but no reply is required.
CMD_ACK 0x00 Without a data domain, the command ID is replaced by a
CMD_ACK, a data packet that is replying at the same time,
and the data length region is 0.
CMD_NACK 0x04 Without a data domain, change the command ID into
CMD_NACK, the data field and its reply packet, the data
length region is 0.
CMD_EXEC 0x05 The data region is necessary, and its specific content depends on
the command ID and the specific command content.

6 Command acknowledge
If the packet is successfully parsed (it means that the packet format is correct and the address
matches), it will be returned as required; if the packet error is received (the packet format is
incorrect or the address is not consistent), the packet will be ignored. The acknowledge of the
command is defined as follows:
Command ID Acknowledge
CMD_GET CMD_SET_NO_RESP
CMD_SET CMD_ACK or CMD_NACK
CMD_SET_NO_RESP No reply
CMD_ACK No reply
CMD_NACK No reply
CMD_EXEC CMD_ACK or CMD_NACK

4/16
MPPT Solar Controller communication protocol February 2018

7 Detailed description of data items


7.1.1 Run state data
ChgSts information
Data item ID: 0x00
Attributes: Read-only(Read all:AA 01 00 01 00 03 00 00 1E 33)
Bytes Content Offset Unit Remarks
2 Uint16 wChgMode; 00 00 Charge Mode(0~4)
2 Uint16 wPvVolt; 01 00 0.1V PV input Voltage
2 Uint16 wBatVolt; 02 00 0.1V Bat Voltage
2 Uint16 wChgCurr; 03 00 0.1A Charging Current
2 Uint16 wOutVolt; 04 00 0.1V /(Internal use)
2 Uint16 wLoadVolt; 05 00 0.1V Load Voltage
2 Uint16 wLoadCurr; 06 00 0.1A Load Current
2 Uint16 wChgPower; 07 00 1W Charging Power
2 Uint16 wLoadPower; 08 00 1W Load Power
2 int16 wBatTemp; 09 00 1℃ Battrey temperature
2 int16 wInnerTemp; 0A 00 1℃ Internal temperature
2 Uint16 wBatCap; 0B 00 1% Battery level
4 Uint32s dwCO2 0C 00 0.1kg CO2 emission reduction
Uint16 wFault; Table 9-1 breakdown
2 0E 00
information details
2 Uint16 wSystemReminder; 0F 00 Table 9-2 system hints details

7.1.2 Battery parameters


BatParam information
Data item ID: 0x01
Attributes: Read and write
Bytes Content Offset Unit Remarks
2 Uint16 wFlag; 00 00 Flag
Battery type:
0: User-defined
1: Flooded
2 Uint16 wBatType; 01 00
2: Sealed;
3: Gel;

Battery system:
00 00:auto
01 00:1*12V
2 Uint16 wBatSysType; 02 00
02 00:2*12V
...
20 00:32*12V
2 Uint16 wBulkVolt; 03 00 0.1V Bulk voltage

5/16
MPPT Solar Controller communication protocol February 2018

2 Uint16 wFloatVolt; 04 00 0.1V Float voltage


Charge current
2 Uint16 wMaxChgCurr; 05 00 0.1A
limit
DisCharge(Load)
2 Uint16 wMaxDisChgCurr; 06 00 0.1A
current limit
Activation charge
2 Uint16 wEqualizeChgVolt; 07 00 0.1V
voltage
Activation charge
2 Uint16 wEqualizeChgTime; 08 00 1min
time
2 Uint16 bLoadUseSel; 09 00 1% Load utilization

2 Uint16 ChkSum;
7.1.3 Run log
Log information
Data item ID: 0x02
Attributes: Read and write
Bytes Content Offset Unit Remarks
2 Uint16 wFlag; 00 00 Flag
4 Uint32s dwRunTime; 01 00 1min -------
2 Uint16 wStartCnt; 03 00 -------
2 Uint16 wLastFaultInfo; 04 00 -------
2 Uint16 wFaultCnt; 05 00 -------
Daily power
4 Uint32s dwTodayEng; 06 00 1wh
generation
4 data_t wTodayEngDate 08 00
Monthly power
4 Uint32s dwMonthEng; 0A 00 1wh
generation
4 data_t wMothEngDate; 0C 00
Total power
4 Uint32s dwTotalEng; 0E 00 1wh
generation
Consume
4 Uint32s dwLoadTodayEng; 10 00 1wh
electricity daily
Consume
4 Uint32s dwLoadMonthEng; 12 00 1wh electricity
Monthly
Consume
4 Uint32s dwLoadTotalEng; 14 00 1wh
electricity Total
2 Uint16 wBacklightTime; 16 00 1S Backlight time
Key switch
2 Uint16 bSwitchEnable; 17 00 1或0 enabled (1
active)

2 Uint16 ChkSum;

6/16
MPPT Solar Controller communication protocol February 2018

7.1.4 Sampling parameters


Parameter information
Data item ID: 0x03
Attributes: Read and write
Bytes Content Offset Unit Remarks
2 Uint16 wFlag; 00 00 Flag
2 Uint16 wPvVoltRatio; 01 00 int /(Internal use)
2 Uint16 wPvVoltOffset; 02 00 int /(Internal use)
2 Uint16 wBatVoltRatio; 03 00 int /(Internal use)
2 Uint16 wBatVoltOffset; 04 00 int /(Internal use)
2 Uint16 wChgCurrRatio; 05 00 int /(Internal use)
2 Uint16 wChgCurrOffset; 06 00 int /(Internal use)
2 Uint16 wLoadCurrRatio; 07 00 int /(Internal use)
2 Uint16 wLoadCurrOffset; 08 00 int /(Internal use)
2 Uint16 wLoadVoltRatio; 09 00 int /(Internal use)
2 Uint16 wLoadVoltOffset; 0A 00 int /(Internal use)
2 Uint16 wOutVoltRatio; 0B 00 int /(Internal use)
2 Uint16 wOutVoltOffset; 0C 00 int /(Internal use)
2 Uint16 wChkSum;
7.1.5 Load parameter
LoadParam information
Data item ID: 0x04
Attributes: Read and write
Bytes Content Offset Unit Remarks
2 Uint16 wFlag; 00 00 Flag
Load Module 1:
2 Uint16 wLoadModuleSelect1; 01 00 int
5100~5118
Load Module 2:
2 Uint16 wLoadModuleSelect2; 02 00 int
5201~5215
Turn on the load's PV
2 Uint16 wLoadOnPvVolt; 03 00 0.1V
voltage
Turn off the load's
2 Uint16 wLoadOffPvVolt; 04 00 0.1V
PV voltage
Open the
Uint16
2 05 00 1min light-control load
wPvContrlTurnOnDelay;
time delay
Close the
Uint16
2 06 00 1min light-control load
wPvContrlTurnOffDelay;
time delay
Open the load time in
4 time_t AftLoadOnTime; 07 00
the evening
Close the load in the
4 time_t AftLoadOffTime; 09 00
evening

7/16
MPPT Solar Controller communication protocol February 2018

Open the load in the


4 time_t MonLoadOnTime; 0B 00
morning
Close the load in the
4 time_t MonLoadOffTime; 0D 00
morning
Load switch status
(read-only):
2 Uint16 wLoadSts 0F 00 1 or 0
1 :open
0 :shut down
Enable time 2:
read and write data
"1" opening period 2
2 Uint16 wTime2Enable 10 00 1 or 0 setting;
read and write data
"0" closing time 2
settings
2 Uint16 ChkSum;
7.1.6 RemotControl parameters
RemoteControl information
Data item ID: 0x06
Attributes: Read and write
Bytes Content Offset Unit Remarks
2 int16 uwMagicNum; 00 00 ---------------
Remote command
2 int16 eRemoteCmd; 01 00
(subcommand)
Command parameters
16 int16 uwData[8]; 02 00
(used for time correction)

7.1.7 Protection parameters


ProParam information
Data item ID: 0x07
Attributes: Read and write
Bytes Content Offset Unit Remarks
2 Uint16 wFlag; 00 00 Flag
Load overvoltage
2 Uint16 wLoadOvp; 01 00 0.1V
protection
Load low voltage
2 Uint16 wLoadUvp; 02 00 0.1V
protection
Overvoltage protection
2 Uint16 wBatOvp; 03 00 0.1V
of battery
Battery overvoltage
2 Uint16 wBatOvB; 04 00 0.1V
recovery point
Battery low voltage
2 Uint16 wBatUvp; 05 00 0.1V
protection

8/16
MPPT Solar Controller communication protocol February 2018

Battery low voltage


2 Uint16 wBatUvB; 06 00 0.1V
recovery

2 Uint16 ChkSum;
7.1.8 Equipment information
Information information
Data item ID: 0x08
Attributes: Read and write
Bytes Content Offset Unit Remarks
2 Uint16 wFlag; 00 00 Flag
16 Uint16 wSerialID[8]; 01 00 Serial number
4 Uint16 wFirmWare[2]; 09 00 Version number
16 Uint16 wModel[8]; 0B 00 Model

2 Uint16 wChkSum;
7.1.9 Temporary data storage
TempParam information
Data item ID: 0x09
Attributes: Read and write
Bytes Content Offset Unit Remarks
2 Uint16 wFlag; 00 00 Flag
4 time_t PeriodLoadCtr2Time; 01 00 ------------------
2 Uint16 bPVEnergySel; 03 00 ------------------
Temperature display
unit selection:
2 Uint16 bBatTempSel; 04 00 1 or 0 1: degrees Fahrenheit.
0: centigrade degrees
centigrade
2 Uint16 bLoadUseSel; 05 00 ------------------
2 Uint16 bLoadLaststate; 06 00 ------------------
2 Uint16 wChkSum;
7.1.10Information on power generation and electricity consumption
EngSave information
Data item ID: 0x0A
Attributes: Read and write
Bytes Content Offset Unit Remarks
2 Uint16 wFlag; 00 00
[0] ~ [11] data
statistics for 1~12
48 Uint32s wMonthPower[12]; 01 00
month power
generation
48 Uint32s wMonthLoadPower[12]; 19 00 [0] ~ [11] data

9/16
MPPT Solar Controller communication protocol February 2018

statistics for 1~12


monthly electricity
consumption
[0] ~ [30] data
124 Uint32s wDayPower[31]; 31 00 statistics for 1~31 day
power generation
[0] ~ [30] data
statistics for 1~31
124 Uint32s wDayLoadPower[31]; 6F 00
daily electricity
consumption
2 Uint16 wChkSum;

7.1.11Table 9-1 breakdown information details

位 Fault information
1 bit Battery voltage over
2 bit PV voltage over
3 bit Charge current over
4 bit Dis-charge over
5 bit Battery temperature alarm
6 bit Internal temperature alarm
7 bit PV voltage low
8 bit Battery voltage low
9bit Trip zero protection trigger
10bit In the control of manual switchgear

10/16
MPPT Solar Controller communication protocol February 2018

8 Relevant data description:


1.wBatType : Battery type (available)

○1 0-User-defind; ○2 1-Flooded; ○3 2-Sealed; ○4 3-Gel;


2.wEqualizeChgVolt : Activation charge voltage
wBulkVolt : Balanced charging voltage
wFloatVolt : Float charging voltage
The set voltage range is 9V~17V, principle:
wFloatVolt < wBulkVolt < wEqualizeChgVolt

3.wBatSysType : Battery system voltage


(here is the 12V battery as the standard, set the number of batteries in series Cell)
Set range 0~32, meaning: Cell*12V= system voltage, example: set number 2, then
2*12V=24V, 24V for battery system voltage. Set 0, which is represented as automatic recognition

4.wBacklightTime : Backlight time setting


Range: 1~999

5.Load control mode specification: 4 modes (Note: when wLoadModuleSelect1 is set to 5100,
5116, 5117 or 5118, wLoadModuleSelect2 data cannot be set, and the default is 5200).

11/16
MPPT Solar Controller communication protocol February 2018

○1 Light-control delay mode (5100): starting voltage (can be set), closed voltage (can be set),

action time delay (can be set);

○2 Fixed time-light control mode:


Period 1 Period 2
5101
Light control opens the load and 5201 The load is opened 1 hours before
closes 1 hours later daybreak and the day is closed
5102 Light control opens the load and 5202 The load is opened 2 hours before
closes 2 hours later daybreak and the day is closed
5103~ Light control opens the load and 5203~ The load is opened 3~13 hours before
5113 closes 3~13 hours later 5213 daybreak and the day is closed
5114 Light control opens the load and 5214 The load is opened 14 hours before
closes 14 hours later daybreak and the day is closed
5115 Light control opens the load and 5215 The load is opened 15 hours before
closes 15 hours later daybreak and the day is closed

○3 Dual timer mode:


5116 Turn-On Time1: (can be set) Turn-On Time2: (can be set)
Turn-Off Time1: (can be set) Turn-Off Time2: (can be set)

○4 Manual switching mode:


5117:Normally open state
5118:Normally close state

6.wChgMode : charge state


#define cChgWait 0
#define cMpptChg 1
#define cBulkChg 2
#define cFloatChg 3
#define cPreChg 4

7.Data structure
typedef struct
{
Uint16 wHi16;
Uint16 wLow16;
}Uint32s;
typedef struct
{
int hour;
int minute;
}time_t;

typedef struct
{

12/16
MPPT Solar Controller communication protocol February 2018

int month;
int day;
}data_t;

8.typedef enum
{
remoteCmd_null, // /* 0 */ Meaningless
remoteCmd_start, //Start charging command
remoteCmd_shutdown, //Stop charging command
remoteCmd_update, //Update command
remoteCmd_modifyDateTime, //Synchro time command
remoteCmd_startSelfTest,
remoteCmd_resetAll, //Restore factory settings
remoteCmd_Set
}remoteCmdType_t;

extern remoteControl_t stRemoteControl;

case remoteCmd_modifyDateTime:
strCalendarTmp.IccYear = stRemoteControl.uwData[0];
strCalendarTmp.IccMon = stRemoteControl.uwData[1];
strCalendarTmp.IccDay = stRemoteControl.uwData[2];
strCalendarTmp.IccHours = stRemoteControl.uwData[3];
strCalendarTmp.IccMin = stRemoteControl.uwData[4];
strCalendarTmp.IccSec = stRemoteControl.uwData[5];

Check and reference code:


uint8_t cProtocol::proGenChecksum(uint8_t* pbData,uint16_t uwLen)
{
uint8_t ubChksum = 0;
while(uwLen--)
{
ubChksum += *pbData++;
}
return (0 - ubChksum) & 0xFF;
}

Remarks: by reading the length of the “offset address + data byte”, we can read a continuous
information in the real-time information table. We should pay attention to the "end address =
offset address + byte length /2 + 1", which should not be greater than the largest offset address in
the table.

13/16
MPPT Solar Controller communication protocol February 2018

9 Some examples of command:


The upper monitor reads real-time information. Its corresponding data item is shown in 5 data
items, and the command ID is CMD_GET, and its data region format is "address + byte length (see
6 data region)". Besides, for this product, the maximum length of bytes is 102.
Read the data ,Read the machine's status information
Command:AA 01 00 01 00 03 00 00 1A 37
Description:
AA Data packet header
01 Device Type: MPPT Controller
00 Address: 0 broadcast address
01 Commandc:CMD_GET
00 Data item:Real-time information
03 Data region length:3 Refers to the back of "00 00 1A", a total of three bytes
00 00 Offset address: 0x0000, the low byte is on the left and the high byte is on the right
1A The total length of the data to be read from the offset address is 26 bytes
37 Check 37 = (0-(AA+01 +01 +03 + 1A))&0xFF

Response(Received data):

Description:
AA Data packet header
01 Device Type: MPPT Controller
00 Address: 0 broadcast address
03 Commandc:CMD_SET_NO_RESP
00 Data item:Real-time information (Refer to Section 5 for a list of data items)
1C The total data byte length is 28 bytes (14 data)
00 00 Data offset (lower 8 bits left and 8 upper right)
00 00 wChgMode;
2F 00 wPvVolt; 0x002f :47 This means that the PV voltage is 4.7V
。。。。。。。
90 checksum
Write the data,For example, set the battery type
Command:AA 01 00 02 01 04 01 00 01 00 4C
Description:
AA Data packet header
01 Device Type: MPPT Controller
00 Address: 0 broadcast address
02 Command:CMD_SET
01 Data item:Battery parameters (refer to Section 5 Data List)
04 Data region length:4 Refers to the back of "01 00 01 00", a total of four bytes
01 00 Offset address: 0x0100, the low byte is on the left and the high byte is on the right
01 00 Battery type data 0x0001
4C checksum

14/16
MPPT Solar Controller communication protocol February 2018

Response(Received data):

AA 01 00 00 01 00 54
AA Data packet header
01 Device Type: MPPT Controller
00 Address: 0 broadcast address
00 Command:CMD_ACK
01 Data item:Battery parameters (refer to Section 5 Data List)
00 Data length: 0 Indicates there is no data
54 checksum
Time correction:
Write data:AA 01 00 02 06 10 01 00 04 00 01 00 01 00 01 00 02 00 02 00 01 00 30
Description:
AA Data packet header
01 Device Type: MPPT Controller
00 Address: 0 broadcast address
02 Command:CMD_SET
06 Data item:remoteControl
10 Data region length:
01 00 Offset address
04 00 Subcommand
01 00 Year
01 00 Month
01 00 Day
02 00 Hour
02 00 Minute
01 00 Second
30 checksum

说明:
AA Data packet header
01 Device Type: MPPT Controller
00 Address: 0 broadcast address
00 Command:CMD_ACK
06 Data item:remoteControl
00 Data region length:0
4F checksum
The data received indicates that the setting was successful

15/16

You might also like