WVC inverter MQTT Data logging for all versions of inverters

Hello folks,
I am Henk from the Netherlands and I own a WVC1200 R3. (230 V)
I followed your discussions with much interest and tried your findings so far on my WVC1200.

Testing is done here with the HC-12 de-soldered from a WiFi modem hooked up to a FDTI 3V3 cable

The 1200 reacts differently from what you report:

  1. There is no response from the 1200 when it is not connected to the grid or in the dark (no DC)
  2. The key code E9 1C 00 00 does not matter, looks it can be anything
  3. The code of the unit does matter 60 00 03 C3 in my case
  4. I tested the F2 65 and F5 68 commands

Sadly the only response I get from the unit are exactly three bytes
C3 65 0A or C3 68 0A

So it seems I see the last two bytes of the command send and a 0A

Anyone has ideas to try?

what is your key that you are sending?

did you try my version of getting data from the above github repository…
just add your inverter to the wvc.ini in this format ( delete the examples)
WVC1200/600003C3/R3

and if you like just enable line 400 and 401 by removing the #

 #Sample="$(cat /dev/shm/ser-data$I | sed 's/<.*//' | sed 's/>//' | sed 's/0x//'  | sed -E ':a ; $!N ; s/\n\s+/ / ; ta ; P ; D' | tr -d ' ' | sed '/^$/d'  | sed 's/^..//')" #| sed -nr '/^.{56,56}$/p')" 
 #echo $Sample

it will try what is known as the correct key format. and if display the all responses from the inverter

if that does not work
try my key Sampling2.tar.gz (1.8 KB) to see what it does perhaps the 1200 has a slightly different format

yes the inverter only provides info if there both an AC and DC inputs

Hi Stephen,

Somehow it is working when I use interceptty.
I was testing with a simple C program, but then somehow the inter-character speed or the raw mode is not functioning properly.
The same program using the back-device of interceptty gives proper results ?!?
So:
0xf2 0x19 0x12 0x10 0x01 0xe9 0x1c 0x00 0x00 0x60 0x00 0x03 0xc3 0x65
Gives the response
0xf2 0x19 0x12 0x10 0x01 0xe9 0x1c 0x00 0x00 0x60 0x00 0x03 0xc3 0x65 +
0x0c 0x25 0x5f 0xe0 0x00 0x00 0x0a 0x10 0x00 0x10 0x00 0x00 0x00 0x00 0x05 0xdc

19121001 is the modem id of the WiFi modem I took the HC-12 from

However note that this:
0xf2 0x19 0x12 0x10 0x01 >0x00 0x00 0x00 0x00< 0x60 0x00 0x03 0xc3 0x65
that is a key of only zeros works also

Sun is down here now, so no more testing until next weekend

regards,

Henk

yes that is known the modemID, PowerID can be anything but 0x00 0x00 before your InverterID should be 0x00 0x00 it meant as an adjustment parameter

but glad you got it working even if only somewhat… as it got relayed through interceptty

yes it looks like a clone, it works with the si4463, even the factory setting is the same: FU3.
Then, will it communicate with the HC-12? Only the essay will tell … I have tried so many that I have no hope lol

My result testing two GT-38
Apparently are similar but:
Default mode is in channel 100 (instead 001)
In any case, a GT-38 not link with a HC-12. Neither change to channel 001
The two GT-38 link together perfectly.
Conclusion, it is not an alternative to WVC communication.
image

1 Like

Try 5V and add some delay between characters in your C code.

Ok,

For anyone interested in a simple monitoring program which can be compiled with gcc on a Linux PC

#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <termios.h>
#include <unistd.h>
#include <errno.h>
#include <sys/ioctl.h>

//char modem_id[] = {0xFB, 0x04, 0x11, 0x87};
char modem_id[] = {0x19, 0x12, 0x10, 0x01};
char inverter_id[] = {0x60, 0x00, 0x03, 0xC3};
char key_id[] = {0x00, 0x00};
char parm[] = {0x00, 0x00};
char cmd1[2] = {0xF2, 0x65};
//char cmd1[2] = {0xF5, 0x68};
char cmdzero[2] = {0xF0, 0x00};
char buf[256];
int  idx = 0;

int fd;
int dtr = TIOCM_DTR;

enum { HEADER1, HEADER2, CMD, TAIL1, TAIL2, DATA } state;

void r3()
{
    int i;
    for(i = 0; i< sizeof(modem_id); i++)
    {
        write(fd, &modem_id[i], 1);
    }
    for(i = 0; i< sizeof(key_id); i++)
    {
        write(fd, &key_id[i], 1);
    }
    for(i = 0; i< sizeof(parm); i++)
    {
        write(fd, &parm[i], 1);
    }
    for(i = 0; i< sizeof(inverter_id); i++)
    {
        write(fd, &inverter_id[i], 1);
    }
}

