DIY-USB-Line-Power-Meter-Stick-Connected-to-Laptop

Another DIY project designed with FabStream’s SoloPCB tool is ready to be shared with Electro-Labs community. This is an USB stick which measures the supply voltage of the USB port and current drawn by the device connected to the port over the stick. Then it calculates the power consumption of the device and displays the whole information with the help of the small OLED display on the board. The stick itself is also powered from the USB port.

The board is built around an Atmel ATMEGA328 microcontroller. To make the circuit as small as possible, the MCU is used in minimal configuration. Internal 8MHz oscillator is used. The voltage and the current are measured by the internal 10 bit ADC. To make the measurements more accurate, an external 2.5V voltage reference IC, Microchip MCP1525 is included. The current is converted to voltage on a 0.01R sense resistor and precisely amplified by LT6106 before read. The stick can measure up to 2.5A. Since the OLED display requires 3.3V supply voltage, L78L33ACUTR linear voltage regulator is used for 5V to 3.3V conversion.

Circuit Design

 

DIY-USB-Line-Power-Meter-Stick-Small

The main component of the circuit is ATMEGA328. It is planned to be used as an Arduino microcontroller with Arduino IDE. Some pins such as MOSI, MISO, SCK, RXD, TXT, 5V, GND and RESET are extended through J3 to J10 to upload an Arduino bootlaoder to the microcontroller and then upload the sketches by using an Arduino UNO board. You can see more details on this page showing how to use Arduino UNO to program an external ATMEGA328.

DIY-USB-Line-Power-Meter-Stick-Top

An external 2.5V voltage reference is used to get more accurate ADC readings. Since the ADC module of ATMEGA328 is 10 bit, the reading resolution is 2.44mV (2.5V/1024). It is quite enough for the purpose of the circuit.

The 5V line of the USB port is passed through a voltage divider network including 14K and 10K resistors to extend the readable voltage up to 6V.

LT6106 is a high side current sense amplifier. The current supplied to the USB device is passing through a 10 milliohm sense resistor. By this way, the current information is converted to voltage. LT6106 precisely amplifies the voltage by a gain factor of 100. Then the voltage is read by another ADC channel of ATMEGA328.

The measured and calculated information are all shown on a 0.5” OLED display. It has a resolution of 60x32px. It is probably the smallest OLED display you can find on the DIY market. It requires 3.3V supply voltage and communicates via SPI interface. To drive the display U8Glib library is used that you can find the whole information about the library on this page.

PCB Design

 

DIY-USB-Line-Power-Meter-Stick-PCB

Assembly And Test

The components of the board are listed below.

Quantity Part Description Designator
1 L78L33ACUTR 3.3V Linear Voltage Regulator SOT-89 U1
1 Microchip MCP1525 2.5V External Voltage Reference SOT-23 U2
1 LT6106 High Side Current Sense Amplifier TSOT-23-5 U3
1 Atmel ATMEGA328P-AU Microcontroller TQFP U4
1 100R 1% 0805 Resistor R1
1 0.01R 0.1% 0805 Resistor R2
3 10K 1% 0805 Resistor R3 R4 R6
1 14K 1% 0805 Resistor R5
5 100nF 50V 0805 X7R SMD Ceramic Capacitor C1 C3 C5 C8 C9
2 1nF 50V 0805 X7R SMD Ceramic Capacitor C4 C7
2 1uF 10V 1206 Ceramic Capacitor C2 C6
1 10uH 1206 Chip Inductor L1
1 0.5" OLED Display DIS1
1 USB-A Male PCB Type Connector J1
1 USB-A Female PCB Type Connector J2

DIY-USB-Line-Power-Meter-Stick-Bottom

Most of the components are surface mount type but there is no challenging soldering process. The USB connectors and the display module are through-hole. You can use female headers not to directly solder the display on the board.

DIY-USB-Line-Power-Meter-Stick-Standby

Software

The Arduino sketch of the board is simple. It basically reads the seperate ADC inputs for the voltage and the current measurements. It averages 10 samples from each channel to filter out the noise. After a simple V*I power calculation, it shows up the values on the display by using the U8Glib library. The measurement is repeated every one second. The software runs in an endless loop.

DIY-USB-Line-Power-Meter-Stick-Closeup

On the image below, you can see the measurement results while charging a cellphone over USB.

DIY-USB-Line-Power-Meter-Stick-Chargin-Cellphone

Here is the Arduino sketch of the USB line power meter stick.

Please feel free to ask your questions and share your comments by using the comments field below.