Another DIY project designed with Solo-Lab.com’s SoloPCB Designer 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.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.
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.
For more detail: DIY USB Line Power Meter Stick