Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jantenhove committed Apr 27, 2020
2 parents fb160aa + 942a868 commit 51aad21
Showing 1 changed file with 36 additions and 30 deletions.
66 changes: 36 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,50 @@
# GoodWe Solar inverter logger based on ESP8266
# GoodWe Solar inverter logger based on ESP8266

This ESP8266 firmware enables you to read information from a GoodWe solar inverter through it's RS485 bus.
Sending information to a MQTT broker is supported, as well as uploading information to [PVoutput](https://pvoutput.org/).
This ESP8266 firmware enables you to read information from a [GoodWe](https://www.goodwe.com/?l=en-us) solar inverter through it's RS485 bus.
Sending information to a MQTT broker is supported, as well as uploading information to [PVOutput](https://pvoutput.org/about.html).

## Requirements
- GoodWe inverter with RS485 connector (this software has been tested with GW3600D-NS and GW3000-NS inverter, but others might also work)
- RS485 converter (can be found on sites like AliExpress, search for *SCM TTL to RS485 Adapter 485 to UART Serial Port 3.3V 5V Level Converter Module*)
- ESP8266 (like NodeMCU or Wemos D1 mini)
- Computer with Arduino IDE installed
- GoodWe inverter with a RS485 connector (this software has been tested with GW3000-NS, GW3600D-NS, GW10KN-DT, but other inverters might also work)
- ESP8266 module (like NodeMCU or WeMos D1 mini)
- RS485 converter (can be found on sites like AliExpress, search for `SCM TTL to RS485 Adapter 485 to UART Serial Port 3.3V 5V Level Converter Module`). For example the *XY-017* board is suitable
- Computer with Arduino IDE installed to flash the firmware

## Flashing firmware
- To flash this firmware, you will need to install the Arduino IDE and configure it for the board you are using (NodeMCU / Wemos)
- You will also need the following libraries
- To flash this firmware, you will need to install the Arduino IDE and configure it for the board you are using (NodeMCU / WeMos)
- You will also need the following libraries, placed into the `libraries` folder belonging to Arduino on your system:
- ['Time' library](https://github.com/PaulStoffregen/Time)
- [NTPClient](https://github.com/arduino-libraries/NTPClient)
- [PubSubClient](https://github.com/knolleary/pubsubclient)
Place these into the `libraries` folder belonging to Arduino on your system.
- Clone/download this repository
- Rename the `Settings.example.h` to `Settings.h` and configure it to match your preferred settings
- Compile and upload the firmware to your ESP8266
- Diagnostics information is sent over serial at 115200 baud *(wifi status, MQTT status, inverter connection status)*
- Compile and upload the firmware to your ESP8266 using the Arduino IDE

Diagnostics information is sent over serial at 115200 baud *(wifi status, MQTT status, inverter connection status)*

## Connecting hardware
The RS485 connector on the inverter is located at the bottom of the inverter, visible when you remove the WiFi module. It can also be hidden behind a small metal plate (for inverters without WiFi). It is a 6 pin green screw terminal (female) you can order the male counterpart on eBay/AliExpress/Farnell. Using female DuPont wires that you insert directly into the connector might also work.
The RS485 connector on the inverter is located at the bottom of the inverter, visible when you remove the original GoodWe wifi-module. It could also be hidden behind a small metal plate (for inverters without WiFi).
It is a 6 pin green terminal (male), the female counterpart is probably part number CTB92HE/6 (3.81mm pitch) but this hasn't been confirmed yet. You can order the female counterpart on eBay/AliExpress/Farnell or similar sites. Using female-female jumper wires that you insert directly into the connector and ESP8266 also works.

***Above information applies to the GWxxxxD-NS range of inverters. Other models might use a different method of connecting. Consult your inverter manual.***

The connector inside the inverter looks like this:
The green 6 pin connector inside the inverter looks like this:

+------------+ +--+--+--+--+--+--+
|------------| | | | | | | |
+------------+ +--+--+--+--+--+--+
USB 1 2 3 4 5 6
+------------+ +---+---+---+---+---+---+
|------------| | . | . | . | . | . | . |
+------------+ +---+---+---+---+---+---+
USB 1 2 3 4 5 6

Connection scheme:
### Connecting to the inverter

Inverter | RS485 converter
--- | ---
pin 1 (485_TX-) | A+
pin 2 (485_TX+) | B-
pin 1 *(485_TX-)* | A+
pin 2 *(485_TX+)* | B-

**Pay attention, RS485 will only work if you disconnect the WiFi module and restart the inverter.
They cannot work simultaneously.**

Connect the RS485 converter to your ESP8266 like this:
### Connecting RS485 converter to ESP8266

RS485 converter | ESP8266
--- | ---
Expand All @@ -52,9 +53,14 @@ RXD | D1
TXD | D2
VCC | 5V / 3V3

*(`D1` (receive) and `D2` (transmit) can be configured to different pins in `Settings.h`)*. It might look weird to connect `RXD` of the module to the receive pin of the ESP8266, but this is how the RS485 converter is labeled.
*(`D1` (receive) and `D2` (transmit) can be configured to different pins in `Settings.h`)*. It might look weird to connect `RXD` of the module to the receive pin of the ESP8266, but this is how the XY-017 RS485 converter is labeled.

## MQTT
### Powering ESP8266 from the GoodWe inverter
Instead of supplying power to the ESP8266 with a separate USB power adapter, it is also possible to 'steal' power from the GoodWe inverter. This can be done by tapping in to the white cable with 5 pin connector (JST-XH) that is normally connected to the original GoodWe wifi-module. **Do not use this method if you want to use MQTT!** For MQTT to show the correct values, the counters are reset to zero at midnight, which obviously won't work if the ESP8266 doesn't have power (inverter turns off when the sun is down). If you only use PVOutput you can use this method.

Use this method at your own risk, and measure/check first before attempting this method! See [here](https://github.com/jantenhove/GoodWeLogger/issues/25) for more information. Confirmed to be working with at least GW3000-NS.

## Retrieving information via MQTT
Subscribe to the `goodwe/` topic in your MQTT client. Information will be posted there and will look like this:
```
goodwe/93600DVA295R148/vpv1 242.6
Expand All @@ -78,19 +84,19 @@ ipv1 | Current of first string of solarpanels | A
ipv2 | Current of second string of solarpanels | A
vac1 | Voltage mains side inverter | V
iac1 | Current mains side inverter | A
fac1 | Frequency (Hz) mains side inverter | Hz
fac1 | Frequency mains side inverter | Hz
pac | Current power production in Watt | W
temp | Internal temperature of inverter | °C
eday | Energy produced today | kWh
workmode | Undocumented parameter. Default=1 | binary
online | Inverter status (1=on, 0=off) | binary

## PVoutput
When you have your PVoutput *API key* and *System ID* configured correctly in `Settings.h`, production data from the inverter will be uploaded to PVoutput every 5 minutes *(interval is configurable in `Settings.h`, but don't go lower than the minimal interval of every 5 minutes as specified by PVoutput)*.
When multiple inverters are connected, by daisy-chaining the RS485 cable, only the production data of the first inverter will be uploaded.
## PVOutput
When you have your PVOutput *API key* and *System ID* configured correctly in `Settings.h`, production data from the inverter will be uploaded to PVOutput every 5 minutes *(interval is configurable in `Settings.h`, but don't go lower than the minimal interval of every 5 minutes as specified by PVOutput)*.
When multiple inverters are connected, by daisy-chaining the RS485 cable, be aware that only the production data of the first inverter will be uploaded!

For the PVoutput upload function to work, it is important that the ESP8266 has access to the internet.
Apart from connections being made to PVoutput, you will also see that the ESP8266 talks with pool.ntp.org on a regular interval. This is done to retrieve the current time, which is needed to post data to PVoutput.
For the PVOutput upload function to work, it is important that the ESP8266 has access to the internet.
Apart from connections being made to PVOutput, you will also see that the ESP8266 talks with `pool.ntp.org` every hour. This is done to retrieve the current time, which is needed to post data to PVOutput.

If you plan to use only MQTT, internet access for the ESP8266 is not needed.

Expand Down

0 comments on commit 51aad21

Please sign in to comment.