@@ -26,14 +26,14 @@ Read datasheet for details.
2626The INA226 is a voltage, current and power measurement device.
2727A few important maxima, see datasheet, chapter 6.
2828
29- | description | max | unit | notes |
30- | :--------------| ------:| -------:| :------|
31- | bus voltage | 36 | Volt | unclear for how long.
32- | shunt voltage | 80 | mVolt |
33- | current | 20 | Ampere |
29+ | description | max | unit | notes |
30+ | :---------------- | ------- :| --------- :| :-- ------|
31+ | bus voltage | 36 | Volt | unclear for how long.
32+ | shunt voltage | 81.9 | mVolt | datasheet 81.92 mV
33+ | current | 20 | Ampere |
3434
3535
36- #### 0.5.0 Breaking change
36+ ### 0.5.0 Breaking change
3737
3838Version 0.5.0 introduced a breaking change.
3939You cannot set the pins in ** begin()** any more.
@@ -42,25 +42,32 @@ The user has to call **Wire.begin()** and can optionally set the Wire pins
4242before calling ** begin()** .
4343
4444
45- #### Special characters
45+ ### Special characters
4646
4747- Ω == Ohm = ALT-234 (Windows)
4848- µ == micro = ALT-0181 (Windows)
4949
5050
51- #### Related
51+ ### Related
5252
5353- https://www.ti.com/product/INA226#tech-docs
5454- https://www.ti.com/product/INA226#params
5555- https://www.ti.com/document-viewer/INA226/datasheet
56- - https://github.com/RobTillaart/INA219
57- - https://github.com/RobTillaart/INA226
58- - https://github.com/RobTillaart/INA236
56+ - https://github.com/RobTillaart/INA219 26 Volt, I2C, 12 bit
57+ - https://github.com/RobTillaart/INA226 36 Volt, I2C, 16 bit
58+ - https://github.com/RobTillaart/INA228 85 Volt, I2C, 20 bit
59+ - https://github.com/RobTillaart/INA229 85 Volt, SPI, 20 bit
60+ - https://github.com/RobTillaart/INA236 48 Volt, I2C, 16 bit
61+ - https://github.com/RobTillaart/INA239 85 Volt, SPI, 16 bit
62+ - https://github.com/RobTillaart/INA3221_RT 26 Volt, I2C, 13 bits (3 channel)
63+ - https://www.adafruit.com/product/5832
64+ - https://www.mateksys.com/?portfolio=i2c-ina-bm
65+ - https://github.com/RobTillaart/printHelpers (for scientific notation)
5966
6067
6168## I2C
6269
63- #### Address
70+ ### Address
6471
6572The sensor can have 16 different I2C addresses,
6673which depends on how the A0 and A1 address lines
@@ -88,7 +95,7 @@ See table - from datasheet table 2, page 18.
8895| SCL | SCL | 79 | 0x4F |
8996
9097
91- #### Performance
98+ ### Performance
9299
93100To be elaborated, example sketch available.
94101
@@ -137,7 +144,7 @@ Also see #30 for another typical deviation problem.
137144```
138145
139146
140- #### Constructor
147+ ### Constructor
141148
142149- ** INA226(const uint8_t address, TwoWire \* wire = Wire)** Constructor to set
143150the address and optional Wire interface.
@@ -148,7 +155,7 @@ Note: one needs to set **Wire.begin()** before calling **begin()**.
148155- ** uint8_t getAddress()** returns the address set in the constructor.
149156
150157
151- #### Core Functions
158+ ### Core Functions
152159
153160Note the power and the current are not meaningful without calibrating the sensor.
154161Also the value is not meaningful if there is no shunt connected.
@@ -179,7 +186,7 @@ Helper functions for the micro scale.
179186- ** float getPower_uW()** idem, in microWatt.
180187
181188
182- #### Configuration
189+ ### Configuration
183190
184191** Note:**
185192The internal conversions runs in the background in the device.
@@ -248,7 +255,7 @@ Note: times are typical, check datasheet for operational range.
248255Note: total conversion time can take up to 1024 \* 8.3 ms ~ 10 seconds.
249256
250257
251- #### Calibration
258+ ### Calibration
252259
253260See datasheet.
254261
@@ -257,7 +264,7 @@ Calibration is mandatory to get **getCurrent()** and **getPower()** to work.
257264- ** int setMaxCurrentShunt(float ampere = 20.0, float ohm = 0.002, bool normalize = true)**
258265set the calibration register based upon the shunt and the max Ampere.
259266From these two values the current_LSB is derived, the steps of the ADC when measuring current.
260- Returns Error code, see below.
267+ Returns Error code, see below. See # 49 about math rounding errors.
261268- ** bool isCalibrated()** returns true if CurrentLSB has been calculated by ** setMaxCurrentShunt()** .
262269Value should not be zero.
263270- ** float getCurrentLSB()** returns the LSB in Ampere == precision of the calibration.
@@ -269,7 +276,7 @@ Value should not be zero.
269276To print these values in scientific notation use https://github.com/RobTillaart/printHelpers
270277
271278
272- #### About normalization
279+ ### About normalization
273280
274281** setMaxCurrentShunt()** will round the current_LSB to nearest round value (typical 0.001) by default (normalize == true).
275282- The user ** must** check the return value == 0x000, otherwise the calibration register is ** not** set.
@@ -283,18 +290,18 @@ normalize flag was set to true.
283290See https://github.com/RobTillaart/INA226/pull/29 for details of the discussion.
284291
285292
286- #### Error codes setMaxCurrentShunt
293+ ### Error codes setMaxCurrentShunt
287294
288295| descriptive name error | value | meaning |
289296| :-------------------------------| :--------:| :----------|
290297| INA226_ERR_NONE | 0x0000 | OK
291- | INA226_ERR_SHUNTVOLTAGE_HIGH | 0x8000 | maxCurrent \* shunt > 80 mV
298+ | INA226_ERR_SHUNTVOLTAGE_HIGH | 0x8000 | maxCurrent \* shunt > 81.9 mV
292299| INA226_ERR_MAXCURRENT_LOW | 0x8001 | maxCurrent < 0.001
293300| INA226_ERR_SHUNT_LOW | 0x8002 | shunt < 0.001
294301| INA226_ERR_NORMALIZE_FAILED | 0x8003 | not possible to normalize.
295302
296303
297- #### Operating mode
304+ ### Operating mode
298305
299306See datasheet, partially tested.
300307
@@ -315,7 +322,7 @@ Descriptive mode functions (convenience wrappers).
315322- ** bool setModeShuntBusContinuous()** mode 7 - default.
316323
317324
318- #### Alert functions
325+ ### Alert functions
319326
320327See datasheet, not tested yet.
321328
@@ -351,13 +358,13 @@ Returns true if write to register successful.
351358The alert line falls when alert is reached.
352359
353360
354- #### Meta information
361+ ### Meta information
355362
356363- ** uint16_t getManufacturerID()** should return 0x5449
357364- ** uint16_t getDieID()** should return 0x2260
358365
359366
360- #### Debugging
367+ ### Debugging
361368
362369- ** uint16_t getRegister(uint8_t reg)** fetch registers directly, for debugging only.
363370
0 commit comments