jets
Posts: 58
Joined: Mon May 06, 2013 9:40 am

Re: Photovoltaic/solar systems monitoring

Fri Nov 01, 2013 10:22 am

Wow, me too just stumbled across this topic.

I have quite similar needs. I have a remote cabin where I would like to monitor Solar PV and Wind turbine, battery pack, temperatures etc..

At the moment I have:
-MPP Solar PCM-6048 MPPT charge regulator (has RS232 and came with Windows software, would be nice to read it from Rpi)
-400W PV array, to be added another 400W, so it will be 800W
-400W Wind turbine and its simple charge regulator
-930Ah 12V battery pack
-One 2KW Inverter for house electricity (lights, coffeemaker etc, usually switched off when I am not there)
-One 600W Inverter for Rpi, cameras and such
-One combo meter measuring battery voltage and wind mill amps (http://www.ebay.com/itm/DC-120V-10A-Vol ... 1142316463) <-- does not have any interface for computer, but maybe could be tinkered?

Anyway, I am really interested on this project. Is it progressing?

Other related Rpi-stuff that I have but are not yet at the cabin and I just got them yesterday:
-1-wire Master with RS232
-Piface for controlling wirelessly controlled 230v sockets by using relays with the original remote controller
-Some 1-wire 1820 temp-sensors

tony56
Posts: 1
Joined: Mon Nov 11, 2013 3:04 am

Re: Photovoltaic/solar systems monitoring

Mon Nov 11, 2013 3:20 am

Hi
I have a online grid connected Samil 2200 inverter connected via RS232, currently monitored using a Windows PC running PVBeanCounter which uploads to PVoutput.org. Unfortunately the latest BeanCounter development requires Windows 7 or later. Seems pointless to me, my Windows XP does fine, except for the power use and need to schedule reboots through the day to ensure stability and reliability of recordings (on edge of my WiFi coverage).
I also have a 1Kw SMA which isn't currently connected (no serial card in Inverter).
Hoping to get a Raspberry Pi soon as I would like to retire the Wundozs PC.
So keen to see development and will assist where I can

Tony

jets
Posts: 58
Joined: Mon May 06, 2013 9:40 am

Re: Photovoltaic/solar systems monitoring

Mon Nov 11, 2013 8:58 am

Well, regarding reading the PCM-6048 solar charge regulator, I have the protocol specs:

https://www.dropbox.com/s/funk3gpyf36qk ... harger.pdf

However, I am not skilled enough to make a software or other means to read it.

I have now RS232 and cable between the PCM-6048 and Rpi.

All help and suggestions are welcome. I believe this same protocol is used by other charge regulators and inverters as well.

instanttim
Posts: 4
Joined: Mon Nov 18, 2013 6:33 pm

Re: Photovoltaic/solar systems monitoring

Mon Nov 18, 2013 6:38 pm

I just bought a Raspberry Pi, and am going to use some open source python scripts to collect data from the Mate3. I then plan on using that data to control home automation tasks, mostly to turn certain outlets on/off based on the charge state...

I haven't decided on all the components and technologies yet. So far I just bought the Pi and know that python will be used since that's what's popular these days for this sort of thing.

jets
Posts: 58
Joined: Mon May 06, 2013 9:40 am

Re: Photovoltaic/solar systems monitoring

Tue Nov 19, 2013 6:38 am

Well, I found this page:

http://www.fieldlines.com/index.php/topic,147639.0.html

The OP of that topic is successfully monitoring Morningstar Tristar by using PyModbus and Python. And I believe my MPP Solar PCM-6048 just might be compatible.

Here is the pymodbus:
https://github.com/bashwork/pymodbus

And I have this RS232-add-on card (with 1-wire master):
http://www.abelectronics.co.uk/products ... and-1-Wire

I had some trouble installing the pymodbus, as I did not have the setuptools, so git cloned the pymodbus, but "python setup.py install" did not succeed and finished with 404 error. So I then directly downloaded the ez_setup.py-file by "wget https://bitbucket.org/pypa/setuptools/r ... z_setup.py" and replaced the original ez_setup.py that came with pymodbus, then it installed fine.

Then I took the code that is used by "Simen" at http://www.fieldlines.com/index.php/topic,147639.0.html.

Here is the code I am trying to use (his code directly), but I have problems (see below):
#!/usr/bin/env python

import time
a = 2
counter = 0

# import the server implementation
from pymodbus.client.sync import ModbusSerialClient as ModbusClient

# configure the client logging
import logging
logging.basicConfig()
log = logging.getLogger('./modbus.error')
log.setLevel(logging.ERROR)

# choose the serial client
client = ModbusClient(method='rtu', port='/dev/ttyAMA0', baudrate=9600, timeout=1)
client.connect()

# Define the State list
state = ['Start', 'Night Check', 'Disconnected', 'Night', 'Fault!', 'BulkCharge', 'Absorption', 'FloatCharge', 'Equalizing']

while a > 1:

#read the registers from logical address 0 to 30.
rr = client.read_holding_registers(0,30,1)

#scaling
batt_scale = 96.667
i_scale = 66.667
array_scale = 139.15

#the stuff we want
battsV = ( rr.registers[9] * 96.667) / 32768
chargeI = ( rr.registers[11] * float(i_scale )) / (2**15)
arrayV = ( rr.registers[10] * float(array_scale )) / (2**15)
statenum = rr.registers[27]
pwmDuty = rr.registers[28] /2.55
regTemp = rr.registers[14]
powerIn = battsV * chargeI
ampH = ( rr.registers[17] + rr.registers[18] ) * 0.1



#debug
# print "Battery Voltage: %.2f" % battsV
# print "Battery Charge Current: %.2f" % chargeI
# print "Array Voltage: %.2f" % arrayV
# print "PWM Duty: %.2f" % pwmDuty
# print "Control State: %.2f" % state
# print "Controller Temp: %.2f" % regTemp
# print "Power in: %.2f" % powerIn
# print "Ah: %.2f" % ampH

out = "V:%.2f" % battsV + " A:%.3f" % chargeI + " AV:%.2f" % arrayV + " D:%.2f" % pwmDuty + " S:" + state[statenum] + " CT:%.2f" % regTemp + " P:%.2f" % powerIn + " AH:%.2f" % ampH + "\n"
fil = open('/mnt/dumpdata.txt', 'w')
fil.write(out)
fil.close()
counter += 1

if counter == 24:
tid = time.ctime()
out = str(tid) + ",%.2f" % battsV + ",%.3f" % chargeI + ",%.2f" % arrayV + ",%.2f" % pwmDuty + "," + state[statenum] + ",%.2f" % regTemp + ",%.2f" % powerIn + ",%.2f" % ampH + "\n"
fil = open('/mnt/dumplog.csv', 'a')
fil.write(out)
fil.close()
counter = 0

time.sleep(5)

# close the client
client.close()

print "done"
When I run it, I get:
[email protected]:~/solarcheck# ./solarcheck.py
Traceback (most recent call last):
File "./solarcheck.py", line 26, in <module>
rr = client.read_holding_registers(0,30,1)
TypeError: read_holding_registers() takes at most 3 arguments (4 given)
As I am not a code genius or coder at all. I have no idea what is wrong (although, I think the line 26 is right, start from 0, go to thirty and us slave 1?). However, it might be that I am trying running it "dry" so that the solar charge regulator is actually OFF, as the sun does not shine (PCM-6048 switches completely off unless it gets at least 40V from the PV array). Maybe it is that? Any advice would be nice.

Only thing i have changed in the code is ttyUSB0 to ttyAMA0, ttyAMA0 is my serial port and the "Simen" has apparently a USB-RS232-adapter.

jets
Posts: 58
Joined: Mon May 06, 2013 9:40 am

Re: Photovoltaic/solar systems monitoring

Tue Nov 19, 2013 8:45 am

Some update. I changed this:
rr = client.read_holding_registers(0,30,1)
In to this:
rr = client.read_holding_registers(0,30,unit=1)
As per this:
https://groups.google.com/forum/#!msg/p ... fYgOGjmlAJ

Where it is stated:
Right,

So in the latest version I added a breaking change where the unit I'd needs to be specified by key,

client.read_holding_registers(regIndex, numRegisters, unit=slaveUnit)

This was done so I could add more parameters in the future. The previous line should work fine for the old and new version.

Galen
Now I get:
[email protected]:~/solarcheck# ./solarcheck.py
Traceback (most recent call last):
File "./solarcheck.py", line 26, in <module>
rr = client.read_holding_registers(0,30,unit=1)
File "build/bdist.linux-armv6l/egg/pymodbus/client/common.py", line 109, in read_holding_registers
File "build/bdist.linux-armv6l/egg/pymodbus/client/sync.py", line 83, in execute
File "build/bdist.linux-armv6l/egg/pymodbus/transaction.py", line 68, in execute
File "build/bdist.linux-armv6l/egg/pymodbus/client/sync.py", line 360, in _recv
File "build/bdist.linux-armv6l/egg/serial/serialposix.py", line 475, in read
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
Which would indicate that as the device is off, it will give no data and thus maybe will work if we get some sunshine :)

