Wednesday, October 8, 2008

Resol VBUS success

at last, the kind folks in Resol sent me the protocol specification for vbus

with openwrt and rrdcollect and rrdcgi, I can now graph the pumps and temperature information of my solar water system.

There is a bash script that collects from the serial port, decodes it , and then outputs the values to a file that rrdcollect parses. All good, some holes in the graphs, probably a bad awk in my script, to be investigated.

Once it's working reliably with no holes, I will try to post graphs here, somehow

EDIT: Now there is a google group http://groups.google.com/group/resol-vbus

EDIT: I wrote a utility to parse the data, seems to have gotten lost in the group, it's here https://code.google.com/p/vbusdecode/

65 comments:

cmioci said...

hello, my aim is to interface the solar power SONNENKRAFT SKSC3 (RESOL) with the PC, but unfortunately I do not have the specific protocol VBus. Could you tell me where I can find.
Thank you

Desra said...

mail technik@resol.de and ask for the vbus protocol doc, it's called VBus_Protokoll.pdf

I'm not sure on distribution rights , but ping me if you can't get it from them ?

They were reluctant at first to give it out as it is only in german.

IF you are using windows, you can download their windows software from their site , the basic or lite version is free.

cmioci said...

hi,
I downloaded the software RESOL Service Center Light and installed. In the folder .. \ RESOL \ ServiceCenterLight \ eclipse \ plugins \ de.resol.servicecenter.vbus.sonnenkraft_2.0.0 file VBusSpecificationSonnenkraft.xml describes the frame of communication used by SONNENKRAFT say right?

cmioci said...

It 'my interest interfaces directly with the solar power unit developing software in Microsoft Visual C++, I would track through a web the performance of my solar thermal plant.

cmioci said...

I rx file by Daniel Pichotka. Thank you.

Desra said...

re: service center, the xml file does show the packet structure, and this is also in the pdf, but the you will see that to decode the data requires some math etc.

service lite will allow you to make a custom image and overlay your temperatures and upload them to website on defined intervals.

I used rrdtool to generate the graphs of my solar system , you can see them else where on this blog, and copy them to a free image server every few hours.

Thats great u got the doc, Daniel was the guy who sent it to me also :-)

cmioci said...

thank you for hints

cmioci said...

News from Daniel Pichotka.
VBus protocol PDF in english :)

More info:
The VBus can be extend until 100 meter with a standard telephone cable (2-wire).

Have a nice weekend.
CM

Desra said...

that is good to know, that it's now available in english !

I used the standard vbus cable and extended the serial via cat5e. I actually got a usb serial, cut the cable and inserted rj45 plugs at the ends.

cmioci said...

but VBus is standard RS-485 two wire ?

Desra said...
This comment has been removed by the author.
Desra said...

I didn't know vbus was a standard rs485 output, I got the rscom kit which converts vbus to rs232, though now there is a simple usb kit

http://www.seconsolar.com/pages/classic/rscom.html

cmioci said...

I have ADAM-4520 (hardware), isolated converter Rs-232 to Rs-422/485. I thought to implement an ActiveX component that allows me to manage serial communication (via VBus frame) and therefore to acquire data from solar power. The data collected will be represented graphically on a synoptic planting.

Desra said...

my embedded board has an rs485 serial port, so I could have used that and saved my self the money on the adapter if I had known it was rs485 , oh well.

The Activex component makes it easier to code, but makes it less portable to other OS's like osx or linux. something in more native c or c++ could be nice and portable.

What is synoptic planting ? is that a graph based output ?

cmioci said...

In other applications I use VisualBasic reading a file .xml and placing graphic images (.gif) on the panel. Do you have any grap product by multiplatform you recommend?

Desra said...

I use rrdtool, its multiplatform and outputs png format graphs. it looks after graphing and data storage etc. The reason I use it is that my measurement/graphing is all done on my maxtor mss2 nas which runs linux. It is possibly not what you want, if you wish to put it all in a panel or app, it's really designed for html pages.

