An Arduino-based measurement system for a hand generator (crank dynamo) with INA226 current sensor and OLED display.
This project measures and displays real-time parameters of a hand generator:
- Voltage (U) - in Volts
- Current (I) - in Amperes
- Power (P) - in Watts
- Energy (E) - in Watt-Hours (Wh)
The measured values are displayed simultaneously on a small OLED display and via serial console.
- Arduino Uno R3
- INA226 Current Sensor
- SSD1306 128 x 64 OLED Display - Buy on Amazon
- Hand Crank Generator - Buy on AliExpress
The schematics will be available soon.
- Real-time Values: Continuous capture of all parameters
- Energy Calculation: Cumulative storage of generated energy based on power and time
- Threshold Detection: Measurements start at voltages > 3.0 V
- OLED Display: Compact display for portable use
- Serial Monitor (9600 Baud): Detailed data output for analysis and debugging
- GyverINA - INA226 sensor control
- U8g2lib - OLED display driver
- Wire - I2C communication
# Via Arduino IDE or PlatformIO
# Search term: GyverINA
# Search term: U8g2The file src/main.cpp contains the shunt configuration (around line 18):
INA226 ina(0.002f, 5.0f); // 2 mOhm shunt, max. 5 ACalculation for other shunt values:
- Max. expected current: 5 A
- Max. voltage drop across shunt: 80 mV
- Shunt resistance = 0.08 V / 5 A = 0.016 Ω
- INA226 (default): 0x40
- OLED Display (default): 0x3C
- Open Arduino IDE
- File → Examples → GyverINA → ... load example
- Install required libraries
- Board: Arduino Uno
- Select port
- Upload
pio run --target upload- Baud rate: 9600
- Shows: Sensor status, calibration value, live measurement data
The system displays the following information:
On OLED Display:
U: 12.5 V I: 0.45 A
P: 5.6 W E: 0.12 Wh
In Serial Monitor (example):
INA226...connected!
Calibration value: 20480
U: 12.5 V, I: 450 mA, P: 5.6 W, E: 0.12 Wh
- Maximum shunt voltage: ±81.92 mV
- With 0.1 Ω shunt: max. ~820 mA measurable
- With 0.002 Ω shunt: max. ~5 A measurable
- Shunt voltage should not exceed 80 mV!
| Problem | Solution |
|---|---|
| INA226 not found | Check I2C address, call Wire.begin() |
| Display stays black | Check OLED I2C address (default: 0x3C), verify connections |
| Measurement values inaccurate | Adjust calibration value, check shunt resistance |
| No data in Serial Monitor | Set baud rate to 9600, check USB cable |
This project uses open-source libraries. See the documentation of the used libraries for details.