Though, it looks like next sun will be available on Sunday.. hope it wakes up sooner by scattered light through the clouds.

terryrmiller
Posts: 1
Joined: Sun Nov 24, 2013 5:03 pm

Re: Photovoltaic/solar systems monitoring

Sun Nov 24, 2013 6:41 pm

I have 8.5KW grid-tie solar system and would like to monitor the rs485 outputs on its two KACO inverters, a 2502xi and a 5002xi. I have a RaspBerry Pi plus an rs485 add-on board (modbus, with auto direction). Would anwmalos's software work with this system? If so, how do I obtain it. The link for the mailing list at https://www.solarspy.net/solardev doesn't function.

instanttim
Posts: 4
Joined: Mon Nov 18, 2013 6:33 pm

Re: Photovoltaic/solar systems monitoring

Fri Dec 13, 2013 5:17 pm

As a follow-up to my previous post. I have been using the Raspberry Pi to collect a data stream from Outback Power equipment (specifically a Mate3). I got the original project from Jesus Perez, but I've been making a lot of changes and I pushed it up to github: https://github.com/instanttim/monitormate

The 0.4 release is just bug fixes to Jesus's distribution. And I don't think I even got them all. But the master branch (if you download the latest) has a lot of changes...
  • Custom labels for your devices and shunts
  • Page layout re-design (HTML/CSS updates)
  • Updated Flot for high-res (retina screen) charts
  • Colored thresholds on the SOC chart Red, Yellow, and Green to match FNDC and Mate3 color-coding.
  • Staggered bar charts (instead of overlapping them)
  • Refactored some of the code, cleanup, etc.
