This is only a preview of the October 2017 issue of Silicon Chip. You can view 34 of the 104 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 "0.01Hz - 6+GHz touchscreen frequency meter, Part 1":
Items relevant to "El Cheapo Modules Part 10: GPS receivers":
Items relevant to "One hour project: Kelvin – the very clever cricket":
Items relevant to "3-way Active Crossover for speakers, Part 2":
Items relevant to "Deluxe eFuse, Part 3: using it!":
Purchase a printed copy of this issue for $10.00. |
Higher power, loads more features . . .
Deluxe
Deluxe
Touchscreen
e Fu
Fuse
se
by Nicholas Vinen
Part 3: final assembly and operation
Having built the PCB assembly for our Deluxe Touchscreen eFuse and performed
some basic tests, we’re going to conclude the story by attaching the six chunky
binding posts, attaching the classy matte black laser-cut lid and fitting it into its
case. We’ll also show some screen grabs and explain how to use the unit and
operate its touchscreen interface.
A
t the end of part two in the August issue, we left off
with a fully assembled and tested unit needing only
to be put into its case. The photo below shows how
the finished assembly is mounted to the lid. This shows
the terminals attached to a bare PCB so that you can clearly
see the mounting arrangement.
Start by removing the washers, nuts and lower half of
the plastic shell from each binding post. Feed each binding post through from the top of the lid, with the four red
posts in the corners and two black posts in between.
Place the other half of the plastic shell on the underside
of the lid and rotate the top and bottom halves until they
slip into the locking slots in the lid.
Now slide an M8 spring washer onto the screw shaft,
followed by a flat washer, and then screw on one of the
nuts that you took off the binding post to hold it in place.
Once you’ve attached all six binding posts in this way,
remove the four screws holding the touchscreen onto the
The basic mounting arrangement showing how
the PCB (in this case without components)
attaches to the display PCB via four threaded
stand-offs. The six heavy-duty binding post
terminals attach to both the front panel and
then directly to the PCB, as shown here. It is
imperative that the terminals make intimate
contact with the PCB tracks and pads.
76
Silicon Chip
Celebrating 30 Years
siliconchip.com.au
Fig.1: touching the fuse trip current value brings up this
keypad which allows you to enter a new trip current value.
It can be specified in amps or milliamps and the “X” button
cancels the entry, retaining the pre-existing value.
Fig.2: this settings screen is brought up by touching the
main screen at left centre and allows you to adjust the
LCD backlight brightness, auto-off timeout (which can be
disabled) and output start-up state.
eFuse PCB but leave the screen in place. Feed each screw
(8-10mm long) through the screen mounting holes in the
top of the lid, then place the 1mm thick Nylon spacers carefully on top of the four corresponding holes on the touchscreen module PCB.
Then slide the six binding post screws through the corresponding holes on the eFuse PCB and carefully lower
the lid down into place. Be careful not to bump the Nylon
washers out of place, then loosely attach the four screws
to the tapped spacers below.
Next, check that the unit is sitting flush on the lid and
the nuts holding the binding posts are just resting on top
of the PCB surface in each case. Tighten or loosen these
nuts as necessary, then do up the four screen mounting
screws properly.
Ensure that none of the large nuts short out any adjacent
components (the board is designed with sufficient clearance – just – but it’s best to check).
Finally, fit the remaining binding post nuts onto the shafts
and tighten them up to make good electrical contact with
the PCB pads, as well as holding the PCB assembly firmly
in place. You can now apply power and check that everything is working before screwing the whole assembly into
the bottom of the case using four black self-tapping screws.
being physically close to the actual inputs themselves.
If there is no voltage applied to the V- input, its reading
should be close to zero, as it is here.
Immediately to the right of these voltage readings, the
instantaneous (short-term averaged) current readings are
shown for both the positive and negative outputs. If those
outputs are off (as they are by default at power-up), then
the word “off” appears instead.
The outputs can be switched on and off by simply touching the upper and lower right-hand corners of the screen.
If they are linked (shown by an unbroken line between
them, along the right edge of the screen) then they will be
switched together and they will also trip off simultaneously
if either exceeds the programmed current limit. They can
be linked or unlinked by touching the centre right edge of
the display.
The trip current and speed are shown at centre right.
The speed is either “Slow”, “Medium” or “Fast” and can
be changed simply by touching it; it will cycle through the
three possible settings. The trip current is shown above this
and you can change it by touching it.
This will bring up a keypad, allowing you to enter a new
value in amps or milliamps (see Fig.1). It takes effect immediately after you have finished setting it. If you change
your mind, you can cancel and the old setting will be retained.
Note that while making these changes, if the
output(s) are still switched
on, the unit will continue to
operate as normal and protect the load(s). It uses the
pre-existing setting as the
trip threshold until you have
finished setting a new one.
Using the unit
The operation of the software has been changed
slightly since our last article,
so what we describe below is
slightly different from what
we stated in the last article.
The photo opposite (top)
shows the eFuse with its
main screen, which appears
immediately after power up.
This is the default screen
and shows all the relevant
parameters which are constantly updated. The input
voltages are shown in the
upper left and lower left An end-on close-up of the heavy-duty terminals attached to
the PCB. Don’t forget the spring washers and flat washers on
corners, with their positions the terminal shafts – they help prevent them working loose.
siliconchip.com.au
Celebrating 30 Years
Fuse trip bars
Because a normal fuse or
circuit breaker will not trip
instantly when the current
flow exceeds the set threshold, the current readings
shown are a useful guide
October 2017 77
Fig.3: both voltage and both current readings can be
calibrated using this screen. It allows you to change the
scale factor and add or subtract a fixed value (offset) and
see the effects of the changes before saving them to flash.
Fig.4: if, at start-up or during operation, the V+, V+H or
V-L supply rails are not within their expected ranges, the
unit will automatically switch off its outputs and display a
screen like this until the fault clears.
but don’t necessarily indicate how close the unit is to tripping. Also, they can only update a few times per second
or they will become too difficult to read. So to give you a
better idea of what’s going on, a bar graph is shown along
the top and bottom edges of the display.
When either bar reaches the right edge of the screen, the
corresponding fuse (top = V+, bottom = V-) will trip off.
This is akin to fitting a standard fuse with a temperature
read-out and calibrating the scale so that the bottom end
is at ambient temperature and the top is at the temperature
where the fuse material will melt. So you can quickly see
how close it is to tripping and these are constantly updated.
We’re also showing temperature readings above and below the voltage readings. These are not the simulated fuse
temperatures, they are the estimated temperatures of Mosfets Q1 and Q3.
As stated in the earlier articles, the continuous current
rating of this unit is limited by the (unavoidable) heating
of those transistors. We don’t want them to be damaged so
the unit will switch the outputs off to protect them.
These estimated temperatures are used for that protection
measure. The data sheet gives a maximum operating junction temperature for the BUK7909 of 175°C (a pretty typical
figure for a Mosfet) but since we’re estimating these, to be
safe, we switch the output off above an estimated 150°C.
We take into account the increase in on-resistance with
elevated temperature and also factor in the estimated
thermal resistance of the Mosfet packages and heatsinks,
along with an estimated maximum ambient temperature
of 45°C, accounting for elevated temperatures inside the
unit’s case during operation. We also monitor the Mosfet
gate voltages, since if they drop, this will increase the onresistance and thus heating.
of the outputs tripping off. You can turn this feature off
(in the settings screen) if you don’t need it. Reducing the
backlight brightness will also reduce the quiescent current and an estimate of the burden current is shown at
centre left (although you can’t really see it when the display backlight is off).
The settings screen also lets you select the state of the
outputs when the unit is powered up. By default, they are
both off.
You can instead set them to retain the last state or to be
on by default. Retaining the last state would make sense
in a semi-permanent installation where the source power
could be lost but you want the load to come back on automatically if it was on when power was lost.
Backlight control and start-up state
Because the unit draws more power from the positive
voltage source when the screen is lit and because you may
be using it in a situation where it’s left connected longterm, the screen will by default switch off after a period of
inactivity. The backlight brightness and time-out settings
are shown at centre left and can be changed by touching
in this area. This brings up the setting screen (see Fig.2).
Touching anywhere on the screen, including areas which
do not have any effect, will reset this timer, as will either
78
Silicon Chip
Calibration
Trimpots VR1 and VR2 on the eFuse PCB allow the common mode rejection of the differential current-sensing amplifiers to be optimised but these do not allow other errors
to be adjusted out such as scale errors due to resistor tolerances, offset errors due to bias currents and offset voltages
or errors in the voltage dividers which allow the unit to
measure the input voltages.
These are instead performed digitally, using the touchscreen. All you need to do is set up the unit with a known
voltage or current and then hold your finger on the reading
which needs to be adjusted (ie, in one of the four corners of
the screen) for a couple of seconds. The display will then
change to the calibration display; see Fig.3.
This shows you the raw reading for that input, along
with two adjustments and the adjusted reading. You can
increase or decrease the scale and offset factors so that the
adjusted reading shown matches the actual reading.
Note that readings above 9.99V/9.99A are shown in the
calibration screen with an extra digit of resolution for easier adjustment.
For example, say you feed exactly 12.00V into the V+
input and you get a reading of 11.70V. Then if you feed
15.00V into V+, you might get a reading of 14.60V. This is
an error of -0.3V at 12V and -0.4V at 15V.
Since the difference in error is 0.1V with a difference in
reading of 2.9V, you can calculate the scale error as being
0.1V / 2.9V = 0.034 and so you can then increase the scale
factor to 1.034 and make the measurements again.
Celebrating 30 Years
siliconchip.com.au
This time you should find that the readings you get are
something like 12.1V for a 12V input and 15.1V for a 15V
input. Since the error is now the same in both cases, that
means we have set the scale value correctly (otherwise,
nudge it slightly up or down and try again). It’s then just a
matter of setting an offset of -0.1V and the readings should
be correct.
Press “Save” to save the calibration to flash memory.
You can then repeat this procedure so that both input
voltage and both current readings are as close as possible
to being correct.
Note that calibrating the current readings can be a little
tricky due to noise. The software is designed so that with
VR1 and VR2 adjusted correctly and the other calibration
settings made correctly, you should get a 0A reading for
both outputs with no load.
We have to take noise in the measurement system into
account when making the calculations since this is overlaid on the current measurements.
But you may find you get a non-zero reading with no
load and this is a good thing to check once you have finished calibration.
If that happens, the easiest solution is to slightly reduce
the offset setting for the relevant output(s) to bring the reading closer to zero. This may lead to a small error at higher
currents but you shouldn’t need a very large offset (hopefully well under 100mA) to get a zero reading. If you do
need a larger adjustment, that suggests that some other aspect of the calibration is off, so go back and check it again.
It is important to get the CMRR adjustment correct; if
you get a zero reading with no load with an input voltage
of say 12V but a non-zero reading at say 30V (or vice versa), that strongly suggests that the CMRR is not good and
you need to tweak VR1/VR2 to fix this, then re-check the
software calibration.
How the software works
Start-up self-checks
Fuse trip logic
While not shown on the main screen, the unit constantly
monitors the V+H and V-L voltage rails to make sure that
they come up to an appropriate voltage before it begins operation and that they do not drop to the point where the
unit will not work correctly.
If the V+ supply voltage is not high enough for the unit
to operate properly, it will not start up and will display a
message indicating this (see Fig.4).
Should V+ drop too far during operation, the outputs
will automatically be switched off and a similar message
displayed. This is to protect the unit itself, since, with a
low V+, the Mosfets could go into partial conduction, causing excessive heating.
Likewise, if a construction error prevents the V+H or V-L
voltages from coming up correctly, at power-up the unit
will refuse to operate and will display a message indicating this and showing the voltages. In this case, you will
need to switch off and check your construction.
If for some reason these voltages drop too much during
operation (eg, due to a dud component), the outputs will
again switch off and a similar message will be displayed.
Conclusion
The software for this project can be downloaded from the
SILICON CHIP website and a programmed PIC32 microcontroller will be available from the SILICON CHIP on-line shop.
siliconchip.com.au
We won’t go into too many details about the BASIC code which
drives the display, handles touch and basically provides the “user
interface” for the eFuse. It’s all pretty standard MMBasic code and
if you’re interested, you can download the source code and have
a look at it.
What made the software a bit tricky for this project was the fairly
complex CFUNCTION that we had to build. That’s because we need
the unit to be checking the current flow at both outputs several thousand times per second in order to switch the output off if it exceeds
the programmed limits. We can’t really rely on BASIC code to do
that as it wouldn’t be fast enough and the timing may not be precise.
So what we do is call a CFUNCTION at the start of the BASIC code
which sets up the analog-to-digital converter (ADC) in the PIC32
to automatically scan the relevant inputs (four to monitor voltages
and two for currents) and convert the voltages at those inputs to
digital values.
We have also set up the main hardware timer, timer 1, to generate periodic interrupts and we check whether the ADC has finished
scanning and converting the programmed inputs. If it has, we extract the values from special registers and add them into a set of
accumulation registers, as well as keeping track of how many times
this has been done.
We’ve had to use the timer because MMBasic doesn’t give
CFUNCTIONs access to most interrupts and that includes the ADC
conversion completed interrupt. As long as the timer interrupts are
frequent enough that it won’t miss an ADC conversion complete
event, this isn’t an issue.
The BASIC code can then call the CFUNCTION with a different
set of parameters to retrieve these values and it can then divide the
accumulated values by the number of times they have been accumulated to get average readings for each input. It simultaneously
resets these accumulators, ready for the next conversion.
We’ve built the fuse trip logic into the timer interrupt routine,
so that no matter what the BASIC code is doing, if the current flow
goes too high or the simulated fuse temperature reaches its limit, the output(s) will be switched off. The BASIC code periodically
checks if this has happened and has the ability to then “reset” the
fuse later, through another CFUNCTION call.
This also has the advantage that the mathematics required to
simulate the action of a fuse can be handled efficiently with C code,
which is important since the calculations are updated thousands of
times per second.
There’s one final trick to the CFUNCTION and that is that the pin
we have used to control the LCD backlight, pin 18 (RB9) is not one
of the Micromite’s PWM outputs. But we want to use PWM to control the backlight brightness. The reason we didn’t use a PWM pin
for the backlight is that all PWM pins are also analog inputs on the
LCD BackPack, and we needed every single analog capable input
for measuring voltages.
Incidentally, the PIC32 chip used for the Micromite has a limited
capability to re-assign pin functions, meaning that it would theoretically be possible to use other pins for PWM but the Micromite
firmware does not currently support this.
Anyway, our solution is simply to use the timer 1 interrupt, which
we have already had to set up to monitor the ADC state anyway, to
pulse this pin with a programmable duty cycle and that allows us to
control the backlight brightness while only using up a small number of extra CPU cycles.
SC
Celebrating 30 Years
October 2017 79
|