Skip to content

How to Build Your Router

Here is below some build examples to give you an idea of the different options and components you can use to build your router. Depending on the components you choose, you will be able to use different routing algorithms (phase control, cycle stealing) and have different precision and performance.

All these builds can be upgraded further with more components.

If you are using the APPER board, you can migrate from APPER to YaSolR quite easily.

You can also set up a Remote JSY with Mycila JSY App to send the grid data remotely to one or several YaSolR routers.

And if you do not like YaSolR, here are some other solar router alternatives I made:

Build Examples

  • The Recycler: reuse your existing Shelly EM or Shelly 3EM to build a router
  • The Minimalist: the cheapest and easiest to build
  • The Elegant: an improved version of the Minimalist using a random SSR and the new JSY-MK-194G with an integrated ZCD
  • The Elite: for people who want the flexibility to use phase control and cycle stealing, with high precision using a dedicated hardware ZCD and a random SSR
  • The Professional: probably the best and safest solution out there with minimal moving pieces

The Recycler

Reuse your existing Shelly EM or Shelly 3EM to build a router with:

  • Standard Synchronous SSR: used for dimming (cycle stealing only)
  • Shelly EM or MQTT is used to measure the grid power and voltage
ESP32 Standard Synchronous SSR Shelly EM or 3EM

Warning

  • Supports Cycle Stealing only (not Phase Control)
  • Not as precise as a JSY (MQTT delays)
  • Not as precise as using Phase Control

The Minimalist

The Minimalist build uses inexpensive and easy to use components to start a router.

  • Standard Synchronous SSR: used for dimming (cycle stealing only)
  • Grid (and output ?) measurement done with a JSY (local or remote)
ESP32 Standard Synchronous SSR JSY

Warning

  • Supports Cycle Stealing only (not Phase Control)
  • Not as precise as using Phase Control

The Elegant

This is an improved version of the Minimalist build using the new JSY-MK-194G which has an integrated ZCD and a random SSR.

  • A Random SSR is used for the dimming (using phase control or cycle stealing)
  • JSY-MK-194G is used both for the Zero-Cross Detection, and to measure the grid power and voltage and the router output
ESP32 Random SSR JSY-MK-194G

Tip

  • The JSY-MK-194G has an integrated ZCD and can be used with a Random SSR directly without the need of an external ZCD module.
  • Supports Phase Control and Cycle Stealing

Warning

The JSY-MK-194G Zero-Cross Detection circuit is software-based and not as good as a dedicated hardware ZCD, so it can be less precise and will produce more power flickering (like RobotDyn dimmers).

The Elite

The Elite build is for people who want the flexibility to use phase control and cycle stealing, with high precision using a dedicated hardware ZCD and a random SSR.

  • A Random SSR is used for the dimming (using phase control or cycle stealing)
  • A dedicated hardware ZCD circuit is used for the Zero-Cross Detection
  • JSY-MK-194G is used both for the Zero-Cross Detection, and to measure the grid power and voltage and the router output
ESP32 Random SSR ZCD Module JSY

Tip

  • Supports Phase Control and Cycle Stealing
  • The dedicated hardware ZCD will be more precise and produce less power flickering than the software-based ZCD of the JSY-MK-194G or RobotDyn dimmers.

The Professional

The Professional build uses a Voltage Regulator to control the power routing. This is probably the most reliable and efficient solution, but it is more complex to set up and wire. Voltage regulators like the LSA or LCTC have an integrated hardware based ZCD circuit to trigger at the right time based on the input voltage control.

The big advantage of a DFRobot DAC module is that it allows to control a LSA directly through the ESP32 and without the need of a ZCD module.

  • A voltage regulator (LSA or LCTC) is used for the dimming (phase control only)
  • A DFRobot DAC is used to control the voltage regulator: DFR0971 (GP8403), DFR1073 (GP8413), DFR1071 (GP8211S)
  • Grid (and output ?) measurement done with a JSY (local or remote)