look elsewhere on my blog , you will see the graphs I generated from by resol controller

Daniel said...

Hi there! I wanted to data log my Resol controller last August, and managed to work out the protocol information from the binary dump. If someone could send me the VBus_Protocol.pdf though, I'd appreciate it to fill in the blanks!

Desra, you mention holes in your data. Did you figure this out? When the pump goes on, I start getting bit errors in the data and it drops out entirely after an hour or so. The data is correct again after the pump stops. I am trying to figure out why this is; some sort of interference anywhere?

I am borrowing an official Resol DL2 to see if that shows the same problem.

Desra said...

mail technik@resol.de and ask for the vbus protocol doc, I believe they have it in english now.

I fixed the holes in my graphs, it was a bash problem with cut and kill pids :-)

your problem sounds like bug in your code decoding the data, vbus has error checking in it, so you should be able to eliminate it being corrupt data.

Are you using a unix/bash system ?

Daniel said...

I have emailed them, no reply yet! As far as I could tell the protocol has checksums (i.e. error checking) but I couldn't figure out any error correction. The checksum is the last byte out of every sextet from what I recall. I've captured all the raw data so I can always reprocess it, but the errors look like bit interference and therefore checksum errors.

Desra said...

what model controller is it, can can you send me a sample of data ?

Daniel said...

It's a Resol BS Plus. I log the data in timestamped packets, so do you want some raw binary data?

I have just relocated all my serial line away from any power cables in the duct it was in before, and am logging it on my laptop next to the controller instead. Now hoping for some sun to get the pump going 100% for a few hours!

From what I remember (it was months since I looked at it) the AA 10 packet start header would turn turn into a CC 90, i.e. the top bits (which I believe are just stripped anyway) would start getting set, and then bytes would appear out of phase.

Massively appreciate your help; I couldn't find anything on the web at the time, so very glad I happened to search again and find your blog.

Desra said...

That's the same controller as me, so I can run the raw, or hex of your capture through my script and give you the results, or I can send you my scripts, you will need a unix system with bash and some basic bash tools, should work in windows under cygwin

Daniel said...

It's all on Linux, so instead of wasting your time, email your scripts over and I'll have a play when I get a chance.

Desra said...

two scripts

here is the first one, it does the decode of the serial capture log file, which is generated by this .

Requires bash, bc, awk, grep , hexdump and tr . most or all of these would be in a normal linux install. The reason I used bash and these tools is that i run it on an embedded openwrt box, and installing perl/php wasn't an option, though now is, so I could re-write in Perl

Daniel said...

Thanks Desra, I will take a look. I have a tiny 150-line C program that captures each packet and writes to a file with a timestamp, rolling files at midnight. Then a seperate C program that decodes it all. Resol have now sent me the protocol doc, and there are no surprises.

Rerouting the serial cable (not the vbus) away from the power cables seems to have fixed all my corruption problems! I have been logging with a laptop in the utility cupboard with no problems. So now I need to find a way to shield it through the duct, or maybe extend the vbus instead, assuming the twisted pair is more tolerant of noise.

Desra said...

is the electrical wiring part of the pump feed ? maybe that is why you get errors when the pump is being stepped ?

my serial to the hot press is over cat 5. i took a usb serial and cut the db9 off and put rj45's on to run it over my cat 5. in an earlier post, someone commented on the max length of vbus cables.
twisted cabling instead of straight, such as alarm cable vs cat5, should make a difference. mi swapped out my home phone cable to cat 5 and now i get adsl2+ at 15mb, previously it ran by power cables etc. and i could only get 8mb with errors.

Frosty said...

Hi Desra,
You've certainly done some great work, this is just what I am hoping to do for my collector - need to get that gas usage down :)
I've finally managed to get my Resol Plus up and running with the RS-COM and capturing nicely into a serial dump file (via some good ol'd cat5)
Is there any chance you could publish your decodesolar.sh?

cheers,
Frosty

Desra said...

hmm, not sure why the name changed, but decodesolar.sh = logsolar.sh

