Skip to content

Commit 025dde9

Browse files
committed
0.1.4 INA236
1 parent 929c14c commit 025dde9

File tree

22 files changed

+55
-22
lines changed

22 files changed

+55
-22
lines changed

libraries/INA236/.github/workflows/arduino-lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ jobs:
66
runs-on: ubuntu-latest
77
timeout-minutes: 5
88
steps:
9-
- uses: actions/checkout@v4
10-
- uses: arduino/arduino-lint-action@v1
9+
- uses: actions/checkout@v5
10+
- uses: arduino/arduino-lint-action@v2
1111
with:
1212
library-manager: update
1313
compliance: strict

libraries/INA236/.github/workflows/arduino_test_runner.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
timeout-minutes: 20
99

1010
steps:
11-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v5
1212
- uses: ruby/setup-ruby@v1
1313
with:
1414
ruby-version: 2.6

libraries/INA236/.github/workflows/jsoncheck.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ on:
55
paths:
66
- '**.json'
77
pull_request:
8+
paths:
9+
- '**.json'
810

911
jobs:
1012
test:
1113
runs-on: ubuntu-latest
1214
timeout-minutes: 5
1315
steps:
14-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1517
- name: json-syntax-check
1618
uses: limitusus/json-syntax-check@v2
1719
with:

libraries/INA236/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88

9+
## [0.1.4] - 2025-08-18
10+
- update GitHub actions
11+
- allow overrule INA236_MINIMAL_SHUNT on command line.
12+
- update reference in readme.md (fix #8)
13+
- minor edits.
14+
915
## [0.1.3] - 2025-07-21
1016
- Sync INA228, setADCRange() calls setMaxCurrentShunt();
1117
- update readme.md

libraries/INA236/INA236.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// FILE: INA236.cpp
22
// AUTHOR: Rob Tillaart
33
// ported from INA226 to INA236 by Josef Tremmel
4-
// VERSION: 0.1.3
4+
// VERSION: 0.1.4
55
// DATE: 2024-05-27
66
// PURPOSE: Arduino library for the INA236, I2C, 16 bit, voltage, current and power sensor.
77
// URL: https://github.com/RobTillaart/INA236
@@ -160,7 +160,7 @@ bool INA236::setADCRange(bool flag)
160160
if (flag) value |= INA236_CONF_ADCRANGE_MASK;
161161
else value &= ~INA236_CONF_ADCRANGE_MASK;
162162
_writeRegister(INA236_CONFIGURATION, value);
163-
// INA228, #26
163+
// INA228, #26
164164
bool rv = setMaxCurrentShunt(getMaxCurrent(), getShunt()) == 0;
165165
return rv;
166166
}

libraries/INA236/INA236.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// FILE: INA236.h
33
// AUTHOR: Rob Tillaart
44
// ported from INA226 to INA236 by Josef Tremmel
5-
// VERSION: 0.1.3
5+
// VERSION: 0.1.4
66
// DATE: 2024-05-27
77
// PURPOSE: Arduino library for the INA236, I2C, 16 bit, voltage, current and power sensor.
88
// URL: https://github.com/RobTillaart/INA236
@@ -14,7 +14,7 @@
1414
#include "Wire.h"
1515

1616

17-
#define INA236_LIB_VERSION (F("0.1.3"))
17+
#define INA236_LIB_VERSION (F("0.1.4"))
1818

1919

2020
// set by setAlertRegister
@@ -41,8 +41,10 @@
4141
#define INA236_ERR_SHUNT_LOW 0x8002
4242
#define INA236_ERR_NORMALIZE_FAILED 0x8003
4343

44-
// See INA226 issue #26
44+
// See INA226 issue #26 + INA236 issue #8
45+
#ifndef INA236_MINIMAL_SHUNT
4546
#define INA236_MINIMAL_SHUNT 0.001
47+
#endif
4648

4749
#define INA236_MAX_WAIT_MS 600 // millis
4850

libraries/INA236/README.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ Arduino library for the INA236, I2C, 16 bit, voltage, current and power sensor.
1616

1717
## Description
1818

19+
**Experimental**
20+
1921
_This documentation is based upon the INA226 library,
2022
and may contain information not updated yet.
2123
Please open an issue if needed._
2224

23-
**Experimental** library for the INA236 current and power sensor.
25+
Experimental library for the INA236 current and power sensor.
2426
Ported and updated from INA226 to INA236 by Josef Tremmel (thanks!).
2527

