Ben Harper Posted February 17, 2021 Posted February 17, 2021 I have a 3KW RCT VMIII, which I connect to a Raspberry Pi via USB cable to monitor it, using software that I wrote myself (https://github.com/bmharper/homepower). This software monitors the inverter's reported load, and uses that information to flip a set of contactors in my house, to either let heavy loads run from grid, or from the inverter. This way I can have more than 3KW devices potentially connected to the inverter, but the "heavy" ones go back to grid, if the inverter is unable to power them. The "essential" circuits always remain connected to the inverter. This setup has been working 100% for over a year, which is how long I've had it. The program queries the inverter every second, and has done so reliably for almost exactly one year. Since about 2 weeks ago, the USB port has started coming and going. The symptom is that /dev/hidraw0 disappears for about an hour at a time, and then magically reappears again. Two weeks ago I thought it was the Raspberry Pi, so I switched it out to a new Pi4, and now the problem is occurring on the new Pi4, so it seems to be the inverter that's at fault. Has anybody else had intermittent connectivity issues with the USB port on the VMIII? Thanks, Ben Quote
Ben Harper Posted February 18, 2021 Author Posted February 18, 2021 Update from thepowerstore.co.za -- apparently if you've opened the case (which I have done), then RCT won't honour the 2-year guarantee. So don't open the top case! Quote
NigelL Posted February 18, 2021 Posted February 18, 2021 (edited) This sounds like an intermittent USB connection issue. Have you tried another cable? [Edit] Also worth trying to clean the USB contacts using some alcohol and a thin cotton-swab. Edited February 18, 2021 by NigelL Quote
Ben Harper Posted February 18, 2021 Author Posted February 18, 2021 thanks @NigelL - I'll try that Quote
Ben Harper Posted February 18, 2021 Author Posted February 18, 2021 Na... it doesn't seem to be a cable/port issue. Quote
JaseZA Posted February 18, 2021 Posted February 18, 2021 I stopped using USB in favour of the RS485 with serial to USB adapter. I also used to have drop outs for no apparent reason with USB. At the time I thought it might just be interference from all the AC wires running close to the USB cable. RS485 has been rock solid also for about a year now to my rPi4. Quote
Ben Harper Posted February 18, 2021 Author Posted February 18, 2021 Thanks @JaseZA. What exactly do I need to buy in order to bridge between RS485 and USB? Quote
JaseZA Posted February 18, 2021 Posted February 18, 2021 Your inverter should have come with an RS485 to serial cable - then you just need to buy a serial to USB adapter. Something like this: https://www.takealot.com/mecer-usb-to-1-serial-9-pin-port/PLID35668474 There are cheaper options that might be worth a try but this is the unit I have. Checked out your Github - nice work! I'm using Solpiplog and automating something very similar to you with home assistant but I can only poll every 5 seconds - which is sometimes too slow to turn off things before the inverter trips on overload.... Quote
Ben Harper Posted February 18, 2021 Author Posted February 18, 2021 @JaseZA Thanks.. I have *something* resembling that plugged in now, and I can see a new serial device /dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0, but I'm unable to talk to it. Do you have any idea how I talk to the serial device instead of the USD HID? Quote
JaseZA Posted February 18, 2021 Posted February 18, 2021 Solpiplog connects to it on /dev/ttyUSB1 - not sure if that helps? Quote
Coulomb Posted February 19, 2021 Posted February 19, 2021 19 hours ago, JaseZA said: Your inverter should have come with an RS485 to serial cable Actually, the command port is RS-232, and the supplied cable is for the RS-232 port. There is an RS-485 port, but that's for connecting to battery BMSs. Quote
JaseZA Posted February 19, 2021 Posted February 19, 2021 18 minutes ago, Coulomb said: Actually, the command port is RS-232 Ah yes - there was a small thought in the back of my mind that I had it the wrong way round! Thanks for correcting this Coulomb! Quote
Ben Harper Posted February 19, 2021 Author Posted February 19, 2021 Thanks @Coulomb.. that would explain why my adapter cable labelled RS485 doesn't work!! And thanks @JaseZA, I've ordered one of those adapters that you linked to... will see tomorrow. Quote
Ben Harper Posted February 20, 2021 Author Posted February 20, 2021 OK.. so I have the RJ45 -> RS232 -> USB cables plugged in, and I can clearly talk to the thing, but every command I issue responds with "(NAK". @Coulomb Have you ever seen this? All the code I can find on the internet doesn't seem to differentiate between talking over USB or RS-232. I know I've got the CRC correct, because it was working perfectly over USB. One other interesting thing.. after rebooting the inverter (ie all plugs out), the very first time I try to talk to it (asking it for QPIGS), it gives me "(PI30" response. Thereafter, it responds exclusively with "(NAK". Quote
Coulomb Posted February 20, 2021 Posted February 20, 2021 (edited) 30 minutes ago, Ben Harper said: OK.. so I have the RJ45 -> RS232 -> USB cables plugged in, and I can clearly talk to the thing, but every command I issue responds with "(NAK". @Coulomb Have you ever seen this? Yes, when the CRC is incorrect. But you say that's right below. Quote I know I've got the CRC correct, because it was working perfectly over USB. One other interesting thing.. after rebooting the inverter (ie all plugs out), the very first time I try to talk to it (asking it for QPIGS), it gives me "(PI30" response. Thereafter, it responds exclusively with "(NAK". Well, (PI30 is the response for the QPI command (Query Protocol Id), and QPI is the first 3 letters of QPIGS. That command is one of the many that requires a correct CRC. So that suggests to me that something is wrong at your end. The CRC must have been calculated on only the first 3 characters of the command (at startup only). Perhaps connect to another PC at 2400 bps and check that the whole command is coming out, and that the checksum is indeed correct as you assume. Some of the communications boards are a little flaky at 9600 bps (required for flash updating). But to fail at 2400 bps would be extraordinary. Edit: I should add that comms via USB uses the same serial port on the DSP, so there is a lot of electronics and cable in common between the two ports. So if something has gone wrong with your comms board or control board or cable between these two that is affecting USB, it may well be affecting RS-232 as well. That doesn't explain your "(PI30" response though. Edited February 20, 2021 by Coulomb Quote
Ben Harper Posted February 20, 2021 Author Posted February 20, 2021 Thanks @Coulomb, saved my bacon! I was missing a call to cfmakeraw() before calling tcsetattr(), so presumably the IO device was in "line" mode instead of "raw" mode. I can once again speak to my little inverter! Thanks for all the help! Quote
Ben Harper Posted February 21, 2021 Author Posted February 21, 2021 For posterity, in case anybody on the internet finds this "(NAK"... here is the C/C++ code for setting up the terminal as regular file device: https://github.com/bmharper/homepower/blob/master/server/inverter.cpp#L239 speed_t baud = B2400; // Speed settings (in this case, 2400 8N1) struct termios settings; int r = 0; if ((r = tcgetattr(FD, &settings)) != 0) { fprintf(stderr, "tcgetattr failed with %d\n", r); Close(); return false; } // baud rate r = cfsetospeed(&settings, baud); if ((r = cfsetospeed(&settings, baud)) != 0) { fprintf(stderr, "cfsetospeed failed with %d\n", r); Close(); return false; } cfmakeraw(&settings); // It's vital to set this to RAW mode (instead of LINE) settings.c_cflag &= ~PARENB; // no parity settings.c_cflag &= ~CSTOPB; // 1 stop bit settings.c_cflag &= ~CSIZE; settings.c_cflag |= CS8 | CLOCAL; // 8 bits // settings.c_lflag = ICANON; // canonical mode settings.c_oflag &= ~OPOST; // remove post-processing if ((r = tcsetattr(FD, TCSANOW, &settings)) != 0) { fprintf(stderr, "tcsetattr failed with %d\n", r); Close(); return false; } tcflush(FD, TCOFLUSH); Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.