-
Notifications
You must be signed in to change notification settings - Fork 41
alertOnPowerOverLimit()
This call is ignored for devices such as the INA219 which have no "ALERT" pin. It will Set, or UnSet, the alert pin functionality depending upon the setting of the "State" boolean Switch for the device given in "deviceNumber"; setting all devices which have an alert pin if the optional "deviceNumber" parameter is omitted.
This function accepts a boolean argument which activates changing state detection on the ALERT pin and a threshold value in milliwatts for the bus power. The pin is open drain so should be pulled high with either an external resistor or by using the Arduino call "pinMode(,INPUT_PULLUP);". When the bus power exeeds the amount specified in the "milliwatts" Parameter the INA2xx will pull this pin down to ground. The state will remain set until the power on the shunt goes below the threshold limit.
(Show Fritzing example layout here)
INA_Class INA(); // Instantiate the class
void setup() {
uint8_t deviceCount = INA.begin(10,100000); // 10 Amp Maximum bus with a shunt resistor of 0.1 Ohm
Serial.print("Found ");
Serial.print(deviceCount);
Serial.print(" INA2xx devices, displaying data for device 0, a \"");
Serial.print(INA.getDeviceName());
Serial.println("\".");
INA.alertOnPowerOverLimit(true,5000); // Set Alarm Pin when voltage is 5V and bus amperage exceeds 500mW
// Ohm's Law : .5V / .1 Ohm
} // of setup
void loop() {
uint16_t ShuntMillivolts = INA.getShuntMilliVolts();
Serial.print("Shunt voltage is ");
Serial.print(ShuntMillivolts);
Serial.print(" milliVolts\n");
delay(5000); // wait 5 seconds before next measurement
} // of main loop
Overview
Installation
Class Instantiation
begin()
setI2CSpeed()
getBusMilliVolts()
getBusRaw()
getShuntMicroVolts()
getShuntRaw()
getBusMicroAmps()
getBusMicroWatts()
getDeviceAddress()
getDeviceName()
setMode()
setAveraging()
setBusConversion()
setShuntConversion()
reset()
waitForConversion()
conversionFinished()
alertOnConversion()
alertOnShuntOverVoltage()
alertOnShuntUnderVoltage()
alertOnBusOverVoltage()
alertOnBusUnderVoltage()
alertOnPowerOverLimit()