I will update getserialdata.sh to point to logsolar.sh instead of decodesolar.sh

Daniel said...

Back from holiday now. It looks like it wasn't interference that was causing the drop outs, rather the heat at the pump station! I wanted to take my laptop on holiday so I moved my file server into the utility cupboard. When I put the insulating cover back on the station, I noticed errors popping up again. So I left it off while on holiday, and for the first time I've managed to capture a complete day's data with many hours of 100% pumping (which shows some interesting patterns that probably belongs on some other forum! Anyone recommend one?)

I am going to put the server back in the loft now, and leave the cover off to make sure that was the issue. If so, I will relocate the controller outside of the pump station. I'd be surprised if this just affected me though!

Desra said...

just checked the manual for the controller, says 0 to 40 degress C. I could imagine an unventilated space like a hot press exceeding that ...

My pump station is in the loft, and the controller is in the upstairs landing.

I wonder was the unit actually making the pump run at the wrong speed too ...

Have you looked at using VBUS to program the controller ? from Resols site

'Parametrisation: DeltaSol® M, E ,ES and the BS-series (and future versions of the product family) can be user-friendly configurated with a PC;'

Frosty said...

Hi Desra,
capturing great with your script, thanks. I need to update to capture the timestamp also, and will post back when I'm done.
Cheers,
Frosty.

Desra said...

Frosty, thats great, my script wasn't tested to be re-usable or portable, so great to hear it was.

I don't use the timestamp from the controller, as I prefer the system time on the computer/collector, which is sync'd with via ntpd to a stratum 1 source from my ISP. I'm not sure if I would have a use for the resol timestamp.... anyway looking at vbus doc, shouldn't be much work to extract :-)

Desra said...

Daniel,

re: I've managed to capture a complete day's data with many hours of 100% pumping (which shows some interesting patterns that probably belongs on some other forum! Anyone recommend one?)

What is 'interesting' about your patterns ?

http://www.greenbuildingforum.co.uk
have some forums that seemed useful, though post rate is low

Jean-Marc said...

Hi Desra,

They want to bill me $200 for the RSCOM adapter. Can you please confirm that VBus is "simply" an RS-485 port? Do you know if a "simple" RS-485 -> RS-232 will do the job? Like this one? http://store.qkits.com/moreinfo.cfm/KC485

Thanks,

JM

Desra said...

i can try next week, but from other comments, it seems others had sucsess with some non resol converters. see early comments above.

i would note that it was 88 euro for vbus - rs232 resol adaper. $200 seems very expensive....

Jean-Marc said...

CAD$223,15 + taxes (5%). That's exactly why I'm trying to find a way to do it myself ;)

So I finally ordered the kit I was talking about before. I will keep you posted if I'm able to make it works with the Resol BS Pro.

tobi said...

I am trying to connect to the vbus of my resol kit, and as soon as I open the connection I get the following bytes, which do not at all look like what I should be getting according to the VBUS specifications:

ff fd 03 ff fb 03 ff fd 00 ff fb 00 ff fd 2c ff fb 2c ff fb 27 00 f0

any ideas ?

Desra said...

How are you collecting this from your serial port, and I assume your baud etc. is set correctly ?

tobi said...

communication parameters have you set on the rs-485 device ?

tobi said...

I have attached a rs-485 to tcp device with data+/data- to the resol vbus connector pair ... the rs-485 is set to 9600 8 bit N parity 1 stop bit

Desra said...

have you a url for product data for that device ? How do you get the serial via tcp from it etc. Which Resol Controller are you using ?

Looking at the data, I assume it's repeating, I don't think it's a resol stream, maybe a message from the tcp/rs485 device ?

tobi said...

yep after doing some more experimentation it seems the message is from the tcp interface device. According to the vbus spec it seems I have to send it some request in order to get data, your sample scripts simple dump what is coming in, does this mean your resol box just keeps talking ?

The box is in another place will look up the name when I get there later today.

Desra said...