It's still a work in progress of course. I'm going to keep working on making the charts nicer, and add a historical browser to let you go back and browse through previous charts etc. Then I'll probably call that the 1.0 release.

Oh, you can see the current unstable version of it running on my system: http://finleyridge.com/power/monitormate.html

jets
Posts: 58
Joined: Mon May 06, 2013 9:40 am

Re: Photovoltaic/solar systems monitoring

Fri Dec 13, 2013 8:58 pm

Hey Instattim, looks like a great work! However, I am using different brand, but hope to utilize your work. Does the Outback use MODBUS/JBUS?

My MPPT PCM-6048 uses JBUS, which I think is pretty much equivalent to MODBUS.

What speeds are you using? Are you connecting by RS232 or something else?

xxv
Posts: 1
Joined: Sun Dec 22, 2013 10:44 pm

Re: Photovoltaic/solar systems monitoring

Sun Dec 22, 2013 10:50 pm

I stumbled across this forum in my search for details on the Tracer MT-5 board. I've managed to get it working with an Arduino and am in the process of writing Python code that will be running on my Raspberry Pi. I put my work-in-progress on my Tracer Github repository. I'll be posting more commits in a bit.

rbrown3rd
Posts: 6
Joined: Fri Feb 14, 2014 12:47 pm

Re: Photovoltaic/solar systems monitoring

Fri Feb 14, 2014 4:52 pm

Hi Instatim and all. I also am interested in your monitoring project. I am currently using a Windows machine to monitor my Outback 4.4kw grid-tie system as you can see at http://bbbrown.mysolarlog.com/ . I have a new Raspberry Pi and since the only Windows machine I have is the one I am using for monitoring I would love to ditch it and use my RP to do the job. Your website looks nice. I'm interested in how you interface the Pi with the Mate. Any info appreciated.

instanttim
Posts: 4
Joined: Mon Nov 18, 2013 6:33 pm

Re: Photovoltaic/solar systems monitoring

Mon Feb 24, 2014 6:36 pm

rbrown3rd wrote:I'm interested in how you interface the Pi with the Mate. Any info appreciated.
The entire project is up on github, (link is in my previous post). The Pi is running a python script which is consuming the UDP data stream from the MATE3. It then formats that as json and sends it on to a web server and SQL database. That could be the same computer (Pi) or it could be a hosted web server anywhere on the internet.

