Here are most of the items that are required to assemble a complete Mk2 PV Router using my PCB-based hardware.
A list of these items is given below.
Central section, top to bottom:
- Schneider enclosure (external dimensions in mm: height = 165, width = 195)
- neon indicator (no longer used, it has been replaced by a LED assembly)
- mains connector (57A, 4-way) + M3 mounting screws
- control cable (red/green to link between the 'main' and 'output' PCBs)
- main board, assembled
- 1.5mm brown multi strand cable for internal high-power wiring
- 16A over-ride switch (SPST, illuminated)
- female spade connectors with covers (x3)
Right hand side, clockwise, from top:
- ABL heatsink & M3 mounting screws (heatsink depth = 20 mm)
- completed output board with triac mounting kit
- M3.5 screws for PCBs (4 for main board, 1 for the output board)
- display module (4-digit display, adapter plate, and ribbon cable)
Left hand side, clockwise, from bottom:
- mode switch (SPST), pre-wired to 2-way SIL connector
- mono 3.5mm jack socket, pre-wired to 2-way SIL connector
- mains switch (1A, DPST, illuminated)
- 16mm glands (x2)
- multi-strand cable for internal low-power wiring
Here is a parts list for the complete router:
When assembling a complete Router system, the first
stage is to work out exactly where everything is to go and then make the necessary holes in the enclosure. It may be helpful to read through the whole of this section first before starting the assembly process.
In the following sequence, I've used an ABS "Thalassa" enclosure from Schneider Electric, type NSYTBS19168. A polycarbonate version is also available, type NSYTBP19168. Two of the PCBs can be screwed directly to the internal mounting points of these enclosures.
NB. Throughout this Build Guide, I've assumed that the enclosure will be mounted horizontally. But if space does not permit this, it can be mounted vertically as shown below.
*** A complete Mk2 unit in 'portrait' orientation is now featured on the Photo Gallery page ***
In this configuration, The triac is not quite central to the heatsink, and the output board requires a support.
With the transformer being hidden behind the heatsink, this arrangement has plenty of wall-space in which to mount the various external components.
In the conventional 'landscape' orientation, my ABL heatsink fits centrally across one end of the enclosure.
Here, the mounting hole for the triac is located centrally across the width of the box and heatsink, and is one 'valley' (6mm) above the mid-point of the heatsink.
NB. In the photo above, the heatsink is located as high as possible, with its upper edge tight against the protruding lip. This means that the triac has to be mounted at the extreme end of its leads. Having assembled several boxes, I've found it better to lower the heatsink slightly - just a few millimeters - which suits the location of the triac better.
If using this type of enclosure, it may be necessary to remove some of the plastic from the unused mounting point below where the triac sits.
A circular aperture is much easier to make than a square one. I use a 32mm 'auger' bit.
When using a Schneider enclosure and ABL heatsink, the centre of this hole needs to be approx. 50mm from the base of the box.
When bolting the triac in place, it's a good idea to use a mounting kit. This one has a mica washer.
An insulating washer takes minimal space so should not noticeably affect the triac's location.
A smear of thermal paste may be helpful too.
When tightening the mounting screw for the triac, a fine screwdriver which fits between the heatsink's fins can come in handy.
Make sure that the plastic bush is properly seated before the nut is fully tightened.
The Schneider enclosure has a strengthening ridge along its underside as shown in red.
The two screws for the connector block need to sit either side of this ridge.
By drilling these holes from the rear, it should be possible to get them in the right place at the first attempt!
In the above photo, the location of the connector block is for when external power wiring is to appear from the right hand side of the box (in this case, the pair of glands on the left-hand-side would not be used).
In the photo below, the location of the connector block is for when external power wiring is to appear from the left hand side of the box (in this case, the pair of glands on the right-hand-side would not be used).
Depending on whether the heatsink is to be situated on the left-hand or the right-hand side of the enclosure when mounted on the wall, the connector and gland locations can be chosen to allow cable access from either above or below.
Here, I've used a different type of mounting kit for the triac. This version has a sheet with thermally-activated adhesive.
Whichever type of mounting kit is used, the heatsink will need to be earthed.
In the above photos, the earth connection is made via an M3 screw to the front face of the heatsink. A more direct approach is to fit the eathing tag directly to the rear face of the heatsink, as shown below:
To ensure a good electrical connection, I've removed the anodising layer around the mounting point using a rotary wire brush.
A serrated washer should ensure good contact.
Here is the completed connection.
A self-tapping screw may be an easier approach than the M3 bolt that I have used here.
In harsh environments, the corrosive effect of dissimilar metals may need to be to taken into consideration.
Various external components will need to be mounted in the walls of the enclosure, their physical positions being dependent on the local circumstances. Some of these components are for mains; others are for low voltage signals. To prevent dust ingress, I would recommend having the override switch at the bottom.
As all connections to the main board are made from above, the assembled board can be screwed into place using the four screws that are supplied with each enclosure.
The wiring for all of these components is shown in this diagram:
The next section is intended to give an overview of how everything is connected together. A detailed order in which to proceed with the mains wiring is suggested further down this page (immediately after the photo of the labels that I use).
The neon that was originally specified is no longer available. It has been replaced by an LED assembly.
Three of the low voltage components are connected to the main board via 2-way SIL sockets. This wiring can be conveniently added before those components are fitted.
The white switch is to select between the two output modes. Its wire goes to the SIL connector marked "mode".
The jack-socket goes to the "CT1" connector.
The red 'bobbin-style' CT goes to the "CT2" connector.
For the components that carry mains voltage, I suggest that they are connected as shown on the diagram, internalWiring_1.pdf which is available on the Downloads page . When configured in this way, the completed Router should be able to pass the standard electrical tests of Continuity and Insulation Resistance.
The following sequence includes the fitting of a 230V neon into the Switched Live wiring. That component is no longer available so I now supply an LED and series resistor which provides an alternative way of showing when the load is active (i.e. on). The LED assembly is normally connected to the low-voltage side of the output stage PCB. It must not be connected to 230 Volts!
When attaching wires to switches etc., I generally use solder and heat-shrink tubing.
This is the DPST mains switch. If using a switch of the illuminated type, the supply wires must go to the outer pair of contacts.
The pair in the centre are for the switched outputs.
For the over-ride switch, with its 6.3mm spade terminals, I find it better to use female receptacles.
With the non-crimp variety, the wire can be soldered into place, then secured with pliers.
The 'male' style of cover is best-suited for this application.
If plastic covers are not available, heat-shrink tubing is an easy alternative.
Having established the correct length for each of the high-current wires, it may be helpful to temporarily remove the 4-way connector block while they are fitted into place. Each of the Line terminals supplies three wires:
The permanently live Line terminal has power-carrying wires for the triac and over-ride switch, and a smaller wire for the 'on/off' switch.
The switched Line terminal has power-carrying wires for the triac and over-ride switch, and a smaller wire for the neon.
To avoid the internal wiring being disturbed during installation, all of the internal connections should be made on the side of the connector block that is furthest away from the glands. As noted above, this means that two of the apertures will need to terminate three wires.
When assembling this demonstration unit, I found this operation to be quite challenging. But here is an easy way:
First, strip about an inch of insulation from each of the wires ...
then tape them together without pre-twisting any of the copper cores.
Now twist all of the copper threads together to form a tight bundle.
After trimming to the required length, this bundle should be an easy fit within the connector block.
NB. The different coloured wires that I used here were just to demonstrate the principle. Normally, they would all be the same colour.
Wires can also be held together using heat-shrink tubing.
For the high-power wiring, it is important that the wires are firmly retained within their connectors.
Slackening and re-tightening the screw while gently moving the wire(s) can help to prevent any subsequent movement.
NB. Please note that stranded wire on power cables should NOT be tinned before being inserted into any type of pressure-activated connector (i.e. screw or crimp). Pre-tinning the wire ends could cause the connection to work loose over time and arcing to occur.
If the tongues in these connectors are not fully raised, they can be encouraged upwards using a short length of bent copper wire.
Make sure that the grub screws are fully retracted first.
With everything in its place ...
... the assembled router will probably look something like this ...
... or, from the other side, like this.
To assist with the testing process which follows, I've connected some 3-core flex in place of the incoming and outgoing supplies. These temporary cables are terminated with a 13A plug and trailing socket respectively. Once installed, these cables would normally be 2.5 T&E.
Now for a closer look at the high-current mains wiring:
The high-current wiring comprises two loops: one for the triac, the other for the over-ride switch.
When either of these circuits is 'on', the permanently live Line terminal is connected to the switched-Line outlet for the load.
(The red/green control cable which runs between the two PCBs can also be seen here.)
Here is the over-ride switch with its full set of spade connectors. The (low-current) blue wire is a switched-neutral for the illumination.
These connectors have not yet been pushed fully home. Depending on the shape of the blade, they may 'click' into place, and be very difficult to remove.
On the white 16A switches that I now supply:
- the central terminal, marked "1", is for the permanently 'live' Line connection;
- the outer terminal marked "2" is for the 'switched live' Line connection;
- the outer terminal marked "3" is the Neutral connection for illumination only;
Now for the low-current mains wiring:
When the heatsink is on the right-hand-side of the enclosure, the low-current wiring behind the mains switch has to cross over so that 'down is 'on'.
If the heatsink and switch were on the opposite sides, no crossover would be necessary.
As shown in my wiring diagram, two of the externally mounted components are illuminated, these being the override switch and neon.
A switched-Neutral feed for these two components can be conveniently provided by TB2.
NB. The neon is no longer normally fitted.
And now for the low-voltage wiring. When fully populated, each of the four 2-way SIL connectors will be in use, as shown below:
The yellow & green pair at "CT1" is for the external CT.
The red & white pair at "CT2" is for the internal CT.
The red & green pair at "trigger" is the control pair for the output board.
The blue & black pair at "mode" is for the switch which selects the output mode.
These SIL connectors are greatly improved with a dab of hot glue to seal the wires in place. As can be seen from the above photo, two of mine have yet to receive this treatment.
The red/green cable for the control signal runs between the "trigger" connector on the main board and the "control" connector on the output board. At the 'main' board end, there needs to be a 2-way SIL connector, as shown above. At the 'output' board end, there can be a similar 2-way SIL connector, or these wires can be screwed into the 2-way terminal block marked "control".
NB. If a lid-mounted LED is to be used instead of a neon to show when the load is on, the 2-way SIL strip on the output board can provide a convenient connection point. In that case, it may be helpful to wire the control cable to the 2-way terminal block.
As shown on the wiring diagram, there are three places where the internal CT can be located.
Here, it is around the switched-Line cable.
The arrow on the CT has no relevance for this application. If the signal is not the right way up, just reverse the SIL connector at CT2.
The above location for the internal CT is fine for when the system is being assembled and installed within the same operation. Before the outlet cable is screwed into place, either of its 'live' cores is passed through the internal CT.
When the assembly and installation stages are being done separately, it may be better for the internal CT to form part of the internal wiring, as shown in the photo below. The area for the external cabling is then completely clear.
And finally, some views from the outside:
The underside of the enclosure seems a natural place for the over-ride switch.
If the T&E cables need to enter from below, the wiring requires a bit more care, but it can be done.
Because this unit has its heatsink on the right, most of the controls are on the left-hand side:
The illuminated mains switch is DPDT, with down being 'on'.
The other switch, for selecting between "normal" and "anti-flicker" modes, is operated in a side-to-side manner.
The 3.5mm socket is for the external CT.
As the top surface is likely to gather dust, I would not recommend locating any controls here.
But it's fine for the cable entry points and the neon.
The entire right-hand side of this unit is taken up by the heatsink.
For a 110 mm length, as shown here, this heatsink profile from ABL has a thermal resistance of just under 1.5 degC/Watt with passive cooling.
I can supply heatsinks of this type which are pre-drilled.
Before fitting the display unit into the front of the box, it may be a good idea to test it first. Testing the display is dealt with after the next few photos. All display modules that I supply will have been tested before dispatch.
The front of the box is a natural place for the 4-digit display to be mounted.
Hot glue is a convenient way to retain the display unit in place, but any glue that can stick to plastic should be fine.
To improve the joint, I roughen both of the surfaces first.
Make sure the display is the right way up before glueing it into place!
Once the glue has set, the adapter plate can be pushed onto the protruding pins.
NB. As mentioned on the Display PCB page, I now recommend soldering the adapter plate directly to the pins of the display module. This provides a more reliable means of connecting to them.
Here's a set of labels that I'm about to apply to the various external components.
For UK use, the "supply" label should read "230V AC"
* * *
The order in which I usually assemble the internal wiring for a Mk2 system is as follows. Two set of photos are provided for units in which the heatsinks are on opposite sides. Depending on the layout of the various components, many different configurations of wiring are possible, but they can all be approached in a similar way. In the accompanying photos, the two sequences are denoted Right and Left. So "W3-R' is wiring stage No 3 for the unit with the heatsink on its right hand side.
|1. Add the two earthing cables||W1_L||W1_R|
|2. Add the mains switch, leaving the "Line" cable unattached||W2_L||W2_R|
|3. Complete the "Line" wiring||W3_L||W3_R|
|4. Add the neon, leaving the switched-line cable unattached||W4_L||W4_R|
|5. Complete the switched-line wiring, which may pass through CT2||W5_L||W5_R|
|6. Add the low voltage cables and the neutral for the override switch||W6_L||W6_R|
|7. Retain any loose cable to the sides of the enclosure||W7_L||W7_R|
(stage 4 is no longer needed as the neon has been replaced by an LED assembly)
* * *
For this pre-built system, the same sequence as above has been followed.
With the layout of this box, the fixed internal wiring is probably as compact as is possible.
Although a second CT has not been fitted, sufficient slack has been left in the switched-line wiring so that this could be done later.
With a different layout for the external components, the fixed internal wiring can look very different but the internal connections are exactly the same.
As with the above unit, sufficient slack has been left in the switched-line wiring so that CT2 can be added later.
Here is the same box in its finished state.
A clip-on CT has been fitted for test purposes. This allows the diverted power to be measured for datalogging via radio (this unit does not have a display).
To continue with this build sequence, access to 230V mains voltage is required. Please take great care, and do not undertake this activity unless you feel confident to do so.
Now that the Router is fully assembled, some additional tests can be performed.
Testing the 4-digit display.
With the ribbon cable for the display module plugged into the main board ...
... just run the sketch
[NB. When a file is downloaded from this website, it is automatically "opened" within a suitable editor or browser. To use a software sketch, the entire content of the displayed file should be copied and saved as a local file using the name that appears here. Because it has the suffix ".ino", that file will then be recognised as an Arduino source file by the Arduino IDE].
The demo_bothDisplays sketch needs to be configured for whichever version of the hardware it is running on. This involves a one-line change near the start of the code. If ICs 3 & 4 are in use, the line #define PIN_SAVING_HARDWARE needs to be included; otherwise, this line needs to be commented out (by adding "//" at the start of the line). Most sketches that use the 4-digit display need to be set up in a similar way.
The behaviour of this sketch is determined by the state of the boolean flag, EDD_isActive. When this flag is set to "true", numbers are displayed; otherwise, it's the idle pattern. EDD stands for Energy Diversion Detection which is only of relevance in the main Mk2 code but I've retained the same name in this test sketch.
Here, the sketch is in its counting mode. As posted, it starts to count up from 1234.
If the starting point is set to 65500, which is interpreted as 65.50 kWh, the display soon rolls over and starts again from 0.
This is because the maximum value of an unsigned int is 65535.
An alternative way of exercising the 4-digit display is to use segCheck_bothDisplays.ino. This sketch runs through each possible value in each location. Before gluing a display module into an enclosure, I run this sketch to make sure that none of its segments have failed. As with the previous sketch, the #define PIN_SAVING_HARDWARE line needs to be included or commented out depending on which version of the hardware is in use.
Testing the output board.
The primary purpose of the Router is to control the supply of mains power to the load. This switching operation is performed by the triac which forms part of the output board.
The output board may have already been tested in isolation. Now that a working main board is available too, the output board can be re-tested in-situ using a test sketch which drives the relevant control pin up and down. For this purpose, temporary 3-core cables should be fitted for the mains supply and load connections.
Here is a suitably modified version of the standard example sketch, blink.ino, in which the control pin has been changed to digital IO pin 4. DIO4 drives one of the pins at the "trigger" connector, the other pin is 3.3 V. For compatability with previous hardware, the triac becomes active when port DIO4 is driven low.
Once blink_dig4.ino has been uploaded to the processor, the output load will hopefully cycle on and off as intended. If it's not behaving in this way, it will be necessary to pause and check everything carefully. If individual tests for the main board and output board pass, then this combined test should work too, assuming that the low-voltage control cable that runs between them is in place and correctly orientated (i.e. '+' to '+').
If the output board does not appear to be working, correct operation of the main board can be easily verified using an LED and series resistor at the "trigger" connector.
Compliance with standard electrical tests
If the DPST mains switch is set to 'off', the processor will stop running (because its DC supply has been lost) but the override switch will continue to function. This is the mode in which the installation should be verified by an electrician: mains switch 'off', override switch 'on'.
Any kind of mains indicator is likely to interfere with (or become damaged by) the standard electrical test of Insulation Resistance, hence the need to disconnect them for testing purposes. This principle is shown in the next pair of photos:
because I've set the override switch
to 'on', the 40W bulb that I'm using as my load is continuously active.
The red illumination within the override switch is visible because its Neutral supply - as supplied by the mains switch - is present.
Here, the (amber) mains switch has been turned to
'off'. This is a DPST switch which breaks the Neutral supply as well as the
The override switch no longer has its Neutral supply. So, although it still functions mechanically as before (the load remains on), the illumination is no longer operational.
Ability to divert surplus power (or "Balance Test")
By this stage of the Build Sequence, each of the main components should have been tested in some way. The operation of the voltage and current sensors is covered within the section for the main board. The display and output boards have already been checked within this section.
[Satisfactory results from the RawSamplesTool, as described in the Main Board section, indicate that the voltage and current sensors are working properly. Running the calibration sketch, as described in the Calibration and Installation section, is another way of checking that all is well with the measurement side. It is well worth confirming that the input stages are OK before moving on to include the output stage.]
Now it's time to see whether everything will work together as a complete system. Before wiring the Router into a 'live' power-generating environment, it may be helpful to simulate some surplus power within a test rig.
NB. Calibration is described on the Installation page. For all builds that I've assembled so far using my new hardware and associated components, powerCal has been found to be around 0.045. Setting powerCal_grid and powerCal_diverted to this figure should be fine for the offline checks in the rest of this section. These two variables are part of the MK2 PV Router sketch.
The job of the Mk2 Router is to maintain a balance between generation and consumption. To do this, it has to sense the energy flow in both circuits. In a real operating environment, only one line needs to be monitored, at the grid connection point. But in a test environment where generation has to be simulated, CT1 needs to be clipped around two wires.
For convenience, I've posted an alternative sketch which allows a complete Mk2 rig to be very easily tested. This sketch includes 1kW of synthesized surplus power, so there's no need for a second circuit. After clipping CT1 around the appropriate core of the output circuit, precisely 1kW of power should be diverted to the output load. If the load is staying on permanently, that could be because the feedback is positive rather than negative. To fix this, the orientation of the CT can be reversed or the other core of the output cable can be used.
This sketch is: balanceCheck_1kW.ino
NB. For this sketch to run, the TimerOne library needs to be installed within the Arduino IDE. A zipped copy of this folder is available on the Downloads page.
A 'proper' test-rig for balance, with plenty of supporting information, is presented in Section 8 of my Diverting Surplus PV Power article. Although that article was written in the context of an Unduino Uno or emonTx, the principle of operation has not changed. An updated version of that diagram, as shown below, is available here.
A simple test rig for the Router.
Current flows through two circuits in opposite directions. The 'generation' circuit is is shown in green, and the consumption circuit is in red. Only one core of each cable should pass through the CT. The red and green arrows are to show that the direction of energy flow is opposite in these two circuits. Power to the load will be regulated by the Router in such a way that the net flow of current through the CT is zero.
Assembling a test-rig of this type is not as difficult as it may sound. Having temporarily equipped my completed router with a 13A plug and socket, its feed and load circuits are already 'live'. Now I just need another cable to supply whatever appliance will be used to simulate my PV. A simple extension lead with its cores exposed for a short section is all that is required ...
... like the black 3-core flex here .
CT1 (blue) needs to be clipped around one core of each circuit, i.e. the generation circuit from above, and the load circuit from below.
CT2 (red) just monitors the diverted power, so is only located around one core of the load circuit (white flex)
The external (blue) CT plugs into the jack socket on the side of the enclosure; this signal reaches the CT1 connector via internal wiring.
NB. The two wires that run through CT1 need to have their current flowing in opposite directions. This is easy enough to check. From the Line side of each circuit, just follow the electrical path until the CT is reached. You need to 'arrive' at CT1 from opposite directions.
In the photo above, the Line (brown) feed in my 'generation' cable arrives at CT1 from the left. The current for my dump load goes via the output board and then passes through the CT on its way to the output gland, so here the current is flowing from right to left. The two currents are therefore flowing in opposite directions through the CT, which is correct.
Now we need to run a Mk2 PV Router sketch which can identify and divert surplus power. Various versions that run on this new hardware are available via the Downloads page. The simplest of these is:
NB. For this sketch to run, the TimerOne library needs to be installed within the Arduino IDE. A zipped copy of this folder is available on the Downloads page. Although this "version 1" sketch is fine for test purposes, I would always recommend using the latest version from the Downloads page for the final installation.
Having saved and uploaded this sketch, the display should start up in its "walking dots" idle mode. As soon as power is drawn via the black "PV generation" cable, the system should spring into life and a matching amount of energy will be diverted to the load. The display shows the total amount of energy that has been diverted since start-up. It will reset automatically after a pre-set period during which no surplus energy has
been detected (the default period is 8 hours)
NB. In latitudes when days are substantially longer during the Summer months, the reset period may need to be reduced to ensure that each day's total is cleared before the next solar day commences.
If the display is not working, make sure that the #define PIN_SAVING_HARDWARE line is correctly configured. This aspect is described higher up this page in the "Testing the 4-digit display" section.
So far, 4 WattHours of energy have flowed through each of my test circuits.
The output mode is dependent on the state of the mode switch.
If this switch is open, or not fitted, the system will be in normal mode; otherwise, it will be in anti-flicker mode.
If this behaviour is not seen, it probably means that the one or both of the CT's signals are reversed. This can be easily remedied by reversing the direction of the leads at the CT1 and CT2 connectors (but not swapping them over!). If CT1 is the wrong way around, the display will never leave its idle pattern. And if CT2 is the wrong way around, the displayed value will never increase. When they are both correct, the behaviour should be as described above.
NB. The rating of the load needs to be greater than the simulated PV, otherwise the system will not be able to maintain a balance between 'import' and 'export'.
The balance test, as described above, is as close as it's possible to get to a real 'live' environment. Once this test is operational, it's worth spending a few minutes to check that everything is behaving as expected. This is the ideal situation in which to put the system through its paces.
- can the operating mode be switched between "normal" and AF?
- does the display show the total amount of diverted energy (albeit uncalibrated)?
- do different levels of simulated power have the expected effect?
- does all activity cease when no simulated power is applied?
Normal and Anti-flicker settings are described in the technical background article that is referenced on the About page. A video showing an installed Mk2 PV Router operating in each of these modes can be found near the end of the calibration & Installation page.
Before moving on to the calibration and installation stages, it's worth checking that everything within the enclosure is as intended. Are all the screws tight, and does any of the wiring need to be tidied away? Has the heatsink been earthed? Is the external wiring area clear of obstructions, and are the mounting holes clear? Is there space for the internal CT, if it has not already been fitted, and the ribbon cable? And so on ...