CMS2000 inverter RS232 Serial Port Hack. (CMS 2000 RS232)..

The latest and greatest cells. New technologies, anything on the forefront of solar tech.

CMS2000 inverter RS232 Serial Port Hack. (CMS 2000 RS232)..

Postby TonyB » Wed Feb 10, 2010 2:18 am

THIS THREAD IS A CONTINUATION FROM HERE: pv-solar-systems-review-advice-appreciated-t233.html

Damn took me ages to find my camera cable :(.
Anyways welcome to the forum.

Fresh Pic:
IMGP2442.jpg


Its a 10KW system i had installed on my roof, split over 8.8KW north facing, and 1.2KW north west.
Ill get pics of my panels up 2morow. :)

Looks like im gonna have a long day tomorrow with these..
User avatar
TonyB
 
Posts: 501
Joined: Sun Dec 02, 2007 3:45 am
Location: Australia

Re: PV Solar Systems / Review advice appreciated

Postby JinbaIttai » Wed Feb 10, 2010 2:41 am

:shock: :shock: :shock:

I feel rather umm, inadequate by comparison :mrgreen:

Nice setup Tony! I look forward to seeing your graphs.

Do you speak Perl? I'm happy to share my (kinda dodgy) code once I've ironed out these last few bugs...

Here's a pic of my *cough* test lab :lol:

Image

yes, they're on top of the washing machine. :mrgreen:

Fortunately they've both got wireless so I can sit at my desk and work on the big screen.

- Jinba
User avatar
JinbaIttai
 
Posts: 21
Joined: Tue Feb 09, 2010 11:13 pm

Re: PV Solar Systems / Review advice appreciated

Postby TonyB » Wed Feb 10, 2010 2:53 am

:lol: I like!! Hehe.
I honestly thought that the RS232 port on these inverters was inactive, and had given up.
Then you just came out of nowhere, and voila!!
I am very thankful

Im an embedded C and C# programmer and unfortunately, although i understand pearl, its not my strong point.
But ild love to see your code anyways, and we can share ideas, and ild certainly be showing you my progress over the next few days.
User avatar
TonyB
 
Posts: 501
Joined: Sun Dec 02, 2007 3:45 am
Location: Australia

Re: PV Solar Systems / Review advice appreciated

Postby JinbaIttai » Wed Feb 10, 2010 11:59 am

well, my startup sequence can do with a little polishing, but it appears to work. No need for Pro Control this morning :mrgreen:

For the record, the second response received from the inverter is AA AA 00 01 01 00 00 81 01 06 01 DE

Also, after looking closer it is apparent that the checksum is exactly that - a sum.

eg in the above string, AA+AA+00+01+01+00+00+81+01+06 = 01 DE

I don't know why I was expecting something a little more complicated :P
User avatar
JinbaIttai
 
Posts: 21
Joined: Tue Feb 09, 2010 11:13 pm

Re: PV Solar Systems / Review advice appreciated

Postby JinbaIttai » Sat Feb 13, 2010 5:36 pm

I finally get the chance to play during daylight hours...

Look, graphs! :mrgreen:

Image
Image

I'm pretty happy with my script now.

It now starts up automatically each morning and dumps the data to a text file, which I can then use to generate the graphs.

I installed Activestate Perl and win32:SerialPort on my windows laptop and with a couple of minor changes the script works there too! 8-)

Just replace Device::SerialPort with win32::SerialPort (in 2 places) and "/dev/ttyS0" with eg "com1"

The script is pretty heavy on Perlisms so if any of it makes little sense, let me know.

- Jinba
Attachments
inverter.pl.txt
inverter.pl - perl script for monitoring CMS-2000 inverters
(6.44 KiB) Downloaded 309 times
User avatar
JinbaIttai
 
Posts: 21
Joined: Tue Feb 09, 2010 11:13 pm

Re: CMS2000 inverter RS232 Serial Port Hack. (CMS 2000 RS232)..

Postby biink » Mon Apr 05, 2010 1:25 am