2628
Read datasheet for details.
@@ -51,8 +53,10 @@ A few important maxima, see datasheet, chapter 6.
5153
- https://github.com/RobTillaart/INA219 26 Volt, I2C, 12 bit
5254
- https://github.com/RobTillaart/INA226 36 Volt, I2C, 16 bit
5355
- https://github.com/RobTillaart/INA228 85 Volt, I2C, 20 bit
56+
- https://github.com/RobTillaart/INA229 85 Volt, SPI, 20 bit
5457
- https://github.com/RobTillaart/INA236 48 Volt, I2C, 16 bit
5558
- https://github.com/RobTillaart/INA239 85 Volt, SPI, 16 bit
59+
- https://github.com/RobTillaart/INA260 36 Volt, I2C, 16 bit
5660
- https://github.com/RobTillaart/INA3221_RT 26 Volt, I2C, 13 bits (3 channel)
5761
- https://www.adafruit.com/product/5832
5862
- https://www.mateksys.com/?portfolio=i2c-ina-bm
@@ -136,7 +140,7 @@ Note: one needs to set **Wire.begin()** before calling **begin()**.
136140
- **bool isConnected()** returns true if the INA236 address is on the I2C bus.
137141
- **uint8_t getAddress()** returns the address set in the constructor.
138142

139-
### BUS VOLTAGE
143+
### Bus voltage
140144

141145
Main function + wrappers.
142146

@@ -146,7 +150,7 @@ This value is always positive.
146150
- **float getBusMilliVolt()**
147151
- **float getBusMicroVolt()**
148152

149-
### SHUNT VOLTAGE
153+
### Shunt voltage
150154

151155
- **float getShuntVoltage()** idem, Returns value in volts.
152156
Note the value can be positive or negative as the INA229 is bidirectional.
@@ -156,15 +160,15 @@ Note the value can be positive or negative as the INA229 is bidirectional.
156160
- **int32_t getShuntVoltageRAW()** integer version requested in issue #3.
157161
Returns raw ADC value, 20 bits with sign extended.
158162

159-
### SHUNT CURRENT
163+
### Shunt current
160164

161165
- **float getCurrent()** returns the current through the shunt in Ampere.
162166
Note this value can be positive or negative as the INA229 is bidirectional.
163167
- **float getAmpere()**
164168
- **float getMilliAmpere()**
165169
- **float getMicroAmpere()**
166170

167-
### POWER
171+
### Power
168172

169173
- **float getPower()** returns the current x BusVoltage in Watt.
170174
- **float getWatt()**
@@ -390,13 +394,20 @@ The alert line falls when alert is reached.
390394
## Adjusting the range of the INA236
391395

392396
**use at own risk**
393-
In issue #26 a hack is made to scale the INA236 to 300A by using a very small shunt.
394-
The library has a minimal limit for the shunt of 0.001 ohm.
395-
This limit can be overruled to support other ranges like the one discussed in #26.
396-
Overruling can be done by patching the following value in the INA236.h file.
397+
398+
See INA226, issue 26 - https://github.com/RobTillaart/INA226/issues/26
399+
See INA236, issue 8 - https://github.com/RobTillaart/INA236/issues/8
400+
401+
In issue #26 a hack is made to scale the INA226 to 300A by using a very small shunt.
402+
The INA236 library has a minimal limit for the shunt of 0.001 Ohm = 1 mOhm.
403+
This limit can be overruled to support wider ranges like the one discussed in #26.
404+
Overruling can be done by changing the value in the **INA236.h** file,
405+
or by defining INA236_MINIMAL_SHUNT on the command line.
397406

398407
```cpp
399-
#define INA236_MINIMAL_SHUNT (0.001)
408+
#ifndef INA236_MINIMAL_SHUNT
409+
#define INA236_MINIMAL_SHUNT 0.001
410+
#endif
400411
```
401412

402413
Be aware that
@@ -418,7 +429,6 @@ Be aware that
418429

419430
#### Could
420431

421-
422432
#### Won't
423433

424434

libraries/INA236/examples/INA236_array/INA236_array.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ INA236 INA[INA_COUNT] =
2424
void setup()
2525
{
2626
Serial.begin(115200);
27+
Serial.println();
2728
Serial.println(__FILE__);
2829
Serial.print("INA236_LIB_VERSION: ");
2930
Serial.println(INA236_LIB_VERSION);

libraries/INA236/examples/INA236_compare_normalize/INA236_compare_normalize.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ INA236 INA(0x40);
1414
void setup()
1515
{
1616
Serial.begin(115200);
17+
Serial.println();
1718
Serial.println(__FILE__);
1819
Serial.print("INA236_LIB_VERSION: ");
1920
Serial.println(INA236_LIB_VERSION);

libraries/INA236/examples/INA236_demo/INA236_demo.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ INA236 INA(0x40);
1414
void setup()
1515
{
1616
Serial.begin(115200);
17+
Serial.println();
1718
Serial.println(__FILE__);
1819
Serial.print("INA236_LIB_VERSION: ");
1920
Serial.println(INA236_LIB_VERSION);

0 commit comments

Comments
 (0)