int main(int argc, char* argv[])
{
    int what;
    int i;
    int count;

    struct termios SerialPortSettings; 

    fd = open("/dev/ttyUSB0",O_RDWR  | O_NOCTTY | O_SYNC);
    if (fd < 3 ) // 0, 1 and 2 are stdin, stdout and stderr
    {
        printf("\n  ERROR ! opening com port\n");
        return -1;
    }

    tcgetattr(fd, &SerialPortSettings);    
    cfsetispeed(&SerialPortSettings,B9600);
    cfsetospeed(&SerialPortSettings,B9600);
    // 8N1 Mode
    SerialPortSettings.c_cflag &= ~PARENB;
    SerialPortSettings.c_cflag &= ~CSTOPB;

    SerialPortSettings.c_cflag &= ~CSIZE;
    SerialPortSettings.c_cflag |=  CS8;
    // no handhake
    SerialPortSettings.c_cflag &= ~CRTSCTS;
    SerialPortSettings.c_cflag |= CREAD | CLOCAL;
    // raw mode
    SerialPortSettings.c_iflag &= ~(ICRNL | INPCK | ISTRIP | IXON | BRKINT);
    SerialPortSettings.c_lflag &= ~(ICANON | IEXTEN | ISIG | ECHO);

    SerialPortSettings.c_oflag &= ~OPOST;

    // Setting Time outs
    SerialPortSettings.c_cc[VMIN] = 1; // Read at least 1 character
    SerialPortSettings.c_cc[VTIME] = 0; // Wait indefinetly

    if((tcsetattr(fd,TCSANOW,&SerialPortSettings)) != 0) // TCSAFLUSH
    {
        printf("\n  ERROR ! in Setting attributes\n");
        close(fd);
        return -2;
    }

    ioctl(fd, TIOCMBIC, &dtr); // clear DTR pin == SET pin of HC-12

    if ((argc == 2) && !strcmp("zero", argv[1]))
    {
        printf("reset power total\n");
        count = write(fd, &cmdzero[0], 1);
        r3();
        count = write(fd, &cmdzero[1], 1);
        sleep(1);
        count = write(fd, &cmdzero[0], 1);
        r3();
        count = write(fd, &cmdzero[1], 1);
        sleep(1);
    }



    tcflush(fd, TCIFLUSH);
    state = HEADER1;

    what = fork();
    if(!what) // child: only handles received bytes
    {
        for(;;)
        {
            int cnt;
            ioctl(fd, FIONREAD, &cnt);
            if(cnt > 0)
            {
                switch (state)
                {
                    case HEADER1:
                    {
                        read(fd, buf, 1);
                        if (buf[0] == cmd1[0])
                        {
                            state = HEADER2;
                        }
                    }
                    break;

                    case HEADER2:
                    {
                        read(fd, &buf[1], 1);
                        if (buf[1] == modem_id[0])
                        {
                           state = CMD;
                           idx = 2;
                        }
                        else
                        {
                            state = HEADER1;
                        }
                    }
                    break;

                    case CMD:
                    {
                        read(fd, &buf[idx], 1);
                        if (++idx == 12)
                          state = TAIL1;
                    }
                    break;

                    case TAIL1:
                    {
                        read(fd, &buf[idx], 1);
                        if (buf[idx++] == inverter_id[3])
                        {
                            state = TAIL2;
                        }
                        else
                        {
                            state = HEADER1;
                        }
                     }
                    break;

                    case TAIL2:
                    {
                        read(fd, &buf[idx], 1);
                        if (buf[idx++] == cmd1[1])
                        {
                            state = DATA;
                        }
                        else
                        {
                            state = HEADER1;
                        }
                    }
                    break;

                    case DATA:
                    {
                        read(fd, &buf[idx++], 1);
                        switch (idx)
                        {
                            case 16:
                            {
                                unsigned int dc = ((buf[14] & 0xff) * 256) + (buf[15] & 0xff);
                                printf("DC voltage  : % 4u.%02u\n", dc / 100, dc % 100); 
                            }
                            break;

                            case 18:
                            {
                                unsigned int ac = ((buf[16] & 0xff) * 256) + (buf[17] & 0xff);
                                printf("AC voltage  : % 4u.%02u\n", ac / 100, ac % 100); 
                            }
                            break;

                            case 20:
                            {
                                //printf("%02X %02X ",buf[18] & 0xff, buf[19] & 0xff);
                                unsigned int amp = ((buf[18] & 0xff) * 256) + (buf[19] & 0xff);
                                printf("DC current  : % 4u.%02u\n", amp / 100, amp % 100); 
                            }
                            break;

                            case 22:
                            {
                                //printf("%02X %02X ",buf[20] & 0xff, buf[21] & 0xff);
                                unsigned int eng = ((buf[20] & 0xff) * 256) + (buf[21] & 0xff);
                                printf("Energy kWh  : % 4u.%02u\n", eng / 100, eng % 100); 
                            }
                            break;
/*
                            case 24:
                            {
                                printf("%02X %02X\n",buf[22] & 0xff, buf[23] & 0xff);
                                unsigned int eng = (((buf[20] & 0xff) * 256) + (buf[21] & 0xff) * 10);
                                printf("Energy Wh: %u\n", eng); 
                            }
                            break;
*/
                            case 26:
                            {
                                //printf("%02X %02X ",buf[24] & 0xff, buf[25] & 0xff);
                                unsigned int watt = ((buf[24] & 0xff) * 256) + (buf[25] & 0xff);
                                printf("Output Watt : % 4u.%1u\n", watt / 10, watt % 10); 
                            }
                            break;

                            case 28:
                            {
                                //printf("%02X %02X ",buf[26] & 0xff, buf[27] & 0xff);
                                unsigned int temp = ((buf[26] & 0xff) * 256) + (buf[27] & 0xff);
                                printf("Temperature : % 4u.%02u\n\n", temp / 100, temp % 100); 
                                state = HEADER1;
                            }
                            break;
                        }
                    }
                    break;
               }
            }
        }
    }
    else //parent: poll for data every 5 secs
    {
        for(;;)
        {
            write(fd, &cmd1[0], 1);
            r3();
            write(fd, &cmd1[1], 1);
            sleep(5);
        }
    }
    close(fd);
}

