Wombat Environmental Node 1.0
An environmental node for SDI-12 and digital sensors.
|
Battery power monitoring handler. More...
#include <battery.h>
Static Public Member Functions | |
static void | begin () |
Setup INA219 IC to monitoring battery voltage and current. More... | |
static double | get_voltage () |
Get the voltage of the battery. More... | |
static float | get_current () |
Get the current flowing from/to the battery. More... | |
static void | sleep () |
Puts the INA219 IC in a sleep mode. More... | |
static void | wakeup () |
Wakes up the INA219 IC. More... | |
Static Private Attributes | |
static const uint8_t | batteryAddr = 0x45 |
Default I2C battery address (cannot be changed without modifying PCB) More... | |
Battery power monitoring handler.
A INA219 IC is used to monitor battery voltage and current. When using the Adafruit_INA219 library this IC requires a 1 ohm resistor across its positive and negative inputs.
|
static |
Setup INA219 IC to monitoring battery voltage and current.
As the battery has a maximum voltage of 4.2V a calibration factor can be used to improve accuracy.
|
static |
Get the current flowing from/to the battery.
Note that this may not be super accurate as the current consumption will change when different components become active and inactive. Using external power such as that through the debugger will also result inaccurate readings.
If the IC is not initialed this function will return -1.0.
|
static |
Get the voltage of the battery.
If the IC is not initialed this function will return -1.0.
|
static |
Puts the INA219 IC in a sleep mode.
The IC will consume around 6 uA when in sleep mode.
|
static |
Wakes up the INA219 IC.
|
staticprivate |
Default I2C battery address (cannot be changed without modifying PCB)