SparkFun INA2XX Arduino Library  v1.0.0-3-gc9007d6
Arduino Library for the SparkFun Qwiic Power Monitor (INA228 / INA237)
Loading...
Searching...
No Matches
SparkFun_INA2XX.h File Reference

Arduino-specific implementation for the SparkFun INA228/INA237 Power Monitors. More...

#include <SparkFun_Toolkit.h>
#include "sfTk/sfDevINA228.h"
#include "sfTk/sfDevINA237.h"
#include <Arduino.h>

Go to the source code of this file.

Classes

class  SfeINA228ArdI2C
 Arduino I2C implementation for the INA228 high-precision power monitor. More...
 
class  SfeINA237ArdI2C
 Arduino I2C implementation for the INA237 power monitor. More...
 

Detailed Description

Arduino-specific implementation for the SparkFun INA228/INA237 Power Monitors.

This file provides the Arduino-specific wrappers for the INA228 and INA237 driver classes. Each wrapper class inherits from its platform-independent device driver and implements I2C communication using Arduino's Wire library via the SparkFun Toolkit.

Typical usage (INA228):

SfeINA228ArdI2C powerMonitor;
void setup() {
Wire.begin();
if (!powerMonitor.begin()) {
Serial.println("INA228 not found!");
while (1);
}
powerMonitor.calibrate(0.015, 10.0); // 15 mOhm shunt, 10A max
}
void loop() {
float current = 0.0f;
if (powerMonitor.getCurrent_A(current) == ksfTkErrOk) {
Serial.print("Current: ");
Serial.print(current, 4);
Serial.println(" A");
}
delay(500);
}
Arduino-specific implementation for the SparkFun INA228/INA237 Power Monitors.
Arduino I2C implementation for the INA228 high-precision power monitor.
Definition: SparkFun_INA2XX.h:69
bool begin(uint8_t address=kI2CAddress, TwoWire &wirePort=Wire)
Initializes the INA228 with I2C communication.
Definition: SparkFun_INA2XX.h:90
sfTkError_t getCurrent_A(float &amps)
Read the calculated current in Amps (24-bit CURRENT, scaled by CURRENT_LSB).
Definition: sfDevINA228.h:80
sfTkError_t calibrate(float shuntResOhms, float maxCurrentA)
Calibrate the device for current and power measurements.
Definition: sfDevINA228.h:52
Author
SparkFun Electronics
Date
June 2026

SPDX-License-Identifier: MIT

See also
https://github.com/sparkfun/SparkFun_INA2XX_Arduino_Library