Skip to content

Commit

Permalink
add blog entry
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieucarbou committed Jul 1, 2024
1 parent bf5b831 commit 0de2105
Show file tree
Hide file tree
Showing 5 changed files with 362 additions and 134 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ description: Blog

# Blog

- [2024-06-01 - Shelly Solar Diverter](/blog/2024-07-01_shelly_solar_diverter)
- [2024-06-26 - Everything on le JSY](/blog/2024-06-26_everything_on_the_jsy)
- [2024-06-25 - Remote JSY through UDP](/blog/2024-06-25_remote_jsy)
- [2024-06-23 - Development is still in progress](/blog/2024-06-23_development_is_still_in_progress)
157 changes: 142 additions & 15 deletions docs/blog/draft.md → docs/blog/2024-07-01_shely_solar_diverter.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@ _Date: TBD_

# Shelly Solar Diverter

- [What is a Solar Router / Diverter ?](#what-is-a-solar-router--diverter-)
- [Shelly Solar Router](#shelly-solar-router)
- [Download](#download)
- [Hardware](#hardware)
- [Wiring](#wiring)
- [Shelly Add-On + DS18B20](#shelly-add-on--ds18b20)
- [Electric Circuit](#electric-circuit)
- [RC Snubber](#rc-snubber)
- [Add a second dimmer](#add-a-second-dimmer)
- [Setup](#setup)
- [Shelly Dimmer Setup](#shelly-dimmer-setup)
- [Shelly Pro EM 50 Setup](#shelly-pro-em-50-setup)
- [How to use](#how-to-use)
- [Configuration](#configuration)
- [Start / Stop Automatic Divert](#start--stop-automatic-divert)
- [Solar Diverter Status](#solar-diverter-status)

## What is a Solar Router / Diverter ?

A _Solar Router_ allows to redirect the solar production excess to some appliances instead of returning it to the grid.
Expand All @@ -21,24 +38,24 @@ A router can also schedule some forced heating of the water tank to ensure the w

## Shelly Solar Router

This solar diverter based on Shelly can control remotely dimmers and could even be enhanced with relays.
This solar diverter based on Shelly and a Shelly script can control remotely dimmers and could even be enhanced with relays.
Shelly's being remotely controllable, such system offers a very good integration with Shelly App and Home Automation Systems like Home Assistant.

It is possible to put some rules based on temperature, time, days, etc and control everything.
It is possible to put some rules based on temperature, time, days, etc and control everything from the Shelly App or Home Assistant.

A shelly script will be setup to activate an automatic mode where the Shelly's will automatically adjust themselves according to the grid import or export (solar production excess)
The Shelly script, is activated, automatically adjusts the dimmers to the grid import or export (solar production excess).

## Download

- **[Shelly Solar Diverter Script](/blog/downloads/solar_diverter.js)**
- **[Shelly Solar Diverter Script](/downloads/solar_diverter.js)**

## Hardware

All the components can be bought at [https://www.shelly.com/](https://www.shelly.com/), except the voltage regulator, where you can find some links [on this website](https://yasolr.carbou.me/build#compatible-hardware)

| [Shelly Pro EM - 50](https://www.shelly.com/fr/products/shop/proem-1x50a) | [Shelly Dimmer 0/1-10V PM Gen3](https://www.shelly.com/fr/products/shop/1xsd10pmgen3) | [Shelly Plus Add-On](https://www.shelly.com/fr/products/shop/shelly-plus-add-on) | [Temperature Sensor DS18B20](https://www.shelly.com/fr/products/shop/temperature-sensor-ds18B20) | [Loncont LSA-H3P50YB](https://fr.aliexpress.com/item/32606780994.html) |
| :-----------------------------------------------------------------------: | :-----------------------------------------------------------------------------------: | :------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------: |
| ![](../assets/img/hardware/Shelly_Pro_EM_50.jpeg) | ![](../assets/img/hardware/Shelly_Dimmer-10V.jpeg) | ![](../assets/img/hardware/Shelly_Addon.jpeg) | ![](../assets/img/hardware/Shelly_DS18.jpeg) | ![](../assets/img/hardware/LSA-H3P50YB.jpeg) |
| ![](/assets/img/hardware/Shelly_Pro_EM_50.jpeg) | ![](/assets/img/hardware/Shelly_Dimmer-10V.jpeg) | ![](/assets/img/hardware/Shelly_Addon.jpeg) | ![](/assets/img/hardware/Shelly_DS18.jpeg) | ![](/assets/img/hardware/LSA-H3P50YB.jpeg) |

Some additional hardware are required depending on the installation.
Please select the amperage according to your needs.
Expand All @@ -54,7 +71,7 @@ Please select the amperage according to your needs.

First the easy part: the temperature sensor and the Shelly Add-On, which has to be put behind the Shelly Dimmer.

![](../assets/img/hardware/Shelly_Addon_DS18.jpeg)
![](/assets/img/hardware/Shelly_Addon_DS18.jpeg)

### Electric Circuit

Expand All @@ -70,7 +87,7 @@ First the easy part: the temperature sensor and the Shelly Add-On, which has to
- The relay / contactor is optional and is used to schedule some forced heating of the water tank to ensure the water reaches a safe temperature, and consequently bypass the dimmed voltage.
- The neutral wire going to the voltage regulator can be a small one; it is only used for the voltage and Zero-Crossing detection.

[![](../assets/img/schemas/Solar_Router_Diverter.jpg)](../assets/img/schemas/Solar_Router_Diverter.jpg)
[![](/assets/img/schemas/Solar_Router_Diverter.jpg)](/assets/img/schemas/Solar_Router_Diverter.jpg)

### RC Snubber

Expand All @@ -80,19 +97,129 @@ If switching the contactor / relay causes the Shelly device to reboot, place a [

If you want to control a second resistive load, it is possible to duplicate the circuit to add another dimmer and voltage regulator.

## Shelly Setup
Modify the config accordingly to support many dimmers and they will be turned on/off sequentially to match the excess production.

## Setup

First make sure that your Shelly's are setup properly.

The program has to be installed inside the Shelly Pro EM 50, because this is where the measurements of the imported and exported grid power is done.
The script has to be installed inside the Shelly Pro EM 50, because this is where the measurements of the imported and exported grid power is done.
Also, this central place allows to control the 1, 2 or more dimmers remotely.

### Shelly Pro EM 50 Setup
### Shelly Dimmer Setup

- Make sure to place the A clamp around the main phase entering the house
- Upload the `Shelly Solar Diverter` script (at the end of this page)
- Make sure the switch (input) are enabled and inverted. S1 should replicate the inverse state of the relay / contactor, so that when you activate the contactor through the Dimmer output remotely, the dimmer will deactivate itself.
- Set static IP addresses

### Shelly Dimmer Setup
### Shelly Pro EM 50 Setup

- Make sure the switch (input) are enabled and inverted. S1 should replicate the inverse state of the relay / contactor.
- Setup the switch to automatically stop the dimmer when turned off
- Set static IP address
- Make sure to place the A clamp around the main phase entering the house in the right direction
- Add the `Shelly Solar Diverter` to the Shelly Pro EM
- Configure the settings in the `CONFIG` object
- Start teh script

## How to use

### Configuration

Edit the `CONFIG` object and pay attention to the values, especially the resistance value which should be accurate, otherwise the routing precision will be bad.

```javascript
const CONFIG = {
// Debug mode
DEBUG: 1,
// Grid Power Read Interval (s)
READ_INTERVAL_S: 1,
PID: {
// Target Grid Power (W)
SET_POINT: 0,
// PID Proportional Gain
KP: 0.8,
// PID Integral Gain
KI: 0,
// PID Derivative Gain
KD: 0.8,
// PID Output Minimum Clamp (W)
OUTPUT_MIN: 0,
},
DIMMERS: {
"192.168.125.93": {
// Resistance (in Ohm) of the load connecter to the dimmer + voltage regulator
// 0 will disable the dimmer
RESISTANCE: 24,
},
"192.168.125.97": {
RESISTANCE: 0,
},
},
};
```

### Start / Stop Automatic Divert

You can start / stop the script manually from the interface or remotely by calling:

```
http://192.168.125.92/rpc/Script.Start?id=1
http://192.168.125.92/rpc/Script.Stop?id=1
```

- `192.168.125.92` begin the Shelly EM 50 static IP address.
- `1` being the script ID as seen in the Shelly interface

![](/assets/img/screenshots/shelly_script_id.jpeg)

Once the script is uploaded and started, it will automatically manage the power sent to the resistive load according to the rules above.

### Solar Diverter Status

You can view the status of the script by going to the script `status` endpoint, which is only available when the script is running.

```
http://192.168.125.92/script/1/status
```

```json
{
"pid": {
"input": 0,
"output": 0,
"error": 0,
"dError": 0,
"errorSum": 0,
"pTerm": 0,
"iTerm": 0,
"dTerm": 0
},
"divert": {
"voltage": 237.9,
"gridPower": 0,
"divertPower": 173.76,
"dimmers": {
"192.168.125.93": {
"divertPower": 86.88,
"nominalPower": 2358.18375,
"dutyCycle": 0.03684191276,
"powerFactor": 0.19194247253,
"dimmedVoltage": 45.66311421705,
"current": 1.90262975904,
"apparentPower": 452.63561967657,
"thdi": 5.11302248812,
"rpc": "pending"
},
"192.168.125.97": {
"divertPower": 86.88,
"nominalPower": 2358.18375,
"dutyCycle": 0.03684191276,
"powerFactor": 0.19194247253,
"dimmedVoltage": 45.66311421705,
"current": 1.90262975904,
"apparentPower": 452.63561967657,
"thdi": 5.11302248812,
"rpc": "pending"
}
}
}
}
```
119 changes: 0 additions & 119 deletions docs/blog/downloads/solar_diverter.js

This file was deleted.

Loading

0 comments on commit 0de2105

Please sign in to comment.