khaupt
Posts: 1
Joined: Mon Feb 24, 2014 11:05 pm

Re: Photovoltaic/solar systems monitoring

Mon Feb 24, 2014 11:06 pm

Please email me [email protected]

jets
Posts: 58
Joined: Mon May 06, 2013 9:40 am

Re: Photovoltaic/solar systems monitoring

Tue Mar 04, 2014 9:46 am

anwmalos wrote:Hi,
You are lucky because fronius inverters are already supported very well. Right now the probe extracts the following info:
power, currentAC, currentDC, voltageAC, voltageDC, frequencyAC, Phase1Current, Phase2Current, Phase3Current, Phase1Voltage, Phase2Voltage, Phase3Voltage, DailyEnergy, TotalEnergy

(these are actually the names of the db columns...)

They are sampled every 5-10secs and an average value is commited in the db every 1 minute.

If you are interested in using/contributing please pm me for more information.
Hello Anwmalos, are you still on this project?

Does this support Modbus/Jbus?

I really would like to test and make this working with PCM-6048 MPP Solar's charge controller, which communicates via RS232.

N3tguru
Posts: 20
Joined: Thu Mar 06, 2014 5:31 am

Xantrex 3.0 and Rainforest Raven to PVOutput.org!

Thu Mar 06, 2014 5:47 am

I finally got my RPi to push data to pvoutput.org! I have a Xantrex 3 grid tie inverter and a Zigbee dongle (Rainforest Raven) for communication with the smart meter on the house.

http://www.pvoutput.org/intraday.jsp?id=28821&sid=26410

The Perl code is based on solar.js.cx code. The site is gone but I found an example here: http://blog.our-files.com/2012/10/solar ... ing-stuff/

I added another serial port to the code to monitor both inputs.

alistercachia
Posts: 1
Joined: Sat Mar 08, 2014 5:24 pm

Re: Photovoltaic/solar systems monitoring

Sat Mar 08, 2014 5:31 pm

Hi,

I have a Steca 2000 inverter with an rs485 port would your setup work for me?

:)

jets
Posts: 58
Joined: Mon May 06, 2013 9:40 am

Re: Photovoltaic/solar systems monitoring

Sat Mar 08, 2014 5:57 pm

I am willing to try anything, so far nothing has worked with my MPP Solar PCM-6048 Solar Charge Controller, the interface is RS232 :( Apparently it uses "Helios Inverter Protocol" and protocol specs also mention J-BUS, which again maybe is pretty much same as MODBUS..

All help would be highly appreciated.

N3tguru
Posts: 20
Joined: Thu Mar 06, 2014 5:31 am

Re: Photovoltaic/solar systems monitoring

Sun Mar 09, 2014 6:32 am

Code: Select all

$serial_port->write("INV?\r");
($count, $xantrex_status) = $serial_port->read(255);
$serial_port->write("KWHTODAY?\r");
($count, $xantrex_kwhtoday) = $serial_port->read(255);
$serial_port->write("TIME?\r");
($count, $xantrex_time) = $serial_port->read(255);
$serial_port->write("POUT?\r");
($count, $xantrex_pout) = $serial_port->read(255);
This is a code snippet from the source mentioned in my previous post that grabs responses from queries on the serial port. Pretty simple and should be easily modded to suit any inverter that can respond to commands issued in a terminal session.

N3tguru
Posts: 20
Joined: Thu Mar 06, 2014 5:31 am

Re: Photovoltaic/solar systems monitoring

Mon Mar 10, 2014 4:57 am

Not much info out there on the MPP other than using their own software. There are JBUS docs but that protocol requires a lot of parsing to get meaningful data out of it.

Have you hooked up a terminal emulator to see what the output looks like? I wonder if there's a way to 'sniff' the serial port while the charger is talking to a PC.

jets
Posts: 58
Joined: Mon May 06, 2013 9:40 am

Re: Photovoltaic/solar systems monitoring

Mon Mar 10, 2014 7:02 am

N3tguru wrote:Not much info out there on the MPP other than using their own software. There are JBUS docs but that protocol requires a lot of parsing to get meaningful data out of it.

Have you hooked up a terminal emulator to see what the output looks like? I wonder if there's a way to 'sniff' the serial port while the charger is talking to a PC.
I have connected to this controller via cu-command from command line. I do not get anything out of it. I think I have minicom or some other terminal emulator, but what should I try with it?

I have the software for Windows XP and it works, but it does not help in this case of course. I did get the specs for baudrate though from the XP software, it is 9600,n,8,1 :) .

