This is only a preview of the July 2025 issue of Silicon Chip. You can view 37 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. Articles in this series:
Articles in this series:
Items relevant to "The SmartProbe":
Articles in this series:
Items relevant to "Hot Water System Solar Diverter, part two":
Items relevant to "Low-cost electronic modules: 8×16 LED Matrix module":
Items relevant to "SSB Shortwave Receiver, part 2":
Purchase a printed copy of this issue for $13.00. |
SmartProbe
Project by Andrew Levido
The SmartProbe is an extremely handy little device for making voltage & continuity
measurements. It won’t replace your multimeter, but it is designed to be the first piece of test
equipment you reach for when debugging or repairing a circuit.
I
have made the SmartProbe very small,
measuring just 60mm long, 30mm
wide and 15mm thick. That’s about
the size of a box of matches, for anyone
old enough to remember one! A probe
fine enough for modern surface-mount
circuits (or through-hole parts) is fitted
to one end of the case, while a short
flying ground lead emerges from the
other.
It is equipped with a 128 × 64 pixel
OLED display and an audio transducer
to show voltage measurements and
give feedback, respectively.
There are no buttons or switches.
The SmartProbe switches itself on
when you pick it up, and off again
when it senses no movement for a few
seconds. You switch between voltage
measurement and continuity modes
by tapping it with your index finger.
The display automatically flips rightway-up however you hold it.
The unit is powered by a single
CR2032 coin cell that should last many
months with typical use.
±0.5%, and the input impedance is
around 1MW on both ranges.
In the continuity mode, the SmartProbe sources a low current (around
1mA) and displays the voltage drop
seen across the probes, just as your
multimeter does on the diode test
range. The source voltage is 3.3V,
enough to forward-bias typical diodes,
transistor junctions and most LEDs.
If the resistance between the probes
is greater than about 60kW, the display
shows “OPEN”. There is an audio indication of continuity if the measured
drop is less than about 1V. The continuity beep responds within a few
milliseconds, which is essential for a
good user experience.
The SmartProbe is not suitable
for use with high-voltage or mains-
owered circuits. While it has a degree
p
of input protection, it does not have
the insulation or overload ratings of
a good multimeter. I considered adding AC voltage or frequency measurement capabilities, but elected to keep
it really small & simple.
Ultra-low power design
The SmartProbe operates in either
voltage measurement or continuity
mode. In the former, it can measure
voltages up to ±50V, switching automatically between two ranges. For
input voltages below ±6V, it has a resolution of 5mV or better; for higher
voltages, the resolution is 50mV.
Its absolute accuracy is within
» Compact size (60 × 30 × 15mm)
and lightweight (24g)
» Measures voltage or continuity
» 128×64 pixel OLED screen
» Internal buzzer for continuity
checking
» Measures up to ±50V
» Can also test diodes/LEDs and
measure forward voltage
» Single fine-tipped probe with a
ground clip
» Powered by an internal CR2032
coin cell
One of the main aims and challenges
of this design was to keep the power
consumption when the device is ‘off’
to a level that would give meaningful battery life, while still being able
to sense movement and wake up. A
CR2032 cell has a capacity of about
235mAh while discharging from 3V
(fully charged) to an end voltage of 2V.
I set myself the goal of aiming for
a shelf life of one year (8760 hours),
meaning less than 27µA of idle consumption. As we shall soon see, that
goal was more than met.
Before diving into the circuit, it is
helpful to look at the block diagram of
the front end (Fig.1). This shows the
device in voltage measurement mode,
with just one voltage range for simplicity. We want to convert a bipolar voltage up to ±50V, appearing between the
probe and clip, to a unipolar voltage
between 0V and 3.3V (V1) suitable for
the analog-to-digital converter (ADC).
We do this by fixing the bottom
(ground clip) end of the Ra/Rb voltage divider to half the supply rail, ie,
around 1.65V. Voltage V1 is therefore
siliconchip.com.au
Australia's electronics magazine
July 2025 33
Specifications
Features & Specifications
Fig.1: one end of the input voltage divider is fixed to ½ of the supply voltage
to provide an offset so that bipolar (±) input voltages can be measured with a
unipolar ADC. The offset is later subtracted by the firmware.
an attenuated and buffered version of
the input voltage offset by ½Vcc, as
described by the equation V1 = (Vin ×
Rb) ÷ (Ra + Rb) + Voffset.
If we also buffer and convert the
offset voltage, Voffset, we can subtract it from the converted version of
V1 in firmware. The resulting digital
code will be a signed value proportional to Vin.
The full circuit (Fig.2) shows that
there are actually two dividers and
associated buffers in the SmartProbe, one for each input voltage
range. For the high-voltage range,
it uses a 2MW/51kW divider, while
the 2MW/680kW divider is for the
low-voltage range. The output of each
is buffered by IC1d and IC1c, respectively, and fed to its own ADC input
channel on microcontroller IC2.
I chose the divider resistor values
such that the voltage span seen by
the ADC inputs is around 3V centred
on around 1.65V (0.15V to 3.15V).
This allowed me to stay away from
the very ends of the ADC range and
avoid a potential source of errors. I
am using ±0.1% tolerance resistors
here, as these are critical to achieving
the required resolution and accuracy.
The op amps are low-cost zerodrift (auto-zero) op amps. These have
a worst case offset voltage of ±10µV
with just 50nV/°C drift. Since they are
connected as unity-gain buffers, there
is no appreciable gain error.
The offset voltage is also buffered
(by IC1a) and fed to another ADC channel. All three of these input buffers are
identical, including protection diode
pairs (D1 through D3), and a small
amount of low-pass filtering on the
inputs (using 1nF/100nF capacitors)
and outputs (1.5kW/1nF). Most of the
filtering of these signals occurs in software, as discussed below.
34
Silicon Chip
When the input voltage is outside the ±6V range, the output of the
low-voltage sensing circuit (IC1c)
saturates, and the digital code associated with this input moves outside
the expected range. The firmware
automatically switches to using the
high-voltage input in this case. If the
high-voltage input approaches saturation, a voltage over-range warning
message is displayed.
The bottom ends of the dividers
are fed by a current-limited buffer,
IC1b. The 10W resistor provides a bit
of protection to the op amp, since its
output would otherwise be connected
directly to the ground clip and therefore exposed to the outside world. The
input of the buffer is connected to a
100kW/100kW voltage divider fed from
one of the microcontroller’s GPIO pins
(PA06, pin 12).
This pin is configured as a digital
output. If it is high, the buffer input is
half of the supply voltage, as in Fig.1.
If the output is low, the bottom end of
the divider is effectively connected to
0V – a state which comes in handy for
continuity mode.
Continuity measurement
So far, we have ignored the network
consisting of Mosfets Q1-Q3 and the
associated passive components. These
form an analog switch that is off in
voltage mode.
In continuity mode, the offset at
the bottom of the voltage dividers is
set to zero, as mentioned above, and
the analog switch is on. This connects
the 3.3V supply to the input probe via
the 3kW resistor. A voltage of approximately 3.3V is therefore present across
the probes when they are open circuit.
This voltage drops as the impedance
between the probe falls, ultimately
to zero if the probe is shorted to the
Australia's electronics magazine
clip. If a diode junction is connected
across the input, with its anode to the
probe, the forward drop of the diode
will appear across the input.
In continuity mode, the voltage is
read by the ADC in the same way as
already described, except the offset
voltage will be close to zero. The equation shown in Fig.1 will still hold, but
we will no longer be able to read negative voltages; that doesn’t matter in
continuity test mode.
You will notice that the output of
buffer IC1c connects directly to the
PA03 pin of the microcontroller, as
well as to the ADC input via the RC
filter. PA03 is internally connected to
a fast comparator that drives the continuity beep tone.
The analog switch
The analog switch deserves a closer
look. We require a switch with a very
high impedance when off, so that no
appreciable current flows through the
3kW resistor when measuring voltages. The switch must withstand ±50V
when open, but have relatively low
on-resistance when closed.
I could not find a suitable off-theshelf analog switch because the voltage requirements are relatively high,
so I built my own using two P-channel
Mosfets with an N-channel Mosfet to
drive them.
The switch is open when Q3 is off,
and the gates of Q1 & Q2 are held at
their source potential by the 100kW
resistor. Since the gate-source voltage
is zero, both Mosfets will be off. You
can see what happens when an external voltage is applied by referring to
the left and middle diagrams in Fig.3.
If the drain of Q1 is at +50V, its
source will also be at this potential
due to the conduction of its body
diode. Both Mosfet’s gates and sources
will therefore be at +50V, so they will
remain off. Q2 will therefore block any
current flow, since its body diode is
reverse-biased.
If the drain of Q1 is at -50V, the body
diode of Q2 is forward-biased, leaving
the sources and gates of both Mosfets at
3.3V. Q1 now blocks any current flow.
When Q3 is switched on, the gates
of both Mosfets gates will be at 0V. The
drain of Q2 is fixed at 3.3V, so the body
diode initially conducts, causing the
sources of both Mosfets to rise almost
to this value. The resulting -3.3V gatesource potential is enough to switch
both Mosfets on, effectively shorting
siliconchip.com.au
Fig.2: the SmartProbe circuit is fairly straightforward, except for a few tricks
related to achieving ultra-low power consumption that are detailed in the text.
out their respective body diodes and
switching the analog switch fully on.
The ZXMP6A17E6 Mosfets I chose
have a maximum Vds of -60V and an
Rds(on) of less than 0.5W with a Vgs
of 2.5V (interestingly, they have six
pins, but the three additional ones
are just extra drain connections).
The total on-resistance of the analog
switch will therefore be around 1W.
The P-channel Mosfets see a worstcase voltage of -53.3V.
siliconchip.com.au
The BSS138K (Q3), with a maximum Vds of 50V, places the upper limit
on switch voltage. This is a bit of a soft
limit, since the 100kW resistor limits
the avalanche current if Q3 were to
break down. Nevertheless, this switch
is what limits the nominal maximum
voltage for the SmartProbe.
Digital circuity
The microcontroller is a 32-bit
STM32L031F6 low-power Arm Cortex
Australia's electronics magazine
M0+ from ST Microelectronics. This
has 32kiB of flash, 8kiB of RAM and
comes in a 20-pin TSSOP package.
Importantly, it operates at any voltage
between 1.8V and 3.6V, and can be put
into various low-power modes where
its current draw reduces to single-digit
microamp levels while still retaining
RAM contents.
The display connects to the microcontroller via an I2C interface. This is a
128 × 64 pixel white OLED screen that
July 2025 35
Both sides of the SmartProbe PCB. The flat flex cable on the back of the OLED is
soldered to the PCB and the screen is then held down with double-sided tape.
measures just 34 × 22 × 1.5mm. These
displays are readily available for just
a few dollars each from AliExpress.
They have a SH1106 control chip
onboard, and can be controlled via
an 8-bit parallel or SPI/I2C serial bus.
The display only needs four 100nF
capacitors and one resistor added to
create the necessary internal voltages
(all shown to the right of DISP1).
The OLED current is set by the resistor. I have used 510kW, which gives a
current of about 10µA per pixel. This
is nice and bright, but means that the
display could draw as much as 82mA
(128 × 64 × 10µA) if all pixels were on.
In reality, the measured current stays
under 20mA or so, since we never
light more than about 25% of the pixels simultaneously.
Nevertheless, the display is the
main current consumer in the circuit
and has to be completely shut down
when the SmartProbe is inactive. To
help ensure it comes up reliably when
awakened, I have wired its hardware
reset pin to a microcontroller GPIO
pin (PC15).
The audio transducer, MB1, is a
small magnetic beeper that requires an
AC signal to operate. This means it can
deliver a variety of tones if driven at
different frequencies. I have used one
of the micro’s PWM outputs (routed to
the PA05 pin) to drive it via Mosfet Q4.
Using a PWM output allows me to
set the tone by varying the PWM carrier
frequency and manage the volume,
and more critically, the current consumption, by limiting the duty cycle.
Even so, it presents a significant (relatively speaking) load on the supply.
For this reason, I used it only when I
think it is really necessary.
Accelerometer
Because the accelerometer is the
only component in this circuit that is
always operational, I needed to choose
it carefully. I selected the LIS2DW12
three-axis “digital motion sensor” for
this application because it is specifically geared toward ultra-low-power
applications.
This chip (IC3) contains a three-axis
MEMS accelerometer and a heap of
signal processing hardware that can
be configured to detect device orientation, free-fall events and tap or
double-tap events on any axis. It can
detect activity and put itself into a lowpower state when it senses inactivity,
waking itself up again autonomously.
I took advantage of the orientation
function to flip the display the right
way up, the single tap function to
change modes and the activity/inactivity function to turn the SmartProbe
on and off.
The device supports a range of
sampling rates and draws anywhere
between 500nA and 90µA when operating. Lower data rates result in lower
operating currents, but some features
we need won’t work at the very lowest data rates. For this reason, we run
the accelerometer at 400 samples per
second when active, dropping to 200
samples per second when ‘off’.
This gives us an ‘off’ power consumption of somewhere around
12-20µA. The data sheet says the consumption will be 12µA in the mode
and data rate we use, but that is specified at 1.8V and 25°C. The data provides no help in understanding what
the consumption will be at higher temperatures or with voltages up to 3.0V,
as it will experience in our circuit.
No data usually means you can
safely assume it will be worse. My
measurements show consumption
closer to 16-20µA with our battery
voltage range and my (unairconditioned) room temperature.
While that is higher than the published figures, I think it is still pretty
amazing performance considering the
chip is taking three 14-bit accelerometer samples every 5ms and pushing
them through a fairly complex digital
signal processing chain.
Hardware-wise, the LIS2DW12 is
very nice; it has just 12 pins, requires
no external components and costs just
$2.50 in single quantities. The downside is that it is only available in a 2
× 2mm leadless package. Fortunately,
it does not have a thermal pad, so it is
easier to hand-solder than some chips
I have come across.
Fig.3: the left and middle diagrams show the voltages on the analog switch in the off state with +50V and -50V applied to
the input, respectively. The rightmost diagram shows them when the switch is on.
36
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
It is a complex device from a firmware perspective, but I took the time
to write a (reasonably) comprehensive driver, since I intend to use this
chip again.
Power supply
The power supply scheme is
straightforward, as shown in Fig.4.
There are two power rails: Vbat,
which is derived from a lithium coin
cell and is always available, plus a
3.3V (3V3) rail that is only available
when the SmartProbe is on. The 3.3V
rail is derived from the coin cell via
a boost converter based around IC4, a
TPS61033.
The boost converter is enabled by
the PWR_ON signal from the microcontroller, so the display, analog front
end and beeper are only powered
when the SmartProbe is on. The shutdown leakage current of the TPS61033
is specified at 0.1µA, so well within
our meagre power budget.
The Vbat supply is the diode-OR
combination of the coin cell voltage
and the 3.3V supply. The upshot of
this is that Vbat will be approximately
3.3V while the device is on, but will
fall to very near the battery voltage
when asleep. Both the accelerometer
and microcontroller will happily operate at any voltage between 3.6V and
1.8V, so this is not a problem for them.
I used a pair of schottky diodes to
combine the supplies to minimise
the forward drop, keeping it to only
about 0.2V at the low currents drawn
in standby mode.
Firmware
The firmware architecture is shown
in Fig.5. The software consists of a
main loop, shown at the top, and four
asynchronous tasks triggered by interrupts, shown at the bottom. Some of
these asynchronous tasks communicate with the main loop via a few
shared data registers and flags.
When an interrupt occurs, the processor stops what it is doing and starts
running code from the appropriate
interrupt service routine (ISR).
When the code starts from reset,
the microcontroller core and onboard
peripherals are initialised. This
includes such things as setting up the
microcontroller clocks, the I2C peripheral, PWM, timers and the like. This
only needs to be done once, because
when the microcontroller is stopped,
the RAM contents and register data
are retained.
After this, the external peripherals
are initialised via their drivers. This
involves enabling the boost converter,
initialising the accelerometer and the
OLED display. This step is repeated
each time the SmartProbe awakens
because the display driver’s configuration registers are lost when the 3V3
rail is disabled.
We also reconfigure the accelerometer, even though it is never shut down
completely. We do, however, disable
some of its functions before putting
the microcontroller into sleep mode,
so it is easier just to reprogram it completely when it wakes up.
Once everything is initialised, we
enter the main loop proper. Here, we
check if the accelerometer has detected
a period of inactivity and put itself into
low-power mode. If it has, we proceed
to put the SmartProbe into ‘off’ mode,
as described below.
If it is still active, we check if fresh
data is available from the ADC sampling task. If not, we loop back and
repeat the cycle, checking continuously for inactivity and new data.
When fresh ADC data is available
(approximately twice per second),
the display is updated according to
the operating mode and taking into
account the orientation of the SmartProbe. This routine also takes care
of the auto-ranging and over-voltage
detection.
ADC sampling
The ADC sampling routine operates independently of the main loop,
triggered every 500ms by a repeating
timer. The analog-to-digital converter
(ADC) peripheral within this microcontroller is extremely flexible. It is a
Fig.4: the 3.3V power
rail is derived from the
coin cell voltage via a
boost converter. This
is disabled when the
SmartProbe is ‘off’ but
the microcontroller and
accelerometer remain
powered by the Vbat rail.
siliconchip.com.au
Australia's electronics magazine
Fig.5: the firmware consists of a
main loop and four asynchronous
tasks, as described in the text. They
communicate with each other via a
few shared data and status registers
(not shown).
12-bit successive approximation converter with an input multiplexer that
can handle up to 18 input channels.
Sixteen of the channels can be connected to input pins (not all of which
are available on the 20-pin version of
the chip), while two can be connected
to internal sources. One of these is a
1.2V bandgap voltage reference. The
ADC also includes a zero-calibration
feature, which we use each time the
SmartProbe becomes active.
The ADC can be configured to
July 2025 37
Table 1 – STM32L031F6P6 power saving modes
Power Mode Core
Peripherals
RAM/Registers
Wake-up
Run
On
On
Retained
Not Applicable
Sleep
Off
On
Retained
Any Peripheral
Stop
Off
Off
Retained
External interrupts, low-power peripherals, RTC, watchdog
Standby
Off
Off
Lost
RTC, watchdog, wake-up pin
automatically scan and convert channels in a sequence. It also has a hardware oversampling capability. If this
is enabled, the ADC will take a series
of samples and average the results for
each channel in the sequence.
I used these features to create a sampling regime that eliminates a lot of
the mains-frequency interference that
would otherwise make achieving stable readings difficult.
If we take many samples of a signal over an integral number of mains
cycles and average them, any mains
frequency component will average to
zero. This is because the average of
any sinusoidal signal over a full cycle
is zero. So, if we make the ADC sample and average each input over one or
more 20ms intervals, any 50Hz component will be eliminated.
In the SmartProbe, the clock division options available to us mean that
we can’t quite do this perfectly. The
best we can manage is to take the 256
samples of each input over a period of
59.05ms – very close to three mains
cycles. This means the mains cancellation will not be perfect, but we should
still reduce it by 34dB (50 times) or
thereabouts, which helps a lot.
This oversampling and averaging
also serves as a simple low-pass filter, helping to smooth out any small
perturbations in the voltage being
measured.
The ADC is therefore set up to convert four inputs in sequence: the high
and low range voltage measurement
inputs, the offset voltage and the internal reference. Each is sampled 256
times, and the results averaged twice
per second. Once configured, all this
happens more-or-less automatically.
An interrupt is triggered at the end
of each conversion sequence, at which
point we need to translate the averaged
ADC readings into absolute voltages
that we can display. The ADC output
is ratiometric with the Vbat power
rail – that means its output code is a
measure of the input voltage as a fraction of Vbat.
Vbat is nominally 3.3V when the
38
Silicon Chip
SmartProbe is on, but this voltage is
not regulated to the extent that would
allow conversion to absolute voltages
at the level of accuracy we want.
Fortunately, there is a way around
this, using the internal bandgap reference. This has a nominal output of
1.2V and pretty good stability. When
the chip is manufactured, the value
of this internal reference is measured
by the ADC while the supply voltage
is fixed at a fairly precise 3.00V, and
the resulting code burned into non-
volatile memory.
The firmware uses this code,
together with the real-time measurement of the internal reference, to calculate the Vbat voltage on each measurement cycle.
Knowing the supply voltage allows
us to determine the absolute value of
the input voltages. It is then only a
matter of subtracting the offset voltage from each of the input voltages to
determine the voltage across the lower
resistor in each divider as a signed
integer in units of millivolts. These
are later adjusted for the divider attenuation in the display update routine.
When new values are calculated,
they are stored in shared memory, and
the flag set to let the main loop know
that new data is available.
Continuity mode & beeper
The accelerometer is set up to detect
single-tap events in the ‘vertical’ axis
of the smart probe (ie, the top or bottom surface when looking at the display) and assert the interrupt line. The
associated interrupt service routine
responds by switching modes: opening or closing the analog switch and
setting the offset voltage appropriately.
A short tone sounds when changing modes – a higher frequency when
switching to voltage mode, and a lower
frequency when switching to continuity mode.
The beeper driver makes use of the
M0+ core’s dedicated tick timer, which
is usually set to provide a system tick
interrupt every millisecond. A tone is
initiated by calling a driver function
Australia's electronics magazine
specifying the desired frequency and
duration. The function starts the tone
playing at the appropriate frequency,
then returns. The tone is automatically
terminated after the requisite number
of 1ms ticks elapse.
It is important (to me anyway) that
the continuity beeper has a very fast
response. The ADC samples are only
updated every 500ms, which is fine for
the display, but way too slow for the
beep. Therefore, I used a comparator,
as mentioned earlier.
One of the two onboard comparators is configured to compare the
low-range input voltage with a fixed
internal voltage set to ¼ of the internal 1.2V reference. If the voltage at the
input pin falls below 0.6V, a flag is set
to indicate continuity. If it is above
this level, the flag is cleared. The comparator output flag is sampled every
system tick and the continuity beep
is sounded if it is set.
Low power operation
We mentioned above that the accelerometer is configured to detect a
period of inactivity and autonomously
put itself into a low-power mode.
When the microcontroller detects this
has occurred, the rest of the circuit
must be shut down until the accelerometer indicates activity has resumed.
We have seen that the accelerometer
consumes up to 20µA in its low-power
mode, and we have a total design target consumption of 27µA or less. This
leaves us with just a few microamps for
everything else, including the microcontroller.
The Cortex M0+ architecture supports a variety of low-power modes
with differing levels of power consumption. The trade-off for lower
power is longer wake-up times and
more limited wake-up functionality.
Table 1 shows a (very) simplified
chart of the available modes and
their key differences. Every one of
the modes shown in the table has several variations, and it is entirely possible for a lower power mode to consume more than a higher power mode
siliconchip.com.au
depending on the exact configuration.
“Run” is the normal operating mode
of the microcontroller and has the
maximum power consumption; the
core and all peripherals are operating. The easiest way to reduce power
in this mode (or any mode where the
clocks are operating) is to reduce the
frequency of the system clock below
its maximum of 32MHz. I use a 3MHz
system clock in the SmartProbe for
this reason.
In “Sleep” mode, the core clock is
disabled, but the peripherals remain
fully operational. RAM and register
contents are preserved. This allows
for a very fast wake-up (in the order of
0.35µs) but comes at the cost of around
1mA current consumption at 16MHz.
As the peripherals continue to operate,
pretty much any of them can wake the
processor up.
“Stop” mode, on the other hand,
has the potential to reduce power consumption to the sub-microamp level.
This is the mode I used for the SmartProbe when it’s ‘off’. Here, the core
and most peripheral clocks are halted;
only the real-time clock and watchdog timer continue to run if they are
enabled (which they aren’t). Volatile
memory is retained.
Several possible sources can wake
the microcontroller from stop mode,
including interrupts triggered by the
states of external pins changing, which
is what we use.
The final low-power mode is
“Standby”. In this mode, almost everything is powered off, including the
RAM and almost all the registers. Only
a very limited selection of wake-up
sources is available, and the wake-up
time is the longest.
Putting the processor into stop mode
is in itself not enough to get the current consumption down to the very
low levels we require. There is quite a
lot to do both within the microcontroller and in the external circuit before
executing the instruction that halts
the processor.
Externally, we shut the OLED display off via an I2C command, shut
down the beeper PWM and turn off
the boost converter. Internally, we stop
the ADC conversion process and the
timer that triggers it, disable the bandgap reference and the buffers that feed
its output to the ADC and the comparator. We also limit the functionality
of the accelerometer to just detecting
activity or inactivity.
siliconchip.com.au
A close-up of the probe
we used for our SmartProbe.
We also put most of the I/O pins into
analog input mode so they look like
high-impedance inputs, minimising
any leakage currents that might otherwise occur. The data sheet suggests
that the digital input schmitt trigger
buffers can be a source of leakage –
hence using the analog input mode.
In fact, leakage current is our number one enemy in ultra-low power circuits such as this, and it can come from
some quite obscure sources.
For example, consider the 4.7kW
I2C pullup resistors. These are pulled
up by one of the microcontroller’s
GPIO pins instead of being directly
connected to the power rail (Vbat) as
one might do normally. Fig.6 shows
why we have to do this. The I2C bus
connects to the micro and the accelerometer, which remain powered up
in stop mode, but also to the display,
which does not.
The display driver’s I2C inputs are
internally protected by diodes connected as shown in the figure. In normal operation, these prevent the input
pin rising more than about 0.6V above
the 3.3V supply or falling more than
0.6V below ground.
However, when the boost converter
is off, the display driver’s positive
power rail is at 0V, allowing a leakage current path from Vbat to ground
via the I2C pullups, as shown by the
red paths.
If Vbat was at 2.5V and the protection diode forward drop was 0.5V,
there would be more than 850µA
leakage in total. This is 30 times more
current than our target, so clearly not
acceptable! Powering the pullups
from a GPIO pin that can be put into
a high-impedance state eliminates this
problem.
Once all the internal and external
extraneous current consumers are
dealt with, we are ready to stop the
microcontroller core and peripherals.
We just have to set or clear a few bits
in various control registers to ensure
the core enters the correct low-power
mode and that it wakes up due to the
right stimulus with the right clock
source.
We have to disable all interrupt
sources except the external interrupt
pin associated with the accelerometer, and globally disable interrupts.
Finally, we can execute a “Wait for
Interrupt” (WFI) instruction that stops
the core until an interrupt is received.
It might seem odd that we globally
disable interrupts if we want to wake
up due to an interrupt, but the way it
works is that the peripheral’s interrupt
flag does the waking (in this case the
external interrupt) regardless of the
state of the global interrupt enable
flag. By disabling global interrupts, we
ensure that when the processor wakes
up, it continues executing code where
it left off and not in an ISR.
On resumption, we have to undo
all the work we did before entering
low-power mode, restoring the I/O pin
states, enabling the boost converter
and the internal regulators and buffers
we disabled. We then reinitialise the
drivers to start the ADC, the display
and all the rest of the stuff necessary
to resume operation.
Construction
Fig.6: if the I2C bus was pulled up
to Vbat, significant leakage currents
would flow through the pullup
resistors and display driver chip’s
input protection diodes when the 3V3
rail is off.
Australia's electronics magazine
The SmartProbe is built on a small
double-sided printed circuit board
coded P9054-04 that measures 54.5
× 29.5mm. Both sides of the board
are fairly tightly packed with surface-mounting parts, although most
are M2012/0805-sized (2.0 × 1.2mm),
so pretty easy to handle. The overlay diagrams, Figs.7 & 8, show where
everything goes.
Start assembly by mounting the
trickiest part, the accelerometer (IC3).
If you are using solder wire, you will
need to apply some flux paste and a
July 2025 39
thin layer of solder to the pads first.
Try to get roughly the same amount of
solder on each pad – if there is too little
on one or two, you risk an open-circuit
connection. If you elect to use solder
paste, try to get a more-or-less even
smear across the footprint.
You can then reflow the chip using
something like a hot air wand, making sure to get it the right way round.
Despite its small size, I found this
package fairly forgiving when it came
to assembly.
Next, solder in the boost converter
chip (REG4) and then the optional
programming connector, CON3, if you
will use it (it isn’t necessary if you
get a pre-programmed chip from our
Online Shop). They should solder in
fairly easily using a fine tip soldering
iron, some good flux and a bit of solder
wick to clean up any bridges.
Mount the rest of the components
on the top side of the board, except
the coin cell holder and the probe connector (CON1), in the order you prefer. I tend to install the finer-pitch and
smaller parts first, working my way up
to the larger ones.
Flip the board over and install the
six passives on the back side, plus the
audio transducer. Finally, add the coin
cell holder and the probe connector
(CON1) to the top side. It is a good idea
to check your work and clean up the
board with a bit of isopropyl alcohol
or another solvent at this point, before
installing the display.
The display’s flat flex cable is soldered directly to the row of pads on
the back of the board. Make sure the
pin 1 designator on the flex is aligned
with the small dot on the board. This
should correspond with the display
being face-up when folded back on
itself. It should be face-down when
the flat flex is straight, and it should
extend over the side of the board nearest the row of pads.
Align the flat flex so that about 1mm
of the PCB pads are visible, and secure
it in place temporarily with a couple
of bits of adhesive tape.
Double-check everything lines up
and tack the display in place by soldering a couple of the pins. I suggest
using two of the signal pins for this,
rather than the pins connected to the
ground plane, as they require a lot
more heat.
If everything still looks good, go
ahead and solder all the pins, taking
care not to create any short circuits.
You can remove the tape and clean up
with a little solvent if you need to, but
keep it away from the display itself.
If you intend to program the microcontroller in-circuit, do that now. You
will need to make a suitable adaptor
to connect the programmer to the flat
flex connector. See the details in the
accompanying panel.
You will have to insert a coin cell
(or otherwise power the microcontroller) while it is being programmed. If
your microcontroller came preprogrammed, you should skip this step.
You can now perform a quick test
by inserting a coin cell into the holder.
You should hear the start-up beep,
and the display should come to life
in voltage mode with a reading close
to 0.000V. The least significant digit
(millivolts) and the sign may move
around a little, but the rest of the digits should be zero.
If you do nothing, the probe should
Figs.7 & 8: follow
these diagrams
to populate the
PCB. Start with
the accelerometer
(IC3), as it is the
fiddliest part to
mount.
40
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
switch itself off after five or six seconds, and it should wake up again you
give it a bit of a jiggle.
This is enough to test the basic functionality. If everything is OK, you can
remove the coin cell and fix the display in place with a small piece of
double-sided foam tape. Fold it over
and align the edges of the display glass
with the outer rectangle on the PCB
silkscreen.
Debugging
If there is a problem, do some troubleshooting before fixing the display
in place. If the unit appears dead, first
measure the 3V3 rail to make sure it
is working when the unit is awake.
If 3.3V is not present, check that the
battery voltage is getting to it and the
boost converter enable pin is high. The
latter is a sign that the micro is at least
trying to start the converter and means
the problem is in the boost converter
itself or there is a short on the 3V3 rail.
If the 3V3 rail is fine and you hear
the start-up beep, but the screen
remains blank, the problem is probably in the I2C bus or with the display.
Check the associated components and
the soldering of the display connector.
It is possible to get shorts under the flat
flex that you can’t necessarily see. Use
a multimeter to look for (unwanted)
shorts between adjacent pins if you
suspect this may be the case.
The firmware does have a fair bit
of error-detection built in. If an error
occurs, the beeper emits a short, low
tone (it is fairly quiet, so listen carefully) and displays a small fault icon
on the screen.
If this says “ACC!”, the code
encountered a problem communicating with the accelerometer. If it says
“DIS!”, the problem is with the display
communication, and if it says “SYS!”
the problem is a processor exception,
so probably related to corrupt code.
Mechanical assembly
Once everything is working as
expected, you can prepare the case.
Mark out and cut the opening for the
display and the sound hole according
to Fig.9. The display aperture can be
cut by drilling a series of holes inside
the marking and finishing up to the
line with files. I used a file to put a
chamfer around the display hole –
the exact dimensions are not critical
as this is purely cosmetic.
Drill the holes in each end of the
siliconchip.com.au
Parts List – SmartProbe
1 Hammond 1551JBK 60 × 35 × 15mm black ABS enclosure
[Altronics H9003]
1 double-sided PCB coded P9054-04, 54.5 × 29.5mm
1 BC-2600 SMD CR2032 cell holder (BAT1)
1 CR2032 3V lithium coin cell (BAT1)
1 Wago 2946-2060-471/998-404 single entry SMD terminal block (CON1)
1 Molex 503480-0800 8-pin flat flex connector, 0.5mm pitch
(CON3; optional, for ICSP)
1 X30654 128×64-pixel 3.3V graphic OLED screen with SH1106 controller
(DISP1) [AliExpress 32890183042]
1 WLPH201610M1R0PP or equivalent 1µH 2A+ inductor,
SMD M2012/0805 size (L1)
1 CMT-0525-75-SMT-TR SMD magnetic transducer buzzer (MB1)
1 6mm-long No.6 self-tapping screw
1 size 4 straw sewing needle
1 alligator clip
1 length of medium-duty hookup wire
1 short length of 2mm diameter heatshrink tubing
1 small piece of double-sided foam-cored tape
Semiconductors
1 TP5534-SR quad chopper-stabilised op amp, SOIC-14 (IC1)
1 32-bit STM32L031F6P6 microcontroller programmed with 0411025A.HEX,
TSSOP-20 (IC2)
1 LIS2DW12 ultra-low-power 3-axis accelerometer, LGA-12 2 × 2mm (IC3)
1 TPS61033DRLR adjustable boost regulator, SOT-583 (REG4)
2 ZXMP6A17E6TA 60V 2.7A logic-level P-channel Mosfets, SOT-23-6 (Q1,
Q2)
2 BSS138K 50V 220mA N-channel logic-level Mosfets, SOT-23 (Q3, Q4)
4 BAV99 ultrafast dual series diodes, SOT-23 (D1-D4)
1 SDM40E20LC 20V 400mA dual common-cathode schottky diode,
SOT-23 (D5)
Capacitors (all SMD M2012/0805 size 50V X7R ceramic unless noted)
1 33μF 16V D-case tantalum
4 10μF 16V
8 100nF
1 10nF
5 1nF
1 100pF C0G/NP0
Resistors (all SMD M2012/0805 size, 1% unless noted)
2 2MW ±0.1%
1 1MW
1 680kW ±0.1%
1 510kW
1 220kW
5 100kW
1 51kW ±0.1%
2 4.7kW
1 3kW
3 1.5kW
1 1kW
1 10W
Optional SWD flat flex adaptor
1 double-sided PCB coded P9045-A, 35 × 25mm
1 Molex 503480-0800 8-pin flat flex connector, 0.5mm pitch (CON1)
1 CNC Tech 3220-10-0300-00 10-pin, 1.27mm-pitch box header (CON2)
1 Molex 0150200079 8-way, 0.5mm pitch 100mm flat flex cable
Australia's electronics magazine
July 2025 41
SWD Programming Adaptor
There was no space on the main PCB
for the standard ST Micro SWD/JTAG
programming header, which is a 2×5pin miniature shrouded box header
(1.27mm pin pitch). Thus, a more
compact 8-way FFC connector was
used. This small PCB adapts that to
the more standard connector so that
a programmer can be connected via
a ribbon cable with an IDC plug.
Its circuit is shown in Fig.a.
Because pins 7 & 8 are not connected
to the main board, only the single-wire
debug (SWD) protocol is supported,
not JTAG. Importantly, note that the
pinout of CON1 is reversed compared
to CON3 in Fig.2. That’s because the
FFC is inserted flat, such that the connections are reversed between those
two connectors.
The adaptor is built on a double-
sided PCB that’s coded P9045-A and
measures 35 × 25mm. The assembly should be straightforward, referring to the overlay diagram, Fig.b. The
TP-X pin is provided
to allow a custom
debugging signal to
be generated from the
microcontroller.
When using it, make sure that
the FFC cable is inserted with the
correct orientation between the two
ends. The easiest way to check this
is to verify continuity between the
grounds of the SWD Adaptor board and target board
before connecting the programmer.
Fig.a: this SWD adaptor connects to
the main circuit (Fig.2) via a flat flex
cable (FFC) and allows a standard
ST Micro programmer to connect via
CON2. The FFC is connected such
that it reverses the connections,
making CON1’s pinout
correspond to CON3
in Fig.2.
A close-up
of the Adaptor’s
flex cable is shown above
and the finished PCB below. We have
used some tape on both ends to
provide extra rigidity.
eye off your needle if it is wider than
about 1mm; otherwise, it may be too
big for the connector.
The connector I used for the probe
has a spring operation. You press down
on the small divot at the top to insert or
remove the conductor. When released,
the connector firmly grips the probe.
That, plus the close fit of the hole in
the case, is enough to hold the probe
solidly in place.
Finally, you need to clip out one of
the two PCB mount bosses inside the
case as it interferes with the display.
The one to remove is diagonally opposite the sound hole.
The PCB is secured to the case with
a #6 × 6mm self-tapping screw – see
Figs.10 & 11. You should solder the
ground lead to the PCB before you
finally mount the board. It solders in
from the top (battery) side, then loops
down and up again through the two
strain relief holes to emerge on the
same side. Thread the wire through
the hole in the case before installing
the board into the case.
I used a ground lead with a connector on the far end, so I had to thread
the near end through the case before
soldering it.
Remember to secure the lid to the
case with the two screws provided.
Coin cells are extremely dangerous
for children, and it is mandatory that
they are only accessible with the use
of a tool. You should also be very careful about where you store them. Keep
them in their special child-resistant
packaging until they are required
and always well and truly away from
inquisitive little hands.
Using the SmartProbe
Fig.b: the SWD adaptor PCB
has just two components,
the connectors, plus three
test points.
case to suit the diameter of the ground
lead and probe you choose (the dimensions shown are what we used). Try to
make the probe hole a close, but not
tight, fit with the probe, including its
insulating sleeve. If it is too loose, the
probe may wobble around.
I made my probe from a sewing needle. These are nice and sharp, so good
for probing surface-mount parts, and
42
Silicon Chip
fairly hard, so they last a while. I used
a size 4 straw-type needle, but any needle with a diameter between 0.5mm
and 1.0mm should do. I covered the
needle in heatshrink tubing, leaving it
about 5mm short of either end.
The eye of my needle was a similar
diameter to the shaft, so I could insert
it through the case and into the connector as-is. You may have to cut the
Australia's electronics magazine
There is no need to calibrate the
SmartProbe, but you can check its
operation fairly easily with basic test
equipment. The absolute accuracy is
measured by setting a bench supply to
some voltage near the middle of each
range (I used 2V and 30V) and comparing the SmartProbe reading to that
from a known good meter, preferably
one with five or more digits.
The three units I built were all well
within ±25mV on the 5V scale and
250mV on the 50V scale (0.5% of full
scale in each case).
You can get an idea of its precision
by taking a series of readings (the more
the better) and looking at the variation between them. Successive readings should not differ more than about
siliconchip.com.au
±5mV and ±50mV on the two ranges,
respectively. Keep the multimeter connected when you do this, to make sure
the measured voltage does not change.
I measured the current consumption
of the three units I built. The maximum current when on was between
15mA and 25mA, depending on the
cell voltage. This means the average
battery life when on will be around
12 hours. When off, the current consumption was always less than 25µA,
corresponding to a shelf life of about
387 days.
Of course, neither of these is a realistic scenario. However, if we assumed
an on-time of 30 minutes per week
(remember it switches off after five or
six seconds of inaction, so this is 30
minutes of actual measurement time),
a fresh cell should last a little over 4
months.
The SmartProbe won’t replace my
multimeters, but if it becomes the first
piece of test equipment that I reach for,
SC
I will consider that a success!
Fig.9: drill the holes in the ends of the
case to sizes that suit your probe and
ground wire. You want a close (but not tight)
fit, so the probe is held firmly in place.
The programming adaptor connected to the
prototype SmartProbe.
Figs.10 & 11: the
PCB is secured in
the case with a #6 × 6mm
self-tapping screw. The probe
is inserted through the hole
in the case and into its
connector after the PCB is
mounted. Ensure the lid of the
case is secured with the supplied
screws to comply with the safety
requirements for coin cells.
siliconchip.com.au
Australia's electronics magazine
July 2025 43
|