Files
OpenDTU/README.md

189 lines
10 KiB
Markdown
Raw Normal View History

2022-06-16 10:40:26 +02:00
# OpenDTU
2022-09-15 19:07:27 +02:00
[![OpenDTU Build](https://github.com/tbnobody/OpenDTU/actions/workflows/build.yml/badge.svg)](https://github.com/tbnobody/OpenDTU/actions/workflows/build.yml)
[![cpplint](https://github.com/tbnobody/OpenDTU/actions/workflows/cpplint.yml/badge.svg)](https://github.com/tbnobody/OpenDTU/actions/workflows/cpplint.yml)
2022-06-16 10:40:26 +02:00
## Background
This project was started from [this](https://www.mikrocontroller.net/topic/525778) discussion (Mikrocontroller.net).
It was the goal to replace the original Hoymiles DTU (Telemetry Gateway) with their cloud access. With a lot of reverse engineering the Hoymiles protocol was decrypted and analyzed.
## Currently supported Inverters
* Hoymiles HM-300
* Hoymiles HM-350
* Hoymiles HM-400
* Hoymiles HM-600
* Hoymiles HM-700
* Hoymiles HM-800
* Hoymiles HM-1000
* Hoymiles HM-1200
* Hoymiles HM-1500
* TSUN TSOL-M350 (Maybe depending on firmware on the inverter)
* TSUN TSOL-M800 (Maybe depending on firmware on the inverter)
* TSUN TSOL-M1600 (Maybe depending on firmware on the inverter)
2022-06-16 10:40:26 +02:00
## Features for end users
2022-07-09 12:57:55 +02:00
* Read live data from inverter
* Show inverters internal event log
2022-08-14 13:57:18 +02:00
* Show inverter information like firmware version, firmware build date, hardware revision and hardware version
* Show current inverter limit (setting the limit is not yet implemented)
* Uses ESP32 microcontroller and NRF24L01+
2022-06-16 10:40:26 +02:00
* Multi-Inverter support
* MQTT support (with TLS)
2022-07-18 22:38:40 +02:00
* Home Assistant MQTT Auto Discovery support
* Nice and fancy WebApp with visualization of current data
2022-06-16 14:32:07 +02:00
* Firmware upgrade using the web UI
* Default source supports up to 10 inverters
* Time zone support
2022-09-19 23:05:44 +02:00
* Ethernet support
2022-06-16 10:40:26 +02:00
## Features for developers
* The microcontroller part
2022-06-16 10:40:26 +02:00
* Build with Arduino PlatformIO Framework for the ESP32
2022-09-19 20:51:51 +02:00
* Uses a fork of [ESPAsyncWebserver](https://github.com/yubox-node-org/ESPAsyncWebServer) and [espMqttClient](https://github.com/bertmelis/espMqttClient)
2022-06-16 10:40:26 +02:00
* The WebApp part
* Build with [Vue.js](https://vuejs.org)
2022-06-22 23:10:17 +02:00
* Source is written in TypeScript
## Hardware you need
### ESP32 board
For ease of use, buy a "ESP32 DEVKIT DOIT" or "ESP32 NodeMCU Development Board" with an ESP32-S3 or ESP-WROOM-32 chipset on it.
Sample Picture:
![NodeMCU-ESP32](docs/nodemcu-esp32.png)
Also supported: Board with Ethernet-Connector and Power-over-Ethernet [Olimex ESP32-POE](https://www.olimex.com/Products/IoT/ESP32/ESP32-POE/open-source-hardware)
#### NRF24L01+ radio board
The PLUS sign is IMPORTANT! There are different variants available, with antenna on the printed circuit board or external antenna.
Sample picture:
![nrf24l01plus](docs/nrf24l01plus.png)
Buy your hardware from a trusted source, at best from a dealer/online shop in your country where you have support and the right to return non-functional hardware.
When you want to buy from Amazon, AliExpress, eBay etc., take note that there is a lot of low-quality or fake hardware offered. Read customer comments and ratings carefully!
A heavily incomplete list of trusted hardware shops in germany is:
* [AZ-Delivery](https://www.az-delivery.de/)
* [Makershop](https://www.makershop.de/)
* [Berrybase](https://www.berrybase.de/)
This list is for your convenience only, the project is not related to any of these shops.
#### Power supply
Use a power suppy with 5V and 1A. The USB cable connected to your PC/Notebook may be powerful enough or may be not.
2022-06-22 23:10:17 +02:00
## Wiring up
### Schematic
![Schematic](docs/Wiring_ESP32_Schematic.png)
### Symbolic view
![Symbolic](docs/Wiring_ESP32_Symbol.png)
2022-06-16 10:40:26 +02:00
### Change pin assignment
2022-07-18 22:38:40 +02:00
Its possible to change all the pins of the NRF24L01+ module.
This can be achieved by editing the 'platformio.ini' file and add/change one or more of the following lines to the 'build_flags' parameter:
```
-DHOYMILES_PIN_MISO=19
-DHOYMILES_PIN_MOSI=23
-DHOYMILES_PIN_SCLK=18
-DHOYMILES_PIN_IRQ=16
-DHOYMILES_PIN_CE=4
-DHOYMILES_PIN_CS=5
```
2022-06-16 14:32:07 +02:00
## Flashing and starting up
### with Visual Studio Code
* Install [Visual Studio Code](https://code.visualstudio.com/download) (from now named "vscode")
2022-06-22 23:10:17 +02:00
* In Visual Studio Code, install the [PlatformIO Extension](https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide)
* Install git and enable git in vscode - [git download](https://git-scm.com/downloads/) - [Instructions](https://www.jcchouinard.com/install-git-in-vscode/)
* Clone this repository (you really have to clone it, don't just download the ZIP file. During the build process the git hash gets embedded into the firmware. If you download the ZIP file a build error will occur): Inside vscode open the command palette by pressing `CTRL` + `SHIFT` + `P`. Enter `git clone`, add the repository-URL `https://github.com/tbnobody/OpenDTU`. Next you have to choose (or create) a target directory.
* In vscode, choose File --> Open Folder and select the previously downloaded source code. (You have to select the folder which contains the "platformio.ini" file)
* There is a short [Video](https://youtu.be/9cA_esv3zeA) showing these steps.
* Adjust the COM port in the file "platformio.ini" for your USB-serial-converter. It occurs twice:
2022-06-22 23:10:17 +02:00
* upload_port
* monitor_port
* Select the arrow button in the status bar (PlatformIO: Upload) to compile and upload the firmware. During the compilation, all required libraries are downloaded automatically.
### on the commandline with PlatformIO Core
* Install [PlatformIO Core](https://platformio.org/install/cli)
* Clone this repository (you really have to clone it, don't just download the ZIP file. During the build process the git hash gets embedded into the firmware. If you download the ZIP file a build error will occur)
* Adjust the COM port in the file "platformio.ini". It occurs twice:
* upload_port
* monitor_port
* build: `platformio run -e generic`
* upload to esp module: `platformio run -e generic -t upload`
* other options:
* clean the sources: `platformio run -e generic -t clean`
* erase flash: `platformio run -e generic -t erase`
### using the pre-compiled .bin files
2022-09-19 22:30:02 +02:00
Use a ESP32 flash tool of your choice and flash the .bin files to the right addresses:
| Address | File |
| ---------| ---------------------- |
| 0x1000 | bootloader_dio_40m.bin |
2022-09-19 22:30:02 +02:00
| 0x8000 | partitions.bin |
| 0xe000 | boot_app0.bin |
2022-09-19 23:05:44 +02:00
| 0x10000 | opendtu-*.bin |
2022-09-19 22:44:08 +02:00
Make sure too uncheck the DoNotChgBin option. Otherwise you will maybe get errors like "invalid header"
2022-06-16 14:32:07 +02:00
## First configuration
2022-07-27 13:19:37 +02:00
* After the initial flashing of the microcontroller, an Access Point called "OpenDTU-*" is opened. The default password is "openDTU42".
* Use a web browser to open the address [http://192.168.4.1](http://192.168.4.1)
2022-06-16 14:32:07 +02:00
* Navigate to Settings --> Network Settings and enter your WiFi credentials
* OpenDTU then simultaneously connects to your WiFi AP with this credentials. Navigate to Info --> Network and look into section "Network Interface (Station)" for the IP address received via DHCP.
* When OpenDTU is connected to a configured WiFI AP, the "OpenDTU-*" Access Point is closed after 3 minutes.
2022-09-05 19:49:52 +02:00
* OpenDTU needs access to a working NTP server to get the current date & time. Both are sent to the inverter with each request. Default NTP server is pool.ntp.org. If your network has different requirements please change accordingly (Settings --> NTP Settings).
* Add your inverter in the inverter settings (Settings --> Inverter Settings)
2022-06-16 14:32:07 +02:00
## Flashing an Update using "Over The Air" OTA Update
Once you have your OpenDTU running and connected to WLAN, you can do further updates through the web interface.
Navigate to Settings --> Firmware upgrade and press the browse button. Select the firmware file from your local computer.
You'll find the firmware file (after a successfull build process) under `.pio/build/generic/firmware.bin`.
After the successful upload, the OpenDTU immediately restarts into the new firmware.
2022-09-30 18:46:22 +02:00
## MQTT Topic Documentation
A documentation of all available MQTT Topics can be found here: [MQTT Documentation](docs/MQTT_Topics.md)
## Available cases
* [https://www.thingiverse.com/thing:5435911](https://www.thingiverse.com/thing:5435911)
2022-06-16 10:40:26 +02:00
## Building
* Building the WebApp
* The WebApp can be build using yarn
```
$ cd webapp
2022-06-16 10:40:26 +02:00
$ yarn install
$ yarn build
```
* The updated output is placed in the 'webapp_dist' directory
* It is only necessary to build the webapp when you made changes to it
2022-06-16 10:40:26 +02:00
* Building the microcontroller firmware
2022-06-16 10:40:26 +02:00
* Visual Studio Code with the PlatformIO Extension is required for building
2022-09-08 19:31:47 +02:00
## Troubleshooting
* First: When there is no light on the solar panels, the inverter completely turns off and does not answer to OpenDTU! So if you assembled your OpenDTU in the evening, wait until tomorrow.
* When there is no data received from the inverter(s) - try to reduce the distance between the openDTU and the inverter (e.g. move it to the window towards the roof)
* Under Settings -> DTU Settings you can increase the transmit power "PA level". Default is "minimum".
* The NRF24L01+ needs relatively much current. With bad power supply (and especially bad cables!) a 10uF capacitor soldered directly to the NRF24L01+ board connector brings more stability (pin 1+2 are the power supply). Note the polarity of the capacitor....
* You can try to use an USB power supply with 1A or more instead of connecting the ESP32 to the computer.
* Try a different USB cable. Once again, a stable power source is important. Some USB cables are made of much plastic and very little copper inside.
* Double-Check that you have a radio module NRF24L01+ with a plus sign at the end. NRF24L01 module without the plus are not compatible with this project.
* There is no possibility of auto-discovering the inverters. Double-Check you have entered the serial numbers of the inverters correctly.
* OpenDTU needs access to a working NTP server to get the current date & time.
* If your problem persists, check the [Issues on Github](https://github.com/tbnobody/OpenDTU/issues). Please inspect not only the open issues, also the closed issues contain useful information.
* Another source of information are the [Discussions](https://github.com/tbnobody/OpenDTU/discussions/)
2022-09-08 19:31:47 +02:00
## Related Projects
- [Ahoy](https://github.com/grindylow/ahoy)
- [DTU Simulator](https://github.com/Ziyatoe/DTUsimMI1x00-Hoymiles)
- [OpenDTU extended to talk to Victrons MPPT battery chargers (Ve.Direct)](https://github.com/helgeerbe/OpenDTU_VeDirect)