A high-performance PPK-2 (Power Profiler Kit II) control application built with ImGui and ImPlot for real-time current measurement visualization.
- High Performance: Optimized C implementation with efficient circular buffer for handling 100k samples/second
- Real-time Visualization: Smooth plotting with ImPlot, capable of displaying millions of samples
- Nordic Semiconductor Branding: Built-in Nordic blue color scheme with easy customization
- Dark/Light Mode: Toggle between dark and light themes
- Source & Ampere Modes: Full support for both PPK2 measurement modes
- Configuration Menu: Collapsible menu for device settings
- Statistics: Real-time min/max/average calculations
- Cross-platform Ready: CMake build system with stubs for Windows/macOS
- CMake 3.15+
- GCC or Clang with C11/C++17 support
- GLFW3
- OpenGL 3.0+
- pkg-config
sudo apt-get install cmake build-essential libglfw3-dev libgl1-mesa-dev pkg-configsudo dnf install cmake gcc-c++ glfw-devel mesa-libGL-devel pkgconfigsudo pacman -S cmake gcc glfw-x11 mesa pkgconfmkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)cmake .. -DCMAKE_BUILD_TYPE=Debug
make -j$(nproc)./ppk2-viewerDefault device port is /dev/ttyACM0. Change this in the Control Panel or modify the source.
- TAB: Toggle Control Panel (perfect for tradeshow presentations)
- SPACE: Start/Stop measurement (when connected)
- CTRL+T: Toggle Dark/Light theme
- CTRL+P: Toggle Presentation Mode (hides technical details)
- CTRL+H: Show keyboard shortcuts help
gdb ./ppk2-viewer# Enable valgrind support in CMake
cmake .. -DENABLE_VALGRIND=ON
make valgrindOr manually:
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind.log ./ppk2-viewerThe Nordic color scheme can be easily modified in src/ui_theme.c:
// Primary: Nordic Blue #00A9CE -> {0.00f, 0.66f, 0.81f, 1.00f}
// Accent: Nordic Teal #00C1DE -> {0.00f, 0.76f, 0.87f, 1.00f}Or programmatically using the API:
ui_theme_set_color("primary", 0.0f, 0.66f, 0.81f, 1.0f);
ui_theme_set_color("accent", 0.0f, 0.76f, 0.87f, 1.0f);.
├── CMakeLists.txt # Build configuration
├── include/ # Header files
│ ├── ppk2_serial.h # Serial communication interface
│ ├── ppk2_protocol.h # PPK2 protocol implementation
│ ├── ui_theme.h # Theme management
│ └── data_buffer.h # Circular buffer for samples
├── src/ # Source files
│ ├── main.c # Entry point
│ ├── ppk2_serial.c # Serial communication (Linux/Windows/macOS)
│ ├── ppk2_protocol.c # PPK2 command protocol
│ ├── ui_theme.c # Theme implementation
│ ├── data_buffer.c # Circular buffer implementation
│ └── ui_main.cpp # ImGui UI implementation
├── lib/ # Third-party libraries
│ ├── imgui/ # Dear ImGui
│ └── implot/ # ImPlot
└── README.md
ppk2_device_t* device = ppk2_init("/dev/ttyACM0");
ppk2_get_modifiers(device); // Read calibration datappk2_set_mode(device, PPK2_MODE_SOURCE); // or PPK2_MODE_AMPERE
ppk2_set_source_voltage(device, 3300); // mV (800-5000)
ppk2_toggle_dut_power(device, true); // Enable DUT powerppk2_start_measuring(device);
float samples[1024];
int count = ppk2_read_samples(device, samples, 1024);
// samples are in microamperes (µA)
ppk2_stop_measuring(device);
ppk2_cleanup(device);- Sample Rate: 100,000 samples/second (PPK2 hardware limit)
- Buffer Capacity: 1,000,000 samples (10 seconds at full rate)
- Display Window: Configurable (10k, 50k, 100k, 500k, 1M samples)
- Memory Usage: ~4MB for full buffer + ImGui overhead
- Frame Rate: 60 FPS with VSync
- Linux implementation only (Windows/macOS stubs provided)
- No data export functionality yet
- No trigger support yet
- Serial port must be specified manually
This project uses ImGui (MIT License) and ImPlot (MIT License). PPK2 protocol based on ppk2-api-python (GPL V2).
Contributions welcome! Areas for improvement:
- Windows and macOS serial port implementations
- Data export (CSV, binary)
- Trigger functionality
- Digital channel visualization
- More configuration options