This is only a preview of the February 2021 issue of Silicon Chip. You can view 34 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 "Follow-up: Quantum-dot Cellular Automata":
Items relevant to "Battery Multi Logger":
Items relevant to "Arduino-based Adjustable Power Supply":
Items relevant to "Electronic Wind Chimes":
Items relevant to "Making Android Apps with App Inventor":
Items relevant to "Making a Compact Virtual Electronics Workbench":
Articles in this series:
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
Off grid? On grid with battery backup? How do you monitor the state of your batteries?
y
r
e
r
t
e
t
Ba ti Logg
l
u
M
By TIM BLYTHMAN
Knowing
the condition of
your batteries is essential for
keeping them healthy long-term. A
system that can monitor and log vital battery
statistics is a great aid, and can help you to avoid
having to shell out for expensive replacements. It can
also be used for troubleshooting, such as when you don’t know
which device is responsible for periodically discharging a battery.
S
olar and wind power is growing in use and getting
cheaper, so there is a need to maintain batteries associated with such systems. You might also have a
large battery in a shed, caravan, boat or another vehicle
that you need to monitor. Backup batteries for mains power
failures are another case where you might need a battery
monitor or logger.
Our new Battery Monitor Logger is versatile and capable, being able to handle a charger and two separate loads
out-of-the-box. It is based on a Micromite LCD BackPack,
so can be reprogrammed in MMBasic, Micromite’s variant of the BASIC language. But as we have
written software with
many useful features,
you don’t need to do
any programming.
We last published a
Battery Capacity Meter in June & July 2009
(www.siliconchip.com
.au/Series/44).
It featured a PIC microcontroller capable of
monitoring a battery’s
voltage and current via
an external current meas28
Silicon Chip
uring shunt. It could log data as well as calculate such things
as battery capacity and estimated battery run time.
New features
The 2009 Battery Capacity Meter used a single shunt so
it could only monitor the overall current moving into or
out of the attached battery.
Our new design supports up to three shunts, so it can
monitor three separate current paths, helping you to split
out the charging or discharging figures across multiple
loads and/or generators.
It even includes a
fourth internal shunt for
monitoring its own power usage.
For example, you might
have a solar panel array
and a wind generator (or
several) and want to keep
track of the energy they
generate separately.
Or you might have several loads like a fridge,
lights and a kettle and
want to see which one
is consuming the most
energy.
Australia’s electronics magazine
siliconchip.com.au
The old design was also limited to around 60V at its input (compared to 100V for this one) and could also store
a minimal amount of data in the PIC. The PIC32 we have
used in this design has much more storage space, so it can
record more data for longer.
The battery voltage and currents are sampled at 10-second
intervals. That data is averaged every hour to give up to two
days of hourly samples. The hourly samples are also averaged over each day to give about a fortnight of daily values.
The flow of both charge and energy is logged, to provide
capacity values in Ah (amp-hours) and Wh (watt-hours).
You specify the full and empty voltages of your battery, plus
the battery capacity, so that the unit can self-calibrate when
the battery is either fully charged or discharged.
A simple, linear voltage state-ofcharge value is also calculated, giving a rough indication of battery state
when the more accurate information is
not available.
10A, you can use the same arrangement except with external shunts.
These will typically have a lower resistance and also can
handle higher dissipation, both factors allowing greater currents to flow safely. For example, you can get 100A shunts
quite easily, or even 500A shunts.
Circuit design
The circuit of the Battery Monitor Logger is shown
in Fig.2. It has been designed as a complete Micromitecompatible board, rather than an add-on board for a Micromite LCD BackPack.
This allows us to control its power usage better, reducing the current drawn from the battery.
Operating concept
Fig.1(a) shows the simplest way to use
the Battery Monitor Logger. The battery
connects to a two-way screw terminal
(CON3) while the positive ends of up
to three loads or charging sources connect to the contacts of three-way screw
terminal CON3a.
The negative ends of those loads/
charging sources connect directly to the
battery negative (ground).
This allows the Battery Monitor Logger to independently measure and display the current flowing to or from each
load or charging source.
It also produces a total current in/out
figure and uses this to keep track of the
battery’s state-of-charge in amp-hours
(Ah). Multiplying this by the battery’s
current voltage gives a nominal watthours (Wh) figure for the current state
of charge.
If you have more than three external
devices to connect, they can share terminals on CON3a, as shown in Fig.1(b). For
example, one terminal is shared by two
loads (LOAD1 & LOAD2). The measurement on that channel will be the total
load current for these two devices. Another terminal is shared by two charging
sources (SOLAR & WIND), and likewise,
their currents will be summed.
The third terminal is shared by
LOAD3 and a mains charger. In this
case, the unit will measure the net current flow in/out – ie, it will see a flow
into the battery if the charger current
exceeds the current drawn by LOAD3,
a flow out if the situation is reversed,
and will measure zero if the two currents are equal (ie, the LOAD3 current
is supplied by the charger).
If you need to monitor currents over
siliconchip.com.au
Fig.1: three examples of how you could use the Battery Logger/Monitor. The
simplest configuration, at top, uses its internal shunts to monitor the currents
(up to 10A) into or out of three loads/charging sources. Or as shown in (B),
you can connect more than three loads/charging sources, with some of them
sharing shunts. For higher-current applications (up to hundreds of amps),
external shunts can be used, as in (C).
Australia’s electronics magazine
February 2021 29
As with any battery-operated device, it’s important to
consider power consumption during the design phase.
The battery and load/charger terminals are at lower
right, with the bottom half of the right-hand page showing
the sensing circuitry. Other external connections (USB,
serial, programming etc) are arranged along the left-hand
side, with the BackPack circuitry occupying most of the
left-hand page, plus the display at centre-right. The unit’s
power supply is across the top of both pages.
The Micromite V2 BackPack (May 2017; siliconchip .com.
au/Article/10652) is the closest BackPack variant to our
design. This comparison is only for the sake of explaining some of our design choices; it is not important if you
are coming to this circuit without knowing about the earlier designs.
We’ve opted to use the 2.8in (7cm diagonal) LCD touch-
l
SC
Ó
BATTERY multi-logger
Fig.2: the circuit includes the equivalent of an entire Micromite V2 BackPack, a precision multi-channel ADC and a
switchmode regulator capable of running the device from a DC supply between 6V and 100V. It monitors the battery
voltage, the current to/from three external points and its own current consumption and logs all this (plus the current
battery state-of-charge) to the internal flash memory of microcontroller IC1.
30
Silicon Chip
Australia’s electronics magazine
siliconchip.com.au
screen in this design, rather than the 3.5in (9cm) version
we’ve been using more recently (eg, in the V3 BackPack),
as the smaller display uses slightly less power.
The V3 BackPack also has many features which simply aren’t needed in this case, hence our choice of the V2
BackPack as the basis for this design. The main advantage
it has compared to the original Micromite BackPack is the
inbuilt USB-Serial interface.
siliconchip.com.au
Battery sensing
The main battery sensing circuitry centres on IC5 (an
AD7192) and REF1 (a MAX6071). IC5 is a four-channel
24-bit ADC (analog-to-digital converter) with an SPI serial interface. It is supplied from REG2’s 3.3V output, with
its analog rail filtered by a 10µH inductor. Each of its 3.3V
supply pins is bypassed by a 100nF capacitor.
IC5 shares the SPI bus with the LCD touchscreen, with
Australia’s electronics magazine
February 2021 31
IC1’s pin 24 used for the
If larger external
CS function, to indicate
shunts are used instead,
when IC5 is being adyou just need to run low• Battery voltage: 6-100V
dressed.
current sensing wires
• Current monitoring: up to three chargers or loads,
IC5 needs a stable reffrom both their ends,
monitored separately
erence voltage to convert
back to CON3/CON3A.
• Current handling: limited only by the shunts used
voltages into digital valThe shunt values can be
ues, and this comes from
set in the software to ac(10A with onboard shunts)
REF1, a MAX6071 2.5V
count for practically any
• Current resolution: 0.1% (10mA with onboard shunts)
reference. It is a very lowresistance value.
• Operating current: <1mA while logging (with display off)
noise and precise voltage
A local analog ground
• User interface: 2.8-inch colour touchscreen
reference chip, and it is
net separates the analog
• Firmware: Programmed in BASIC
supplied with 3.3V from
voltages from digital SPI
• Data logging: can be viewed on device graphically,
REG2, with 100nF casignals.
pacitors on its input and
or downloaded as CSV files
Supply current
output. Its output sup• Measurements: current charge (Ah) and energy (Wh)
plies IC5’s REFIN1+ (pin
The current drawn by
• State of charge: displayed based on voltage and charge
15), while IC5’s REFIN1the circuit itself is mod(pin 16) is tied to analog
est but not insignificant,
ground.
and needs to be accountEach of the four analog inputs to IC5 is fed by a
ed for to get accurate measurements. Since it is a fairly low
390kΩ/10kΩ divider, bypassed at the bottom by a 100µF
current, we use a different technique to monitor it. Any
capacitor. This means that the nominal full-scale reading
current flowing into our circuit from the battery at CON3
is 100V with a resolution of around 6µV, and settling times
flows out through a 100mΩ shunt resistor, generating a
of around ten seconds. We use the ADC to perform a convoltage below ground proportional to the current.
version cycle (of all channels) about once every ten secIC6 is a single-channel op amp in a five-pin SOT23-5
onds, a slow rate needed to obtain maximum resolution.
SMD package. It is wired as an inverting amplifier with a
One of the dividers is connected directly across the
gain of 100 (100kΩ/1kΩ), presenting a voltage to IC1’s pin
battery at CON3. The other three monitor the voltage at
4 where the micro’s internal ADC can read it.
the load/charger end of the three shunts which connect
The 100nF capacitor and 100kΩ resistor provide simibetween the BAT terminal of CON3 and the terminals of
lar smoothing on this signal (a time constant of around ten
CON3A. By measuring the difference between the voltages
seconds) so that it too can be sampled at similar intervals
fed to the ADC, we can determine the current flow into or
to the other channels.
out of each terminal.
When the Battery Monitor Logger is operating, the LED
The PCB provides pads for 15mΩ shunt resistors which
backlight of the LCD panel consumes the most power, so
allow a theoretical resolution under 10mA. These are 3W
a high PWM frequency is used to ensure that this measparts, notionally allowing up to 14A to be sensed. In pracurement is accurate.
tice, the terminals limit this to around 10A.
Features & specifications
Power supply
There are two possible power sources in this circuit;
USB socket CON5 can supply 5V, while the battery connection at CON3 handles up to 100V from the battery
being monitored. There are several components on the
board that have a 100V maximum rating, so this is a
hard limit and should not be exceeded.
A switchmode buck regulator chip, IC4 (LM5163)
efficiently steps the battery voltage down to 5V. Its
supply from the battery via CON3 is bypassed with
These photos show an earlier prototype, which was
missing the MISO series resistor and CON6 (which is not
used by the current version of the software). Some of the
resistor and capacitor values are slightly different too, but
overall it looks quite similar to the final version. Take note
of the values shown on the silkscreen PCB overlay diagram
during construction.
32
Silicon Chip
Australia’s electronics magazine
siliconchip.com.au
a 2.2µF capacitor and fed into pins 2 (VIN) and 1 (GND).
A voltage above 1.5V on pin 3 (EN) enables the regulator,
which is equivalent to a voltage of around 5.5V at CON3
due to the 1MΩ/390kΩ resistive divider.
Apart from accepting up to 100V at its input, IC4 also
has an extremely low idle current of just 10.5µA with no
load, and not much more at light loads. Its efficiency varies with the input voltage and load current, but is typically
in the 75-90% range. See the panel below for more details
on this handy little chip.
It switches its pin 8 output (SW) alternately between VIN
and GND using a pair of internal N-channel Mosfets. The
upper Mosfet has its gate voltage supplied from the 2.2nF
capacitor on pin 7 (BOOST).
The pulses are smoothed by the 120µH inductor and a
22µF capacitor to provide the output voltage. The voltage
on feedback pin 5 (FB) is internally compared to a 1.2V
reference, so the 30kΩ/10kΩ divider sets the output voltage to 4.8V.
This is set to be slightly less than 5V so that if an alternative 5V supply is available, it takes over from the battery.
Schottky diode D2 feeds the 4.8V into a pi filter formed of
two further 10µF capacitors and a 10µH inductor.
The 1nF capacitor across the 30kΩ resistor at the top of
the FB divider helps with the stability of the circuit that
drives the output pulses, by ensuring sufficient ripple at
the FB pin for the circuit to operate correctly. See our panel
for more detail on this.
Microcontroller details
This approximately 5V rail then feeds the Micromite sec-
tion of the circuit. MCP1700-3.3 REG2 and its associated bypass capacitors provide the 3.3V supply for microcontroller
IC1. This is a 32-bit, 50MHz micro (PIC32MX170F256B) and
is surrounded by its own complement of bypass capacitors.
IC1 is programmed with the MMBasic firmware and
runs a BASIC program to implement the Battery Monitor
Logger functions.
While some Micromite BackPacks used the 28-pin DIP
version of this IC, the Battery Monitor Logger uses the 28pin SMD (SOIC) part. It works identically but is smaller, so
we can cram more onto the PCB, and most of the other ICs
are only available as SMDs anyway. In this case, its pins
are relatively far apart (on a 1.27mm/0.05in pitch) so it is
not difficult to solder.
To save power, the micro can switch 5V power on and
off to the touchscreen via the 14-way LCD header. A high
level on IC1’s pin 10 turns on N-channel Mosfet Q4, which
is otherwise held off by a 10kΩ pull-down resistor. When
Q4 is on, it pulls P-channel Mosfet Q3’s gate low, which
allows 5V to flow from Q3’s source to drain and into the
LCD panel’s supply pin.
A similar arrangement, controlled by IC1’s pin 26 via
Mosfets Q2 and Q1, switches power to the LCD panel’s
LED backlight. Typically, a PWM signal is applied to pin
26, modulating the backlight brightness.
Unlike the Micromite BackPack V2, which had PWM
brightness control, we have omitted the option of manual
backlight control as the backlight is easily the biggest user
of power in the circuit.
So it needs to be fully shut off during logging and monitoring.
DS3231 MEMS variant
The DS3231 real-time clock IC has
been the go-to choice for keeping track
of time for the last five years or so.
Its appeal is no doubt enhanced
by the fact that it is available in
an easy-to-use module typically sold as an Arduino accessory.
Such a module was the subject of our first El Cheapo Modules
feature from October 2016 (siliconchip.com.au/Article/10296),
which we used in several projects, typically in combination with
a Micromite. The module includes I2C pullup resistors, an I2C
EEPROM and a cell holder.
The module simplifies connection as it includes all that is needed
for the DS3231 chip to work, but sometimes it’s too big. We used the
bare DS3231 IC (which comes in a wide 16-pin SOIC SMD package)
in our Micromite BackPack V3 (August 2019; siliconchip.com.au/
Article/11764) and the Ol’ Timer II clock (July 2020; siliconchip.
com.au/Article/14493).
To support those projects, we kept a stock of those ICs. One
day, we were surprised to receive a package of small 8-pin SOIC
parts instead of the wide 16-pin SOICs that we were expecting.
Had we been conned?
No; we had received the DS3231M variant instead. Those familiar with the DS3231 will know that it only uses eight of its pins;
the lower pins are marked NC (“not connected”). The reason for
siliconchip.com.au
the large package is not
that it needs 16 pins, but
because it includes a temperature-compensated crystal oscillator inside the plastic IC case,
which would not fit inside an 8-pin
package chip.
But with the advance of MEMS technology
(see our article in the November 2020 issue: siliconchip.com.
au/Article/14635), the crystal oscillator inside the DS3231 has
been superseded by a smaller MEMS device.
So given their small size and decent performance, we decided
to try them out in this project. We found the DS3231M to work
the same as the DS3231. The nominal accuracy is slightly worse
at ±5ppm compared to ±3.5ppm, but for situations where size is
of concern, the smaller package is the overriding concern.
The MEMS part doesn’t appear to suffer from crystal ageing
either, which means that in the longer term, it could be more accurate unless this is compensated for in the earlier version of the
chip. The backup battery current draw appears to be higher for
the MEMS part in typical cases, but in most cases, the battery life
will still be close to its shelf life.
In this particular project, we’ve made allowances for either part
in the PCB design, with a dual footprint that suits both the wide 16pin SOIC part and the narrower 8-pin SOIC part. We don’t know if
the DS3231M will end up more popular than the original DS3231,
but we’re ready for either eventuality.
Australia’s electronics magazine
February 2021 33
Screen1: The main screen provides all the critical statistics
for your battery, as well as three simple menu options
for accessing other features. The greyed values seen are
capacity calculations which are not yet valid, as the Logger
has not detected a complete charge and discharge cycle;
they will light up brighter when that happens.
Screen2: The Data screen provides a graphical view of
the logged data. Different timespans can be shown, and
the display will automatically scroll once a minute to
show current data. The Weeks option provides around a
fortnight of data. Data can also be dumped as CSV rows
over the console serial port with the Export button.
Serial communications
Both IC1 and IC2 have their in-circuit serial programming
(ICSP) pins broken out to the edge of the PCB at CON2 and
CON1 respectively. This is a feature not seen on the other
BackPacks, but we have included it here because the SMD
ICs used here are more difficult to program out-of-circuit
than through-hole (DIP) chips.
A DS3231 real-time clock, IC3, provides accurate timekeeping over long periods. Its I2C serial bus pins 15 and 16
(SDA and SCL) connect to IC1 at pins 18 and 17, the I2C
pins used by the Micromite firmware. Two 4.7kΩ resistors
provide the pullups needed by the I2C protocol.
The PCB is also fitted with a SOIC-8 footprint to allow
the similar DS3231M (which uses a MEMS oscillator rather
than a crystal) to be used instead. See the separate panel
explaining the differences.
IC1 sends display data and gets touch events back from
the touchscreen using an SPI serial bus on its pins 3, 14
and 25 (MOSI, MISO and SCK). These connect to the LCD
panel’s pin 6 and 12 (MOSI), pin 13 (MISO) and pins 7 and
10 (SCK). MISO stands for “master in, slave out” while
MOSI stands for “master out, slave in”.
The MISO line has a series 1kΩ resistor so that it can still
operate when the LCD panel is switched off. These signals,
plus a chip select signal from IC1’s pin 9, also connect to
the SD card header at the other end of the LCD panel PCB
via a four-pin header.
We had planned to use the SD card to store data, but
flash memory limitations in the micro mean that there
isn’t enough space to include the (rather large) libraries
needed to do this.
IC2 is an 8-bit PIC16F1455 microcontroller programmed
with the Microbridge firmware. This allows it to act as a
USB-Serial bridge, and it can also program the PIC32 microcontroller.
Pushbutton S1 is used to switch IC2 between USB-Serial
and programming modes, with LED1 flashing to indicate
that it is passing serial data, or lighting up solidly when
in programming mode.
Mini USB Type-B socket CON5 is used both for USB
communications (D+/D-) as well as optionally supplying
5V power. Schottky diode D1 feeds USB 5V to the Micromite 5V rail. Jumper JP1 provides the means to bypass D1
if needed.
REG1 is identical to REG2 and supplies 3.3V to IC2 independently. Serial TX and RX signals are bridged to and
from the virtual USB-Serial port by IC2. These connect
between its pins 5 and 6, via 1kΩ resistors, to Micromite
console pins 11 and 12 on IC1.
IC2’s pins 2, 3 and 7 can be used to program IC1 via its
ICSP interface; they are connected to IC1’s pins 4, 5 and 1
respectively. The PGD signal travels via JP2, which allows
IC1’s pin 4 to be used as an analog input when it is not being used for programming.
34
Silicon Chip
Software operation
Some of the following may seem obscure to those not familiar with MMBasic, but this information could come in
handy if you want to change the code.
MMBasic certainly makes driving the LCD (TFT) panel
easy, as it performs startup initialisation and has built-in
BASIC commands for drawing on and writing to the display. But it needs some help to work with our circuit arrangement, which starts with the LCD panel powered off,
and therefore not ready to accept the initialisation commands that are automatically sent.
So we need to add a routine (in the MM.STARTUP subroutine) to set pin 10 as an output and set it high, then rerun the LCD initialisation code. Every time we power up the
display after shutting it down, we need to trigger that code.
We also need to control the other lines that run to the
LCD panel, as some of these idle high by default and would
therefore waste power. MMBasic does not allow direct control of these, as the firmware reserves them to control the
LCD panel, so we need to ‘POKE’ directly to IC1’s registers
and then run a command to reinitialise the LCD controller.
Similarly, shutting down the controller requires direct
POKEs to shut down those pins. No software deinitialisation
Australia’s electronics magazine
siliconchip.com.au
The LM5163 switchmode regulator IC
Our initial design plans for the Battery Logger set the ambitious
target of designing it to work at up to 80V, improving on the 60V
limit of the old Battery Capacity Meter. That one used an LM2574HV
integrated switchmode IC operating at a fixed frequency of 50kHz,
requiring a sizeable toroidal inductor and electrolytic capacitor.
Hoping that that state of the art had progressed in the last decade, we decided to look for newer parts. We found plenty of parts
capable of working with a 100V supply, which is impressive.
1MHz switching frequencies are no longer uncommon. This
much higher switching frequency means that a smaller inductor
and capacitors are needed, helping us to keep our board compact.
Many parts we found could only deliver 100mA. While this might
have been sufficient with careful control of the LCD backlighting,
we wanted more headroom. The LM5163 came in as the cheapest
part capable of more than 100mA (500mA) in an easily-soldered
SOIC-8 package, which is a good compromise between size and
ease of handling.
As is typical of modern buck regulator designs, it is a synchronous
type, meaning it has two internal switches. The incoming voltage is
switched to the inductor by a high-side internal Mosfet. When the
Mosfet is off, a second low-side Mosfet is switched on to provide
a path for the inductor current to circulate. This removes the need
for an external diode to serve this role and increases its efficiency.
The LM5163 is a COT (constant on-time) design; the time that the
high-side Mosfet is switched on is set by an external resistor, after
which it is switched off. The feedback pin monitors the output voltage,
and when the output voltage has decayed, another on-cycle begins.
So the duty cycle is modulated to maintain the desired output voltage, but the constant on-time means that the switching frequency
varies, although it can be predicted.
When we built our first prototype, everything worked as expected;
we were truly impressed with how flexible and easy-to-use this tiny
part was. But then, it started squealing! The tone would change with
load (which we could easily modulate by adjusting the LCD backlight
intensity) and input voltage. It was bad enough, especially around
12V, that we needed to do something about it.
The cause was electrical noise, which was affecting when it would
switch on. It might switch on early, which causes the output voltage to
rise. This will cause the next switch-on to be delayed, as the controller will be waiting for the output voltage to drop below its threshold.
The output pulses start to cluster into bursts, and it is these
clusters that occur at audible frequencies, causing the high-pitched
squealing we were hearing (‘subharmonic oscillation’) – see below.
As we found with our Switchmode 78xx replacement (siliconchip.
com.au/Article/14533), trying to get these sort of parts to operate
optimally over a wide range of input voltages can be tricky. In that
case, extra output capacitance helped.
Fortunately, a section of the LM5163 data sheet (reproduced in
Fig.4) describes methods to avoid
this. The aim is to increase the ripple seen by the FB pin, so that the
regulator has a clearly defined time
to switch on, despite the presence
of noise.
We tried the Type 1 method, which
involves adding series resistance to the
output capacitor. The extra resistance means that the voltage seen
at the FB pin is influenced less by the capacitor and more by the
pulses from the inductor.
But it also means that the output capacitor is less effective at
filtering the output voltage, and we found it did little to reduce the
squealing.
So we tried part of the Type 2 method (omitting the series resistor from Type 1) and simply added the ‘feedforward’ capacitor in
parallel with the top feedback divider resistor. This means that the
FB pin sees the full amplitude of the output ripple voltage, as it is
coupled directly by the capacitor rather than being simply divided
by the resistor chain.
This effectively quadruples the ripple seen by the FB pin with our
30kΩ/10kΩ divider, without degrading filtering. That eliminated the
squealing, so we have kept it in our final design.
Any switching device which depends on a feedback voltage from
a divider to switch its output elements can benefit from having a
feedforward capacitor. It depends on the frequency of operation,
capacitor value and divider ratio, though.
A word of caution: while this capacitor may appear to be a cure-all,
it does have the side-effect of slowing down response to transients
as it reduces the closed-loop gain for higher frequency components.
Fig.4: Texas Instruments’ recommended solutions for
subharmonic oscillation or ‘squegging’ in the LM5163. We
tried Type 1, and it didn’t work, but Type 2 did. It only
requires the addition of a low-value feedforward capacitor,
Cff, across the upper half of the feedback divider. Type 3
is similar but adds another pole for improved transient
response; that’s overkill in our application.
Fig.3: usually, low
ESR is considered
desirable in a
capacitor as it gives
superior filtering,
but when it filters
out the ripple too
effectively, it affects
the regulator’s
ability to produce
pulses regularly.
siliconchip.com.au
Australia’s electronics magazine
February 2021 35
Parts list – Battery Multi-Logger
1 double-sided PCB coded 11106201, measuring 86mm x 50mm
1 2.8in LCD touch panel with ILI9341 controller
1 UB3 Jiffy box (optional, depending on desired mounting)
1 laser-cut acrylic panel to suit LCD and UB3 box [SC3456, SC3337, SC5063 or sim.]
2 5-pin right-angle headers (CON1, CON2; both optional, for programming IC2 & IC1)
1 2-way 5/5.08mm-pitch screw terminal (CON3)
1 3-way 5/5.08mm-pitch screw terminal (CON3A)
2 2-pin headers (CON4 & JP1; both optional)
1 SMD mini-USB socket (CON5)
1 3-way pin header (CON6, serial port; optional)
1 3-pin header (JP2)
2 jumpers/shorting blocks (JP1,JP2)
1 SMD coin cell holder (BAT1) [BAT-HLD-001 – Digi-key, Mouser etc]
1 CR2032/CR2025 cell or similar (BAT1)
1 120µH 6mm x 6mm SMD inductor (L1) [eg, SRN6045TA-121M – Digi-Key, Mouser etc]
2 10µH 1206/3216-size SMD chip inductors (L2,L3)
1 SMD or through-hole 4-pin tactile pushbutton switch (S1)
1 14-pin header socket strip (for LCD)
1 4-way female socket strip (for LCD)
8 M3 x 6mm panhead machine screws
4 M3 x 12mm tapped spacers
4 M3 x 1mm untapped spacers (eg, stacks of 3mm ID washers)
3 heavy-duty current shunts [eg, Jaycar QP5415, Altronics Q0480 – optional, see text]
hookup and heavy-duty wiring to suit shunts, batteries and load (see text)
Semiconductors
1 PIC32MX170F256B-I/SO 32-bit microcontroller programmed with MMBasic or
11110620A.hex, SOIC-28 (IC1)
1 PIC16F1455-I/SL 8-bit microcontroller programmed with Microbridge firmware,
SOIC-14 (IC2)
1 DS3231/DS3231M real-time clock IC, wide SOIC-16 or SOIC-8 (IC3)
1 LM5163DDAR synchronous buck regulator, SOIC-8 (IC4)
1 AD7192BRUZ 24-bit ADC, TSSOP-24 (IC5)
1 NCS325 CMOS op amp, SOT-23-5 (IC6)
1 MAX6071AAUT25+TT high-precision 2.5V reference, SOT23-6 (REF1)
2 MCP1700-3.3 low-dropout 3.3V regulators, SOT-23 (REG1,REG2)
2 IRLML2244TRPBF P-channel MOSFETs, SOT-23 (Q1,Q3)
2 2N7002 N-channel MOSFETs, SOT-23 (Q2,Q4)
1 3mm or SMD M3216/1206 LED (LED1)
2 SS14 (or equivalent) 40V 1A SMD schottky diodes, DO-214AC (D1,D2)
Capacitors (all SMD M3216/1206 size)
4 100µF 6.3V X5R
1 22µF 16V X5R
7 10µF 50V X7R
1 2.2µF 100V X7R
10 100nF 50V X7R
1 2.2nF 50V C0G/NP0
1 1nF 50V C0G/NP0
Resistors (all 1% SMD M3216/1206 size 1/8W metal film except where noted)
1 1MΩ
(code 105 or 1004)
5 390kΩ
(code 394 or 3903)
2 100kΩ
(code 104 or 1003)
2 30kΩ
(code 303of 3002)
8 10kΩ
(code 103 or 1002)
2 4.7kΩ
(code 472 or 4701)
8 1kΩ
(code 102 or 1001)
1 0.1Ω
(code R100 or 0R10)
3 15mΩ 1% 3W (M6331/2512 size; not needed if external current shunts are used)
36
Silicon Chip
Australia’s electronics magazine
is needed as the LCD can simply be
powered down from any state.
Despite this complication, it’s relatively easy to sense touches on the
LCD panel even if it is shut down.
This is necessary, as the user needs
some way to wake the unit up if it is
in a low power state.
Even when the LCD is powered off,
the TIRQ pin (which is connected to
IC1’s pin 15) is pulled to GND whenever the panel is touched. As the Micromite firmware provides a weak pullup on this pin, simply monitoring the
state of this pin is sufficient to know
if a touch has occurred.
The main job of the MMBasic program is to read the battery voltage and
the voltage across the three shunts to
infer battery voltages and currents. It
logs these to variables which are kept
in RAM and they are regularly saved
to internal flash memory.
With the circuit running from the
battery it is monitoring, it would take
a major fault to shut it down and lose
the contents in RAM, so only longerterm samples are saved to flash memory hourly. If the unit needs to be disconnected to work on the battery, at
most one hour of data will be lost.
When saving to flash, the data is
averaged over a period before being
archived. This means that less data
needs to be stored, but a good amount
of data can be kept for historical purposes.
For example, you might like to compare how much power your solar panels are putting into your battery over a
period of a few weeks. Data about current and power usage is also used to
calculate parameters such as battery
capacity and state of charge.
The MMBasic program also provides a user interface to allow settings
to be changed and values to be graphed
and viewed. Plus there is the option
to dump the data over a serial port so
that it can be exported to a PC program
for graphing and analysis.
We’ll delve more into the software
operation during the setup procedure
next month.
Next month
In the second and final part of this
feature, will have the complete PCB
assembly details, microcontroller programming procedures, setup and operation instructions, calibration information along with the final construction procedure.
SC
siliconchip.com.au
|