Hi There,
Congrats on getting this going. Great job and thanks for saving me the time to develop so far.
I have run up my system on your script and have it up and running as well. I am not at all familure with perl so this is my first attemt at it. My pc is running Windows 7 and I have to run a usb to serial converter, due to no serial ports being available on my motherboard. I have had to comment out the line that sets the baudrate. This gives me an error. Any idea why?
# $serial->baudrate($baud) || die 'fail setting baudrate, try -b option';
Also - How do you make the graph? I presume you use a spreadsheet to graph the log output. Yes?
If this is excel is it possible, and would you be so kind as to give me a copy as the format is just what I am looking for.
Thanks
biink
biink
 
Posts: 2
Joined: Mon Apr 05, 2010 1:06 am

Re: CMS2000 inverter RS232 Serial Port Hack. (CMS 2000 RS232)..

Postby JinbaIttai » Mon Apr 05, 2010 10:13 pm

Hi blink! Glad to hear someone's found my script useful.

No idea why setting the baud rate doesn't work for you, but if you are able to get the data then your system must default to 9600 so I wouldn't worry too much.

You have still got the $baud = "9600"; at the top of the file, right?

For drawing the graphs I use RRDtool although doing so in a spreadsheet shouldn't be too hard. I don't know if Excel can handle unix timestamps, so you might want to play with the localtime() function in Perl to output the timestamp in a more suitable format - then highlight the timestamp and Pac columns and click the graph wizard and see what it gives you.

I don't have Excel here, but I just spent a few minutes playing with the Gnumeric spreadsheet application, and by converting the timestamp to a date+time, and using its graph wizard I get: (click image for larger version)

Image

I am unable to share my RRD script as it contains proprietary code I developed years ago, but RRD is worth learning as the possibilities are endless!

As an example, here are some RRD graphs I auto-generate to compare my solar output with the solar radiation detected at two locations in the Perth Metro area. Today was a very cloudy day, and it's interesting to see my output drop at the same time as one or both of the monitoring stations:

Image
Image
Image

Oh and I replaced the ugly black night-time shading with sunrise/sunset vertical lines. Much easier on the eyes :)
User avatar
JinbaIttai
 
Posts: 21
Joined: Tue Feb 09, 2010 11:13 pm

Re: CMS2000 inverter RS232 Serial Port Hack. (CMS 2000 RS232)..

Postby biink » Wed Apr 07, 2010 10:28 am

Hi Jinba,
Thanks for the feedback. I can only assume the baud setting problem is due to the usb>serial conversion device that I am using. I have ordered a different one and will test that when it arrives. I have an old laptop that has a serial port and may resort back to this as well. Just not a perl expert and with it running Windows 98 it may prove too difficult to setup methinks :o
Also - I am keen to place the outputs online. Looking at http://www.pachube.com/. Will advise when I get this going.
Thanks
biink
biink
 
Posts: 2
Joined: Mon Apr 05, 2010 1:06 am

Re: CMS2000 inverter RS232 Serial Port Hack. (CMS 2000 RS232)..

Postby Inspector » Fri May 14, 2010 8:47 am

