Category Archives: PVout

Photo voltic power generation at Fjord Alle 27 Ringkobing Denmark.
The array consists of 6 250W panels oriented at azimuth 212° (South West) with an elevation of 45°.
The plant export power to the net via a1500W Growatt inverter which is monitored with a Raspberry Pi.

Monitoring a Growatt PV inverter using Raspberry Pi

A Raspberry Pi is used to read data from a PV inverter (Growatt 1500) with firmware version G1.8 (modbus protocol) via the RS232 serial port. The data is automatically uploaded to pvoutput.org. Upload is sceduled every 5 min by setting up  a cronjob for running a dedicated python script.
Feel free to use any bit of the code you like. Due reference is appreciated.
The code has been tested over some days and seem stable enough. It spits out a glitch AttributeError: ‘NoneType’ object has no attribute ‘registers’ when the inverter is not connected to the grid. But the effect is just that nothing is uploaded to pvout.org.

For older versions of the Growatt inverters a standard serial protocol is used. If you happen to own one of these you cannot use the python script as it is. Either the script should be modified for the serial protocol or you may want to look at : http://www.snafu.priv.at/mystuff/ where a perl script is provided which basically does the same stuff just for a serial protocol
The most resent upload from the system is here read with a portlet from pvoutput.org.
PVoutput.org

Go through the tabs below for information on the parts I used for this project.

RPIUSB/serialPowerWiFi
The Raspberry Pi used here is the model B with 512 MB RAM.

RPI model B from Adafruit
RPI model B from Adafruit

http://www.adafruit.com/products/998 It is installed with Derbian on a standard SD 4GB memory card. The Pi is enclosed in a standard casing

USB/Serial Converter -  FT232RL
USB/Serial Converter – FT232RL

To connect to the inverter you need a serial port on you RPI. I used a USB/Serial adapter but you may also try it out with TTL/Serial. Recommended: The FT232RL from Adafruit provides +-10V serial (RS232) not 5V serial (TTL). Don’t buy your USB/serial adapter cheap since it is really annoying debugging on a faulty connection. The above displayed product from Adafruit is high quality and reliable: http://www.adafruit.com/products/18 It is plug and play and automatically available on /dev/ttyUSB0 on your pi. You can check if it is correctly recognised by

lsusb

You should see it somewhere in the list. In my case it says

Bus 001 Device 005: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Any Micro USB Charger will do. Buy one with at least 750 mA since the RPI needs to power both a WiFi dongle and a USB/serial adapter.
If your inverter is placed somewhere with poor signal you may consider an external antenna type adapter. But make sure it is compatible with the chipset on the RPI!
Seek information here: http://elinux.org/RPi_USB_Wi-Fi_Adapters
I used a RALINK RA5370 with an external antenna.

RALINK RA5370 USB WiFi
RALINK RA5370 USB WiFi

Pictures of setup

Here is a picture of the setup.

Growatt PV inverter and RPI
Growatt PV inverter and RPI

Python stuff

You will need a few libraries installed in Python before running the code.
A Python wrapper around the OpenWeatherMap web API

pip install pyowm

And the modbus protocol for talking to you modbus serial device.

easy_install -U pymodbus
pip install  -U pymodbus

If you find any Python libraries missing, please post it here.

Setting up the serial port

Configure your serial port on the RPI correctly before connecting to the inverter. Start with a connection to you PC using putty.

  1. Enable SSH on your RPI
  2. Download the Putty SSH client on your PC.
  3. Setup a connection.

When you are done and you can connect to your PC then you will need to configure the serial port on the RPI. Use e.g. Minicom to do this. In the command line on your RPI type in

minicom

and make sure your setup looks like this.

Serial port setup

If you are using a TTL/serial connection instead of the recommended USB/serial adapter then your serial port should probably be named /dev/ttyAMA0

Make sure your the user group you are running the script from is a member of “dialout”

 ls -l /dev/tty*S*

You should see something like this

ScreenShot061

I don’t know if there is much else to say. Try it out and if you run into problems I may be able to help you out since already made most of the mistakes on the way.