mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.3.0 INA3221_RT
This commit is contained in:
parent
018ec25de3
commit
060e3e07a0
@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|||||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
|
||||||
|
## [0.3.0] - 2024-08-14
|
||||||
|
- Fix #6 setCriticalCurrent()
|
||||||
|
- add array example
|
||||||
|
- update keywords.txt
|
||||||
|
- update readme.md
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
## [0.2.0] - 2024-04-15
|
## [0.2.0] - 2024-04-15
|
||||||
- Fix #2, reimplement several functions
|
- Fix #2, reimplement several functions
|
||||||
- makes 0.1.0 obsolete
|
- makes 0.1.0 obsolete
|
||||||
@ -14,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
- add **INA3221_tests.ino** example
|
- add **INA3221_tests.ino** example
|
||||||
- sort of unit test.
|
- sort of unit test.
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
## [0.1.0] - 2024-02-05
|
## [0.1.0] - 2024-02-05
|
||||||
- initial version.
|
- initial version.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// FILE: INA3221.cpp
|
// FILE: INA3221.cpp
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.2.0
|
// VERSION: 0.3.0
|
||||||
// DATE: 2024-02-05
|
// DATE: 2024-02-05
|
||||||
// PURPOSE: Arduino library for the I2C INA3221 3 channel voltage and current sensor.
|
// PURPOSE: Arduino library for the I2C INA3221 3 channel voltage and current sensor.
|
||||||
// URL: https://github.com/RobTillaart/INA3221_RT
|
// URL: https://github.com/RobTillaart/INA3221_RT
|
||||||
@ -162,7 +162,7 @@ uint32_t INA3221::getWarningAlert(uint8_t channel)
|
|||||||
|
|
||||||
// mA wrappers
|
// mA wrappers
|
||||||
|
|
||||||
int INA3221::setCriticalCurrect(uint8_t channel, float milliAmpere)
|
int INA3221::setCriticalCurrent(uint8_t channel, float milliAmpere)
|
||||||
{
|
{
|
||||||
return setCriticalAlert(channel, 1000.0 * milliAmpere * _shunt[channel]);
|
return setCriticalAlert(channel, 1000.0 * milliAmpere * _shunt[channel]);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
// FILE: INA3221.h
|
// FILE: INA3221.h
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.2.0
|
// VERSION: 0.3.0
|
||||||
// DATE: 2024-02-05
|
// DATE: 2024-02-05
|
||||||
// PURPOSE: Arduino library for the I2C INA3221 3 channel voltage and current sensor.
|
// PURPOSE: Arduino library for the I2C INA3221 3 channel voltage and current sensor.
|
||||||
// URL: https://github.com/RobTillaart/INA3221_RT
|
// URL: https://github.com/RobTillaart/INA3221_RT
|
||||||
@ -13,7 +13,7 @@
|
|||||||
#include "Wire.h"
|
#include "Wire.h"
|
||||||
|
|
||||||
|
|
||||||
#define INA3221_LIB_VERSION "0.2.0"
|
#define INA3221_LIB_VERSION "0.3.0"
|
||||||
|
|
||||||
|
|
||||||
class INA3221
|
class INA3221
|
||||||
@ -58,7 +58,7 @@ public:
|
|||||||
|
|
||||||
// Wrappers using milliAmpere (Shunt must be set correctly!).
|
// Wrappers using milliAmpere (Shunt must be set correctly!).
|
||||||
// NOTE: LSB = 40 uV so milliAmpere should be >= 0.4 mA (assume R = 0.1)
|
// NOTE: LSB = 40 uV so milliAmpere should be >= 0.4 mA (assume R = 0.1)
|
||||||
int setCriticalCurrect(uint8_t channel, float milliAmpere);
|
int setCriticalCurrent(uint8_t channel, float milliAmpere);
|
||||||
float getCriticalCurrent(uint8_t channel);
|
float getCriticalCurrent(uint8_t channel);
|
||||||
int setWarningCurrent(uint8_t channel, float milliAmpere);
|
int setWarningCurrent(uint8_t channel, float milliAmpere);
|
||||||
float getWarningCurrent(uint8_t channel);
|
float getWarningCurrent(uint8_t channel);
|
||||||
|
@ -41,6 +41,11 @@ Some important maxima, see datasheet for all details.
|
|||||||
| current | 1.63 | Ampere | I = U/R
|
| current | 1.63 | Ampere | I = U/R
|
||||||
|
|
||||||
|
|
||||||
|
#### 0.3.0 breaking changes.
|
||||||
|
|
||||||
|
Renamed setCriticalCurrect() ==> setCriticalCurrent() to fix typo.
|
||||||
|
|
||||||
|
|
||||||
#### 0.2.0 breaking changes.
|
#### 0.2.0 breaking changes.
|
||||||
|
|
||||||
Several functions have been reimplemented after issue #2.
|
Several functions have been reimplemented after issue #2.
|
||||||
@ -72,6 +77,9 @@ As always feedback is welcome, please open an issue on GitHub.
|
|||||||
|
|
||||||
- https://github.com/RobTillaart/INA219
|
- https://github.com/RobTillaart/INA219
|
||||||
- https://github.com/RobTillaart/INA226
|
- https://github.com/RobTillaart/INA226
|
||||||
|
- https://github.com/RobTillaart/INA228
|
||||||
|
- https://github.com/RobTillaart/INA3221_RT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## I2C
|
## I2C
|
||||||
@ -120,7 +128,7 @@ Four most important calls.
|
|||||||
All parameters channels are zero based => so numbered 0 , 1 or 2.
|
All parameters channels are zero based => so numbered 0 , 1 or 2.
|
||||||
Using channels > 2 are not handled (correctly).
|
Using channels > 2 are not handled (correctly).
|
||||||
|
|
||||||
#### Constructor
|
### Constructor
|
||||||
|
|
||||||
- **INA3221(const uint8_t address, TwoWire \*wire = Wire)** Constructor to set
|
- **INA3221(const uint8_t address, TwoWire \*wire = Wire)** Constructor to set
|
||||||
the address and optional Wire interface.
|
the address and optional Wire interface.
|
||||||
@ -131,7 +139,7 @@ Note: one needs to set **Wire.begin()** before calling **begin()**.
|
|||||||
- **uint8_t getAddress()** returns the address set in the constructor.
|
- **uint8_t getAddress()** returns the address set in the constructor.
|
||||||
|
|
||||||
|
|
||||||
#### Core Functions
|
### Core Functions
|
||||||
|
|
||||||
Note the power and the current are not meaningful without calibrating the sensor.
|
Note the power and the current are not meaningful without calibrating the sensor.
|
||||||
Also the value is not meaningful if there is no shunt connected.
|
Also the value is not meaningful if there is no shunt connected.
|
||||||
@ -160,7 +168,7 @@ Wrapper functions for the micro scale.
|
|||||||
- **float getPower_uW(uint8_t channel)** idem, in microWatt.
|
- **float getPower_uW(uint8_t channel)** idem, in microWatt.
|
||||||
|
|
||||||
|
|
||||||
#### Shunt Resistor
|
### Shunt Resistor
|
||||||
|
|
||||||
The shunt resistor is typical in the order of 0.100 Ohm.
|
The shunt resistor is typical in the order of 0.100 Ohm.
|
||||||
|
|
||||||
@ -168,7 +176,7 @@ The shunt resistor is typical in the order of 0.100 Ohm.
|
|||||||
- **float getShuntR(uint8_t channel)** returns value in Ohm.
|
- **float getShuntR(uint8_t channel)** returns value in Ohm.
|
||||||
|
|
||||||
|
|
||||||
#### Shunt Alerts, warning and critical
|
### Shunt Alerts, warning and critical
|
||||||
|
|
||||||
(not tested)
|
(not tested)
|
||||||
Read datasheet!
|
Read datasheet!
|
||||||
@ -193,7 +201,7 @@ Wrappers using milliAmpere (assuming Shunt is set correctly!).
|
|||||||
These are often more intuitive from user perspective.
|
These are often more intuitive from user perspective.
|
||||||
NOTE: LSB = 40 uV so milliAmpere should be >= 0.4 mA (assume Shunt = 0.1 Ohm)
|
NOTE: LSB = 40 uV so milliAmpere should be >= 0.4 mA (assume Shunt = 0.1 Ohm)
|
||||||
|
|
||||||
- **int setCriticalCurrect(uint8_t channel, float milliAmpere)**
|
- **int setCriticalCurrent(uint8_t channel, float milliAmpere)**
|
||||||
sets the critical alert level in milliAmpere.
|
sets the critical alert level in milliAmpere.
|
||||||
- **float getCriticalCurrent(uint8_t channel)** returns milliAmpere
|
- **float getCriticalCurrent(uint8_t channel)** returns milliAmpere
|
||||||
- **int setWarningCurrent(uint8_t channel, float milliAmpere)**
|
- **int setWarningCurrent(uint8_t channel, float milliAmpere)**
|
||||||
@ -201,7 +209,7 @@ sets the warning alert level in milliAmpere.
|
|||||||
- **float getWarningCurrent(uint8_t channel)** returns milliAmpere
|
- **float getWarningCurrent(uint8_t channel)** returns milliAmpere
|
||||||
|
|
||||||
|
|
||||||
#### Shunt voltage sum
|
### Shunt voltage sum
|
||||||
|
|
||||||
(not tested)
|
(not tested)
|
||||||
Read datasheet!
|
Read datasheet!
|
||||||
@ -211,7 +219,7 @@ Read datasheet!
|
|||||||
- **int16_t getShuntVoltageSumLimit()** returns set value in microVolt.
|
- **int16_t getShuntVoltageSumLimit()** returns set value in microVolt.
|
||||||
|
|
||||||
|
|
||||||
#### Configuration
|
### Configuration
|
||||||
|
|
||||||
(partially tested)
|
(partially tested)
|
||||||
Read datasheet for bit pattern of the mask.
|
Read datasheet for bit pattern of the mask.
|
||||||
@ -273,7 +281,7 @@ Note: In combination with average the total conversion time can take up to
|
|||||||
1024 x 8.3 ms almost 9 seconds (+ 10% deviation ==> 10 seconds)
|
1024 x 8.3 ms almost 9 seconds (+ 10% deviation ==> 10 seconds)
|
||||||
|
|
||||||
|
|
||||||
#### Operating mode
|
### Operating mode
|
||||||
|
|
||||||
(not tested)
|
(not tested)
|
||||||
See datasheet!
|
See datasheet!
|
||||||
@ -301,7 +309,7 @@ Descriptive mode functions (convenience wrappers).
|
|||||||
- **int setModeShuntBusContinuous()** mode 7 - default - (only one tested)
|
- **int setModeShuntBusContinuous()** mode 7 - default - (only one tested)
|
||||||
|
|
||||||
|
|
||||||
#### Mask / enable register
|
### Mask / enable register
|
||||||
|
|
||||||
(not tested)
|
(not tested)
|
||||||
See datasheet!
|
See datasheet!
|
||||||
@ -316,7 +324,7 @@ TODO: convenience wrappers
|
|||||||
- 9 x getters
|
- 9 x getters
|
||||||
|
|
||||||
|
|
||||||
#### Power Limit
|
### Power Limit
|
||||||
|
|
||||||
(not tested)
|
(not tested)
|
||||||
See datasheet!
|
See datasheet!
|
||||||
@ -329,7 +337,7 @@ To guard the BUS voltage, max value 32760
|
|||||||
- **int16_t getPowerLowerLimit()**
|
- **int16_t getPowerLowerLimit()**
|
||||||
|
|
||||||
|
|
||||||
#### Meta information
|
### Meta information
|
||||||
|
|
||||||
(tested)
|
(tested)
|
||||||
|
|
||||||
@ -337,7 +345,7 @@ To guard the BUS voltage, max value 32760
|
|||||||
- **uint16_t getDieID()** should return 0x2260, mine returns 0x3220.
|
- **uint16_t getDieID()** should return 0x2260, mine returns 0x3220.
|
||||||
|
|
||||||
|
|
||||||
#### Debugging
|
### Debugging
|
||||||
|
|
||||||
- **uint16_t getRegister(uint8_t reg)** fetch registers directly, for debugging only.
|
- **uint16_t getRegister(uint8_t reg)** fetch registers directly, for debugging only.
|
||||||
- **uint16_t putRegister(uint8_t reg, uint16_t value)** load registers directly, for debugging only.
|
- **uint16_t putRegister(uint8_t reg, uint16_t value)** load registers directly, for debugging only.
|
||||||
|
@ -33,7 +33,7 @@ getCriticalAlert KEYWORD2
|
|||||||
setWarningAlert KEYWORD2
|
setWarningAlert KEYWORD2
|
||||||
getWarningAlert KEYWORD2
|
getWarningAlert KEYWORD2
|
||||||
|
|
||||||
setCriticalCurrect KEYWORD2
|
setCriticalCurrent KEYWORD2
|
||||||
getCriticalCurrent KEYWORD2
|
getCriticalCurrent KEYWORD2
|
||||||
setWarningCurrent KEYWORD2
|
setWarningCurrent KEYWORD2
|
||||||
getWarningCurrent KEYWORD2
|
getWarningCurrent KEYWORD2
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/RobTillaart/INA3221_RT.git"
|
"url": "https://github.com/RobTillaart/INA3221_RT.git"
|
||||||
},
|
},
|
||||||
"version": "0.2.0",
|
"version": "0.3.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"frameworks": "*",
|
"frameworks": "*",
|
||||||
"platforms": "*",
|
"platforms": "*",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=INA3221_RT
|
name=INA3221_RT
|
||||||
version=0.2.0
|
version=0.3.0
|
||||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
sentence=Arduino library for the I2C INA3221 3 channel voltage and current sensor.
|
sentence=Arduino library for the I2C INA3221 3 channel voltage and current sensor.
|
||||||
|
Loading…
Reference in New Issue
Block a user