ESP32 Voltage Regulator DFRobot DAC JSY

Tip

  • No ZCD circuit required
  • Precise phase control dimming

Warning

  • More complex to setup
  • A remapping / calibration might be required to find the right values to control the voltage regulator with the DFRobot DAC
  • Cannot use cycle stealing algorithm, only phase control

Hardware Selection

Supported ESP32 Boards

Here are the boards for which firmwares can be downloaded. If yours is not listed, just ask: it may be possible to add it.

Board UARTs Ethernet
Denky D4 2
ESP-32S 1
ESP32-DevKitC (recommended - 3 UARTs) 2
ESP32-S3-DevKitC-1 (recommended - 3 UARTs) 2
Olimex ESP32-GATEWAY 2
Olimex ESP32-POE 2
T-ETH-Lite ESP32 S3 (recommended - 3 UARTs) 2
TinyPICO 2
Waveshare ESP32-S3 ETH Board 2
Wemos D1 R32 (wemos_d1_uno32) 2
Wemos D1 Mini 32 (wemos_d1_mini32) 2
WIPI 3 2
WT32-ETH01 1

Remember: UART 0 is often linked to USB port and logging so this is only the number of available UARTS for Serial 1 and Serial 2 that is shown here.

Which Dimmer to Choose

Here are some pros and cons of each phase control system. I do not recommend using RobotDyn dimmers. They are cheap, dangerously wired and not very good for the ZCD and heat dissipation.

RobotDyn (TRIAC):

  • Pros:
    • cheap and easy to wire
    • 40A model comes with a heat sink and fan
    • All in one device: phase control, ZCD, heat sink, fan
  • Cons:
    • limited in load to 1/3 - 1/2 of the announced load
    • 16A / 24A models comes with heat sink which is too small for its supported maximum load
    • no solution ready to attach them on a DIN rail.
    • The heat sink often has to be upgraded, except for the one on the 40A model which is already good for small loads below 2000W.
    • The ZCD circuit is less accurate and pulses can be harder to detect on some boards
    • You need to go over some modifications to (improve wiring / soldering and heat sink)
    • You might need to replace the Triac or move it

Random Solid State Relays:

  • Pros:
    • cheap and easy to wire
    • support higher loads
    • can be attached to a DIN rail with standard SSR clips
    • lot of heat sink models available
  • Cons:
    • limited in load to 1/3 - 1/2 of the announced load
    • require an external ZCD module, heat sink

Synchronous Solid State Relays:

  • Pros:
    • cheap and easy to wire
    • support higher loads
    • can be attached to a DIN rail with standard SSR clips
    • lot of heat sink models available
  • Cons:
    • limited in load to 1/3 - 1/2 of the announced load
    • require heat sink
    • can only be used with the Cycle Stealing modulation algorithm, not with Phase Control

Voltage Regulators:

Voltage regulators include a ZCD module and a phase control system which can be controlled in many ways. These are the best option: they are big and robust. But they require an additional module to control them with an ESP32 (DfRobot DAC). This is also the option used in the Shelly Solar Router.

Heat Sink:

In any case, do not forget to correctly dissipate the heat of your Triac / SSR using an appropriate heat sink. RobotDyn heat sink is not enough and requires some tweaking (like adding a fan or de-soldering the triac and heat sink and placing the triac on a bigger heat sink).

It is best to take a vertical heat sink for heat dissipation. In case of the RobotDyn 40A, you can install it vertically.

Which Relay to Choose

For bypass relays used for outputs

For bypass relays, you can use electromagnetic relays because they will be used less frequently. Also, some electromagnetic relay boards have both a NO and NC output to better isolate the dimming circuit and bypass circuit.