I've made up a lead to connect PC to CMS2000 but ProControl can't find the inverter. I only connected COM, RX and TX (swapping TX & RX at one end - or shouldn't I have done this either?), as per the layout in the manual, but do I also need to connect RTS and CTS pins in a similar fashion to the RX and TX?

Lead is 11m long using CAT-5 cable (I know it's not the right cable but I thought I'd try it out)...
Inspector
 
Posts: 21
Joined: Sun May 09, 2010 9:44 pm
Location: under the sun

Re: CMS2000 inverter RS232 Serial Port Hack. (CMS 2000 RS232)..

Postby JinbaIttai » Fri May 14, 2010 1:52 pm

Hi Inspector

Don't cross the rx and tx, that's only required if you are connecting two computers (two DTE devices)

You only need to connect rx, tx and ground as per the manual, and it's just a "straight through" cable - ie just like connecting to a modem :)

I'm now using a serial to bluetooth adapter on the inverter, and a usb-bluetooth dongle on the PC (no more mini laptops on the washing machine :D )

I did find I had to loop RTS and CTS together at the bluetooth adapter, as the stupid thing only talks hardware handshake, which the inverter does not do. By looping them it will give the adapter the CTS signal it is waiting for...

If you're connecting directly to a computer then you won't need to do that, and can just connect the 3 pins as per the manual.
User avatar
JinbaIttai
 
Posts: 21
Joined: Tue Feb 09, 2010 11:13 pm

Re: CMS2000 inverter RS232 Serial Port Hack. (CMS 2000 RS232)..

Postby Inspector » Sun May 16, 2010 5:38 pm

Still no luck after doubling-up the pairs in the CAT-5 cable (and after returning RX and TX to correct pins). Perhaps there's too much interference on the cable (two computers with their cases removed might be causing too much RF interference in the immediate area). I'll have to see if I've got an old modem cable in the garage, or buy one. I assume the COM port on the inverter is activated from factory...

Too bad the laptop doesn't have a COM port - I might have to buy an adaptor to use USB if it's cheaper than a modem cable.


I'm also curious - does the inverter store data for XX hours, or only output instantaneous data?
Inspector
 
Posts: 21
Joined: Sun May 09, 2010 9:44 pm
Location: under the sun

Re: CMS2000 inverter RS232 Serial Port Hack. (CMS 2000 RS232)..

Postby TonyB » Sun May 16, 2010 6:01 pm

Hello Inspector,

The RX from the Inverter goes to TX of your PC.
The TX from the PC goes to RX of your Inverter.

That is, Pin 2 of inverter to Pin 2 of PC RS-232.
And, Pin 3 of inverter to Pin 3 of PC RS-232.
Also, Pin 5 to Pin 5, Common Ground.

I doubt the problem is interference. It only runs at 9600 baud, so you should have no interference issues even with long cable runs.

The Inverters serial comm is activated from factory.

Be sure your PC is reading the correct serial port.

All data outputted is real time only. The only stored info is the accumulated Energy in KW/Hrs.
User avatar
TonyB
 
Posts: 501
Joined: Sun Dec 02, 2007 3:45 am
Location: Australia

Re: CMS2000 inverter RS232 Serial Port Hack. (CMS 2000 RS232)..

Postby Inspector » Sun May 16, 2010 9:44 pm

I was getting errors copying photos from my camera (USB) with the inverter comms lead still connected to the PC (disconnected from the inverter though) so I suspect there may be conflicts within the PC's USB/COM port bus. I'll try again later in the week with all USB devices disconnected from the PC and see if that helps.

New laptop doesn't have COMM port, but I have an old laptop with COMM port, but no easy way of getting the software onto it (no ethernet, no floppy drive, and last time I fired it up, I think the CD drive didn't work either).


Edit: removed all USB devices from PC, but ProControl is still unable to communicate with inverter. Is there some simple commands I can use in hyperterminal to communicate with it (and at least get something out of it, so I know my cable is OK)? or other program I can try?


Inverter firmware is Ver 1.00

edit2!!!!!!!!! I connected with hyperterminal then when I closed hyperterminal, the inverter popped up on ProControl screen. But there was not enough sunlight left to interrogate it for long... It appears ProControl only allows 5 parameters to be displayed simultaneously.
Inspector
 
Posts: 21
Joined: Sun May 09, 2010 9:44 pm
Location: under the sun

Re: CMS2000 inverter RS232 Serial Port Hack. (CMS 2000 RS232)..

Postby Inspector » Thu May 20, 2010 6:59 pm

