123Solar 123Solar Web Solar logger

How-to build a solar logger for ABB Power-One Inverters

odroidThis guide describe the way to turn a plug computer into a websolar logger. Before starting here is the frightening mandatory warning :
Do not open inverter enclosure when under load. High-voltage can cause death or serious injuries !
Both AC and DC power must always be disconnected. Even though, this will not be still 100% safe as internal capacitors may remain charged after disconnecting all sources of power.

Material :

You may use a ARM devices like a PogoPlug, a Raspberry Pi or an Odroid. These devices are quite cheap (less than 50euro), without fans and are really low on consumption. If you choose a Pogoplug, beware : The Pogoplug v3 isn't supported and the mobile version, have only one USB port ! You must have a dedicated drive of at least 2GB but you'll be at ease with more.
You can also use any x64 PC, like a NUC.

For ABB inverters, you'll need a converter USB/RS485 (Prolific 2303 chipset or FTDI FT232) you can find one for less than 10eur on ebay .

Make a RS485 cable: Use a RJ12 or more conveniently, the terminal block. See your manual for the correct connexion. On RJ12: it is Pin 2 as TR+, Pin 4 as TR- and Pin 6 as Grnd.
The 120ohm resistor (S2) should be set to 'on' on the last inverters of the bus.

Setting up :

The whole installation takes around an hour. So, let's start by listening to DI and then, log on your router and assign a static IP to your box. You may also configure your router and forward the port 80 if you wish to access your box from the outside and use a Dynamic DNS service like FreeDNS. You can install a systemd timer to update the DNS.
(Edit the example and put the files in /etc/systemd/system/ then "systemctl start freedns.timer" and "systemctl enable freedns.timer".)

So, let's start by installing the excellent Arch Linux ARM Linux distro for ARM or Arch Linux for x86.

Installation and configuration of the logger :

Once you finish with Arch Linux, log in ssh and change the root password

Configure your system


To list available zones use: timedatectl list-timezones
set-keymap

Add you hosts name in hosts list,it should match the one you previously set


eg: 127.0.0.1 localhost.localdomain localhost Plugbox

Update the whole things and install converter drivers (may takes a while)

Your system will reboot. Login in using your new password.

Installation and configuration of the webserver :

Installing nginx and PHP


Put this nginx config file, this fastcgi_params and this fastcgi.conf file in /etc/nginx/

Configuring php :


uncomment (remove the ;) extension=calendar.so and curl.so

Enable nginx and php-fpm service on boot and start it :

At this stage you should be able to see your empty webserver running

Since PHP 7.4 there is hardening options. You must allow to use your com. devices by setting PrivateDevices=false in php-fpm.service.
Check your version with "php -v", do "systemctl status php-fpm" for details

Check /var/lock permissions, some distros have 755 by default. If so, change it to 777 because application like aurora need to write port lock in there as http user.

Installation of the communication application :

Download the Aurora inverter communication application from here and compilators

Put aurora in your /home folder

then extract

Make sure the communication with the inverter(s) work and is reliable ! (eg: aurora -a2 -T -d0 -e /dev/ttyUSB0)

Allow the http user to run aurora and use the com ports :

Installation and configuration of SMTP :

If you wish to received email notification from 123Solar, install msmtp (Easy and simple SMTP client)

edit the configuration file /etc/msmtprc, if you use gmail, you better generate an application password.

eg :
# Accounts will inherit settings from this section
defaults
auth on
tls on

tls_trust_file /etc/ssl/certs/ca-certificates.crt

# Gmail address
account gmail
host smtp.gmail.com
port 587
from youraccount@gmail.com
user youraccount@gmail.com
password spoutnik

# Set a default account
account default : gmail

The permission and ownership of /etc/msmtprc should be set -precisely- to -rw------- 1 http root

Look for sendmail_path option in /etc/php/php.ini and edit it like this : sendmail_path = "/usr/bin/msmtp -C /etc/msmtprc -t"

Restart nginx

Installation and configuration of 123Solar :

Put the archive on your web server's folder then extract.

Go then in your browser for configuration (eg: http://yourIP/123solar/).

Once the http authentication files have been setup, you need to uncomment the lines "Uncomment those lines" in the /etc/nginx/nginx.conf example.


Powered by 123Solar