In the world of electronics development, measuring power consumption accurately has always been a critical challenge. Whether you're designing battery-powered IoT devices, optimizing circuit efficiency, or debugging power-hungry components, you need precise, real-time measurements of voltage, current, and power consumption. Traditional benchtop multimeters are bulky, expensive, and lack the capability for continuous data logging and remote monitoring.
The VisionThe Mini Current Meter was born from a simple yet ambitious vision: create a compact, battery-powered, high-resolution digital power monitor that could operate independently, log data continuously, and transmit measurements wirelessly to a centralized dashboard. The goal was to build something small enough to fit on a breadboard, precise enough for professional use, and smart enough to operate autonomously.
How to Use the LoggerThis meter has a pin socket with three pins: VBUS/VIN+, GND, and VIN-. The VBUS/VIN+ pin is connected to the voltage input or the current input. The GND pin is connected to the ground of the voltage or current input. The VIN- pin is connected to the load side of the voltage or current input.
DO NOT CONNECT WITH REVERSE POLARITY BETWEEN VBUS/VIN+ AND GND. IF CONNECTED INCORRECTLY, THE ADC IC WILL BE DAMAGED.
The measurement interval time is fixed at 100ms. Each measurement data is sent to the server every 1 second.
The display shows the current voltage, current, power consumption, battery voltage, buffer consumption, WiFi connection status, and channel number.
If the WiFi Access Point cannot establish a connection, the display will not show the WiFi indicator. If voltage is measured while 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 buffer bar on the display. When the buffer is full (the bar reaches the right edge of the display), measurement stops automatically. When WiFi is connected and data is transmitted to the server, the buffer bar shrinks to the left. When the buffer is full and measurement is stopped, measurement will resume automatically after the buffer drops below 50%.
Calibration Function - Built-in calibration functionality with persistent storage. Long press the center button for 2+ seconds to perform automatic calibration that corrects voltage and current measurement offsets. Calibration results are automatically saved to non-volatile storage and restored on power-up.
The Technical FoundationHeart of Precision: INA228 ADC
At the core of this device lies the Texas Instruments INA228 IC, a 20-bit delta-sigma ADC that delivers exceptional measurement resolution. With 195µV bus voltage resolution and 163.84mV shunt voltage resolution, this chip can detect even the smallest power variations that other meters might miss. The device supports voltage measurements from 0 to 35V and current measurements up to 10A, making it versatile for a wide range of applications.
Brain: ESP32-C3 Microcontroller
The ESP32-C3-WROOM module serves as the intelligent brain of the system. This RISC-V based microcontroller brings several key capabilities:
- Built-in WiFi connectivity for wireless data transmission
- Sufficient processing power to handle real-time calculations
- Low power consumption for extended battery life
- Rich peripheral support for I2C communication and display control
Visual Interface: SSD1306 OLED Display
A compact 128x64 monochrome OLED display provides immediate visual feedback. The display shows:
- Real-time voltage, current, and power readings with auto-ranging (mV/V, mA/A, mW/W)
- Battery voltage status
- WiFi connection indicator and signal strength
- Buffer usage visualization
- Channel selection (1-4 channels supported)
- Measurement status
Rust Programming Language
The entire firmware is written in Rust using the ESP-IDF framework, bringing several advantages:
- Memory safety without garbage collection
- Zero-cost abstractions for embedded systems
- Strong type system preventing common programming errors
- Excellent concurrency support with thread-safe data structures
Modular Design
The software follows a clean modular architecture:
main.rs - Core application logic and sensor interfacing
displayctl.rs - Display management with auto-ranging and flicker prevention
currentlogs.rs - Data logging and buffer management
wifi.rs - WiFi connection and network management
transfer.rs - InfluxDB data transmission
Recent Updates
Version 0.1.1 - 2025.08 - Calibration and Accuracy Improvements
- Added calibration functionality: Built-in calibration system with persistent storage
- Fixed volatage measurement - Change to the step voltage 195.3125uV/LSB correctly.
The Board DesignThe board design is compact and efficient, You can use the Gerber files [here] for PCB manufacturing in the 'hardware' directory.
The ESP32-C3 module is mounted on a custom PCB. To mount the ESP32-C3 module, you can use the hotplate method like this:
There are several GND pads on the ESP32-C3 module bottom, which need to be soldered to the PCB for proper grounding. This ensures stable operation and accurate measurements.
Auto-Range Display System: The display automatically switches between measurement ranges (mV/V, mA/A, mW/W) with hysteresis to prevent flickering. The system uses smart thresholds (2V/2A/2W for scaling up, 1.5V/1.5A/1.5W for scaling down) to ensure stable display readings.
Intelligent Buffer Management: When WiFi connection is lost, the device automatically stores measurements in internal memory. The system monitors buffer usage and provides visual feedback through a progress bar. When the buffer reaches capacity, logging stops automatically. Once WiFi reconnects and the buffer drops below 50%, logging resumes automatically.
Multi-Channel Support: Users can cycle through 4 different measurement channels using a center button, allowing multiple measurement points to be monitored with a single device.
Real-Time Data Transmission: Every measurement (taken at 100ms intervals) is aggregated and transmitted to an InfluxDB server every second when WiFi is available.
The HardwareCompact Form Factor
At just 37mm(W) x 67mm(D) x 55mm(H), the Mini Current Meter is designed to fit into tight spaces. Whether you're measuring current on a breadboard circuit or monitoring power consumption in a prototype enclosure, its small size makes it incredibly versatile.
Battery-Powered Operation
A built-in LiPo battery provides up to 12 hours of continuous operation. The device features:
- USB Type-C charging port for modern convenience
- Intelligent charging management with CHG (charging) and FUL (full) LED indicators
- Automatic charging cutoff when battery is full
- Battery voltage monitoring displayed on screen
Local Measurement
The device continuously samples voltage and current at 100ms intervals using the high-resolution INA228 ADC. Power consumption is calculated in real-time from these measurements.
Wireless Transmission
When WiFi is available, measurements are packaged and transmitted to an InfluxDB time-series database every second. The data includes:
- Timestamp with nanosecond precision
- Voltage, current, and power readings
- Battery status
- Channel identification
- Device metadata
Dashboard Visualization
Users can monitor real-time data through InfluxDB dashboards, supporting:
- Multiple device monitoring (up to 4 channels per device)
- Historical data analysis
- Custom graph configurations
- Real-time alerts and notifications
Using Ubuntu 22.04 LTS
1. Install Rust Compiler
sudo apt update && sudo apt -y install git python3 python3-pip gcc build-essential curl pkg-config libudev-dev libtinfo5 clang libclang-dev llvm-dev udev libssl-dev python3.10-venv
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
select No.1
After installation, you need to set the environment variable for Rust.
Add the following line to your shell configuration file (e.g., `~/.bashrc`, `~/.zshrc`, etc.):
source "$HOME/.cargo/env"
2. Install toolchain for ESP32-C3
cargo install ldproxy
cargo install espup
cargo install cargo-espflash
At this time (2025-07-25), espup cannot be compiled. If you get an error, please use the following command to install the toolchain.
cargo install cargo-binstall
cargo binstall espup
espup install
espup update
Then, run the following command to set the environment for the ESP32-C3 toolchain:
. ./export-esp.sh
3. Add UDEV rules
sudo sh -c 'echo "SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"303a\", ATTRS{idProduct}==\"1001\", MODE=\"0666\"" > /etc/udev/rules.d/99-esp32.rules'
sudo udevadm control --reload-rules
sudo udevadm trigger
4. Download Mini Current Meter code
git clone https://github.com/hnz1102/mini-current-meter.git
cd mini-current-meter/code
5. Setting WiFi SSID, Password, and InfluxDB Server IP Address
You need to set the WiFi SSID, password, and InfluxDB server IP address in the configuration file.
You can find the configuration file 'cfg.toml.samp' in the `code` directory. You need to copy this file to `cfg.toml` and edit it.
nano code/cfg.toml
[mini-current-meter]
wifi_ssid = "XXXXXXXXXXXX" # Set your WiFi SSID.
wifi_psk = "XXXXXXXXXXXXX" # Set your WiFi Password.
shunt_resistance = "0.005"
influxdb_server = "<IP Address>:8086" # Set your InfluxDB server IP address.
influxdb_api_key = "<API_KEY>" # Set your InfluxDB API Key.
influxdb_api = "/api/v2/write?org=<ORG>&bucket=LOGGER&precision=ns" # Set your InfluxDB API URL. You must set <ORG> same as Initial Organization Name.
influxdb_tag = "ch"
influxdb_measurement = "minicurrent"
max_records = "1023"
6. Connecting the Board and Setting Device and Toolchain
Connect the mini-current-meter via USB to this build code PC. Then,
cargo espflash board-info
select /dev/ttyACM0
Chip type: esp32c3 (revision v0.4)
Crystal frequency: 40MHz
Flash size: 4MB
Features: WiFi, BLE
MAC address: xx:xx:xx:xx:xx:xx
7. Build Code and Write to Flash
cargo espflash flash --release --monitor
App/part. size: 964,240/3,145,728 bytes, 30.23%
[00:00:00] [========================================] 12/12 0x0
[00:00:00] [========================================] 1/1 0x8000
[00:00:11] [========================================] 546/546 0x10000 [2023-11-11T10:17:05Z INFO ] Flashing has completed!
Automatically boots!
How to Install InfluxDB
1. Download [InfluxDB](https://docs.influxdata.com/influxdb/v2.7/install/?t=Linux) and Install
wget https://dl.influxdata.com/influxdb/releases/influxdb2-2.7.0-amd64.deb
sudo dpkg -i influxdb2-2.7.0-amd64.deb
sudo service influxdb start
2. Configure InfluxDB
Connect to 'http://<InfluxDB installed PC Address>:8086'
Click `GET STARTED` and set `Username`, `Password`, `Initial Organization Name`, and `Initial Bucket Name`
Username: Set login username as InfluxDB administrator web console
Password: Set login password as InfluxDB administrator web console
Initial Organization Name: Organization Name ex. ORG
Initial Bucket Name: LOGGER
After setting these, click `CONTINUE`.
3. Copy the Operator API Token
You can see the operator API token in the browser. YOU WON'T BE ABLE TO SEE IT AGAIN!
If you want to get a new API token, click `API Tokens` menu from `Sources` Icon, then click `GENERATE API TOKEN` and select `All access token`, click `Save`.
You can see the new API token and copy it.
After copying the token, click `CONFIGURE LATER`.
4. Import the Dashboard Template
Click the `Dashboard` icon, and select `Import Dashboard` from the `CREATE DASHBOARD` menu.
Drop the `mini-current-meter/dashboard/mini-current-meter.json` file to `Drop a file here`, then click `IMPORT JSON AS DASHBOARD`.
You can see the `Mini Current Meter Dashboard` panel on the Dashboards page.
Click this panel, and you can see the Mini Current Meter Dashboard.
If you want to customize the dashboard design, click the configure mark. You can change the graph design.
6. Start Mini Current Meter Logging and Send Data
Turn on the power switch. Logging data will be sent to InfluxDB. You can see the data on the dashboard.
Real-World ApplicationsElectronics Development
- Breadboard circuit power analysis
- Component power characterization
- Battery life estimation for portable devices
- Power optimization during development
IoT Device Testing
- Measuring sleep mode current consumption
- Analyzing power spikes during wireless transmission
- Long-term power consumption monitoring
- Multi-channel system analysis
Educational Use
- Teaching power measurement concepts
- Demonstrating energy efficiency
- Real-time power visualization for students
- Hands-on electronics learning
This project represents months of careful engineering, from initial concept to final implementation. Key milestones included:
1. Hardware Design: Selecting optimal components for accuracy, size, and power consumption
2. Firmware Development: Building robust, real-time measurement software in Rust
3. Display Optimization: Implementing auto-ranging with flicker prevention
4. Network Integration: Creating reliable WiFi connectivity and data transmission
5. User Interface: Designing intuitive display layouts and button controls
6. Safety Validation: Ensuring protection against misuse and component damage
Open Source PhilosophyThe Mini Current Meter embraces open-source principles:
- Software: MIT License for maximum flexibility
- Hardware: CC-BY-SA V4.0 for schematic and PCB designs
- Documentation: Comprehensive build instructions and usage guides
- Community: Encouraging modifications and improvements
When compared to a handheld multimeter, the Mini Current Meter showed measurement errors ranging from 177µA to 220µA. Additionally, WiFi transmission introduced further errors, measured to be between 80µA and 150µA. These errors can be improved through calibration. The ADC shunt voltage measurement time has been set to a maximum of 4120µS, with the ADC sampling average count set to 512 counts. This configuration improves measurement precision and minimizes errors to the greatest extent possible.
ConclusionThe Mini Current Meter represents more than just a measurement device—it's a complete solution for modern electronics development. By combining high-precision analog measurement with intelligent digital processing, wireless connectivity, and intuitive visualization, it bridges the gap between traditional bench equipment and modern IoT requirements.
Whether you're a professional engineer optimizing power consumption, a student learning electronics fundamentals, or a maker building the next generation of connected devices, the Mini Current Meter provides the precision, convenience, and intelligence needed to measure, understand, and optimize electrical power in your projects.
The journey from concept to working device demonstrates the power of modern tools: precision analog components, efficient microcontrollers, robust programming languages, and open-source collaboration. It's a testament to what's possible when hardware and software work together seamlessly to solve real-world problems.
Comments