Lester Burnham's Blog

Samil Inverter & Current Cost on Raspberry Pi MKII

Hi Again,

It’s been a while since my last post on this topic, as I was overseas for a few months and it was working pretty flawlessly. The only problem was that it was running on 2 x Raspberry Pi’s, because of USB problems I was having. Samil Inverter on one Pi uploading to PVoutput.org, with the Current Cost CC128 running on the other, but uploading to xively.com, with PVoutput.org grabbing data from there.

I was a real work around because of the frustrations of trying to find perl, python or java scripts that would upload to PVoutput.org. I couldn’t manage to get Oracle java installed properly, as it was still being ported to ARM. So, the only other option was perl script uploading to xively.com. This worked, but occasionally would sit waiting for a request that was missed and just sit doing nothing. My coding experience was zero, so I had to just put up with it until things matured.

A big thanks to Evert from the Netherlands for tidying things up a bit in inverter.pl and pvoutput.pl with his valuable coding skills dating back to the 70’s :), while managing to install this on his Synology DS212 NAS.

Now they have matured, so I was testing with a new 512mb model B Raspberry Pi with Raspbian “2013-09-25-wheezy-raspbian.zip”.

I then went on to install X11vnc to enable us to run headless, using VNC from here.

Make sure you set hdmi_force_hotplug=1 in /boot/config.txt

I normally do this by shutting down the Pi and inserting the SD card into a reader, then mounting and editing /boot/config.txt manually. You may also be able to do it by running rasp-config while enabling SSH.

First task was to create a folder called solar in your home directory, then download the pvoutput integration scripts from here and copy the required files & folders mentioned in the install.html to your /home/solar folder.


I renamed the folder from pvoutput.v1.4.7 to pvoutput for simplicity. Don’t forget to make /home/pi/solar/pvoutput/bin/pvoutput.sh executable. Either by right click properties > permissions or running this in a terminal

chmod +x /home/pi/solar/pvoutput/bin/pvoutput.sh

Second task was to install Oracle java 1.7

sudo apt-get update && sudo apt-get install oracle-java7-jdk

Everthing went pretty well except for the mismatch errors when trying to run pvoutput.sh

WARNING: RXTX Version mismatch

Following this Post fixed the problem. Who knows, you might be able to install Oracle Java 1.8 now without any problems.

The next thing is to install the prerequisites for the inverter perl scripts

sudo apt-get install libdevice-serialport-perl libappconfig-perl libwww-perl

Download the Inverter scripts & Current Cost files and extract them to a temp folder in your home directory. Copy the inverter & logs folders into your solar folder. Copy the pv_start.sh file to  ~/solar/pvoutput/bin/

Make sure the cron_delete.sh, inverter.pl, postpvoutput & pv_start.sh files are executable.

With the pvoutput program, be sure to monitor the /solar/pvoutput/logs/pvoutput.log for errors and debug.

Make sure you set the correct USB device in the correct config file ie: in my case  /solar/inverter/config.txt /dev/ttyUSB0 for the inverter, then for the Current Cost /dev/ttyUSB1 in /solar/pvoutput/conf/pvoutput.ini

You will need to make sure both devices are plugged in at boot, so they load in their natural order. If it doesn’t work, reverse the plugs and try again or modify the config files.

Copy and paste the lower 3 lines in the crontab file into your users crontab

crontab -e

Paste this in

30 21 * * * ./solar/inverter/cron_delete > /dev/null
1 6 * * * cd /home/pi/solar/inverter ; perl inverter.pl >> inverter.log 2>&1
* 5 * * * cd /home/pi/solar/pvoutput/bin/ ; bash pv_start.sh >> pv_start.log 2>&1

 To exit Ctrl+x, then y for yes and enter to close.

I now normally start each process manually in a terminal each by:

cd /home/pi/solar/pvoutput/bin/
bash pvoutput.sh

cd /home/pi/solar/inverter/
perl inverter.pl

The pv_start.sh is currently un-tested, but should be OK. It will also run in the background and write data to /solar/pvoutput/bin/pv_start.log

The inverter.pl will run in the background when started by cron, but you will see the /solar/inverter/inverter.log filling with data if within operating hours.

This is still less than a week running, so use at your own risk 🙂

Leave a Reply