Three versions of this PCB have been produced as shown in the photo below. While they all perform in a similar way, each version provides more flexibility than the previous one. The latest version (Rev 2.1a) will be supplied with all new orders.
Rev 1.1 had a minor tracking error. These PCBs are still available for the cost of the postage.
Rev 2.1 has a separate power supply stage for the RF module. Easy access is provided to all IO ports.
Rev 2.1a has pre-routed corners. Access to IO ports is with pin-pairs that have 0.1" spans wherever possible.
This assembly guide was originally written for the orange (Rev 1.1) board, but I am gradually updating it to show the later PCBs. Where any significant differences exist between PCB versions, this will be noted in the text. Before starting to assemble this board, I recommend looking through the whole of this page.
NB. To test this board, a suitable programming facility which includes a USB programming adapter will be required. Guidance about how to set up such a facility is available at https://www.arduino.cc/en/Guide/HomePage
A complete set of components for the main board is shown in the photo below. A parts list, and circuit diagrams for both versions of the PCB (Rev 1 and Rev 2), are available via the Downloads page.
All versions of this PCB have holes which match the mounting points inside a Schneider NSYTBS19168 enclosure.
Version 2.1a of the PCB has pre-routed corners. For both previous versions of the PCB, the two lower corners have to be removed by hand as shown here.
My preferred way of assembling this PCB is to fit the components in increasing order of height. In the photo below, all of the resistors that are necessary for the basic operation of the board and the display have been fitted. Only those which may be needed for the RF facilty have been omitted.
Most of the resistors on this board have a 1/4 Watt rating.
R6, which is the burden resistor for the primary current sensor, needs to be rated at 1/2 Watt.
This is to prevent possible overheating during periods of high consumption by the premises that is being monitored.
The following two photos with the original PCB (Rev 1.1) show close-up images of the seven resistors which are needed for the basic operation of this board.
R1 - R5 are grouped together near the centre of the board.
NB. R1 is now specified as 47K, rather than 10K.
NB. I now recommend using lower valued components for R4 and R5 as noted below.
The two 'burden' resistors are next to the connectors for CT1 and CT2.
NB. As noted above, R6 should have a 1/2 Watt rating rather than 1/4 Watt as shown here.
Resistor values are shown on the circuit diagram and are repeated here for convenience:
(please read the notes below which are relevant to these component values)
R1 = 47K. This provides the "pull-up" for the processor's reset line. R2 = 10K. Along with R3, this provides a reference voltage for the input sensors. R3 = 10K. Along with R2, this provides a reference voltage for the input sensors.
R4 = 10K (or 100R, as below). R4 & R5 reduce the size of the AC signal from the transformer.
R5 = 100K (or 1K0, as below). R4 & R5 reduce the size of the AC signal from the transformer. R6 = 120R. This is the burden resistor for the 'grid' current sensor, which uses CT1 R7 = 120R. This is the burden resistor for the 'diverted' current sensor, which uses CT2 Note 1. The original value for R1 of 10K, as used by similar
monitoring systems, has been found to give unreliable performance with
boards that are operated at 5V. The value of 47K lies within the
specified range of 30K - 60K in the Atmel 328P datasheet(Rrst, on page 314 of 600) and is now recommended for use with all Mk2 boards.
Note 2: As mentioned near the top
of the Technical Notes page, I now recommend using lower values for R4
and R5 (i.e. 100R and 1K0 respectively). These lower valued components
are to increase the load on the transformer. This can prevent it from going into saturation which distorts the output waveform.
Note 3: The value for R6 and R7 was initially specified as 150R. When operating the processor at 3.3V, this gives a working range of just under 4 kW. By reducing these values to 120R, the range is increased to approx 4.5 kW. For a 5V system, the original value of 150R gives a working range of approx 5.8 kW.
If whole-house datalogging is required, the working range of the
'grid' sensor can be increased by reducing the value of R6. However, it
must be recognised that the sensitivity of the measurement system will
be correspondingly reduced.
R6 = 56R will allow measurements of up to approximately 10 kW R6 = 47R will allow measurements of up to approximately 12 kW R6 = 39R will allow measurements of up to approximately 14 kW
These burden resister values are for when the processor is operated at
3.3 V. If operated at 5V, these ranges are increased by approximately
R11 - R18 are the series resistors for the 4-digit display. If the board is to be operated at 3.3V, these eight resistors should be 220R. If operated as 5V, this value should be increased to 470R to maintain a similar level of brightness.
Next, the diodes can be added. These provide a degree of protection to the processor when high currents flow through the CTs.Although space is available for four protection diodes (two for each CT channel),
only D1 and D2 are likely to be of any practical use. In most applications, the current that is measured by CT2 is relatively small so D3
and D4 can be safely omitted.
Rather than bending the legs of these components tightly to fit into the holes, I prefer to mount them slightly away from the board as shown here.
NB. These components must be fitted in the correct orientation as shown on the silk-screen layer.
of 0.1" SIL pin-strip are used at several locations to provide
low-power connections to the PCB. The FTDI header (where the board is
programmed from) requires a 6-way section, and 2-way sections are used
at various other locations as shown on the silk-screen image. Pin-strip can be easily cut to length with a sturdy knife or wire cutters.
I generally fit these SIL-strips at this stage because they can be difficult to adjust if nearby components are already in place. In the photo below, I am about to solder the 6-way FTDI strip into place.
With the SIL-strip resting on some sponge, both hands are free for soldering the first pin.
Non-vertical pin-strip can be easily corrected at this stage by re-melting the solder while gently pressing on the plastic part with a fingernail.
Don't forget to solder the rest of the pins into place too!
Here, all of the main sections of SIL pin-strip have been fitted;
The "FTDI" port requires a 6-way section.
"trigger", "mode", "CT1" and "CT2" connections each require a 2-way section.
Next, I generally fit the header-sockets for the ICs. If the pin-saving hardware is in use, four ICs will be needed (IC1 - IC4); otherwise there will only be two (IC1 & IC2. This distinction is explained in more detail later.
Each header socket has a notch at one end. This should be aligned with the equivalent mark in the silk screen image, as shown here.
The 4-digit display can be controlled in either of two ways. If the RF facility is not required, and those IO pins are not needed for any other purpose, a full set of IO pins on the processor can be dedicated to driving the display. This configuration requires the addition of fourteen wire links as shown in the silk-screen layer. The board in the next photo is being assembled in this way:
The 14 links are shown here with pink wire:
5 links at IC3; 1 link at IC4; 5 links at J1-5; 1 link at R24; 1 link at R25; 1 link at R26;
If the RF facility is required (or if any of those IO
pins are needed for any other purpose), the display can be operated
using the "pin-saving hardware". For this arrangement, header sockets for IC3 and IC4 need to be fitted as shown below.
Here, one of the original PCBs is shown with just these headers in place, for IC3 and IC4.
NB. When the pin-saving hardware is in use, no wire links should be fitted at the J1-J5 connector.
Because this board is being assembled with the pin-saving hardware, header sockets have been fitted at all four IC locations.
The remaining components can be assembled in any convenient order. In all cases, I would recommend only attaching one lead for each component initially; the alignment can then be checked and adjusted as necessary before the rest of them are soldered into place.
In the next photo, I am about to fit the 16 MHz crystal. This component is indicated on the silk-screen layer as X1.
I like to raise these radial components slightly away from the board before soldering them into place.
A matchstick can be put to good effect for this purpose. Here, some heat-shrink sleeving has been used to increase the matchstick's thickness.
NB. Although they look fairly similar, it is important that these two
capacitors are fitted in the correct locations. The larger
capacitor (C1 = 100 uF) is closest to the bridge rectifier. The smaller one (C2 = 10 uF) is nearest to IC2. If these two components are swapped over,
the resulting symptoms can be difficult to diagnose.
The voltage regulator (VR1) must be fitted as shown on the silk-screen layer (with its metal fin away from the transformer). Depending on the application, VR1 will either be a 3.3V or a 5V device.
Soldering the leads for VR1 is likely to need more heat.
To reduce the amount of metal to be heated, I pre-cut these leads to the required length.
Leaded solder, which melts at a lower temperature, may be helpful for these connections.
Before fitting any of the ICs, the operation of the power supply needs to be checked.
************************************************************************************************** Safety Warning: To continue with this build sequence, access to 230V mains voltage is required. Please do not proceed to this next stage unless you are competent to do so.
Before fitting any of the ICs, the operation of the power supply needs to be checked. In the photo below, I have connected a temporary 230 V AC supply via a 3-Amp fuse. Although not required by this PCB, the Earth core provides a degree of safety in the event of the operator accidentally coming into contact with the 230 V AC line.
If everything has been correctly assembled, the output of the power supply should be about 3.3 Volts ....
... or 5V if a 5V voltage regulator has been fitted.
This voltage can be conveniently checked at the "access to power" connector, as shown here.
Other than the transformer, which may feel slightly
warm after several minutes, none of the components on the board should
show any noticeable increase in temperature.
With the correct voltage in place, the ICs can now be fitted. The first of these is IC2. This is an op amp which provides a mid-rail reference voltage for the voltage and current sensors.
With Dual-in-Line packs, the pins may need to be bent inwards slightly to fit into the header.
This can be done by gently 'rolling' the chip on each side in turn.
To minimise the risk of electrical damage, this operation should be done on a protective surface such as an anti-static bag.
With the pins nicely aligned, the IC can be gently placed onto its header as shown here.
ICs need to be fitted the correct way around. The dot on the chip must align with the notch in the silk-screen image.
When everything has been carefully checked, the chip can be pressed firmly home.
With IC2 in place, and power applied to the board, the voltage reference can be measured.
Vref should be approximately half of the supply voltage. Here I am testing a 3.3 V board.
A convenient place to access Vref is at the upper end of R6. The SMA jack-socket is a convenient earth.
Vref can also be accessed at various other places, as shown on the circuit diagram for this board.
The main processor, IC1, is fitted in the same manner as for IC2.
With so many pins, it's all to easy for one of them to get bent underneath.
Warning: if this IC is the wrong way around when power is applied, it will most likely never work again!
With the processor in place, it may be a good idea to check that the power supply is still OK. Assuming that is it, let's run a sketch (program) to establish whether the processor is working.
For this next stage, a suitable programming facility will need to be in place. Details about how to set up the Arduino Integrated Development Environment (IDE) can be found at the top of this page.
A USB-to-USART programmer will need to be plugged onto the FTDI connector on the PCB as shown below. The other end of the programmer needs to be connected via a suitable USB lead to the programming facility (PC or equivalent).
The pin at one end of the programmer's 6-way connector
will be labelled Gnd.
This needs to correspond with the '0V' marking
on the PCB.
The transformer has two outputs: one is for the DC supply, the other is for the AC voltage sensor which should already be working. This can be verified by running a programme (sketch) which displays the analogue measurements that are being taken by the Atmel processor (IC1).
[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].
uploaded this sketch to the processor via the Arduino IDE, the Serial Window (magnifying
glass icon) needs to be opened within a few seconds, otherwise the
action will be missed. After completing each run, the sketch can be
re-started from the keyboard by entering the character 'g', followed by
RawSamplesTool_2chan displays the AC voltage and current
samples for one or more complete mains cycles. If a sizeable current is being
measured as well as the voltage, the displayed results will look more
Here is some output that I captured when measuring the current
drawn by a 3 kW load with my CT plugged into CT2. When
the CT was moved over to the CT1 port, the resulting output looked almost identical but with the
'1' and '2' characters swapped over.
If no signals are available at the CT1 and CT2 ports, the waveforms for those channels will both be straight lines. Only the voltage signal will display a sinusiodal appearance. To check the operation of the CT1 and CT2 ports while the PCB is being tested on the bench, some suitable wiring will be needed.
Here, a standard CT has been connected to the CT1 port via a temporary connection.
The external CT normally plugs into a 3.5mm jack-socket in the wall of the enclosure. The signal gets to the PCB connector via internal wiring as shown in this image from the System Assembly page.
To check the operation of individual IO ports such as the "mode" port (D3) or the "trigger" port (D4), a simple sketch such as "blink.ino" can be used. This can be found in the Examples section of the Arduino IDE (File -> Examples -> Basics).
Here, I am checking the operation of D3 and D4 using a pair of push-on adapters.
Each one is just an LED with a series resistor (e.g. 220R)
A simple sketch to exercise D4 is on my Downloads page as "blink_dig4.ino".
Formal testing of the 4-digit display is described in the Assembly & Testing page. When checking a completed PCB in isolation, I have a functional but blemished display assembly which can be used for this purpose as shown below.
Here, my extension lead for the Serial interface is being
used to avoid putting strain on the USB/USART board which can be seen
in the foreground.
Although not evident in this photo, the display was cycling through its test sequence at the time.
When you've reached this stage, Congratulations - you now have a working main board.
* * *
If the RF facility is required, an RFM12B module will need to be fitted to the board. This device requires a power supply of 3.3V which may or may not altready be be available on the PCB.
If the processor is running at 3.3 Volts (i.e. VR1 = 3.3V), a simple wire link between the 'Vin' and 'Vout' pins at VR2 will extend this voltage to the RF module Additional links at R24 - R26 are needed to connect three of the digital control lines. With these four links in place, the board is ready for the RFM12B device to be fitted.
This board is being assembled for use with a single 3.3 V voltage regulator as described above.
Testing was achieved by connecting a linking cable to an adjacent PCB on which the power supply was present.
The on-board PSU can supply power to a second board if necessary.
With everthing else in place, the final component to be fitted is the RFM12B module. ********************************************************************************************************** Warning about the risk of Electro-Static Damage (ESD) The
RFM12B module is a static-sensitive component which could be easily
damaged if handled incorrectly. The modules that I supply have been
tested and sealed into individual anti-static pouches. Please ensure
that suitable precautions are taken when fitting this component,
particularly if working in hot dry conditions. **********************************************************************************************************
While the RF module is held in the correct place by any convenient means, e.g. a sliver of doubled-sided tape, each wire is connected as shown
in the following sequence. The next two photos were taken using a
prototype board, but the method of mounting the RF chip has not changed
First, a suitably fine wire is inserted into the hole in the PCB.
This needs to be retained by some temporary means while being soldered into place from above ...
... then, the wire is pushed down into the recess on the RFM12 and soldered into place.
Wires are only needed for 8 of the possible 14 locations as shown in the photo below.
Finally, any excess wire is trimmed away from both above and below the board.
All of the components for the RF stage have now been fitted.
To avoid any possible confusion, it's a good idea to write the frequency of the module onto the PCB.
Of the eight wires that are connected to the RFM12 module, five are for digital IO ports D2 and D10 - D13) which are then dedicated for this purpose. The remaining three wires are for the power rails and the aerial.
While checking the performance of an RF module, a temporary aerial can be easily made by resting a suitable length of wire in the centre of the SMA socket.
A quarter-wave aerial for 433 MHz is 164 mm; for 868 Mhz it is 82 mm.