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.
Go through the tabs below for information on the parts I used for this project.
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
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
Seek information here: http://elinux.org/RPi_USB_Wi-Fi_Adapters
I used a RALINK RA5370 with an external antenna.

Pictures of setup
Here is a picture of the setup.

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.
- Enable SSH on your RPI
- Download the Putty SSH client on your PC.
- 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.
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
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.
Hi thx for the script!
I bought the same cable and its recognized by the pi:
Bus 001 Device 005: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
my inverter (TL1000) with firmware 1.8 is at com1 and up and running.
when I start your script it gives me this error:
Traceback (most recent call last):
File “./growatt2.py”, line 32, in
print rr.registers
AttributeError: ‘NoneType’ object has no attribute ‘registers’
any idea what could be wrong?
Jan
oke I solved it , I deleted the print rr.registers line and now it works!
thx for the script!!
Sounds good. Have fun 🙂
I’m an absolute raspbeginner, I hope you will forgive me too silly questions. But:
will your method work when ‘some’ wifi module is connected to the rs232 port in my Growatt 1500 and my raspberry is connected (rj45) to our wifi router?
Barry Binnenweg
Den Haag, Holland
We used a netgear wlan 1100 usb adapter and a €13,50 Ewent rs232/usb cable and things work great! http://pvoutput.org/intraday.jsp?id=30420&sid=27862
Hey that’s cool :o)
Thanks for sharing!
Hi Barry,
Can you tell us how you connected the Growatt system to the PVoutput.org website?
We are using a Growatt 4200MTL with a Growatt wireless connector and the Growatt logging server but we also want to log on PVoutput.org
Hi Johan.
It is a little broadly formulated question. Let me point you in the right direction.
You create an account on PVOutput.org. Get your APY Key and system ID by logging into your account and browse to the relevant section.
Then you use Curl to upload the data you read out of your Growatt inverter.
There is a quite elaborated help section on PVOutput for how to use the Curl commands.
You can see how I did it under the os output section in the python script for uploading:
http://www.sisand.dk/?page_id=139
Hi,
Thanks for your guide.
I had everything working but my pi got hacked so I formatted my pi and started again. I’ve followed the same instructions but now it wont read from the inverter (NoneType error).
The modbus test code doesnt work, same pi, same code, its completely baffled me.
Any ideas?
It may have to do with your firmware version of the inverter.
I know that some 1.7 and below would have an older modbus protocol.
The code is tested for 1.8 firmware version but newer may Again have a different protocol.
You can check your firmware version by the silly knock-menu on the inverter.
I’ve been using your script succesfully to monitor a Growatt inverter during more then one year now. Do you think i should be able to use it monitoring a Samil inverter as well? Or could you fingerpoint me to a modification in the script to make it work for that inverter as well?
Good work!
Do you have (or know where to find) a list of all the Growatt registers?
Some of the basic stuff is described in line 34 to 60 in the code.
But you can find more here:
http://www.snafu.priv.at/mystuff/growatt-proto.pdf
Hi, I’ve been hacking on the script again recently (see http://blog.elwell.org.uk) and got it to correctly output 2 word values such as total KWh to date. It also constantly publishes state onto mqtt message bus and notifies any faults via pushover
All source in github (https://github.com/Elwell/solarmon )
Andrew
Good stuff 🙂
Thank you for sharing information,
sorry, I just learned about this explanation, what do you mean by the “dialout” member? because I didn’t appear.
please instructions …
Is it possible to get a copy of the image running for the “old” type growatt?
Hi Torben. Oh… I don’t have that anywhere anymore 🙁
Sorry.