The Online Documentation is HERE
To transfer the code to the microcontroller (ESP32 or TTGO) it is necessary to install Visual Studio Code.
Once installed, you must install the PlatformIO package which will be used later for all your projects and not only for the Dimmer or the Pv router.
The sources are available on the Github (a code repository web server)
once your Visual Studio is launched, go to your Terminal and type
git clone https://github.com/xlyric/pv-router-esp32.git
it will then clone the repository on your machine and you can adapt the code to your needs and upload it.
you can then go to the directory created during the command
In the case of an update, you can update your code again with the following command
git pull
If you want to keep the router in access point mode, you don't have to do anything, just upload the code.
If you want to use it on your wifi network, you have to configure 1 file to operate the Router
In the Data directory which contains the HTML pages, you must rename the file wifi.json.ori
in wifi.json and enter the connection parameters of your internet box
Uploading is done with Visual Studio Code (VS) using the PlatformIO tab
During your 1st Upload, you must connect your TTGO or ESP32 to your PC with a USB cable
Thanks to VS you will load in the microcontroller the firmware and the HTML pages of the router
There are 2 uploads to do:
- one for the firmware (the system code)
- one for the filesystem (configuration files and website)
Then you can directly upload the code remotely with the /update page of the router
Uploading is done with Visual Studio Code (VS) using the PlatformIO tab
your code being already present on the router, you can now directly generate the binary files to be sent.
In general, only the General Build is to be done.
The Build Filesystem Image is only there to update the HTML pages when functionalities evolve.
once the build is done:
it shows where the firmware is.
all you have to do is connect with the internet browser on your pv router and go to the /update page
and upload the firmware
In the case of updating the Filesystem ( HTML file ), it's the same procedure, you just have to take the Filesystem binary and select Filesystem.
Warning: before uploading it is important to check that the data/wifi.json file is present on your repository and contains the connection information to your internet box.
it is also preferable before the update to save its configuration by going to the /config.json web page and copy/paste the information into the config.json of your repository (or save it in a third-party file)
The creation of the Pv router with the card adapted for the TTGO Tdisplay is currently the fastest
this card can be ordered from the APPER association, and its purchase is considered a donation and therefore partially tax deductible.
The rest of the components can be ordered from various component suppliers. (Aliexpress, Amazon...)
The display: TTGO Tdisplay
Amazon...
the probe SCT013-30A
A 12V recovery power supply
- You have to find an old 9-12V coil power supply in a drawer to convert it to AC power
(or buy a power supply from openenergymonitor.com)
12V AC power supplies as standard are very rare.
A classic USB power supply (1A max)
The card once mounted with the TTGO can be integrated into the box sold by the TTGO
to then be integrated into a table or other after uploading
Preparing the 12V-AC power supply
You have to open the power supply and remove the diode bridge present inside.
then resolder the coil outputs to the 12V power cable
Your 9-12V power supply is now ready.
It is advisable to check before the AC voltage delivered by the power supply.
Once the assembly is mounted, you can upload the firmware as indicated in this post
you will in principle have a functional Pv router
The Photovoltaic Router is in charge of analyzing the direction of the current at the level of the electric meter thanks to the probe placed on the Phase wire.
If the current is positive, the house consumes current from the electrical network.
If the current is negative, the solar panels present provide more energy than what the house currently consumes.
The purpose of the Pv router is therefore to increase the power of a remote load to compensate for this overproduction.
In general, this load is an energy or heat storage area that will be needed at a later time (Hot water, mass heating, battery, EV, etc.)
The self-consumption of your photovoltaic installation is therefore maximized, and its impact on the electrical network is reduced. (and associated costs)
Once the code has been uploaded (firmware and filesystem) and the entire router has been installed, it is possible to connect with your Web browser to the IP that is displayed on your PV router display.
You can therefore consult the information sent by the PV router.
On this interface you will find a gauge with the power requested from the network and the power requested from the dimmers (in %)
For the power requested from the network, there are 3 states that can be configured:
- Stable: the PV router has stabilized consumption.
- Injection: The Pv router will gradually increase the load to stabilize consumption
- Grid: The Pv router will reduce the load to limit the needs of the house.
On this interface, there is also an ON/OFF Oled button which is in charge of turning the Oled screen on or off.
it can just be a delay on or off until the next button press.
(ON/OFF or timer)
This button is also remote on the PV router, it is the right button of the TTGO
on the base page, there is a "configuration" link that points to the /setup.html page
this page allows you to configure all the functions of the router.
MQTT Server: IP of the MQTT server which collects information from the router (mainly for logs)
MQTT Publish: Indicates the location of the publication (Jeedom and Domoticz compatible data)
IDX POWER and IDX DIMMER: are the IDs configured on your home automation servers.
Dimmer IP: Is the IP of your 1st Dimmer which will receive the command from the PV router
Consumption Limit (Delta): Is the value of the power from which the PV router will reduce the power of the dimmer
Injection limit (deltaneg): Is the value of the power from which the PV router will increase the load of the dimmer
Connected load/W: Is the estimated power connected to the 1st dimmer, this value in W facilitates regulation.
Limiter in %: Is the 1st security to avoid asking too much power from your dimmers.
the value is defined by the sum of all the dimmers that are associated with your PV router
For example where your 1st router is limited to 80% power and the 2nd is limited to 40%.
the sum of the 2: "120" is therefore entered in the Limiter box.
Functional configuration
If the SCT013 probe is connected upside down and therefore sends a negative value instead of positive, the "polarity" button must be unchecked
The COSPHI represents the offset between the sync carrier and the network, this value is by default at 5
It is not advisable to touch it.
To preserve the life of the display, it can be switched on on demand
By default, if the wifi file is not configured, the router goes into AP mode, it will create its own wifi network.
the Wifi network will be of the PV-ROUTER-XXXX type.
The password will be PV-ROUTER
the IP address of the PV router will be 192.168.4.1
if a dimmer has been configured to connect to this network, the PV router will automatically detect it, and route the photovoltaic surplus to this dimmer.
For reasons of use, it is currently only possible to put 1 single dimmer on the network in AP mode.
Update of 03/09/2022
- Integration of AP mode by défault with personalised SSID
Update of 06/08/2022
- Access point (AP) mode for site without Wifi, automatic configuration when dimmer is connecting
Update of 05/24/2022
- Compatibility with frontius et envoy S et R
Update of 03/24/2022
- Wifi reconnection in case of network loss
Update of 03/03/2022
- Addition of the temperature of the 1st dimmer on the TTGO display
Update of 02/26/2022
- Added screen sleep feature (requires filesystem update)
Update of 01/02/2022
- Fixed sending data to Jeedom via MQTT
Update of 01/17/2022
- Translation into English of display information
Update of 01/10/2022
- removal of the Emonlib library.
Update of 17/12/2021
- Printing of the V2 card for TTGO mounted in SMD and compatible with the TTGO box
Update of 15/11/2021
- Printing of the V1 board for TTGO mounted in SMD
Update of 10/10/2021
- TTGO-Tdisplay support
Update of 07/10/2021
- Passage of the filesystem in LittleFS
Update of 05/15/2021
- Fixed IDX and display bug
Update of 04/28/2021
- Correction of the library provided by Robotdyn
Update of 04/16/2021
- Init Commit for ESP32
Update of 05/18/2019
- Fixed IDX and display bug
Update of 31/12/2019
- Implementation of the configuration page
Update of 26/12/2019
- OLED display fix
Update of 07/09/2019
- Documents
Update of 07/18/2019
- V3 map printing for lolin or Wemos
Update of 07/07/2019
- Support for Domoticz
Update of 20/06/2019
- Init Commit for ESP8266
Update of 05/28/2019
- Printing of the V2 map
Update of 12/05/2019
- V1 card printing
OLD Documentation :
I created this pv router to separate the power part of the analysis part.After 2 years of working with an ESP8266, I made evolutions to upgrade to an ESP32. ( and visual Studio Code )
first time I use Oled display and I migrate to a TTGO tdisplay, for an easyer intregration.
this router use a very simple tech by using phase differences.
The project can reproduce easily for the electronic board.
however I made an industrial version of it to make things easier.
The board was sold by a French Association ( APPER )
You only need to by separatly :
. A TTGO-Tdisplay
. A SCT-013-30
. And an 12V - AC power supply ( Sinus ) you can made it with a modified old 12DC coil transformer. ( see below )
For packaging, I use the box that comes with the TTGO.
Rename the file wifi.json.ori to wifi.json and change SID
Rename the file config.json.ori to config.json
If you know your configuration you can change it on config.json
Upload the firmware and filesystem. the system will start and working
A complete documentation (in French ) is here
You can use OTA upload by the web page /update
Build firmware of filesystem with VS and upload the .bin
Under the /setup.html page you can configure information for connecting to the MQTT server ( support domoticz or Jeedom ).
Enter the information of the dimmer, the max limit percent power you want to send, the slot between the dimmer work ( low and high )
If you want to swith off oled after a limited time ( button right for swith / or website )
...
In case you use multi dimmers, you need to calculate the max % needed for all dimmers,
For example if 1st dimmer is 80% max and 2nd dimmer is 40% max, you need to configure the power limit to 120
( and configure all dimmers directly with the limit )
connections :
OLED :
3.3V
GND
21 SCL
22 SDA
SCT013 wbr
div bridge R/R between 3.3V and GND
SCT013 connected at the middle of div bridge and pin 34 ( --> Linky )
Condensator 470uf between GND and the middle of div bridge. ( filter )
pin 32 GRID
pin 33 SCT013
The carrier is made with a 12v transformer power supply.
The bridge rectifier is removed and the wavy part is kept
There is a divider bridge not to exceed 3.3V and a diode for half alternation.
The assembly as a whole will raise the power and the direction of the current.
Like the ESP8266 version, it can connect directly to the Wifi dimmer to control the power.
github Project
Open the transformer and remove the diode bridge
Close the transformer and verify the voltage. ~12V AC ( 9-16v ) and adjust the divider bridge if needed ( output 3.3V max )
if you compile directly or not configure the wifi, the pv router switch on AP mode ( access point ), It will detect and configure automaticaly if a dimmer is present on the network. in this mode, the web service can't download some google services ( graphics )
the wifi mode work only if you rename the file wifi.json.ori
compiled bin ( firmware and filesystem (spiffs ) is present in the folder "compiled_bin". it will launch the pv router in AP mode.
you can show the signal with the oscillo on the main page
###BUG DALLAS Onboard Dallas not working on GPIO 37 on TTGO --> connect Dallas Data on GPIO 25