For external Relays

  • If you want to use the relays to automatically switch one of the resistance of the water tank, as described in the recommendations to reduce harmonics and flickering, you must use a SSR because the relay will be switched on and off frequently.
  • If you are not using the automatic relay switching, and you either control them manually or through a Home Automation system, you can use electromagnetic relays, providing the relays won't be switched on and off frequently.
  • Use a Zero-Cross SSR for resistive loads
  • Use a Random SSR for inductive loads (pump, motors)

Also to consider:

  • You should not use electromagnetic relays to switch a load on and off frequently because they have a limited number of cycles before they fail and they can be stuck.
  • Relays have to be controllable through a 3.3V DC signal.
  • It is easier to find SSR supporting high loads that can be controlled by a 3.3V DC signal than electromagnetic relays.
  • Also, SSR with a DIN Rail clip are easy to install.
  • On the other hand, SSR can be more affected by harmonics than electromagnetic relays and they are more expensive.

How to Choose a Solid State Relay

  • Make sure you add a heat sink to the SSR or pick one with a heat sink, especially if you use a Random SSR instead of a RobotDyn
  • Type of control: DA: (DC Control AC)
  • Control voltage: 3.3V should be in the range (example: 3-32V DC)
  • Verify that the output AC voltage is in the range (example: 24-480V AC)
  • Verify the SSR amperage: usually, it should be 2-3 times the nominal current of your resistive load (example: 40A SSR for a 3000W resistance). For induction loads, it should be 4-7 times the nominal current.
  • Zero Cross SSR (which is the default for most SSR): for the bypass relay or external relays with resistive loads, or when using Cycle Stealing modulation routing algorithm
  • Random SSR: if you choose to not use the RobotDyn but a Random SSR for Phase Control, or external relays with inductive loads (pump, motors)

To Upgrade Your Router

Here are below what you can add to upgrade your router:

Hardware Description
A bypass relay to avoid using the dimmer when auto bypass is enabled, and an additional relay to control an external load
A temperature sensor to measure the water tank temperature to automatically stop or start the water heating
A push button to restart the router easily
LEDs to display the system status
A display to show the router information
A PZEM to precisely measure the routed power for each output. Only useful if you have more than one output, or no JSY

Remote JSY with Mycila JSY App

YaSolR supports receiving JSY metrics remotely from Mycila JSY App through UDP.

The communication is so fast that using a remote JSY has no impact on performance and is exactly the same as using a JSY connected to the ESP32. In both cases, the router will be able to react at least 3 times per second.

Refer to Mycila JSY App project to find more information about how to wire your JSY.

Here is below some examples of hardware you can use to setup a Remote JSY with Mycila JSY App:

Mean Well HDR-15-5 5V DC ESP32 JSY

Wiring

Powering

Warning

Make sure to power the components from the ESP32 3.3V and not directly from the 5V supply. This is especially true for the JSY, PZEM, DS18, Display, DAC, ZCD, etc.

Power them through +5V ONLY if your ESP is not able to correctly output 3.3V, or you have some JSY or PZEM read timeout. Some PZEM devices also have to be powered by +5V DC.

If powering by +5V DC, you need to use the same +5V DC that is also used to power the ESP32 (same GND).

In my setup, where I have a lot of components for testing, I have to power these components through +5V DC:

  • DAC
  • ZCD module
  • Relay board

My JSY is powered by the ESP32, and my PZEM (v4) also, but the previous ones (v3) had to be powered by +5V DC.

Default GPIO

The hardware and GPIO pinout are heavily inspired by Routeur solaire PV monophasé Le Profes'Solaire from Anthony.

Most of the features can be enabled or disabled through the app and the GPIO pinout can be changed also through the app in the GPIO page.

Here are below the default GPIO pinout for each board. -1 means not mapped, either because this is not possible (for example some boards to not have enough UART to support at the same time JSY and PZEM), or because the mapping is just not defined by default and you need to go in YaSolR GPIO section to define to the pin you want.

Tested boards:

FEATURE ESP32 NodeMCU-32S esp32s3 wt32_eth01 T-ETH-Lite esp32-poe esp32-gateway wipy3 tinypico denky_d4
I2C SCL (Display, DFRobot, etc) 22 22 9 32 40 -1 -1 -1 -1 -1
I2C SDA (Display, DFRobot, etc) 21 21 8 33 41 -1 -1 -1 -1 -1
JSY Serial2 RX 16 16 16 5 18 35 16 4 4 22
JSY Serial2 TX 17 17 17 17 17 33 17 25 25 21
Light Feedback (Green) 23 -1 -1 -1 -1 -1 -1 -1 -1 -1
Light Feedback (Red) 15 -1 -1 -1 -1 -1 -1 -1 -1 -1
Light Feedback (Yellow) 2 -1 -1 -1 -1 -1 -1 -1 -1 -1
OUTPUT #1 Bypass Relay 32 32 40 12 20 -1 -1 -1 -1 -1
OUTPUT #1 Dimmer 25 25 37 2 19 -1 -1 -1 -1 -1
OUTPUT #1 Temperature Sensor 18 18 18 15 3 -1 -1 -1 -1 -1
OUTPUT #2 Bypass Relay 33 33 33 -1 15 -1 -1 -1 -1 -1
OUTPUT #2 Dimmer 26 26 36 -1 7 -1 -1 -1 -1 -1
OUTPUT #2 Temperature Sensor 5 5 5 -1 16 -1 -1 -1 -1 -1
Push Button (restart) EN EN EN EN EN EN EN EN EN EN
RELAY #1 13 13 13 14 5 -1 -1 -1 -1 -1
RELAY #2 12 12 12 -1 6 -1 -1 -1 -1 -1
System Temperature Sensor 4 4 4 4 4 -1 -1 -1 -1 -1
ZCD (RobotDyn, ZCD, JSY-194G) 35 35 35 35 8 -1 -1 -1 -1 -1
PZEM-004T v3 Serial1 RX 14 14 14 -1 -1 36 -1 26 26 25
PZEM-004T v3 Serial1 TX 27 27 11 -1 -1 4 -1 27 27 33

Migration from APPER to YaSolR

Here are some pinout examples reported by users having migrated from APPER to YaSolR.

With the Wemos D1 R32 (wemos_d1_uno32):

  • Output 1 Dimmer: 18
  • Output 1 Bypass Relay: 17
  • Output 2 Dimmer: 22
  • Relay 1: 21
  • Relay 2: 5
  • System DS18 Sensor: 23
  • Zero-Cross Detection (ZCD): 19

With the Wemos D1 Mini 32 (wemos_d1_mini32):

  • Output 1 Dimmer: 18
  • Output 1 Bypass Relay: 26
  • Output 1 DS18 Sensor: 23
  • Zero-Cross Detection (ZCD): 27

How to Wire RobotDyn Dimmer

The diagram below shows how to wire dimmers based on RobotDyn modules.

You can click on the diagram to open the interactive mode or download the image.

How to Wire Random Solid State Relay Dimmer

The diagram below shows how to wire dimmers based on Random Solid State Relay.

You can click on the diagram to open the interactive mode or download the image.

How to Wire Voltage Regulator Dimmer and DAC

The diagram below shows how to wire the DFRobot DAC to control a LSA or LCTC voltage regulator:

  • LSA / LCTC Voltage Regulators + DAC GP8211S (DFR1071)
  • LSA / LCTC Voltage Regulators + DAC GP8403 (DFR0971)
  • LSA / LCTC Voltage Regulators + DAC GP8413 (DFR1073)

You can click on the diagram to open the interactive mode or download the image.

How to Wire Bypass Relay

The diagram below shows how to wire the bypass relays to force heating through the relay without using the dimmer for this output feature.

You can click on the diagram to open the interactive mode or download the image.

How to Wire JSY and PZEM

The diagram below shows how to wire the following optional YaSolR measurement devices and where to put the clamps:

  • PZEM-004T v3
  • JSY