jets
Posts: 58
Joined: Mon May 06, 2013 9:40 am

Re: Photovoltaic/solar systems monitoring

Mon Mar 10, 2014 9:31 am

Hmm. Even though this is more going towards off-topic..

I suspect that my /dev/ttyAMA0 is not working properly.

As if I do: python -m serial.tools.list_ports

It lists only ttyUSB0 and ttyUSB1

I have 3g dongle there, which the ttyUSB's are related, I guess.

How do I make sure my ttyAMA0 is working properly? I am not onsite right now, but I left the cable in place between the charge controller and Raspberry Pi.

I think I should see something if I access the ttyAMA0 via terminal emulator or simply by cat-command or so..

jets
Posts: 58
Joined: Mon May 06, 2013 9:40 am

Re: Photovoltaic/solar systems monitoring

Mon Mar 10, 2014 12:43 pm

I am going somewhere with this. The SunnyRoo device's protocol looks almost identical. I just go the libpowercom that should work with it, but so far no luck. I have not yet found any other software to work with Sunny Roo. And looks like PV Bean Counter is no longer available for Linux.. Maybe someone knows where to get old version of PVBC that would run on Linux?

Now I think I must somehow make sure my Raspi's ttyAMA0 works as it should be working.

N3tguru
Posts: 20
Joined: Thu Mar 06, 2014 5:31 am

Re: Photovoltaic/solar systems monitoring

Mon Mar 10, 2014 9:31 pm

Yes, minicom will do the trick. minicom -b 9600 -o -D /dev/ttyAMA0. Try it also with sudo.

If its RS232 I have only had luck using a USB to RS232 adapter with the RasPi. It would then obviously show up on ttyUSB0 or ttyUSB1.

I had issues with acces to the /dev/ttyusb0 device until I followed the first part of this guide: http://elinux.org/RPi_Serial_Connection

My cron job to export info to pvoutput runs as root.

N3tguru
Posts: 20
Joined: Thu Mar 06, 2014 5:31 am

Re: Photovoltaic/solar systems monitoring

Mon Mar 10, 2014 9:56 pm

Sorry.. more goodies. Im looking for a way to do TDS monitoring of a RO unit... found this doc on using the ttyAMA0 port. https://www.atlas-scientific.com/_files ... e_code.pdf

jets
Posts: 58
Joined: Mon May 06, 2013 9:40 am

Re: Photovoltaic/solar systems monitoring

Tue Mar 11, 2014 7:17 am

N3tguru wrote:Yes, minicom will do the trick. minicom -b 9600 -o -D /dev/ttyAMA0. Try it also with sudo.

If its RS232 I have only had luck using a USB to RS232 adapter with the RasPi. It would then obviously show up on ttyUSB0 or ttyUSB1.

I had issues with acces to the /dev/ttyusb0 device until I followed the first part of this guide: http://elinux.org/RPi_Serial_Connection

My cron job to export info to pvoutput runs as root.
I have run all my tests as root.

Well, I did not get anything from terminal connection. I think my RS232 does not work :( I wonder if it is because I have 1-Wire Master+RS232 unit together with Real Time Clock AND 433Mhz transmitter?

I have done everything that is needed to take ttyAMA0 into use. That is to disable getty to ttyAMA0 from inittab and then remove references for ttyAMA0 console from cmdline.txt.

This is what I have: http://www.abelectronics.co.uk/products ... and-1-Wire

Then I have this: http://cgi.ebay.co.uk/ws/eBayISAPI.dll? ... 1038612257 (only the transmitter)

And then this RTC: http://cgi.ebay.co.uk/ws/eBayISAPI.dll? ... 1210428446

So maybe those interfere with the RS232 communications?

I did get proper information when I connected to the ttyUSB1 with minicom, which gives information from the USB-3g-dongle.

I better get a USB-RS232 adapter for this.. I guess.

And I did get the libpowercom installed and also tested with the libpowercom-testfile that comes with it. I guess the libpowercom is the correct way to go with my controller.

Return to “Automation, sensing and robotics”