-
Notifications
You must be signed in to change notification settings - Fork 40
alertOnShuntUnderVoltage()
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 millivolts for the shunt voltage. 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 voltage goes below the amount specified in the "millivolts" Parameter the INA2xx will pull this pin down to ground. The state will remain set until the voltage on the shunt goes above 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 0.1 Ohm shunt resistor
Serial.print("Found ");
Serial.print(deviceCount);
Serial.print(" INA2xx devices, displaying data for device 0, a \"");
Serial.print(INA.getDeviceName());
Serial.println("\".");
INA.alertOnShuntUnderVoltage(true,500); // Set Alarm Pin when voltage is 5V and bus amperage
// is less than 5A. 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()