You can click on the diagram to open the interactive mode or download the image.

How to Wire Accessories

The diagram below shows how to wire the following optional YaSolR accessories:

  • push button
  • LEDs
  • temperature sensors for router, output 1 and output 2
  • external relays 1 and 2
  • screen

You can click on the diagram to open the interactive mode or download the image.

How to Wire Random SSR with JSY-MK-194G ZCD

The diagram below shows how to wire the Elegant, which is composed of a Random SSR and a JSY-MK-194G which does both the measurement and the Zero-Cross Detection.

You can click on the diagram to open the interactive mode or download the image.

How to Wire Electronic Water Heater (like ACI)

If your water heater has an electronic board (like ACI ones), you need to either bypass it or integrate it in the circuit.

There are a lot of schemas and tutorials online to do that. See for example: https://forum-photovoltaique.fr/viewtopic.php?t=67337

Where to Buy

Here is the non exhaustive list where to find some hardware to build your router. Links are provided for reference only, you can find them on other websites.

ESP32 Boards

Links:

Accessories:

Dimmers

Voltage Regulators

  • They support Phase Control only.
  • They require a DFRobot DAC between the ESP32 and the voltage regulator to control it.
  • They include a ZCD circuit, so you can use them without an external ZCD module, even with a Random SSR.
  • They are big and robust

Links:

DfRobot DACs to control the voltage regulator:

Heat Sinks:

Synchronous Solid State Relays

See How to Choose a Solid State Relay.

  • They support Cycle Stealing only.
  • Pick a DC Control AC model that can be controlled by a 3.3V DC signal and with an output AC voltage in the range of your grid voltage (example: 24-480V AC).
  • The amperage should be 2-3 times the nominal current of your resistive load (example: 40A SSR for a 3000W resistance).

Links:

Random Solid State Relays

See How to Choose a Solid State Relay.

  • They support Phase Control and Cycle Stealing.
  • They require a Zero-Cross Detection Module.
  • Pick a DC Control AC model that can be controlled by a 3.3V DC signal and with an output AC voltage in the range of your grid voltage (example: 24-480V AC).
  • The amperage should be 2-3 times the nominal current of your resistive load (example: 40A SSR for a 3000W resistance).

Links:

Zero-Cross Detection Modules

Required with a Random SSR only.

Links:

Tip

I often order batches of this good ZCD module on PCBWay to get them cheaper and split the cost with friends. So if you need one, look at the YaSolR Pro page to see if I have some stock left

RobotDyn dimmers include a Zero-Cross Detection circuit, but they are not very good for the ZCD and heat dissipation. They support Phase Control and Cycle Stealing.

Links:

Warning

  1. It is possible to switch the TRIAC of an original RobotDyn AC Dimmer with a higher one, for example a BTA40-800B BOITIER RD-91
    Ref: Triacs gradateurs pour routeur photovoltaïque.
  2. The heat sink must be chosen according to the SSR / Triac. Here is a good video about the theory: Calcul du dissipateur pour le triac d'un routeur (from Pierre)
  3. Make sure to improve the RobotDyn wiring/soldering

Measurement Devices

For grid and/or routing measurements:

For grid measurement only:

For routing measurement only:

Relays

Electromagnetic Relays can be used for the 2 relays and the 2 bypass relays because they will be switched on and off less frequently. I have tried the electromagnetic relays below and they sometimes get stuck... I don't know if this is caused by the poor quality or I got some lemons. So for a more reliable usage, maybe use a Synchronous Solid State Relay, that you could also use as a replacement for the dimmer if the dimmer fails one day. Otherwise, if you can find a reliable one, I really like the ability to have both a NO and NC output to better isolate the dimming circuit and bypass circuit.

Links:

Temperature, LEDs, Displays

Temperature sensor:

Trafic light LEDs:

I2C OLED Display:

Mounting Accessories