This is only a preview of the June 2026 issue of Silicon Chip. You can view 43 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:
Items relevant to "Phenomenal Pinball Machine, Part 1":
Items relevant to "Human Comfort Indicator":
Items relevant to "Simple USB Power Monitor":
Items relevant to "Micropower SSB Transmitter":
Purchase a printed copy of this issue for $14.00. |
USB Power Monitor Kit (SC7683, $50): includes the PCB and all onboard parts
U Simple
S Power
B Monitor
By Richard Palmer
This circuit uses just a handful of parts but it can
measure USB voltage, current and power over a wide range (up
to 36V, 3A & 108W). It displays the readings on an OLED screen.
Displays USB bus voltage, current, power and energy delivered
Simple and detailed display formats
Supports USB 2.0 and 3.0 power delivery up to 3A/36V
Display settings remembered between sessions
±0.3% voltage and ±1% current accuracy
Display rotation at the touch of a button
Resolution: 100μA, 10mV Serial data logging
W
hile USB-C is slowly taking over,
there are still many devices using
USB-A plugs and sockets.
While our recent USB-C Power
Monitor (August 2025; siliconchip.au/
Series/445) is also capable of measuring USB-A devices with appropriate
adaptors, this project is substantially
simpler – it is basically an update on
the December 2012 USB Power Monitor (siliconchip.au/Article/460) with
higher resolution, modern components and the ability to measure the
wider range of voltages and currents
when the device uses a USB power
delivery (PD) mode.
The monitor has two display modes.
The default shows the USB bus voltage and current flow in large characters. A second mode, with smaller text,
adds the power and the energy that has
been delivered while the unit has been
powered on. The display can also be
flipped upside-down, if required for
more convenient reading.
The unit also provides a TTL-
compatible serial logging output,
shown in Screen 1, which avoids the
need for copying down a long series
of readings when monitoring over an
extended time period.
the many variations and how they
evolved.
In summary, a standard 4-pin USB
1.0 port can supply up to 500mA at
5V. USB 2.0 upgraded the 4-pin standard to 1A. USB 3.0 introduced power
delivery and a 9-pin USB-A connector, which is backwards-compatible
(ie, four of the nine pins are in the
same locations and have the same
functions).
USB-C PD can deliver up to 5A at
20V after negotiation between the
source and sink over the CC (Configuration Channel) pin using BMC signalling. When no negotiation occurs,
Component selection
USB connectors and power
delivery
There are a range of USB port types,
each with its own power capabilities.
The Wikipedia article on USB hardware (https://w.wiki/3oc8) details
60
Silicon Chip
5V is supplied. With USB 3.1, which
is exclusively delivered via USB-C
connectors, up to 5A at 48V can be
delivered.
In suspend mode, when the PC
or laptop is asleep, the host controller stops sending keep-alive (Start of
Frame) signals to devices. This tells
the connected device to go into idle
mode, with a reduced allowable current draw.
A USB device may adopt very different power profiles, depending on
which kind of power source and cable
are used, and whether the host is active
or asleep.
Screen 1: example output of the serial
logging feature in the Arduino Serial
Monitor.
Australia's electronics magazine
The monitor uses just three ICs, an
OLED display and a handful of passive components.
The SSD1306 128×64-pixel 0.96inch (24.4mm) I2C OLED screen’s footprint determines the size of the PCB,
with additional strips at the edges to
accommodate the tactile switch (S1)
and USB connectors.
The USB connectors, CON1 and
CON2, are soldered directly to the
PCB. The 9-pin USB-A plug and
socket are compatible with USB 1.0,
2.0 and 3.0 devices. SMD connectors
were selected because very few 9-pin
through-hole versions are available,
making reliable component sourcing
difficult.
Voltage and current measurements
are made by an INA237 power monitor
siliconchip.com.au
USB 3.1 PD Warning
The unit may be damaged with USB
3.1 power delivery modes sourcing
more than 36V. This can occur
when connected to a USB-C power
source designed to deliver more
than 180W, which permits up to 48V
to be supplied.
chip, which has an internal 16-bit
analog-
to-digital converter (ADC),
offering better than ±0.3% accuracy
and providing up to 85V high-side
voltage and current measurements.
The higher-priced INA238 chip
can be substituted, as it is pin- and
code-equivalent. It has better (±0.1%)
current accuracy, which will not
increase the overall accuracy of the
unit, as the shunt resistor’s 1% tolerance is substantially greater.
Through-hole power resistors with
resistances of less than 1W and tolerances better than ±5% are rare and
expensive, so a 1W ±1% M6332 (2512
imperial) low-resistance metal alloy
(LRMA) SMD resistor is used for the
current shunt (R1).
LRMA resistors use a cupro-nickel
alloy and have a very low temperature
coefficient, in the range of ±75ppm
(±0.0075%) per °C, which translates
to less than 0.4% variation across
a working range of 10-40°C. As the
stated temperature coefficient allows
for either a rise or fall in resistance
when the temperature rises, we have
not included temperature compensation in the current calculations.
The shunt resistor value is determined by the 3A maximum current
requirement and the 163.84mV full
scale of the INA237’s ADC. A value
of 0.025W results in 75mV across
the shunt and ¼W dissipation at 3A.
While 0.05W could have been used, the
lower value resistor means reduced
power dissipation and a lower V+ voltage drop without significantly affecting the overall accuracy.
To minimise the effect of any temperature rise on current readings, we
have connected the resistor’s terminals
to as substantial a PCB copper area as
the USB signal traces allow.
As USB 3.0 power delivery mode
can negotiate anything from 5V to 20V
on the V+ USB pin, a 3.3V regulator
with a wide input range is required
to reduce the voltage to drive the circuitry. While both the microcontroller
siliconchip.com.au
The INA237 DC power monitor IC
The INA23x series of DC power monitors offer current, voltage, power and die
temperature measurement (see the diagram below). It has a 16-bit ADC that
is shared by voltage, current and temperature measurements.
The chip can operate at 3.3V or 5V, is controlled over an I2C serial bus and
consumes less than 1mA. Two address pins allow up to four chips to coexist
on a single I2C bus.
Other products in the INA2xx series come with higher-accuracy 20-bit ADCs
or SPI control interfaces rather than I2C.
The current shunt resistor can be located on the high or low side of the load,
as the current input’s common voltage range is -0.3V to +85V. The chip has two
ranges for measuring the shunt voltage, 42mV and 164mV full-scale, providing
flexibility in choosing the shunt resistor’s value to best balance measurement
accuracy and heat generation.
As the chip has a very low input bias current, accurate current measurement from microamperes to kiloamperes is possible anywhere in the permitted input voltage range.
A digital filter rolls off the ADC response at half the sampling frequency to
avoid aliasing measurement errors. The sampling time is individually adjustable for the voltage, current and temperature measurements, ranging from
50μs to 4ms. The chip can average up to 1024 samples, further reducing noise.
Any necessary calculations are undertaken in the background to minimise
measurement lag.
The INA237 also has an alert pin, which changes state when any desired
combination of current, bus voltage, power or die temperature goes outside
set limits.
The INA237 chip includes a shared ADC that measures voltage, current and
temperature. The embedded processor can average up to 1024 readings and
calculate the power figure.
and power monitor chip can operate
at either 3.3V or 5V, 3.3V was selected
to provide headroom for this regulator when operating from a 5V supply.
The MIC5233-3.3 regulator was
selected as it has a small SOT-23-5
footprint, can handle the required
input voltage range and is readily
available. It is connected to V+ on the
upstream USB connector to avoid the
unit’s current consumption being registered by the INA237.
Like with the December 2012
design, no case is required. Instead,
the unit is protected by enclosing it
in a length of clear heat-shrink tubing.
Circuit description
The USB Power Monitor circuit
is shown in Fig.1. Regulator REG1
reduces the input USB input voltage,
Australia's electronics magazine
V+ on CON2, to 3.3V for the ICs and
display. Its heatsinking requirements
are not substantial, as the circuit only
draws a few milliamps. It can be disconnected at JP1 while the microcontroller is being programmed.
Power and data signals travel
between the two USB connectors,
CON1 and CON2, with the V+ line
interrupted by shunt resistor R1
(25mW). This resistor translates the
current consumed by the device under
test to a voltage, which is captured
by the power monitor chip’s Vin+ and
Vin− terminals.
The USB V+ voltage is measured
on the CON2 (output) side, so that the
voltage available to the device under
test is correctly displayed.
An ATtiny85 microcontroller operating at 16MHz drives the power
June 2026 61
A TTL serial-to-USB
adaptor (with
the black
PCB) can be
connected
to the Power
Monitor for
logging power-on time,
bus voltage, current
and more.
monitor chip and display. It has a Universal Serial Interface (USI) that can be
configured as an I2C or SPI port. During
device programming, the SPI mode is
used, while under normal operation,
the USI is in I2C mode to communicate
with the OLED and INA237 ADC chip.
The ATtiny85’s I2C interface has
SCL on pin 7 and SDA on pin 5.
Pull-up resistors for these pins are provided by the OLED display. The I2C
bus runs at 400kHz, at which speed
all the required traffic is completed
well within the two-second display
update cycle.
The I2C pins are shared with the
SPI interface used for in-circuit programming (via CON3), which is initiated when pin 1, RESET, is pulled low
by the programmer. When the unit is
booted normally, the code sets the pins
to I2C mode.
Once programming is complete, the
MISO SPI signal (PB1 at ATtiny85 pin
6) is no longer needed in I2C mode.
It is re-assigned as the unused RxD
(receive) serial pin for serial log data,
with the TxD (transmit) logging data
coming from pin 2 (PB3).
Software
When power is applied, the microcontroller initialises the OLED display, which is expected at I2C address
0x3C. The power monitor chip, IC2,
has an address of 0x40 with its A0 and
A1 pins tied to ground.
The resistance of the shunt and the
maximum current to be measured are
provided to the power monitor chip’s
driver software, which calculates
the calibration value for the chip’s
SHUNT_CAL register using the value
of the shunt resistor. Voltage calibration is inbuilt.
The chip is set to sample the current and voltage every 280μs and average them over 1024 readings, which
provides a final set of readings at
approximately 300ms intervals. It provides measurements in signed 16-bit
integer format, which are converted
into floating-point measurements in
software. The display updates once
every two seconds.
Fitting the display driver and font
into the available memory proved
challenging. The microcontroller only
has 8kiB bytes of flash memory program space and 512 bytes of RAM. A
full font would consume more than
the total flash, but for this project, we
don’t need the full ASCII character set.
So large and small fonts were created that contain only the characters
0-9 plus the decimal point, space, “V”,
“A”, “W” and “m” characters.
The usual practice of creating a bitmap in memory and then copying it
to the display would have taken 1024
bytes of RAM. Instead, each line of
characters is converted to bitmap format and written directly, in rows of
eight pixels at a time, to the display.
These 8 × 128 pixel ‘pages’ create
a restriction that a new line can only
start at the top of a new page if the previously written data isn’t to be overwritten. In practice, this means eight
rows of tiny characters, four rows of
medium-sized characters, or two rows
of large characters. Only the two- and
four-row options are used.
The tactile switch (S1) is sensed by
the ATtiny85 on pin 3 with the GPIO
port’s pull-up current enabled. It is
checked once per display cycle. A
press lasting one display cycle changes
between the two display modes, while
a two-cycle press rotates the display
by 180°.
Fig.1: the device uses three integrated circuits, one OLED display module, a shunt resistor and not much else. The circuit
simplicity is mainly due to the features of the INA237/238 being a perfect fit for our needs in this application.
62
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
Serial logging is accomplished by
driving the serial port in software
(bit-banging) as the hardware USI is
occupied with I2C communication for
the OLED screen.
The signal is at 4800 baud with 3.3V
TTL-compatible levels. A TTL serialto-USB adaptor and a suitable terminal
program can be used to view and save
the data. Only the RxD and GND pins
on the serial adaptor need to be connected to the USB monitor. The data is
comma-delimited, including the time
since power-on, USB bus voltage and
current written in the same format displayed on the screen.
PCB design
To ensure minimal voltage drop in
the USB ground return path, the USB
GND pins are connected to the PCB
ground plane as well as having pointto-point copper traces.
The ground plane has been removed
under the USB signal traces to minimise parasitic capacitance, which can
degrade high-speed signals. All the signal traces are of equal length to minimise relative phase shifts.
Parts List – Simple USB Power Monitor
1 double-sided PCB coded 04104261, 44 × 29mm
1 128×64-pixel monochrome 0.96-inch I2C OLED module [SC6176/SC6936]
1 Würth 692112030100 9-pin USB 3.0 SMD plug (CON1)
1 Switchcraft RAHUA30E 9-pin USB 3.0 SMD socket (CON2)
1 2×3 pin header (CON3; optional, for ICSP)
1 3-pin header (CON4; optional, for serial logging)
1 4.5 × 4.5mm, 5mm tall SMD tactile pushbutton switch (S1)
[Altronics S1112A]
1 6-pin vertical 2.54mm-pitch pin header (for mounting OLED module)
1 50mm length of 35-50mm wide (measured flat) clear heatshrink tubing
1 USBasp programmer with 6-pin adaptor and IDC cable
(optional; for ICSP) [Jaycar XC4627 + XC4613]
Semiconductors
1 INA237 or INA238 power measurement IC, VSSOP-10 (IC1)
[Mouser 595-INA237AQDGSRQ1, DigiKey 296-INA237AQDGSRQ1CT-ND]
1 ATtiny85V-20PU microcontroller programmed with 0410426A.HEX, DIP-8
(IC2) [Altronics Z5105, Jaycar ZZ8721 (both supplied blank)]
1 MIC5233-3.3YM5 or MIC1793-330OT LDO 3.3V linear regulator,
SOT-23-5 (REG1) [Mouser MIC5233-3.3YM5-TR]
Capacitors/resistors
2 4.7μF 25V SMD M2012/0805 X7R multi-layer ceramic capacitors
1 100nF 50V SMD M2012/0805 X7R multi-layer ceramic capacitor
1 0.025W ±1% 1W+ M6332/2512 LRMA SMD current-sense resistor
[Mouser LRMAP2512-R025FT4]
Construction
All components mount on the 44 ×
29mm PCB, which is coded 04104261
– see Fig.2. The OLED screen, tactile
switch and USB connectors fit on one
side, with the remaining components
on the other.
The ATtiny85 chip comes in an
8-pin DIL package. While it could be
socketed, that is not recommended
as it will produce a bump in the heatshrink cover on the bottom of the unit.
Leave mounting the OLED until last,
as the USB connectors and in-circuit
programming pins can’t be soldered
in once it is in place.
If you are programming your own
ATtiny85, solder it in and follow the
instructions below. Programming may
be done at this point or after other components have been mounted. If the regulator is in place when programming,
JP1 must be broken to prevent the regulator being reverse-powered and possibly damaged.
Next, install the surface-mount
parts. Begin with the three ICs and
then follow with the passive components. Most of the SMD parts are big
enough not to present too many difficulties. We’ve covered SMD soldering
on many occasions in the past, so we
won’t go into detail here.
siliconchip.com.au
Fig.2: like the circuit, the PCB is simple and assembly is straightforward. Make
sure to mount the screen last, and carefully check all the SMD solder joints,
especially on IC1, before moving on to the through-hole parts.
The INA237/8 power monitor chip
is in a VSSOP package with 0.5mm pin
spacing. If you accidentally bridge any
of the pins, simply use solder wick to
clean it up. A dab of ‘no-clean’ flux
paste applied to the bridge beforehand
makes clean-up easier.
Solder in USB connectors CON1
and CON2 next. I had to lever up the
shield on CON2, as the pins were
unreachable with a soldering iron.
Don’t worry if the shield breaks off.
Once testing is complete, it can be
clipped back on and a couple of dabs
of solder on the top edge will hold it
firmly in place.
At this stage, plugging the unit into
a USB power source should produce
3.3V between JP1 and either of the
grounded USB connector cases.
Mount the OLED display using a
pin header for the connections and
two single pin pieces of header strip
Australia's electronics magazine
soldered through the mounting holes
at the other end of the display to
anchor it. Before soldering, make sure
that the pins on CON3 don’t foul any
components on the OLED module.
Cut all the OLED pins off flush on
both sides.
If logging is required, trim off any
protruding leads from pins 2 and 4 of
the ATtiny85. Remove the middle pin
from the three-pin header and mount
it on the underside of the PCB, parallel to CON2. Extra solder pads have
been provided to make the connections more robust.
Programming the ATtiny85
If you haven’t purchased a pre-
programmed ATtiny85, you will need
programming hardware and software.
While there are many options available, I have found the following to
be straightforward and reliable on
June 2026 63
Screens 2 & 3: the main Zadig screen with the USBasp device selected and libusbK as the target driver (shown at left).
Device Manager showing that the USBasp driver has been successfully changed to libusbK (shown at right).
Windows. For Mac and Linux users,
there are several good online tutorials
for ATtiny85 USBasp programming.
First, purchase the USBasp programmer (see www.fischl.de/usbasp)
from your favourite source. Make sure
it has a 6-pin socket and IDC cable or
includes a 10-pin to 6-pin adaptor.
For Arduino users, complete code is
also included in the download pack.
Board and device settings are listed
at the top of the main program. The
programmer to select is the “USBasp
(ATTiny Core)”.
Otherwise, download and install
AVRDUDESS (siliconchip.au/link/
acb4), which includes the AVRDUDE
command-line programming software.
Next, download and install Zadig
(https://zadig.akeo.ie). Plug in the
USBasp programmer and run Zadig
(Screen 2).
If USBasp doesn’t show in the
device field, click on Options → List
All Devices and select it from the list.
Select libusbK from the dropdown
list that the green arrow points to,
and click on the Install (or Reinstall)
Driver button. Wait for the process to
complete.
Now if you open Windows Device
Manager, you should now see an entry
for libusbK USB devices, similar to the
one in Screen 3.
Programming is undertaken with
the ATtiny85 mounted on the PCB
and the programmer connected to the
ICSP header. No USB cables should be
connected to the USB Power Monitor
while programming.
Everything is now ready to program the ATtiny85. If your USBasp
programmer has a voltage selector
jumper, choose 5V. Open link JP1 on
the Power Monitor board to prevent
reverse-
powering REG1 during programming.
Connect the USBasp and Monitor
boards via the 6-pin connector. Pin
1 (red stripe on the cable) is marked
with a white dot on the PCB. Plug the
USBasp into a USB port on your computer and run AVRDUDESS (Screen 4).
Select “usbasp-clone” from the list of
programmers and select “ATtiny85”
from the microcontrollers list.
Locate the HEX file from the
download package (siliconchip.au/
Shop/6/3621) using the “…” button
to the right of the Flash field. Leave
the EEPROM field blank but change
the “Fuses & lock bits” settings to L =
0xF1, H = 0xD7, E = 0xFF, LB = 0xFF.
The AVRDUDESS window should
look similar to Screen 4.
Click on the Write button next to the
Fuses & lock bits settings, then click
Program! The console panel should
show progress, ending with a message indicating that the flash memory
or fuse bytes have been verified. Disconnect the programmer and re-solder
JP1 to restore the power supply from
REG1. The Power Monitor is ready
for use.
Testing
The unit can now be fully tested.
Plug it into a power source. The display should light up after a second or
so, displaying close to 5V and 0.0A.
Screen 4: this AVRDUDESS window shows the programmer type, target
microcontroller and HEX file selected. Note the values in the “Fuse” and “lock
bits” settings. These need to be written to set the clock speed correctly.
The larger
PCB is one
version of the
USBasp-based
AVR programmer.
Since this one has a
10-pin socket, you’ll need a 10-pin to
6-pin adaptor (shown adjacent), or to
purchase one with a 6-pin socket.
Australia's electronics magazine
siliconchip.com.au
64
Silicon Chip
Press and hold the tactile switch; the
display should change format after a
display cycle.
Plug any USB device into the measurement port. The displayed voltage
should drop marginally, and the current reading should show a non-zero
value. Calibration is not required.
If all is well, the heatshrink sleeve
can be added and shrunk on the outside edges. If header pins were fitted
to CON3, the pins should be trimmed
down to the plastic retainer before fitting the heatshrink tubing.
While large-bore clear heat shrink
tubing isn’t readily available from
the main Australian suppliers, eBay
and AliExpress both have suitable
products. Be careful not to shrink the
tubing too tightly, as the screen rotation switch can become permanently
depressed. If this happens, cut a circle
in the heat-shrink tubing around the
switch’s plunger.
Operation
Operation is straightforward. Simply connect the monitor to a USB
power source and the device to test
into the USB socket on the monitor.
Initially, the unit will display the
USB bus voltage and the load current
in large characters. If the button is
pressed for a display cycle (approximately two seconds), the display will
change to also show the instantaneous
power flow and the total energy that
has been delivered since the unit was
powered on.
The display automatically switches
between amps, watts and amp-hours
and their milli- equivalents when the
current/power/energy reading is low.
If the text on the display is upside
down, hold the switch down for two
display cycles and it will flip.
When logging, always connect
the Power Monitor to its USB power
source before connecting the TTL
serial adaptor. Otherwise, the monitor
may not operate correctly.
The USBasp programmer
connected to the
underside of the Power
Monitor (with a red
colour PCB for the
6-pin adaptor this time.
While an IC socket was
used for IC2 here, we do
not recommend
using one, as it will
produce a bump in
the heatshrink.
The Monitor attached to my
vintage decade resistance
box during testing.
Conclusion
The INA237 power monitor chip
enabled this project to be developed
with a high level of accuracy using
only a few components.
The ability to calculate the energy
consumed and log readings on a
computer extends its usefulness for
devices such as power banks and battery chargers where the load varies
SC
over time.
Here is the Power Monitor connected to my mobile phone from a power
delivery capable charger.
siliconchip.com.au
Australia's electronics magazine
June 2026 65
|