USB current meter

Current meter, electronics

Assembled current meter

Specifications:

  • > 600mA measurement range
  • <10mA resolution
  • <5% error
  • Power switch
  • Warning LED at 400mA
Advertisements

White

Current meter, electronics

Another month, another board version.  This time the updated edition of the USB current meter.  And not just one, but 20 boards; kindly made by Seeed Studios.  White (of course!), with rounded corners, about the size of a USB drive.  Once assembled, it is pleasingly solid to hold.  These boards are meant to serve as demonstration samples: I can populate them, show them to people, and mail them all over the world.  In addition, building more than one unit adds confidence that the circuit functions as expected.

The only major change on this revision is the use of an ZXCT1010 to measure the output current – my previous LM358-based effort struggled at low currents, and required a larger sense voltage than I felt comfortable with.  The ZXCT1010 is suitably sensitive, highly linear and requires very little additional components.  (I did, however, spend a day debugging an unexpectedly high transimpedance, before I realised that I had been referring to the datasheet of the ZXCT1110.)

In addition to the change in current sensing, I moved the components closer together and shortened the board to be less than 50mm long.  The LED also moved to be next to the switch.  Although the footprint for the programming header is still present, I plan on leaving it unpopulated, and just connecting using pogo pins.

Current monitor

Current meter, electronics

My boards arrived from PCBtrain a few weeks ago, so you’d expect enthusiastic assembly to ensue. However,  most of my time is going into finding a job, so I’ve made relatively little progress. I started with the current monitor, to see what it feels like when assembled – so far I’m very happy.  It’s just like a slightly heavier memory stick.

The ATtiny does what it should, the LCD can display what I tell it to, and the switch works fine too.  Currently I’m recalculating the resistor values for current measurement, as I seem to have made the gain optimistically small. A similar measurement circuit is used in the power supply, so this provides a clean space to make sure it words exactly as designed.

USB current monitor

Current meter, electronics

The power supply is meant to be a tool.  But to build a tool, you need tools.  And sometimes you need to build those too.

Measuring the efficiency of the power supply is hard.  I can measure the output voltage over a known resistance, and calculate the output power.  But at the moment I have no input power measurements, except if I run it from a bench power supply.  And the bench supply goes through an LDO, so I have to compensate for that too.   Initially, I assumed that my laptop would complain around 2.5W, so I turned up the output until the USB voltage dropped, and calculated the efficiency as quite high.  However, with more tuning of the PWM frequency, I managed to get the measured output power to 2.7W.  Apparently my laptop is quite forgiving if you increase the power demand very slowly.  But this means I need a better tool.

One option is to  cut open a USB cable and connect a ammeter in series.  A more procrastinatory option, however, is to build a dedicated USB current monitor.  You simply plug it in, it measures the current passing through, and displays it. A warning LED for high currents.   So that’s where my weekend went.

Current monitor block diagram

This is a quite a simple circuit, so I won’t go into too much detail.  The current measurement is done with an LM358 measuring the voltage drop over a low-side sense resistor.  This is scaled to an appropriate level for the ATtiny’s ADC (i.e. < 2.5V).  The ATtiny doesn’t have enough pins to drive a cheap display, so I use three bytes worth of shift register to control the 7-segment LCD.

Why an ATtiny?  Price, mostly.  They are small, relatively cheap, and allows reuse of code written for the power supply.

After layout, the board is about the size of a USB flash drive, most of it filled by the 3 digit LCD.  I’ll piggyback it on my next manufacturing order, then I can write some code.

current monitor layout