I wanted a tool to measure the power, voltage, and current values used by PCs, smartphones, and devices I created, so I created a measurement tool. The measured data taken can be sent to an InfuxDB server and displayed on a dashboard.
By changing the type of adapters, you can measure from USB-TypeC to Type-A/B by changing the type of adapters.
Custom PCBs were created with the help of PCBWay, and they can be created simply by posting the PCB Gerber file archives on the quick order website. I recomend a use of PCBWay Plug-in for KiCad. With this plugin, you can upload gerber data and order a PCB with a single click.
The voltage input range is from 0 to 85V, Maximum current input is 5A.
FeatureHigh-resolution - By using Texas Instruments INA228 IC - 20-bit delta-sigma ADC, It can be got measurement data with 195.uV Bus voltage and 163.84mV Shunt voltage.
Microcontroller on board - No need for a client PC when you are measuring. Directly send to the server.
Transfer measurement data via WiFi - This Logger can transfer data to Linux PC via WiFi network and you can see the dashboard graph in influxDB.
Battery Powered - Using LiPo battery. It can run for 24-48 hours.
Multiple Adopter - This Logger can be changed 4 type adopters (USB-Type-C-Type-C, USB-Type-A-mini Type-B, JST-PH-Connector for Battery, 3P-Terminal)
How to use the LoggerThis logger has four types of adapters, and by changing them, it is possible to measure the usage voltage, current, and power consumption of various devices"
Red Adapter - To measure the voltage and current from the USB Type-C Power Adapter to the Type-C Power Input Device(PCs, etc.)
Yellow Adapter - To measure the voltage and current from the USB Type mini-B port to the USB Type-A output port.
Green Adapter - To measure the voltage and current between the JST-PH connector. (Batteries, etc.)
Blue Adapter - To measure the voltage and current of some cabling type.
For example, if you want to measure the voltage of USB-Type-C power, set the red adopter into the slot. If the power supply does not work, you can try to insert one of the connected Type-C connections in the opposite side of the back. Because a Type-C cable has two sides.
The Blue Adapter has 3 pins screw terminal. To measure voltage and current, connect to the following the schematic.
DO NOT CONNECT WITH OPPOSITE POLARITY. IF CONNECTED, THE ADC IC IS WILL BE DAMAGED.
The measurement interval time can be selected from 5 ms to 1 sec. When the logger is powered on, the interval time is 5 ms, then pressing the INT button will set the interval to 10, 50, 100, 500ms, or 1 sec.
Push the START button, then the logger starts to send to the server voltage, current and power consumption data.
A display can show you the current voltage, current, power consumption, battery voltage, buffer consumption, and WiFi connection status.
If the WiFi Access Point cannot establish a connection, the display will not show WiFi mark. If voltage is measured while the WiFi is not connected, the data is stored in the logger's internal memory buffer. The buffer that is not being sent to the server is indicated by a red bar line on the display. When the buffer is full (the line reaches the right edge of the display), the measurement stops automatically. Then, when the WiFi is connected and transmitted to the server, the buffer line shrinks to the left. If the buffer is full and the measurement is stopped, pressing the Start button again discards the measurement data being held and starts the measurement again.
If you send data to the server, You can see the realtime data using Dashboard by [InfluxDB](https://www.influxdata.com/influxdb/).
After the measure, to stop logging, push the START button again.
To charge a battery, just connect to a USB Type-C port from the bus-powered USB port. During the charge, the CHG LED is RED ON. After the charging is full, the FUL LED is GREEN ON. And the charging will be stopped automatically. But,
DO NOT CONTINUE THE CHARGE IF THE BATTERY IS FULL FOR A LONG TIME.
Design a SchematicFor EDA, I used KiCad 7.0 to draw the schematic. The connection between the ESP32-C3 microcontroller and OLED Display (SSD1331) is an SPI connection, and the INA228, an IC that measures voltage, is connected via I2C. MCP73831 was used to control Battery charging.
There are 4 types of adapters.
The next step is to create the PCBs layout.
I ordered PCBWay to manufacture my board. With the PCBWay Plugin for KiCad, I was able to order easily: from KiCad's main menu, select Plugin and Content Manager.
Select PCBWay Plug-in for KiCad and Click Install button. Then click Apply Pending Changes.
After that, you can see the PCBWay icon on the menu of PCB Editor. To upload the gerber data of the PCBs, just click the PCBWay Icon.
And then, your browser will automatically launch and the PCBWay order screen will appear. You can select the board spesicifications.
After the order, I recieved boards about 1 week later.
I am happy at the moment of mounting components.
I also design the container for this tool. Then I printed them by 3D printer.
In the photo, the board in the blue case and the board in the green case are put in the wrong case. Correctly, the board in blue and the board in green are interchanged.
Place the battery at the bottom and connect it to the main board. Then, place the separator board on top of the battery and the main board on top of it. When the board fits perfectly, put the red switch cap on the left switch. If the cap is loose, glue it back on. Insert the white panel into the top and the main unit is complete. Complete the adapters by placing a cap on each of them.
Using Ubuntu 22.04.02 LTS
Please refer to the GitHub page.
https://github.com/hnz1102/current-logger
Current-Logger can't directly send data to influxDB API since ESP32-C3 does not TLS software stack. This agent program is responsible for changing HTTP communication from Temp-Logger to HTTPS communication and passing data to the InfluxDB API. I prepared this agent that is purpose only for a local network because it has no security.
ConclusionIt would be interesting to measure the voltage, current, and power consumption of various USB devices. Actually, I found that the current changes widely with the use of electricity. Next, we would like to create a tool that allows us to switch and share data between two USB memory devices with a single touch on two PCs.
Thanks to the PCBWay for support and produce PCBs with better quality.
LICENSEThis source code is licensed under MIT. Other Hardware Schematic documents are licensed under CC-BY-SA V4.0.
Comments
Please log in or sign up to comment.