This morning ProControl did not detect the inverter (I'd left the software running, anticipating it to detect the inverter starting up). I fiddled with hyperterminal again but it didn't work as it did yesterday. Finally it worked after unplugging all the USB devices again, then also unplugging the inverter comms cable from COM2 port and reinserting it, then restarting ProControl. I am sure this time it was the reinsertion of the COM2 plug which resulted in it working properly.

Is there a setting I need to change for the inverter to be automatically detected? Alternatively, am I better off using another program or Jinba's script (does it work with Windows OS?)? I don't want to have to manually set up the detection of the inverter each morning to record the data, and much prefer a set-and-forget setup.
Inspector
 
Posts: 21
Joined: Sun May 09, 2010 9:44 pm
Location: under the sun

Re: CMS2000 inverter RS232 Serial Port Hack. (CMS 2000 RS232)..

Postby JinbaIttai » Thu May 20, 2010 9:43 pm

Since you are getting errors on USB devices while the serial port is connected, I suspect they may be sharing IRQs.

com1 normally uses IRQ4, and com2 uses IRQ3 - you may be able to assign a different IRQ for the USB controller in your BIOS and/or via the device manager in windows.

Alternatively, can you use com1 instead?

The other thing I'm wondering about is if your long serial cable is causing a ground loop - ie the "earth" is at a different potential at the inverter than it is at the PC, so you're getting current flow along the cable which is confusing the computer and/or pro control. I know you can get ground loop effects even over relatively short audio cables, which is what made me wonder.

note: I'm much more a software person than a hardware person, so I'm probably talking out of my proverbial :D

I doubt my software would make any difference as it talks the same protocol as ProControl - if ProControl can't find the inverter, I'd be surprised if my software can. It does run on Windows, and it does make it much easier to have graphs drawn for you unattended, but is probably not that easy to install for Perl newbies.

P.S. have I mentioned you can get RS232 to Bluetooth adapters for around $50 (and USB-bluetooth adapters for under $10) and do away with all the cabling/hardware conflict hassles? :P
User avatar
JinbaIttai
 
Posts: 21
Joined: Tue Feb 09, 2010 11:13 pm

Re: CMS2000 inverter RS232 Serial Port Hack. (CMS 2000 RS232)..

Postby JinbaIttai » Thu May 20, 2010 9:48 pm

Tony

How did you go with logging your fleet of inverters? :D

I'd love to see some graphs for them at peak output... 8-)

Edited to add: I've spent some time the last few months tweaking my script, as it occasionally did not run the startup sequence correctly in the mornings. Mainly because I was either not initialising the variables correctly, or declaring them incorrectly *sigh*

Updated version attached! This one has been fire and forget for the last few weeks. :lol:

- Matt
Attachments
inverter_v2.pl.txt
Slightly updated version that fixes some startup bugs
(6.52 KiB) Downloaded 62 times
User avatar
JinbaIttai
 
Posts: 21
Joined: Tue Feb 09, 2010 11:13 pm

Re: CMS2000 inverter RS232 Serial Port Hack. (CMS 2000 RS232)..

Postby Inspector » Sun May 23, 2010 8:41 pm

I've changed it back to COM1 and it seems to be working alot better now; no need to unplug USB devices any more.

However, the ProControl software does not automatically detect the inverter turning on in the morning; I need to restart the software after the inverter has powered-up, so it can detect the inverter. Is there an easy way of doing this (like a program launch scheduler in WinXP for example)???

edit: I found the Windows task scheduler and set it up. It looks like I'll need to close the program each evening so it starts again the next morning, as attempting to run it again while it's already operating does not create a new task.
Inspector
 
Posts: 21
Joined: Sun May 09, 2010 9:44 pm
Location: under the sun

Re: CMS2000 inverter RS232 Serial Port Hack. (CMS 2000 RS232)..

Postby Inspector » Tue May 25, 2010 6:09 pm

So much for Winblows... The task scheduler didn't start ProControl when it was supposed to... Back to square one.
Inspector
 
Posts: 21
Joined: Sun May 09, 2010 9:44 pm
Location: under the sun

Re: CMS2000 inverter RS232 Serial Port Hack. (CMS 2000 RS232)..

Postby TonyB » Tue May 25, 2010 9:23 pm

JinbaIttai wrote:How did you go with logging your fleet of inverters? :D


JinbaIttai

Unsuccessful.
Im had multiple issues accessing 5 com ports via RS232-USB converters, then i sorta gave up.
Ill do some experimenting with the pro control software and put up some curves for you to see.

BTW i received $2250 credit from Origin Energy last Quarter, gross meter was only installed for 2 months :D .

Anyways, I'm still working on this, been tied down with work etc, but will continue debugging as soon as time permits.

Cheers.
User avatar
TonyB
 
Posts: 501
Joined: Sun Dec 02, 2007 3:45 am
Location: Australia

Re: CMS2000 inverter RS232 Serial Port Hack. (CMS 2000 RS232)..

Postby JinbaIttai » Sat May 29, 2010 8:35 pm

Hi Tony

I used to work for a dial-up ISP so I keep thinking about multi-port serial interfaces :mrgreen: A 64-port "Stallion panel" is probably overkill...

Have you looked into getting the RS485 interfaces for your inverters? That would allow you to talk to all inverters from the one USB-RS485 adapter in your PC.

- Matt
User avatar
JinbaIttai
 
Posts: 21
Joined: Tue Feb 09, 2010 11:13 pm

Next

Return to Tech Talk.

Who is online

Users browsing this forum: No registered users and 0 guests