Collect from Kaco Inverters and send the data to your cloud using Ardexa
The purpose of this project is to collect from Kaco Inverters and send the data to your cloud using Ardexa. Data from Kaco solar inverters is read using an RS485 connection and a Linux device such as a Raspberry Pi, or an X86 intel powered computer.
How does it work
This application is written in Python, to query Kaco inverters connected via RS485. This application will query 1 or more connected inverters at regular intervals. Data will be written to log files on disk in a directory specified in the script. Usage and command line parameters are as follows:
# sudo kaco_ardexa log --help Usage: kaco_ardexa log [OPTIONS] SERIAL_DEVICE BUS_ADDRESSES OUTPUT_DIRECTORY Contact each inverter and log the latest readings
sudo kaco_ardexa log /dev/ttyS0 2,4-7 /opt/ardexa/kaco/logs
RS485 to USB converter
Kaco inverters can use RS485 as a means to communicate data and settings RS485 is a signalling protocol that allows many devices to share the same physical pair of wires, in a master master/slave relationship See -> http://www.usb-serial-adapter.org/ for further information
When an RS485 to USB converter has been plugged in, on Linux systems the device will connect to something line /dev/ttyUSB0. To check:
sudo tail -f /var/log/syslog ...then plug in the converter
You should see a line like:
usb 1-1.4: ch341-uart converter now attached to ttyUSB0
This means that the RS485 serial port can be accessed by the logical device
dmesg | grep tty
Inverter to RS485 (DB9) Physical Connection
If your computer has an RS485 port, then the inverter can be connected directly to this port. The inverter is connected using 3 wires to the RS485 DB9 port on the computer. DO NOT connect the inverter RS485 to a RS232 port. They are not voltage compatible and damage will probably occur. For this to happen, you need a devices like these:
Each and every RS485 port that uses DB9 has a different pinout. So you have to read the actual manual for the physical RS485 port you are using. For example; if using the Advantech UNO 2362G, the following pins are used: Pin1 = D- , Pin 2 = D+ and Pin 5 = GND. All other pins are not connected, so do not connect any other pins. So to wire it all up:
- Make sure the Advantech is turned off
- D+ Pin from the Kaco Inverter (should be Pin 2 on the RS485 inverter interface) to Pin 2 of the RS485 DB-9 (Female) on the Advantech UNO 2362G
- GND Pin from the Kaco Inverter (should be Pin 5 on the RS485 inverter interface) to Pin 5 of the RS485 DB-9 (Female) on the Advantech UNO 2362G
- D- Pin from the Kaco Inverter (should be Pin 7 on the RS485 inverter interface) to Pin 1 of the RS485 DB-9 (Female) on the Advantech UNO 2362G
Confirm the physical serial port by running the command
dmesg | grep tty. As stated previously, it should return something like
/dev/ttyS1 if using a serial com port, or something like
/dev/ttyUSB0 if using a 485/USB serial converter.
The Kaco Protocol
Kaco (http://kaco-newenergy.com/) supply supply retail and commercial grade Solar PV inverters. This python script is designed to collect data from Kaco Powador inverters. It collects from the Powador 30.0-39.0 series of inverters, using RS485 connected devices. It can be easily adapted to other Kaco inverter types. Contact us to help you with adapting this script to collect from other Kaco inverters. The kaco protocol is detailed in this document -> https://www.photovoltaikforum.com/download/file.php?id=11571. Unfortunately it is in German, so we have translated it to English as best we can. You can find it in the 'docs' directory.
How to use the script
On a raspberry Pi, or other Linux machines (arm, intel, mips or whetever), make sure Python is installed (which it should be). Then install the pip package:
sudo apt-get update sudo apt-get install python-pip sudo pip install kaco-ardexa
Note that the applications should be run as root only since needs access to a device in the
Collecting to the Ardexa cloud
Collecting to the Ardexa cloud is free for up to 3 Raspberry Pis (or equivalent). Ardexa provides free agents for ARM, Intel x86 and MIPS based processors. To collect the data to the Ardexa cloud do the following:
a. Create a
RUN scenario to schedule the Ardexa Kaco script to run at regular intervals (say every 300 seconds/5 minutes).
b. Then use a
CAPTURE scenario to collect the csv (comma separated) data from the filename
/opt/ardexa/kaco/logs/. This file contains a header entry (as the first line) that describes the CSV elements of the file.
Contact Ardexa at email@example.com, and we'll do our best efforts to help.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for kaco_ardexa-1.0.2-py2.py3-none-any.whl