Yes, I remember getting that impression from the Docs.
My device sends the stream from power on, I had to do nothing to get it to transmit. Perhaps this is the default mode, as it is possible to write data to some controllers over vbus, and the 'command mode' part of the doc indicates two way responses.

It would be great to know the device you use as it may be of interest to others.

I hope to make a C version of my code that is 'realtime' instead of 5 min cron etc. Infact I just installed gcc on my embeded box today for this purpose. But it will take me some time...

btw, incase you don't hear this often enough, Thank-you for rrdtool ! I have used it for many years and it has made my working-life much easier.

tobi said...

ha ... I found it, after switching the wires of my vbus connection around it works fine ...

I will post a perl script that does life decoding some time this weekend ...

glad to hear rrdtool is helpful!

tobi said...

for those interested, I am using this device to access the vbus over the network ... http://www.exsys.ch/index.php?main_page=product_info&products_id=583&language=en connecting the data+ and data- to the two vbus connectors. It then makes the vbus traffic available on a tcp port ... pretty simple ...

dqnlt said...

I have been using a C version that does live logging and decoding for a few months now. It seems like all my problems stemmed from the controller itself overheating; with the shroud removed I've had no corruption problems. Mail me direct if you want a copy, or I'll put on sourceforge or something.

Desra said...

That would be brilliant, sourceforge or code.google.com. the amount of hits I get on this page is large enough that I think many people will find it useful. Probably more so as the basic controllers now have vbus support.

My intent was to use this as an excuse to learn c++ as I only use bash/perl/php/VB at the moment.

I was planning to have my code read from a port, or a pipe, and output to console or a file, and default to a Deltasol BS Plus decode, with the option of passing field/frame/datatype information on the command line so that it can decode any resol vbus information, or just the values you want. i.e.

cat /dev/ttyUSB0 | vbusdecode -f my.file -d 1-2,double -d 3-4,double -d 5-6,int -d 6-7,date

would make my.file always contain only the current values

or

cat capture.file | vbusdecode


would return all the values in capture.file to stdout

tobi said...

why do you want to write this in C ? is there no perl on your target platform ? Also since the ID of the device is in the destination address of the packet, a decoder tool could automatically switch to the right template. I have now written some perl code to fetch streaming data and feed it into an rrd file and it is working well ... I plan on polishing it up to solve the whole vbus reading issue but this may take some time, so drop a line if you want a copy as it stands.

dqnlt said...

I will have a look at code.google.com then. I think you can dynamically decode since the frame type is in the message; I'll have a look. Mine is currently in two parts; one that logs every packet from the serial port with a timestamp to a file. The decoder then processes this file, with the option to follow it in real time.

Desra said...

Why in C ? well I am currently using a transmeta board with a 128mb Flash, and would prefer not to have to put micro perl on with device::serialport or similar as the cpu is somewhat low spec (kinda like a 486dx2 66:-) and flash space. Plus it gives me a c++ project :-)

I realise that the model number is included in the frame headers, but I have 2 reasons for supporting args for exact field extraction (?)

1) newer models, do we really want to have to write more code to support newer models and maintain ? i.e. this year , resol added more vbus support to more models, by allowing args , people could still use the tool for models not defined. My intent was to do both args and pre-known models, plus I can only test on BS plus model.

2) I use rrdcollect, so having a file with just the values I care about makes it easier, i.e. I don't care about the system type, or relay states etc. This is really not a problem, as rrdcollect can ignore certain values, but is even easier if the arg support is in the utility.

The utility could support reading in the xml files that come with Resol service center, they have all the frame data with names, but this makes it more complex I guess.

Thoughts ?

Daniel said...

Hi all!

Once upon a time RESOL offered an open-source command line application capable of connecting to several different data source types (serial port being one option), parsing a XML file containing protocol information and outputing the formatted data to a text file.

Its development was deprecated and distribution was stopped so no current controller is supported. And the XML file structure is completely different from the one that is currently used for the ServiceCenter so you can not simply reuse those files.