Hell, what happened with the formattig ?

Fixed the formatting for you.

To post a snippet of code, put three backticks (the ` character) at the top of your code
and three at the bottom of your code.

Thanks Bill

1 Like

On separate lines such as

    ```
    your code
    ```
1 Like

Hi everyone, I am really pleased to find this discussion. I have bought a standard WVC600 without the 433 MHz transmitter but only with Powerline transmission. Since I don’t want to deal with mains, I opened my inverter and found an UART header. To implement your work I would like to add an ESP8266 to control the inverter. The main issue is that my inverter has no ID printed anywhere… Is there a command to look up the inverters connected?
I would also ask you if you can kindly provide a pinout for this UART.

since it all built on the board, and I added esp to powerline devices before to devices ( TED1000) you need to look up your powerline IC then determine which one are its RX/TX
then follow the trace to its endpoint as the UART you found might be only for programing the PIC – you need to be careful
a command to search out IDs you can try ModemID search which was

 0xFA: //READ_MODEM_ID  ends with 0x6D

but I do not know what length you would use it was 8 on the older WVC so I would start with that

 0xFA:0xF2:0xF2:0xF2:0xF2:0xF2:0xF2:0x6D

if not it any ones guess you can adopt my little pattern search to try varying lengths and it could be but thier programmers have being consistent so other possibilities could be f0------63 , fb------6e, fc------6f, f6------69, f7------6a

example from older WVC modem

     0xF1: //ADJUST_OUTPUT_POWER - modemID/inverterID plus 2 bytes ( presumably decimal to hex either  99% = 63  or more likely 255 steps 252 = 99%  hex of fc
     0xF2: //REAL_TIME_DATA - modemID/inverterID- ends with 0x65
     0xF3: //INVERTER_POWER_ON  - modemID/inverterID ends with 0x66
     0xF4: //INVERTER_POWER_OFF modemID/inverterID  ends with 0x67
     0xF5: //DATA_COLLECTION --modemID/inverterID  ends with 0x68
     0xF8: //MODEM_CONNECTION_TEST  modemID -ends with 0x6B
     0xFA: //READ_MODEM_ID  ends with 0x6D

I have looked on the board for the TED1000 but I couldn’t find it.
No luck either with the header port. The components I have found are a bunch of LM358.
is it a double sided pcb?

the ted 1000 was a powerline device for energy monitoring-- the powerline transceiver should be a relativity large chip 12 - to 28 pins generally MAX, ST or other manufacture but since it Chinese they tend to use off the shelf - kq-330 /kq-130

but just to be sure do you have powerline version ( I am not even sure they have powerline version) and not a version that
has no communication protocol at all

take a full picture of the inverter board layout

On the manual it is specified that has power line communication @300bps and TTL serial @9600bps. The board is made by solarepic.

well what are the the name and numbers on the two largest chips

The one near the header is PIC16F716, the other one is ucc2806dw from TI.
The pinout of the header port is (referred to pin of pic MCU):
PIN4 (pull up)
5V
GND
PIN13
PIN12

nope the pic the little micro controller the other voltage regulator and the blue thing is precision transformer-- what else doses it have - what are the the smaller chips with – i think if it does you must have the transceiver
is PIC16F716 correct as that one does not seam programmable are you sure it not PIC16F76 like what is on my inverters and modems chip