This is only a preview of the July 2004 issue of Silicon Chip. You can view 37 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Versatile Micropower Battery Protector":
Items relevant to "Appliance Energy Meter, Pt.1":
Items relevant to "Remote Control For A Model Train Layout":
Purchase a printed copy of this issue for $10.00. |
Pt.1: By JOHN CLARKE
Control your power costs with the:
ENERGY METER
Have you recovered from the shock of
receiving your last power bill? Have you
resolved to reduce your electricity usage?
This Energy Meter lets you accurately
monitor energy usage for individual
appliances and even figures out what it
costs to run them.
I
F YOU WANT to save power and
reduce costs, you need to know
how much power each appliance
uses over a period of time. Most appliances don’t run all the time, so you
need to know the power they use while
they are actually running and how
30 Silicon Chip
much they use over the longer term.
The easiest way to determine that
is to use an electronic power meter
and this new “Energy Meter” fits the
bill nicely. It displays the measured
power in Watts, the elapsed time and
the total energy usage in kWh. In ad-
dition, it can show the energy cost in
dollars and cents. As a bonus, it also
includes comprehensive brownout
protection.
One obvious use for this unit it to
show refrigerator running costs over
a set period of time, so that you can
quickly determine the effect of different thermostat settings. Alternatively,
it could be used to show the difference in energy consumption between
the summer months and the winter
months.
If you have a solar power installation, this unit will prove invaluable.
It will quickly allow you to determine
which appliances are the most “power
hungry”, so that you can adjust your
energy usage patterns to suit the capacity of the installation. And there are
siliconchip.com.au
lots of other uses – for example, the
unit could be used to determine the
cost of pumping water, the running
costs of an aquarium or even the cost
of keeping your TV set on standby
power, so that it can be switched on
via the remote control.
Standby power
The cost of standby power is something that most people never think
about. However, there are lots of appliances in your home that continuously
consume power 24 hours a day, even
when they are supposedly switched
off. These appliances include TV sets,
VCRs, DVD players, hifi equipment
and cable and satellite TV receivers.
They remain on standby so that they
are ready to “power up” in response to
a command from the remote control.
Then there are those devices that are
powered via a plugpack supply. These
devices include modems, some printers, portable CD players and battery
chargers (eg, for mobile telephones).
However, simply switching these
devices off when not in use is not
the complete answer because their
plugpacks continue to draw current
– unless, of course, they are switched
off at the wall socket.
Some high-power appliances also
continue to draw current when they
are not being used. For example, most
microwave ovens have a digital clock
which operates continuously and the
same applies to some ovens. Typically,
the standby power usage for each of
these appliances is about 2W.
What else? Well, let’s not forget
computers. Then there are those appliances which must always be on, otherwise there’s no point having them.
These include cordless telephones,
digital alarm clocks, burglar alarms
and garage door openers. Do a quick
audit of your house – you will be quite
surprised at how many appliances you
have that are either permanently powered or operating on standby power.
By using the Energy Meter, you can
quickly monitor these devices and
find out which are the energy wasters.
Perhaps when you learn the results,
you will be persuaded to turn some of
these devices off at the wall or even do
away with them altogether!
that, when it’s not being used to check
energy consumption, the unit can be
used to provide brownout protection
for a selected appliance.
Basically, a brownout occurs when
the mains voltage goes low (ie, much
lower than the nominal 240VAC)
due to a supply fault. This can cause
problems because motor-driven appliances (eg, washing machines, airconditioners, dryers, refrigerators,
freezers and pumps) can be damaged
by a low mains supply. If the supply
voltage is low, the motor can fail to
start (or stall if it’s already running)
and that in turn can cause the windings
to overheat and burn out.
In operation, the SILICON CHIP Energy meter can switch off power to
an appliance during a brownout and
restore power when the power is returned to normal. The power can either
be restored immediately the brownout
condition ends or after a delay of 1824 minutes. This delay feature is ideal
for use with refrigeration equipment,
as it allows the refrigerant to settle
if the brownout occurred during the
cooling cycle.
Using the Energy Meter
As shown in the photos, the SILICON
CHIP Energy Meter is housed in a rugged plastic box with a clear lid. This
plastic case is important because the
internal circuitry operates at mains
Main Features
•
•
•
•
•
•
•
•
•
•
Displays power in Watts
Displays energy usage in
kWh
Displays measurement period
in hours
Displays energy cost in
dollars and cents
Brownout detection and
power switching
LCD module shows several
readings simultaneously
Calibration for power, offset
and phase
Adjustment of cents/kWh for
cost reading
Adjustment of brownout voltage threshold, calibration,
hysteresis & duration.
Optional delayed return of
power after brownout is
restored to normal voltage
potential. Two 10A mains leads are
fitted to the unit – one to supply power
from the mains and the other to supply
power to the appliance.
The unit is easy to use: simply plug
it into the mains and plug the appliance into the output socket.
The unit is easy
to build, with all
parts mounted on
two PC boards. Pt.2
next month has the
assembly details.
Brownout protection
A bonus feature of the SILICON
CHIP Energy Meter is the inclusion
of brownout protection. This means
siliconchip.com.au
July 2004 31
Specifications
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Wattage resolution ......................................................................... 0.01W
•
•
Zero Offset adjustment .................................... 0.12% of reading per step
Maximum wattage reading ....................................................... 3750.00W
Kilowatt hour resolution ................................................. 1Wh (0.001kWh)
Maximum kWh reading ..................................................... 99999.999kWh
Cost/kWh resolution .....................................................................0.1 cent
Maximum cost/kWh reading ...................................................... $9999.99
Cost/kWh setting from ...........................................................0-25.5 cents
Timer resolution............................................................... 0.1h (6 minutes)
Maximum timer value .................................................................. 9999.9h
Timer accuracy (uncalibrated) typically ........................................ ±0.07%
Maximum load current .................................................... 10A (15A surge)
Reading linearity ............................................. 0.1% over a 1000:1 range
Frequency range of measurement ......................................40Hz to 1kHz
Battery current drain during back-up ............................................... 10mA
Accuracy .............................Depends on calibration (error can be <0.5%)
Accuracy drift with temperature ............................................... 0.002%/°C
Brownout voltage detection accuracy after calibration ...................... ±2%
Brownout return delay ........................................................18-24 minutes
Wattage calibration adjustment ................... 0.0244% of reading per step
(±2048 steps)
Current monitoring resistance .......... 1% tolerance, 20ppm/°C coefficient
An LCD display is visible through
the lid of the case and the only exposed
parts are four mains-rated switches.
These switches are used to set the display modes, reset values and (initially)
to set the calibration values.
In use, the Energy Meter is simply connected in-line between the
mains supply and the appliance to be
monitored. The LCD shows two lines
of information and this information
includes: (1) the elapsed time; (2)
the power consumption in watts; (3)
brownout indication; and (4) the energy consumption in kWh (kilowatthours).
The elapsed time is shown on the
top, lefthand section of the display and
is simply the time duration over which
the energy has been measured. This is
shown in 0.1 hour increments from
0.1h (ie, 6 minutes) up to 9999.9h.
That latter figure is equal to just over
416 days or 1 year and 51 days, which
should be more than enough for any
application!
32 Silicon Chip
After it reaches this maximum
elapsed time, the unit automatically
begins counting from 0.0h again. Alternatively, the timer can be reset to
0.0h at any time by pressing the Clear
switch.
The power consumption figure
(watts) is displayed to the right of the
elapsed time and is updated approximately once every 11 seconds. This
has a resolution of 0.01W, with a maximum practical reading of 3750.00W
(ie, equal to the power drawn by a 15A
load with a 250V supply). A 10A load
will give a reading of about 2400W,
depending on supply voltage.
Immediately beneath this figure
is the total energy consumption (in
kWh) since the measurement started.
This has a range from 0.000kWh to
99999.999kWh, with a resolution of
1Wh. The maximum value represents
over 4.5 years of energy consumption for an appliance drawing 2500W
continuously.
This reading can be reset to
0.000kWh by pressing the Clear
switch. In this case, the switch must
be held closed for about four seconds
before the RESET is indicated on the
display.
Finally, brownout indication is
shown in the lower lefthand section
of the display. It displays “SAG” if the
mains level drops below the selected
voltage for a set time, with the unit
also switching off the power to the
connected appliance.
Alternatively, under normal power
conditions (ie, no brownout), the SAG
display is blanked and power is supplied to the appliance.
Function switch
Pressing the Function switch on
the front panel changes the display
reading, so that the energy reading is
shown in terms of cost instead of kWh.
Once again, this reading can be reset
to $0.00 by pressing the Clear switch.
The maximum reading is $9999.99
but this is unlikely to ever be reached.
Pressing the Function switch again
toggles the energy reading to kWh
again.
Holding down the Function button
switches the Energy Meter into its
calibration modes. There are eight
adjustment modes available here
and these can be cycled through by
holding the button down or selected
in sequence with each press of the
Function switch. We’ll take a closer
look at the various calibration modes
in Pt.2 next month.
Making power measurements
OK, now that we’ve looked at the
main functions of the Energy Meter,
let’s see how we go about making
power measurements.
In operation, the Energy Meter measures the true power drawn by the load.
It is not affected by the shape of the
waveform, provided that the harmonics do not extend above 1kHz and the
level does not overrange.
In a DC (direct current) system, the
power can be determined by measuring the applied voltage (V) and the
current (I) through the load and then
multiplying the two values together
(ie, P = IV). Similarly, for AC (alternating current) supplies (eg, 240V mains),
the instantaneous power delivered to
a load is obtained by multiplying the
instantaneous current and voltage
values together. However, that’s not
the end of the story when it comes to
siliconchip.com.au
average power consumption, as we
shall see.
Fig.1 shows a typical situation
where the current and voltage waveforms are both sinewaves and are in
phase with each other (ie, they both
pass through zero at the same time).
In this case, the instantaneous power
waveform is always positive and
remains above zero. That’s because
when we multiply the positive-going
voltage and current signals, we get a
positive result. Similarly, we also get
a positive value when we multiply
the negative-going voltage and current
signals together.
The average (or real) power is represented by the dotted line and can
be obtained by filtering the signal
to obtain the DC component. In the
case of in-phase voltage and current
waveforms, it can also be obtained by
measuring both the voltage and the
current with a meter and multiplying
the two values together. For example,
the voltage shown in Fig.1 is a 240V
RMS AC waveform and this has a peak
value of 339V. The current shown is
10A RMS with a peak value of 14.4A.
Multiplying the two RMS values
together gives 2400W, which is the
average power in the load.
Note that, in this case, the power
value is the same whether we average the instantaneous power signal
or multiply the RMS values of the
voltage and current. Multimeters are
calibrated to measure the RMS value
of a sinewave, so if a sinewave has a
peak value of 339V, the meter will read
the voltage as 240V (ie, 0.7071 of the
peak value).
For non-sinusoidal waveforms,
only a “true RMS” meter will give
the correct voltage and current readings. RMS is shorthand for “root mean
square”, which describes how the
value is mathematically calculated. In
practice, the RMS value is equivalent
to the corresponding DC value. This
means, for example, that if we apply
1A RMS to a 1Ω load, the power dissipation will be 1W – exactly the same
as if we had applied a 1A DC current
to the load.
The waveforms in Fig.1 are typical
of a load that is purely resistive, where
the current is exactly in phase with the
voltage. Such loads include electric
light bulbs and electric radiators.
By contrast, capacitive and inductive loads result in out-of-phase voltage and current waveforms. If the
siliconchip.com.au
Fig.1: this graph shows the voltage (V) and current (I) waveforms in phase
with each other. Note that the instantaneous power is always positive for
this case.
load is capacitive, the current will
lead the voltage. Alternatively, if the
load is inductive, the current will lag
the voltage.
Inductive loads include motors and
fluorescent lamps. The amount that
the current leads or lags the voltage is
called the power factor – it is equal to
1 when the current and voltage are in
phase, reducing to 0 by the time the
current is 90° out of phase with the
voltage. Calculating the power factor
is easy – it’s simply the cosine of the
phase angle (ie, cosφ).
Lagging current
Fig.2 shows the resulting waveforms
when the current lags the voltage by
45°. In this case, the resulting instantaneous power curve has a proportion
of its total below the zero line. This
effectively lowers the average power,
since we have to subtract the negative
portion of the curve from the positive
portion.
And that’s where the problems start.
If we now measure the voltage (240V)
and current (10A) using a multimeter
and then multiply these values together, we will obtain 2400W just as
before when the two waveforms were
in phase. Clearly, this figure is no
longer correct and the true power is,
in fact, much lower, at 1697W.
This discrepancy arises because the
power factor wasn’t considered. To
correct for this, we have to multiply
our figure of 2400W by the power factor (ie, cos45° = 0.7071). So the true
power is 2400 x 0.7071 = 1697W.
These calculations become even
more interesting when the current
leads or lags the voltage by 90° as
shown in Fig.3 – ie, we have a power
factor of 0. In this case, the voltage and
current waveforms still measure 240V
July 2004 33
Fig.2: here’s what happens when the current lags the voltage by 45°. In this
case, the resulting instantaneous power curve has a proportion of its total
below the zero line, effectively lowering the average power.
and 10A respectively when using a
multimeter but the power dissipation
is now zero. This is because the same
amount of instantaneous power is both
above and below the zero line.
This means that even though there
is 10A of current flowing, it does not
deliver power to the load!
Alternatively, we can use our formula to calculate the true power dissipation in the load. In this case, we
get 240 x 10 x Cos90° = 0 (ie, cos90°
= 0). So once again, we get a power
dissipation of 0W, despite the fact that
the current is 10A and we have 240V
applied to the load.
Other waveform shapes such as
produced by phase control circuits,
where the waveform is “chopped”,
present even more difficulties when
it comes to making power measurements. However, the SILICON CHIP Energy Meter overcomes these problems
34 Silicon Chip
by averaging the instantaneous power
signal over a set interval (11s) to obtain
the true power.
The result is an accurate power
measurement which takes into account
the phase angle and the shapes of the
voltage and current waveforms.
Converting the measured power dissipation (Watts) into energy consumption (kWh) is straightforward. This is
simply the average power used by the
appliance over a 1-hour period. So if an
appliance draws 1000W continuously
for an hour, its energy consumption
will be 1000Wh, or 1kWh.
Specialised IC
The SILICON CHIP Energy Meter is
based on a special “Active Energy
Metering IC” from Analog Devices,
designated the ADE7756AN. Fig.4
shows the main internal circuit blocks
of this IC and also shows how it has
been connected to the mains, to make
voltage and current measurements.
As can be imagined, the internal operation of this IC is quite complicated
and it has a host of features, some of
which are not used in this design. If
you want to find out more about this
IC, you can download a complete
data sheet (as a pdf file) from www.
analog.com.
Most of the features and adjustments available in the ADE7756AN
IC are accessed via a serial interface.
This communications interface allows
various registers to be accessed and
altered and also allows them to receive
processed data.
As shown on Fig.4, there are two
input channels – one to monitor the
voltage and the other for the current.
Amplifier 1 (Amp1) is used to monitor
the load current but it doesn’t do this
directly. Instead, it monitors the voltage
developed by passing the load current
through a 0.01Ω resistor (R1).
The maximum dissipation within
this resistor at 10A is 1W, which gives
an expected 30°C temperature rise
above ambient. For this reason, we
have specified a low-temperature coefficient resistor to minimise resistance
changes as the temperature rises.
In operation, Amp1 can be set for
a gain of 1, 2, 4, 8 or 16 and for a
full-scale output of 1, 0.5 or 0.25V.
These values are set by writing to the
appropriate registers within the IC
via the serial communication lines. In
this circuit, the gain is set at 1 and the
full-scale output at 250mV.
The 250mV range was chosen to
suit the 100mV RMS (141.4mV peak)
that’s developed across resistor R1
when 10A is flowing through the load
(which is in series). It also allows sufficient headroom for a 15A current to
be measured – equivalent to 150mV
RMS across R1, or 212mV peak.
Amp2 is similar to Amp1 except that
its full-scale output voltage is fixed at
1V. Only the gain can be set and in this
case, we have set the gain of 4.
As shown, the Active input from
the mains is divided down using a
2.2MΩ and 1kΩ resistive divider. This
divided output is at 113.5mV RMS
(161mV peak) for a 250V input and
this is then fed directly to Amp2. As
a result, the signal level at the output
will be 454mV RMS, or 644mV peak,
well within the 1V full-scale output
capability of this stage.
The circuit is even capable of casiliconchip.com.au
tering for situations where the mains
voltage reaches 280V RMS (396V
peak). In this case, the voltage from
the resistive divider will be 180mV
peak, which gives 720mV peak at the
amplifier’s output.
Both Amp1 and Amp2 have provision to zero the offset voltage at their
output (this is the voltage that appears
at the output when the amplifier’s
inputs are both at ground or 0V). Of
course, an ideal amplifier would have
an output offset of 0V but that doesn’t
happen in practice.
In this application, however, we
don’t have to worry about trimming
out the offset voltages because a highpass filter is included in the signal
chain (following multiplier 1). This
filter prevents the offsets from affecting the power reading but note that
offset adjustment would be required
to accurately measure DC power in
other circuit applications.
A/D converters
The output signals from the amplifier stages are converted to digital values using separate (internal) analog-todigital converters (ADC1 & ADC2). For
those interested in the specifications
of this conversion, the sampling rate is
894kHz and the resolution is 20 bits.
An analog low-pass filter at the front
of each ADC rolls off signals above
10kHz, to prevent errors in the conversion process which might otherwise
occur if high-frequency signals were
allowed to pass into the ADC.
The output of each ADC is then
Fig.3: it gets even more interesting when the current lags (or leads) the
voltage waveform by 90°. In this case, the voltage and current waveforms
still measure 240V and 10A respectively but the average power dissipation
is now zero. This is because the same amount of instantaneous power is
both above and below the zero line.
Fig.4: this block diagram shows the main components of the ADE7756AN Active Energy Metering IC and shows how
it is connected to the 240VAC mains supply. Two internal op amp circuits monitor the current (Amp 1) and voltage
(Amp 2) signals and the sampled values are then fed to separate analog-to-digital converters.
siliconchip.com.au
July 2004 35
36 Silicon Chip
siliconchip.com.au
Fig.5: the circuit uses a PIC microcontroller to process the data from the ADE7756AN Active Energy Metering IC and to drive the LCD module.
digitally filtered with a low-pass filter
to remove noise. This filter does not
affect 40Hz to 1kHz signals but rolls off
frequencies above about 2kHz.
Next, ADC1’s output is applied to a
multiplier. This stage alters the digital
value fed into it according to a “gain
adjust” value that’s applied to the
multiplier’s second input. This gain
adjust value can be changed by writing
to this register and in our circuit, it’s
used to calibrate the wattage reading
to its correct value.
A High-Pass Filter (HPF) stage is
then used to process the adjusted signal from the multiplier. This removes
any DC offsets in the digital value and
applies the resulting signal to one
input of Multiplier 2.
ADC2 operates in a similar manner
to ADC1 and also includes a low-pass
filter (LPF) stage. Another LPF stage
then rolls off the signal at frequencies
above about 156Hz. This effectively removes any extraneous high-frequency
components in the signal before it is
fed to the SAG detection circuit. This
detection circuit monitors the voltage
level and outputs a SAG signal if the
voltage drops below the level set in
the SAG register.
As well as going to the LPF stage, the
signal from ADC2 is also fed to a phase
compensation circuit (Phase Adjust).
This stage can change the signal phase
relative to the signal from ADC1 and is
included to compensate for any phase
differences which may be caused by
any current and voltage-measuring
transducers (not applicable here).
Immediately following this stage,
the signal is applied to the second
input of Multiplier 2. This effectively
multiplies the current and voltage
signals to derive the instantaneous
power value. This is then filtered using another low-pass filter, to produce
a relatively steady value, although it
does allow some ripple in the output
since it does not completely attenuate
AC signals and only rolls off signals
above 10Hz.
The resulting power value is then
mixed in the Offset Comparator with
an offset adjustment, to give a zero
reading when there is no current flowing through R1. Its output is stored in
the Waveform Register, the contents of
which are continuously added to the
Active Energy register at an 894kHz
rate.
Finally, the data in the Active Energy Register can be retrieved via the
siliconchip.com.au
WARNING!
This circuit is directly connected to the 240VAC mains. As such, all
parts may operate at mains potential and contact with any part of the
circuit could prove FATAL. This includes the back-up battery and all
wiring to the display PC board.
To ensure safety, this circuit MUST NOT be operated unless it is fully
enclosed in a plastic case. Do not connect this device to the mains with
the lid of the case removed. DO NOT TOUCH any part of the circuit unless the power cord is unplugged from the mains socket.
This is not a project for the inexperienced. Do not attempt to build it
unless you know exactly what you are doing and are completely
familiar with mains wiring practices and construction techniques.
Serial Data Interface. Note that the
values retrieved from this register
will vary, because of the ripple allowed through the LPF at the output
of Multiplier 2. However, these variations are less noticeable if the period
between each retrieval is made as long
as possible, so that any ripple can be
integrated out over time.
For this reason, we have selected a
retrieval interval of about 11 seconds
and this removes most of the variation.
That’s about the maximum practical
limit, as a longer period could cause
the register to overrange when high
powers are being measured.
Circuit details
OK, so the way in which the
ADE7756AN chip works is rather complicated. Fortunately, we don’t have
to worry too much about this, since
the complicated stuff is all locked up
inside the chip.
Refer now to Fig.5 for the full circuit
details. Apart from the ADE7756AN
chip (IC1), there’s just one other IC
in the circuit – a PIC16F628A microcontroller (IC2). This microcontroller
processes the data from IC1 and drives
the LCD display module. And that’s
just about all there is to it – apart from
the power supply circuitry and a few
other bits and pieces.
IC1 operates at 3.58MHz as set by
crystal X1 and this frequency determines all the other operating rates,
such as ADC sampling and the phase
variation. In addition, the device operates from a single +5V supply rail,
although its inputs at pins 4, 5, 6 & 7
can go below the 0V level.
In operation, the sampled current
and voltage waveforms are applied to
the balanced inputs of the internal amplifiers – ie, to V1+ and V1- for Amp1
(current) and to V2+ and V2- for Amp2
(voltage). These balanced inputs are
provided so that any common mode
(ie, noise) signals at the inputs are
cancelled out.
However, in order to do this, both
inputs to each amplifier must have
the same input impedance and signal
path. So, for the voltage signal, both
inputs of Amp2 are connected to a
2.2MΩ and 1kΩ voltage divider and
these in turn are connected across the
Active and Neutral lines.
Similarly, the current monitoring
inputs are both connected to series
0.01Ω and 1kΩ resistors but note that
only one of these (ie, R1) carries the
load current. This resistor is rated at
3W, while the non-load current carrying resistor (R2) simply consists of a
short length of fine-gauge copper wire.
R2 is necessary to mimic the noise
picked up by R1.
All inputs are filtered to remove
high-frequency hash above about
4.8kHz by connecting 33nF capacitors
to ground (ie, from pins 4, 5, 6 & 7).
Note that the whole circuit is referenced to the mains Neutral, with the
0V rail for both IC1 and IC2 connected
to this line. However, because the circuit
is connected directly to the mains, it must
be treated as live and dangerous (as can
happen if Active and Neutral are transposed in the house wiring – eg, the power
point is wired incorrectly).
IC1’s reference voltage at pin 9 is filtered using parallel-connected 100µF
and 100nF capacitors. This provides a
stable reference voltage for the ADCs
and is typically 2.4V. However, variations between individual ICs could
result in a reference voltage that’s 8%
above or below this value but this is
taken care of by the calibration procedure.
July 2004 37
Fig.6: the top trace in this scope shot is the voltage that
appears on pin 7 of IC1 (TP2). This is the sampled mains
voltage from the 2.2MΩ and 1kΩ resistive divider. The
lower trace is the current waveform at pin 4 of IC1,
resulting from a 4.3A load. This produces a 43.45mV
RMS signal across the 0.01Ω current sensing resistor (R1).
Fig.7: this scope shot, captured at the output of the Energy
Meter, shows the operation of the brownout feature. In
this case, the brownout protection is set to switch off
below 203V RMS (288V peak) and power is restored only
when the voltage increases by the hysteresis level (35V
RMS or 50V peak) – ie, to 238V RMS.
WARNING: these two scope waveforms are shown to explain the
operation of the circuit. DO NOT attempt to monitor these waveforms
yourself – it is too dangerous.
The SAG output appears at pin 13
and is normally held high via a 1kΩ
pull-up resistor. This, in turn, holds
Mosfet Q1 on and so relay RLY1 is also
normally on (assuming link LK1 is in
position). Conversely, when a power
brownout occurs, the SAG output
goes low and Mosfet Q1 and RLY1
both turn off.
The SAG output from IC1 also
drives RA1 (pin 18) of IC2 and this
does two things. First, it “instructs”
the microcontroller to send the SAG
indication data to the LCD display
when a brownout is detected. Second,
it allows IC2 to provide the optional
delayed turn-on feature after a brownout via RB0 and LK2 (ie, LK2 used
instead of LK1).
When the SAG output goes low,
RB0 also immediately goes low and
turns off Q1 as before. However, when
the brownout ends, RB0 remains low
and only goes high again after an 1824 minute delay to switch on Q1 and
RLY1 and thus restore power to the
appliance.
Note that the relay contacts are
used to break the power to the load
by opening the Active connection.
When there is no brownout, the relay is
energised and the supply is connected
to the load.
38 Silicon Chip
IC1 also connects to IC2 via its serial
interface and these lines are labelled
Data In, Data Out, Serial Clock and
Chip Select (pins 20, 19, 18 & 17,
respectively). In operation, IC2 uses
these lines to program the registers
within IC1 and to retrieve the monitored power data.
Microcontroller IC2 also drives the
LCD module using data lines RB7-RB4.
These lines also connect respectively
to switch S4 (direct) and to switches
S3-S1 via diodes D3-D5. These diodes
are necessary to prevent the data lines
from being shorted together if more
than one switch is pressed at the
same time.
In operation, IC2 can determine if
a switch is closed (ie, pressed) by first
setting its RB7-RB4 data lines high and
then checking the RB3 input which
connects to the commoned side of
the switches. If none of the switches
is pressed, the RB3 input will be held
low via the associated 10kΩ resistor
to ground. Conversely, if a switch is
pressed, the RB3 input will be pulled
high via that switch (and its associated
diode, if present).
The microcontroller then determines which switch is closed by setting all data lines low again and then
setting each data line high (and then
low again) in sequence. The closed
switch is the one that produces a high
at RB3.
IC2’s RA2 & RA0 outputs (pins 1
& 17) control the register select (RS)
and enable (EN-bar) inputs on the LCD
module, to ensure that the data is correctly displayed. Trimpot VR1 adjusts
the LCD’s contrast by setting the voltage applied to pin 3 of the module.
A 4MHz crystal (X2) sets IC2’s clock
frequency. This crystal determines
the accuracy of the 0.1hr timer and
the watt-hour calibration. However,
frequency adjustment has not been included since the crystal’s untrimmed
accuracy is better than the accuracy
provided by IC1 for the wattage reading.
Power supply
Power for the circuit is derived from
the mains via transformer T1. Its 12.6V
AC secondary output is rectified using
bridge rectifier BR1 and the resulting
DC rail filtered using a 1000µF capacitor. This rail is then fed through
rectifier diode D1, filtered using a
100µF capacitor and fed to 3-terminal
regulator REG1.
REG1 provides a stable +5V rail for
IC1, IC2 and the LCD module. Note,
however, that this +5V rail must also be
regarded as being at mains potential (as
must all other parts in this circuit, including the back-up battery). It might have a
low DC voltage but it can also be sitting
at 240VAC!
Note also that we have specified a
siliconchip.com.au
low dropout regulator here and this
has been done for two reasons. First,
it allows the +5V rail to be maintained
for as long as possible when the mains
supply falls – important for maintaining the supply during a brownout.
Second, this regulator was designed
for automotive use and is capable of
suppressing transient voltages of up
to 60V at its input.
This latter feature is useful for
mains supply circuits, where there
are likely to be transients during
lightning storms. In addition, a Metal
Oxide Varistor (MOV) connected between Active and Neutral at the mains
input has been included to suppress
transient voltages above the normal
mains supply.
The supply rail for relay RLY1 is
derived from the output of the bridge
rectifier (BR1). This rail is fed to the
relay via a 68Ω 1W resistor, which
reduces the voltage to about 12V.
Diode D6 protects Mosfet Q1 from
damage by quenching any back-EMF
voltage spikes that are generated when
RLY1 turns off.
Back-up battery
An optional 9V back-up battery has
also been included in the power supply and this is connected to REG1’s input via diode D2. This back-up power
is useful if the energy consumption of
an appliance is to be measured over
a long period of time (eg, weeks or
months), since it maintains the active
energy register values and allows the
timer to continue counting if there is
a blackout.
You can use either a standard battery or a rechargeable nicad battery
to provide back-up power. If a nicad
battery is used, resistor (R3) is installed
to provide trickle charging from the
output of D1.
Most applications will not require
battery back-up, since you will just
want to measure the energy consumption over a relatively short period.
In this case, the accumulated energy
reading will be lost when the mains
power is switched off. However, all the
settings (ie, the SAG parameters, offset
and power calibration, cost per kWh
and phase, etc) are retained when the
mains power is off, as these are stored
in a permanent memory.
That’s all we have space for this
month. Next month, we will give the
complete construction and calibration
SC
details.
siliconchip.com.au
Parts List
1 PC board, code 04107041,
138 x 115mm
1 display PC board, code
04107042, 132 x 71mm
1 front panel label, 138 x 115mm
1 sealed ABS box with clear lid,
165 x 125 x 75mm (Altronics
H0328 or equivalent)
1 12.6V 7VA mains transformer
(Altronics M2853L) (T1)
1 12V SPDT 30A 250VAC relay
(Altronics S4211) (RLY1)
1 LCD module (DSE Z 4170,
Altronics Z 7000A, Jaycar QP
5515)
1 S20K 275VAC Metal Oxide
Varistor (MOV)
1 3.58MHz crystal (X1)
1 4MHz crystal (X2)
1 18-pin DIL socket (for IC2)
1 M205 safety fuse holder (F1)
(Jaycar SZ-2028 or equivalent)
1 M205 10A fast blow fuse
1 2-metre or 3-metre mains
extension cord
2 cordgrip grommets for 6mm
diameter cable
4 mains-rated pushbutton
momentary-close switches
(Jaycar SP 0702)(S1-S4)
1 4-way 0.1-inch pitch pin header
1 6-way 0.1-inch pitch pin header
1 4-way 0.1-inch header plug
1 6-way 0.1-inch header plug
4 stick-on rubber feet
1 9V battery (optional – see text)
1 connector plug & lead for 9V
battery (optional, see text)
1 U-shaped bracket to suit 9V
battery (optional, see text)
1 M3 x 6mm screw (optional)
1 M3 metal nut (optional)
6 M3 x 10mm Nylon countersunk
screws
2 M2 x 9mm Nylon screws
4 M2 Nylon nuts
6 M3 x 12mm tapped Nylon
spacers
7 M3 x 6mm screws
1 M3 x 12mm screw
5 M3 metal nuts
5 M3 star washers
1 14-way single in-line pin header
(for Altronics and DSE LCD
module); or
1 7-way dual in-line header (for
Jaycar LCD Module)
1 3-way single in-line header
1 shorting plug for header
1 3mm diameter solder lug
3 6.4mm insulated spade connectors
2 2.8mm spade connectors
1 100mm length of 4-way
rainbow cable
1 100mm length of 6-way
rainbow cable
1 40mm length of 0.2mm
enamelled copper wire
1 400mm length of 0.7mm tinned
copper wire
1 150mm length of hookup wire
1 50mm length of 16mm
diameter heatshrink tubing
1 50mm length of 2.5mm diameter heatshrink tubing
1 50mm length of 6mm diameter
heatshrink tubing
5 50mm long cable ties
12 PC stakes
Semiconductors
1 ADE7756AN Active Energy
Metering IC (IC1)
1 PIC16F628A-20P programmed
with wattmetr.hex (IC2)
1 LM2940CT-5 low dropout 5V
regulator (REG1)
1 STP30NE06L logic Mosfet (Q1)
1 W04 1.2A bridge rectifier
(BR1)
3 1N4004 1A diodes (D1,D2,D6)
3 1N914, 1N4148 diodes
(D3-D5)
Capacitors
1 1000µF 25V PC electrolytic
1 100µF 25V PC electrolytic
4 100µF 16V PC electrolytic
1 10µF 16V PC electrolytic
3 100nF MKT polyester
4 33nF MKT polyester
1 1nF MKT polyester
4 33pF NPO ceramic
Resistors (0.25W 1%)
2 2.2MΩ 1W 400V
1 10kΩ
5 1kΩ
1 680Ω 0.5W (install only if backup battery is rechargeable)
1 68Ω 1W
1 10Ω
1 .01Ω 3W resistor (Welwyn
OAR-3 0R01) (Farnell 3274718) (R1)
1 10kΩ horizontal trimpot (code
103) (VR1)
July 2004 39
|