The application depended on libxml2 for XML parsing. Is that available on your openwrt device?

If you are nevertheless interested you can just send a mail to vbus@resol.de, they will provide you with the necessary information.

Desra said...

i will mail them. thanks for the info. if it is open source, maybe i can update it and publish.

this is part of the reason i like the option of passing the parameters in args, it usable if not maintained. also not requiring xml files or depending on libxml seems to keep with the spirit of simple, self contained, single purpose unix utils.

i should have no problem installing libxml. it a pretty common requirement so probably already packaged.

i have started a util and got passed the worst pain of being a newbie at c/c++ i hope. i have it decoding the header and hope to do the frame decode bit late in the week and then the args stuff after that. it has been 23 yrs since i looked at c at the differences between all the datatypes lik unsigned char, are things i had happily forgotten :)

Desra said...

I have the basics done in C here http://code.google.com/p/vbusdecode/

and as usual, now want to start from scratch again as I could do it much better, maybe using a struct for the header and for the frame, and not using fgets.

Martin said...

We are just about to install our solar with the Resol controller and would like to use the VBus to monitor how effective it is but don't want to pay for the Resol USB to VBus lead. Is it possible to make this lead from another cheaper standard lead?

Desra said...

VBUS is RS485, so any USB to RS485 should work

Desra said...

I have used this supplier with out problem, but not for rs485 adapters.

http://www.dealextreme.com/search.dx/search.rs-485

Jean-Marc said...

I bought and received this one: http://store.qkits.com/moreinfo.cfm/KC485 but I did not get a chance to solder it. But looks to be good. I hope to be able to test it this summer...

Desra said...

I have setup a google group , as this section has become a long read.

I hope some of the posters here will sign up :-)

http://groups.google.com/group/resol-vbus

Markster said...

I'm getting a new system with a Caleffi iSolarPlus which I believe is just a rebadged Resol controller. It has 2 connections for the VBUS. The RS-COM adapter is no longer available. Resol now has a USB adapter and are comming out in the fall with an ethernet adapter. I was quoted >$300 for the USB adapter which is ridiculous.

Do you guys think this would work?
http://www.startech.com/item-download/NETRS2321E-1-Port-RS-232-422-485-Serial-over-IP-Ethernet-Device-Server.aspx

You can get it for < $100 at buy.com, amazon etc... and would be nicer than a straight RS232-RS485 converter for my setup.

I haven't seen the Caleffi controller yet, but I'm hoping there are markings on which is D- and which is D+. On the PDF it just shows connection 9 and 10....

Desra said...

Hi Markster,

Can you post this on http://groups.google.com/group/resol-vbus ??

I am hoping to move as much vbus related stuff there :-)

And I have an interesting alternative answer waiting for you :-)

robert said...

http://focus.ti.com/lit/ds/symlink/msp430f149.pdf
This is probably cpu in resol unit and connection pins is 32,33.Can You confirm it?

Desra said...

Hi Robert

Can you post this on http://groups.google.com/group/resol-vbus ??

I am hoping to move as much vbus related stuff there :-)

I can open the controller and look at what processor is on it tomorrow.

Are you asking is the vbus interface connected to pins 32 and 33 ?

If they were, I would assume it's not direct, as from the manual in the google group, the voltages for mark/space are not normal rs485, so there maybe some electronics between the vbus output and whatever cpu package is in the controller.

frylock said...

Can You make few photos?
I have sonnenkraft SKSC2, this unit dont have pinouts for vbus. Maybe You tell me what chip is between major CPU and vBus pinouts.
link to photos of my unit
http://groups.google.com/group/resol-vbus?msg=subscribe

frylock said...

I want to build somthing like that

http://www.solver.katowice.pl/index.php?menu=10&lang=p%EA

fred.b.lopes said...


I have sonnenkraft SKSC2, this unit dont have pinouts for vbus.
Maybe You tell me how make conection between SKSC2 and RESOL VBus.
Can You make few photos ou desgin?

load testing