{"id":10535,"date":"2021-01-03T15:06:51","date_gmt":"2021-01-03T15:06:51","guid":{"rendered":"https:\/\/wolles-elektronikkiste.de\/ina226-current-and-power-sensor"},"modified":"2025-09-27T14:48:46","modified_gmt":"2025-09-27T14:48:46","slug":"ina226-current-and-power-sensor","status":"publish","type":"post","link":"https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor","title":{"rendered":"INA226 Current and Power Sensor"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">About this Post<\/h2>\n\n<p>After reporting on the INA219 in <a href=\"https:\/\/wolles-elektronikkiste.de\/en\/ina219-current-and-power-sensor\" target=\"_blank\" rel=\"noopener noreferrer\">my last post<\/a>, I would like to introduce the INA226 and my associated library <a href=\"https:\/\/github.com\/wollewald\/INA226_WE\" target=\"_blank\" rel=\"noopener noreferrer\">INA226_WE<\/a> in this article.<\/p>\n<p>In a first approximation, the INA226 is an INA219 with alarm function, which is particularly well suited for monitoring currents. In addition, the INA226 can be used on both the high-side and the low-side. I will come back to other differences to the INA219 in the course of this article. <\/p>\n<p>First of all, I will deal with the measuring principle and the technical data. Then I present the library with its numerous example sketches. Finally, the last part is for those who want to go deeper. It deals with the inner details of the INA226 and the library.<\/p>\n\n<h2 class=\"wp-block-heading\">The measuring principle<\/h2>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/INA226_Modul-1024x498.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"498\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/INA226_Modul-1024x498.jpg\" alt=\"An INA226 module\" class=\"wp-image-6779\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/INA226_Modul-1024x498.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/INA226_Modul-300x146.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/INA226_Modul-768x374.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/INA226_Modul-1536x748.jpg 1536w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/INA226_Modul-1320x642.jpg 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/INA226_Modul.jpg 1800w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">An INA226 module, front and back<\/figcaption><\/figure>\n\n<p>Basically, the INA226 works the same way as the INA219. You conduct the current to be measured via the terminals IN+ and IN- through a <a href=\"https:\/\/de.wikipedia.org\/wiki\/Shunt_(Elektrotechnik)\" target=\"_blank\" rel=\"noopener noreferrer\">shunt<\/a> (current resistor). An A\/D converter measures the voltage drop across the shunt and the INA226 calculates the current from this.<\/p>\n<p>If you use the bare INA226 (the eight-pin IC on the module), then you are free to choose the size of the shunt. The modules have a shunt of 0.1 ohms. In any case, this applies to all models that I have dealt with.<\/p>\n<p>In addition, the INA226 measures the bus voltage, i.e. the voltage drop across consumer. This happens between VBUS and GND. The INA219, on the other hand, measures the bus voltage between IN and GND. That&#8217;s why you have to place the INA219 before the consumer (high-side). With the INA226 you are more flexible; you can use it on the high-side as well as on the low-side.<\/p>\n<p>The INA226 calculates the power from the current and the voltage drop across the consumer. It writes the measured values to its data registers, from where you can query them via I\u00b2C.<\/p>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/INA226_scheme-1024x532.png\"><img decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/INA226_scheme-1024x532.png\" alt=\"INA226 in high-side configuration\" class=\"wp-image-6780\"\/><\/a><figcaption class=\"wp-element-caption\">INA226 in high-side configuration<\/figcaption><\/figure>\n\n<h3 class=\"wp-block-heading\">Typical circuit<\/h3>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/INA226_Wiring_HiSide-1024x655.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"655\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/INA226_Wiring_HiSide-1024x655.png\" alt=\"Typical INA226 circuit (used for examples) \" class=\"wp-image-6782\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/INA226_Wiring_HiSide-1024x655.png 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/INA226_Wiring_HiSide-300x192.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/INA226_Wiring_HiSide-768x491.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/INA226_Wiring_HiSide-1536x982.png 1536w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/INA226_Wiring_HiSide-1320x844.png 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/INA226_Wiring_HiSide.png 1567w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Typical INA226 circuit (used for examples) <\/figcaption><\/figure>\n\n<p>I used the above (high-side) circuit for all example sketches. It is important that the INA226 and the consumer have a common GND, otherwise the measurement of the bus voltage will not work. If you swap IN+ and IN- you will get negative values for the shunt voltage and current.<\/p>\n\n<h2 class=\"wp-block-heading\">Some technical data of the INA226 module <\/h2>\n\n<ul>\n<li>Bus voltage: 0 &#8211; 36 volts<\/li>\n<li>Maximum bus current: 800 milliampere<\/li>\n<li>Supply voltage: 3 &#8211; 5.5 volts<\/li>\n<li>Power consumption (self-determined):\n<ul>\n<li>Continuous mode: 0.35 mA<\/li>\n<li>Power-Down Mode: 2.3.\u00b5A <\/li>\n<\/ul>\n<\/li>\n<li>Measurement modes: continuous or on-demand (&#8220;triggered&#8221;);<\/li>\n<li>Averaging of 1, 4, 64, 128, 256, 512 or 1024 individual measurements<\/li>\n<li>A\/D conversion time adjustable in eight levels: 0.14 to 8.2 ms<\/li>\n<li>Data registers:\n<ul>\n<li>Shunt voltage register<\/li>\n<li>Bus voltage register<\/li>\n<li>Current register<\/li>\n<li>Power register<\/li>\n<\/ul>\n<\/li>\n<li>Communication via I\u00b2C, 4 addresses can be set (back of module):\n<ul>\n<li>0x40: A0, A1 open<\/li>\n<li>0x41: A0 closed, A1 open<\/li>\n<li>0x44: A0 open, A1 closed<\/li>\n<li>0x45: A0, A1 closed<\/li>\n<\/ul>\n<\/li>\n<li>Programmable alarm pin for limit violations and available data<\/li>\n<\/ul>\n\n<p>Further technical data can be found in the manufacturer&#8217;s <a href=\"https:\/\/www.ti.com\/lit\/ds\/symlink\/ina226.pdf?ts=1592146667758&amp;ref_url=https%253A%252F%252Fwww.google.de%252F\" target=\"_blank\" rel=\"noopener noreferrer\">data sheet.<\/a><\/p>\n\n<p>Most INA226 modules have the 0.1 \u03a9 shunt. However, there are also models with 0.01 or 0.02 \u03a9, for example. With the 0.1 \u03a9 shunt, the maximum current is 0.819175 A. If you use the bare module, you are correspondingly more flexible. I have implemented a function that allows you to use a different resistor.   <\/p>\n\n<h2 class=\"wp-block-heading\">Use of the INA226 library<\/h2>\n\n<p>You can download the library INA226_WE <a href=\"https:\/\/github.com\/wollewald\/INA226_WE\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> from GitHub or install it directly with the Library Manager of the Arduino IDE.<\/p>\n<p>I have written a total of seven example sketches to demonstrate the functions of the library. I will focus most on the example of continuous mode. Many of the functions are used in all sketches and therefore only need to be explained once.&nbsp;<\/p>\n\n<h3 class=\"wp-block-heading\">Example 1: Continuous Mode<\/h3>\n\n<p>After you have installed the library and wired your INA226, upload the sketch &#8220;Continuous.ino&#8221;.<\/p>\n<\/p>\n<div class=\"scroll-paragraph\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-group=\"Continuous.ino\" data-enlighter-title=\"Continuous.ino\">#include &lt;Wire.h&gt;\n#include &lt;INA226_WE.h&gt;\n#define I2C_ADDRESS 0x40\n\n\/* There are several ways to create your INA226 object:\n * INA226_WE ina226 = INA226_WE(); -&gt; uses I2C Address = 0x40 \/ Wire\n * INA226_WE ina226 = INA226_WE(I2C_ADDRESS);   \n * INA226_WE ina226 = INA226_WE(&amp;Wire); -&gt; uses I2C_ADDRESS = 0x40, pass any Wire Object\n * INA226_WE ina226 = INA226_WE(&amp;Wire, I2C_ADDRESS); \n *\/\nINA226_WE ina226 = INA226_WE(I2C_ADDRESS);\n\nvoid setup() {\n  Serial.begin(115200);\n  Wire.begin();\n  if(!ina226.init()){\n    Serial.println(\"Failed to init INA226. Check your wiring.\");\n    while(1){}\n  }\n\n  \/* Set Number of measurements for shunt and bus voltage which shall be averaged\n    * Mode *           * Number of samples *\n    INA226_AVERAGE_1            1 (default)\n    INA226_AVERAGE_4            4\n    INA226_AVERAGE_16          16\n    INA226_AVERAGE_64          64\n    INA226_AVERAGE_128        128\n    INA226_AVERAGE_256        256\n    INA226_AVERAGE_512        512\n    INA226_AVERAGE_1024      1024\n  *\/\n  \/\/ina226.setAverage(INA226_AVERAGE_16); \/\/ choose mode and uncomment for change of default\n\n  \/* Set conversion time in microseconds\n     One set of shunt and bus voltage conversion will take: \n     number of samples to be averaged x conversion time x 2\n     \n     * Mode *         * conversion time *\n    INA226_CONV_TIME_140          140 \u00b5s\n    INA226_CONV_TIME_204          204 \u00b5s\n    INA226_CONV_TIME_332          332 \u00b5s\n    INA226_CONV_TIME_588          588 \u00b5s\n    INA226_CONV_TIME_1100         1.1 ms (default)\n    INA226_CONV_TIME_2116       2.116 ms\n    INA226_CONV_TIME_4156       4.156 ms\n    INA226_CONV_TIME_8244       8.244 ms  \n  *\/\n  \/\/ina226.setConversionTime(INA226_CONV_TIME_1100); \/\/choose conversion time and uncomment for change of default\n  \n  \/* Set measure mode\n    INA226_POWER_DOWN              - INA226 switched off\n    INA226_TRIGGERED               - on demand, both current and bus voltage\n    INA226_TRIGGERED_CURRENT_ONLY  - on demand, current only\n    INA226_TRIGGERERD_BUS_ONLY     - on demand, bus voltage only\n    INA226_CONTINUOUS              - continuous, both current and bus voltage (default)\n    INA226_CONTINUOUS_CURRENT_ONLY - continuous, current only\n    INA226_CONTINUOUS_BUS_ONLY     - continuous, bus voltage only\n  *\/\n  \/\/ina226.setMeasureMode(INA226_CONTINUOUS); \/\/ choose mode and uncomment for change of default\n  \n  \/* If the current values delivered by the INA226 differ by a constant factor\n    from values obtained with calibrated equipment you can define a correction factor.\n    Correction factor = current measured with calibrated device \/ current measured by INA226\n    Be aware that Imax depends on the real shunt size.\n  *\/\n  \/\/ ina226.setCorrectionFactor(0.95);\n  \n  Serial.println(\"INA226 Current Sensor Example Sketch - Continuous\");\n  \n  ina226.waitUntilConversionCompleted(); \/\/if you comment this line the first data might be zero\n}\n\nvoid loop() {\n  float shuntVoltage_mV = 0.0;\n  float loadVoltage_V = 0.0;\n  float busVoltage_V = 0.0;\n  float current_mA = 0.0;\n  float power_mW = 0.0; \n\n  shuntVoltage_mV = ina226.getShuntVoltage_mV();\n  busVoltage_V = ina226.getBusVoltage_V();\n  current_mA = ina226.getCurrent_mA();\n  power_mW = ina226.getBusPower();\n  loadVoltage_V  = busVoltage_V + (shuntVoltage_mV\/1000);\n  checkForI2cErrors();\n  \n  Serial.print(\"Shunt Voltage [mV]: \"); Serial.println(shuntVoltage_mV);\n  Serial.print(\"Bus Voltage [V]: \"); Serial.println(busVoltage_V);\n  Serial.print(\"Load Voltage [V]: \"); Serial.println(loadVoltage_V);\n  Serial.print(\"Current[mA]: \"); Serial.println(current_mA);\n  Serial.print(\"Bus Power [mW]: \"); Serial.println(power_mW);\n  if(!ina226.overflow){\n    Serial.println(\"Values OK - no overflow\");\n  }\n  else{\n    Serial.println(\"Overflow! Choose higher current range\");\n  }\n  Serial.println();\n  \n  delay(3000);\n}\n\nvoid checkForI2cErrors(){\n  byte errorCode = ina226.getI2cErrorCode();\n  if(errorCode){\n    Serial.print(\"I2C error: \");\n    Serial.println(errorCode);\n    switch(errorCode){\n      case 1:\n        Serial.println(\"Data too long to fit in transmit buffer\");\n        break;\n      case 2:\n        Serial.println(\"Received NACK on transmit of address\");\n        break;\n      case 3: \n        Serial.println(\"Received NACK on transmit of data\");\n        break;\n      case 4:\n        Serial.println(\"Other error\");\n        break;\n      case 5:\n        Serial.println(\"Timeout\");\n        break;\n      default: \n        Serial.println(\"Can't identify the error\");\n    }\n    if(errorCode){\n      while(1){}\n    }\n  }\n}<\/pre>\n<p>\u00a0<\/p>\n<\/div>\n<p>\n\n<h4 class=\"wp-block-heading\">Parameter setting using the example of continuous mode<\/h4>\n\n<p><code>INA226_WE ina226 = INA226_WE()<\/code> creates your IN226 object. You can pass the I2C address and \/ or a wire object. The latter allows you to use both I2C buses of an ESP32, for example.   <\/p>\n<p>The <code>init()<\/code> function activates the INA226 with the default values. To change these basic settings, you can vary three parameters in the setup: <\/p>\n<ol>\n<li>Set the number of individual measurements for the shunt and bus voltage conversion with <code>setAverage()<\/code>\n<ul>\n<li>1, 4, 16, 64, 128, 256, 512 or 1024 individual measurements are averaged<\/li>\n<\/ul>\n<\/li>\n<li>Setting the A\/D conversion time for the shunt and bus voltage with <code>setConvTime()<\/code><br><ul>\n<li>8 levels adjustable between 140 \u00b5s and 8.244 ms<\/li>\n<li>Note: obtaining a data set of shunt and bus voltage takes twice the time<\/li>\n<\/ul>\n<\/li>\n<li>Setting the measurement mode with <code>setMeasureMode()<\/code>\n<ul>\n<li>INA226_CONTINUOUS &#8211; continuous measurement (current and bus voltage, current only or bus voltage only)<\/li>\n<li>INA226_TRIGGERED &#8211; &#8220;on request&#8221; (current and bus voltage, current only, or bus voltage only)<\/li>\n<li>INA226_POWER_DOWN &#8211; switches off the INA226. But better use the more comfortable <code>powerDown()<\/code> function, which is explained below.<\/li>\n<li>The INA226 actually allows determining shunt <span style=\"text-decoration: underline;\">or<\/span> bus voltages &#8211; but I did not implement that. Using my library, the measurements are only available in a double pack.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>With <code>setCorrectionFactor()<\/code> you can introduce a correction factor if the current values determined with the INA226 should differ from those determined by you, for example, with calibrated measuring instruments. The factor is the quotient of the exact and the INA226 value. <\/p>\n\n<h4 class=\"wp-block-heading\">Other functions used in the example<\/h4>\n\n<p>You can query the data registers of the INA226 at any time. They contain the last measured value. Before the first measurement is completed, all values are zero. With <code>waitUntilConversionCompleted()<\/code> you can wait until the current measurement has been completed.<\/p>\n<p>Using <code>readAndClearFlags()<\/code> the overflow and alarm flags are read. In this example sketch, we need this call only to update the state of the variable overflow, which &#8211; if true &#8211; signals the overflow of a register.<\/p>\n<p>The functions for reading the data registers, such as <code>getShuntVoltage_mV()<\/code>, should be self-explanatory.<\/p>\n\n<h4 class=\"wp-block-heading\">Calculation of the measurement time<\/h4>\n\n<p>The duration of a measurement results from the number of individual measurements (averages) and the conversion time. If current and bus voltage are measured, twice the time is required: <\/p>\n<\/p>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 19px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/ql-cache\/quicklatex.com-e0e0b8f35644747fe967f014fb8f831c_l3.png\" height=\"19\" width=\"406\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#091; &#100;&#117;&#114;&#97;&#116;&#105;&#111;&#110;&#32;&#61;&#32;&#78;&#117;&#109;&#98;&#101;&#114;&#95;&#123;&#97;&#118;&#101;&#114;&#97;&#103;&#101;&#115;&#125;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#67;&#111;&#110;&#118;&#101;&#114;&#115;&#105;&#111;&#110;&#84;&#105;&#109;&#101;&#92;&#99;&#100;&#111;&#116;&#32;&#50; &#92;&#093;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p>\n<p>\n\n<h4 class=\"wp-block-heading\">Output<\/h4>\n\n<p>And this is what the output of the sketch looks like on the serial monitor:<\/p>\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Ausgabe_Cont_INA226.png\"><img loading=\"lazy\" decoding=\"async\" width=\"633\" height=\"257\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Ausgabe_Cont_INA226.png\" alt=\"INA226 - Output of the continuous sketch\" class=\"wp-image-24910\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Ausgabe_Cont_INA226.png 633w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Ausgabe_Cont_INA226-300x122.png 300w\" sizes=\"auto, (max-width: 633px) 100vw, 633px\" \/><\/a><figcaption class=\"wp-element-caption\">Output of the continuous sketch<\/figcaption><\/figure>\n\n<h3 class=\"wp-block-heading\">Example 2: On-Demand (Triggered) Mode <\/h3>\n\n<p>You set the triggered mode with <code>setMeasureMode(TRIGGERED)<\/code>. Each measurement is started manually with <code>startSingleMeasurement()<\/code>.  I have programmed the function to automatically wait until the current readings are available. So you <strong>don&#8217;t<\/strong> need to call <code>waitUntilConversionCompleted()<\/code> in triggered mode. However, this function blocks the sketch for the measurement duration. If you don&#8217;t want this, then use the <code>startSingleMeasurementNoWait()<\/code> function. You can find a sketch for this (Triggered_non_blocking.ino) in the library example sketches.  <\/p>\n<p>Otherwise, the sketch is identical to Continuous.ino.<\/p>\n<\/p>\n<div class=\"scroll-paragraph\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-group=\"Triggered.ino\" data-enlighter-title=\"Triggered.ino\">#include &lt;Wire.h&gt;\n#include &lt;INA226_WE.h&gt;\n#define I2C_ADDRESS 0x40\n\n\/* There are several ways to create your INA226 object:\n * INA226_WE ina226 = INA226_WE(); -&gt; uses I2C Address = 0x40 \/ Wire\n * INA226_WE ina226 = INA226_WE(I2C_ADDRESS);   \n * INA226_WE ina226 = INA226_WE(&amp;Wire); -&gt; uses I2C_ADDRESS = 0x40, pass any Wire Object\n * INA226_WE ina226 = INA226_WE(&amp;Wire, I2C_ADDRESS); \n *\/\nINA226_WE ina226 = INA226_WE(I2C_ADDRESS);\n\nvoid setup() {\n  Serial.begin(115200);\n  Wire.begin();\n  if(!ina226.init()){\n    Serial.println(\"Failed to init INA226. Check your wiring.\");\n    while(1){}\n  }\n\n  \/* Set Number of measurements for shunt and bus voltage which shall be averaged\n       * Mode *         * Number of samples *\n    INA226_AVERAGE_1            1 (default)\n    INA226_AVERAGE_4            4\n    INA226_AVERAGE_16           8\n    INA226_AVERAGE_64          64\n    INA226_AVERAGE_128        128\n    INA226_AVERAGE_256        256\n    INA226_AVERAGE_512        512\n    INA226_AVERAGE_1024      1024\n  *\/\n  \/\/ina226.setAverage(INA226_AVERAGE_1); \/\/ choose mode and uncomment for change of default\n\n  \/* Set conversion time in microseconds\n    One set of shunt and bus voltage conversion will take: \n    number of samples to be averaged x conversion time x 2\n    \n       * Mode *              * conversion time *\n    INA226_CONV_TIME_140          140 \u00b5s\n    INA226_CONV_TIME_204          204 \u00b5s\n    INA226_CONV_TIME_332          332 \u00b5s\n    INA226_CONV_TIME_588          588 \u00b5s\n    INA226_CONV_TIME_1100         1.1 ms (default)\n    INA226_CONV_TIME_2116       2.116 ms\n    INA226_CONV_TIME_4156       4.156 ms\n    INA226_CONV_TIME_8244       8.244 ms  \n  *\/\n  \/\/ina226.setConversionTime(INA226_CONV_TIME_1100); \/\/choose conversion time and uncomment for change of default\n  \n  \/* Set measure mode\n    INA226_POWER_DOWN              - INA226 switched off\n    INA226_TRIGGERED               - on demand, both current and bus voltage\n    INA226_TRIGGERED_CURRENT_ONLY  - on demand, current only\n    INA226_TRIGGERERD_BUS_ONLY     - on demand, bus voltage only\n    INA226_CONTINUOUS              - continuous, both current and bus voltage (default)\n    INA226_CONTINUOUS_CURRENT_ONLY - continuous, current only\n    INA226_CONTINUOUS_BUS_ONLY     - continuous, bus voltage only\n  *\/\n  ina226.setMeasureMode(INA226_TRIGGERED); \/\/ choose mode and uncomment for change of default\n  \n  \/* If the current values delivered by the INA226 differ by a constant factor\n    from values obtained with calibrated equipment you can define a correction factor.\n    Correction factor = current measured with calibrated device \/ current measured by INA226\n    Be aware that Imax depends on the real shunt size.\n  *\/\n  \/\/ ina226.setCorrectionFactor(0.95);\n  \n  Serial.println(\"INA226 Current Sensor Example Sketch - Triggered\");\n   \n  \/\/ ina226.waitUntilConversionCompleted(); \/\/makes no sense - in triggered mode we wait anyway for comleted conversion\n}\n\nvoid loop() {\n  float shuntVoltage_mV = 0.0;\n  float loadVoltage_V = 0.0;\n  float busVoltage_V = 0.0;\n  float current_mA = 0.0;\n  float power_mW = 0.0; \n  \n  ina226.startSingleMeasurement();\n  ina226.readAndClearFlags();\n  shuntVoltage_mV = ina226.getShuntVoltage_mV();\n  busVoltage_V = ina226.getBusVoltage_V();\n  current_mA = ina226.getCurrent_mA();\n  power_mW = ina226.getBusPower();\n  loadVoltage_V  = busVoltage_V + (shuntVoltage_mV\/1000);\n  checkForI2cErrors();\n    \n  Serial.print(\"Shunt Voltage [mV]: \"); Serial.println(shuntVoltage_mV);\n  Serial.print(\"Bus Voltage [V]: \"); Serial.println(busVoltage_V);\n  Serial.print(\"Load Voltage [V]: \"); Serial.println(loadVoltage_V);\n  Serial.print(\"Current[mA]: \"); Serial.println(current_mA);\n  Serial.print(\"Bus Power [mW]: \"); Serial.println(power_mW);\n  if(!ina226.overflow){\n    Serial.println(\"Values OK - no overflow\");\n  }\n  else{\n    Serial.println(\"Overflow! Choose higher current range\");\n  }\n  Serial.println();\n  \n  delay(3000);\n}\n\nvoid checkForI2cErrors(){\n  byte errorCode = ina226.getI2cErrorCode();\n  if(errorCode){\n    Serial.print(\"I2C error: \");\n    Serial.println(errorCode);\n    switch(errorCode){\n      case 1:\n        Serial.println(\"Data too long to fit in transmit buffer\");\n        break;\n      case 2:\n        Serial.println(\"Received NACK on transmit of address\");\n        break;\n      case 3: \n        Serial.println(\"Received NACK on transmit of data\");\n        break;\n      case 4:\n        Serial.println(\"Other error\");\n        break;\n      case 5:\n        Serial.println(\"Timeout\");\n        break;\n      default: \n        Serial.println(\"Can't identify the error\");\n    }\n    if(errorCode){\n      while(1){}\n    }\n  }\n}<\/pre>\n<p>\u00a0<\/p>\n<\/div>\n<p>\n\n<h3 class=\"wp-block-heading\">Example 3: Power-Down Mode<\/h3>\n\n<p>In power-down mode, you bring down the power consumption of the INA226 from approx. 0.35 mA to approx. 2.3 &nbsp; \u00b5A (own measurements).<\/p>\n<p>The example sketch PowerDown.ino shows the power-down mode in action. The sketch initializes the INA226 with the default parameters. Five sets of measurements are output every three seconds. The function <code>powerDown()<\/code> then saves the contents of the configuration register and disables the INA226. The function <code>powerUp()<\/code> writes back the copy of the configuration register. On the one hand, this writing process awakens the INA226, on the other hand it ensures that the INA226 returns to the previously selected mode (here: continuous).<\/p>\n<\/p>\n<div class=\"scroll-paragraph\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-group=\"PowerDown.ino\" data-enlighter-title=\"PowerDown.ino\">#include &lt;Wire.h&gt;\n#include &lt;INA226_WE.h&gt;\n#define I2C_ADDRESS 0x40\n\n\/* There are several ways to create your INA226 object:\n * INA226_WE ina226 = INA226_WE(); -&gt; uses I2C Address = 0x40 \/ Wire\n * INA226_WE ina226 = INA226_WE(I2C_ADDRESS);   \n * INA226_WE ina226 = INA226_WE(&amp;Wire); -&gt; uses I2C_ADDRESS = 0x40, pass any Wire Object\n * INA226_WE ina226 = INA226_WE(&amp;Wire, I2C_ADDRESS); \n *\/\nINA226_WE ina226 = INA226_WE(I2C_ADDRESS);\n\nvoid setup() {\n  Serial.begin(115200);\n  Wire.begin();\n  \/\/ default parameters are set - for change check the other examples\n  ina226.init();\n  Serial.println(\"INA226 Current Sensor Example Sketch - PowerDown\");\n  Serial.println(\"Continuous Sampling starts\");\n  Serial.println();\n}\n\nvoid loop() {\n  for(int i=0; i&lt;5; i++){\n    continuousSampling();\n    delay(3000);\n  }\n  \n  Serial.println(\"Power down for 10s\");\n  ina226.powerDown();\n  for(int i=0; i&lt;10; i++){\n    Serial.print(\".\");\n    delay(1000);\n  }\n  \n  Serial.println(\"Power up!\");\n  Serial.println(\"\");\n  ina226.powerUp();\n}\n\nvoid continuousSampling(){\n  float shuntVoltage_mV = 0.0;\n  float loadVoltage_V = 0.0;\n  float busVoltage_V = 0.0;\n  float current_mA = 0.0;\n  float power_mW = 0.0; \n\n  ina226.readAndClearFlags();\n  shuntVoltage_mV = ina226.getShuntVoltage_mV();\n  busVoltage_V = ina226.getBusVoltage_V();\n  current_mA = ina226.getCurrent_mA();\n  power_mW = ina226.getBusPower();\n  loadVoltage_V  = busVoltage_V + (shuntVoltage_mV\/1000);\n  \n  Serial.print(\"Shunt Voltage [mV]: \"); Serial.println(shuntVoltage_mV);\n  Serial.print(\"Bus Voltage [V]: \"); Serial.println(busVoltage_V);\n  Serial.print(\"Load Voltage [V]: \"); Serial.println(loadVoltage_V);\n  Serial.print(\"Current[mA]: \"); Serial.println(current_mA);\n  Serial.print(\"Bus Power [mW]: \"); Serial.println(power_mW);\n  if(!ina226.overflow){\n    Serial.println(\"Values OK - no overflow\");\n  }\n  else{\n    Serial.println(\"Overflow! Choose higher current range\");\n  }\n  Serial.println();\n}<\/pre>\n<p>\u00a0<\/p>\n<\/div>\n<p>\n\n<h3 class=\"wp-block-heading\">Example 4: Conversion Ready Alarm <\/h3>\n\n<p>Now upload \u201cContinuous_Alert_Controlled.ino\u201d. With this example, you get to know the alert pin. First, a high number of individual measurements to be averaged is set at 512. We select 8.244 milliseconds as the conversion time. This means that the combination of shunt and bus voltage measurement takes around 8.4 seconds.   We select CONTINUOUS as the measurement mode. The function <code>enableConvReadyAlert()<\/code> activates the alert pin, which is active-low by default. The alert pin is connected to the Arduino Pin 2, for which we set up an interrupt.<\/p>\n<p>When a measurement is finished, the alert pin goes to LOW and an interrupt is triggered. The variable &#8220;event&#8221; becomes true and the if block is processed in the main loop. First, <code>readAndClearFlags()<\/code> is executed. This will delete the conversion ready flag and also read the overflow flag. The measurement data is read and displayed. The interrupt on pin 2 was deactivated after triggering and is switched on again after the values have been output. <\/p>\n<\/p>\n<div class=\"scroll-paragraph\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-group=\"Continous_Alert_Controlled.ino\" data-enlighter-title=\"Continous_Alert_Controlled.ino\">#include &lt;Wire.h&gt;\n#include &lt;INA226_WE.h&gt;\n#define I2C_ADDRESS 0x40\n\nint interruptPin = 2;\nvolatile bool event = false;\n\n\/* There are several ways to create your INA226 object:\n * INA226_WE ina226 = INA226_WE(); -&gt; uses I2C Address = 0x40 \/ Wire\n * INA226_WE ina226 = INA226_WE(I2C_ADDRESS);   \n * INA226_WE ina226 = INA226_WE(&amp;Wire); -&gt; uses I2C_ADDRESS = 0x40, pass any Wire Object\n * INA226_WE ina226 = INA226_WE(&amp;Wire, I2C_ADDRESS); \n *\/\nINA226_WE ina226 = INA226_WE(I2C_ADDRESS);\n\nvoid setup() {\n  Serial.begin(115200);\n  pinMode(interruptPin, INPUT_PULLUP); \/\/ for modules without internal pullup\n  Wire.begin();\n  ina226.init();\n\n  \/* Set Number of measurements for shunt and bus voltage which shall be averaged\n    * Mode *     * Number of samples *\n    INA226_AVERAGE_1            1 (default)\n    INA226_AVERAGE_4            4\n    INA226_AVERAGE_16          16\n    INA226_AVERAGE_64          64\n    INA226_AVERAGE_128        128\n    INA226_AVERAGE_256        256\n    INA226_AVERAGE_512        512\n    INA226_AVERAGE_1024      1024\n  *\/\n  ina226.setAverage(INA226_AVERAGE_1024); \n\n  \/* Set conversion time in microseconds\n     One set of shunt and bus voltage conversion will take: \n     number of samples to be averaged x conversion time x 2\n     \n    * Mode *                * conversion time *\n    INA226_CONV_TIME_140          140 \u00b5s\n    INA226_CONV_TIME_204          204 \u00b5s\n    INA226_CONV_TIME_332          332 \u00b5s\n    INA226_CONV_TIME_588          588 \u00b5s\n    INA226_CONV_TIME_1100         1.1 ms (default)\n    INA226_CONV_TIME_2116       2.116 ms\n    INA226_CONV_TIME_4156       4.156 ms\n    INA226_CONV_TIME_8244       8.244 ms  \n  *\/\n  ina226.setConversionTime(INA226_CONV_TIME_8244); \/\/ Conversion ready after conversion time x number of averages x 2\n\n  \/* Set measure mode\n    INA226_POWER_DOWN              - INA226 switched off\n    INA226_TRIGGERED               - on demand, both current and bus voltage\n    INA226_TRIGGERED_CURRENT_ONLY  - on demand, current only\n    INA226_TRIGGERERD_BUS_ONLY     - on demand, bus voltage only\n    INA226_CONTINUOUS              - continuous, both current and bus voltage (default)\n    INA226_CONTINUOUS_CURRENT_ONLY - continuous, current only\n    INA226_CONTINUOUS_BUS_ONLY     - continuous, bus voltage only\n  *\/\n  \/\/ina226.setMeasureMode(INA226_CONTINUOUS); \/\/ choose mode and uncomment for change of default\n  \n  \/* If the current values delivered by the INA226 differ by a constant factor\n    from values obtained with calibrated equipment you can define a correction factor.\n    Correction factor = current measured with calibrated device \/ current measured by INA226\n    Be aware that Imax depends on the real shunt size.\n  *\/\n  \/\/ ina226.setCorrectionFactor(0.95);\n  \n  Serial.println(\"INA226 Current Sensor Example Sketch - Continuous_Alert_Controlled\");\n  \n  attachInterrupt(digitalPinToInterrupt(interruptPin), alert, FALLING);\n\n  ina226.enableConvReadyAlert(); \/\/ an interrupt will occur on interrupt pin when conversion is ready\n}\n\nvoid loop() {\n  if(event){\n    ina226.readAndClearFlags(); \/\/ reads interrupt and overflow flags and deletes them \n    displayResults();\n    attachInterrupt(digitalPinToInterrupt(interruptPin), alert, FALLING); \n    event = false;  \n  }\n  \n  delay(100);\n}\n\nvoid displayResults(){\n  float shuntVoltage_mV = 0.0;\n  float loadVoltage_V = 0.0;\n  float busVoltage_V = 0.0;\n  float current_mA = 0.0;\n  float power_mW = 0.0; \n  \n  shuntVoltage_mV = ina226.getShuntVoltage_mV();\n  busVoltage_V = ina226.getBusVoltage_V();\n  current_mA = ina226.getCurrent_mA();\n  power_mW = ina226.getBusPower();\n  loadVoltage_V  = busVoltage_V + (shuntVoltage_mV\/1000);\n    \n  Serial.print(\"Shunt Voltage [mV]: \"); Serial.println(shuntVoltage_mV);\n  Serial.print(\"Bus Voltage [V]: \"); Serial.println(busVoltage_V);\n  Serial.print(\"Load Voltage [V]: \"); Serial.println(loadVoltage_V);\n  Serial.print(\"Current[mA]: \"); Serial.println(current_mA);\n  Serial.print(\"Bus Power [mW]: \"); Serial.println(power_mW);\n  if(!ina226.overflow){\n    Serial.println(\"Values OK - no overflow\");\n  }\n  else{\n    Serial.println(\"Overflow! Choose higher current range\");\n  }\n  Serial.println();\n}\n\nvoid alert(){\n  event = true;\n  detachInterrupt(digitalPinToInterrupt(interruptPin));\n}<\/pre>\n<p>\u00a0<\/p>\n<\/div>\n<p>\n\n<h4 class=\"wp-block-heading\">Practical application of the Conversion Ready Alert<\/h4>\n\n<p>During the long 8 seconds between measurements, the Arduino or the microcontroller you are using in your project has nothing to do. This consumes valuable electricity in battery-powered projects. So just send your microcontroller to sleep and let it wake up through the interrupt. If you don&#8217;t know how to do it, look <a href=\"https:\/\/wolles-elektronikkiste.de\/en\/sleep-modes-and-power-management\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> at my post on this subject.<\/p>\n\n<h3 class=\"wp-block-heading\">Example 5: Limit Alert<\/h3>\n\n<p>I would like to introduce you to the Limit Alarm using the sketch Limit_Alert.ino. The INA226 runs in triggered mode. On the Arduino side, an interrupt on pin 2 is set up again.<\/p>\n<p>The function <code>enableAlertLatch()<\/code> sets the alarm pin so that it is active when an alarm is raised until it is manually <code>readAndClearFlags()<\/code> set inactive again. Without this setup, the pin would be automatically reset if the next measured value is within the limits.<\/p>\n<p>With <code>setAlertType()<\/code> you determine the limit and which of the measured values is observed. You can specify a min or max limit for the shunt voltage, bus voltage, or current. For the power you can only set a max limit. Actually, the INA226 has no alarm function for the current, I implemented this via a detour.<\/p>\n<p>And that&#8217;s it. When the set limit is exceeded, the alarm pin becomes active, the interrupt is triggered and the measured values are read. However, the alarm is triggered for each individual measurement and not only after measurements set via averages have been completed.<\/p>\n<p>You have to be a bit careful with the <code>readAndClearFlags()<\/code> function. When you read the flags to evaluate them, you delete them. If the alarm condition still exists, the alarm pin becomes active again immediately. If this happens before the interrupt is reactivated, everything gets confused. The alarm pin would already be low, while the interrupt pin would wait for a falling event. It could wait for a very long time! This is why <code>readAndClearFlags()<\/code> is called again after the interrupt has been reactivated. Separating the reading and deletion of the flags would be a little easier to control, but this is not implemented in INA226.<\/p>\n<\/p>\n<div class=\"scroll-paragraph\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;Wire.h&gt;\n#include &lt;INA226_WE.h&gt;\n#define I2C_ADDRESS 0x40\n#define SAMPLING_PERIOD 500\n#define OUTPUT_PERIOD 2000\n\nint interruptPin = 2;\nvolatile bool limitEvent = false;\n\n\/* There are several ways to create your INA226 object:\n * INA226_WE ina226 = INA226_WE(); -&gt; uses I2C Address = 0x40 \/ Wire\n * INA226_WE ina226 = INA226_WE(I2C_ADDRESS);   \n * INA226_WE ina226 = INA226_WE(&amp;Wire); -&gt; uses I2C_ADDRESS = 0x40, pass any Wire Object\n * INA226_WE ina226 = INA226_WE(&amp;Wire, I2C_ADDRESS); \n *\/\nINA226_WE ina226 = INA226_WE(I2C_ADDRESS);\n\nvoid setup() {\n  Serial.begin(115200);\n  pinMode(interruptPin, INPUT_PULLUP); \/\/ for modules without internal pullup\n  Wire.begin();\n  ina226.init();\n\n  \/* Set Number of measurements for shunt and bus voltage which shall be averaged\n      * Mode *          * Number of samples *\n    INA226_AVERAGE_1            1 (default)\n    INA226_AVERAGE_4            4\n    INA226_AVERAGE_16          16\n    INA226_AVERAGE_64          64\n    INA226_AVERAGE_128        128\n    INA226_AVERAGE_256        256\n    INA226_AVERAGE_512        512\n    INA226_AVERAGE_1024      1024\n  *\/\n  \/\/ ina226.setAverage(INA226_AVERAGE_1024); \n\n  \/* Set conversion time in microseconds\n     One set of shunt and bus voltage conversion will take: \n     number of samples to be averaged x conversion time x 2\n     \n       * Mode *              * conversion time *\n    INA226_CONV_TIME_140          140 \u00b5s\n    INA226_CONV_TIME_204          204 \u00b5s\n    INA226_CONV_TIME_332          332 \u00b5s\n    INA226_CONV_TIME_588          588 \u00b5s\n    INA226_CONV_TIME_1100         1.1 ms (default)\n    INA226_CONV_TIME_2116       2.116 ms\n    INA226_CONV_TIME_4156       4.156 ms\n    INA226_CONV_TIME_8244       8.244 ms  \n  *\/\n  \/\/ ina226.setConversionTime(INA226_CONV_TIME_8244); \n  \n  \/* Set measure mode\n    INA226_POWER_DOWN              - INA226 switched off\n    INA226_TRIGGERED               - on demand, both current and bus voltage\n    INA226_TRIGGERED_CURRENT_ONLY  - on demand, current only\n    INA226_TRIGGERERD_BUS_ONLY     - on demand, bus voltage only\n    INA226_CONTINUOUS              - continuous, both current and bus voltage (default)\n    INA226_CONTINUOUS_CURRENT_ONLY - continuous, current only\n    INA226_CONTINUOUS_BUS_ONLY     - continuous, bus voltage only\n  *\/\n  ina226.setMeasureMode(INA226_TRIGGERED); \/\/ choose mode and uncomment for change of default\n  \n  \/* If the current values delivered by the INA226 differ by a constant factor\n    from values obtained with calibrated equipment you can define a correction factor.\n    Correction factor = current measured with calibrated device \/ current measured by INA226\n    Be aware that Imax depends on the real shunt size.\n  *\/\n  \/\/ ina226.setCorrectionFactor(0.95);\n  \n  Serial.println(\"INA226 Current Sensor Example Sketch - Limit_Alert\");\n  \n  \/* In the default mode the limit interrupt flag will be deleted after the next measurement within limits. \n    With enableAltertLatch(), the flag will have to be deleted with readAndClearFlags(). \n  *\/\n    ina226.enableAlertLatch();\n  \n  \/* Set the alert type and the limit\n      * Mode *        * Description *           * limit unit *\n    INA226_SHUNT_OVER     Shunt Voltage over limit          mV\n    INA226_SHUNT_UNDER    Shunt Voltage under limit         mV\n    INA226_CURRENT_OVER   Current over limit                mA\n    INA226_CURRENT_UNDER  Current under limit               mA\n    INA226_BUS_OVER       Bus Voltage over limit            V\n    INA226_BUS_UNDER      Bus Voltage under limit           V\n    INA226_POWER_OVER     Power over limit                  mW\n  *\/\n  ina226.setAlertType(INA226_POWER_OVER, 250.0); \/\/ alert, if power &gt; 250.0 mW\n \n  attachInterrupt(digitalPinToInterrupt(interruptPin), alert, FALLING);\n}\n\nvoid loop() {\n  static unsigned long lastMeasurement = 0;\n  static unsigned long lastOutput = 0;\n  \n  if(millis() - lastMeasurement &gt;= SAMPLING_PERIOD) {\n    ina226.startSingleMeasurementNoWait();\n    lastMeasurement = millis();\n  }\n\n  if(millis() - lastOutput &gt;= OUTPUT_PERIOD) {\n    lastOutput = millis();\n    displayResults();\n  }\n  \n  if(limitEvent){\n    ina226.readAndClearFlags(); \/\/ reads interrupt and overflow flags and deletes them \n    Serial.println(\"ALERT!\");\n    displayResults();\n    lastOutput = millis();\n    limitEvent = false;\n    attachInterrupt(digitalPinToInterrupt(interruptPin), alert, FALLING); \n    ina226.readAndClearFlags();\n  }  \n}\n\nvoid displayResults(){\n  float shuntVoltage_mV = 0.0;\n  float loadVoltage_V = 0.0;\n  float busVoltage_V = 0.0;\n  float current_mA = 0.0;\n  float power_mW = 0.0; \n  \n  shuntVoltage_mV = ina226.getShuntVoltage_mV();\n  busVoltage_V = ina226.getBusVoltage_V();\n  current_mA = ina226.getCurrent_mA();\n  power_mW = ina226.getBusPower();\n  loadVoltage_V  = busVoltage_V + (shuntVoltage_mV\/1000);\n  \n  Serial.print(\"Shunt Voltage [mV]: \"); Serial.println(shuntVoltage_mV);\n  Serial.print(\"Bus Voltage [V]: \"); Serial.println(busVoltage_V);\n  Serial.print(\"Load Voltage [V]: \"); Serial.println(loadVoltage_V);\n  Serial.print(\"Current[mA]: \"); Serial.println(current_mA);\n  Serial.print(\"Bus Power [mW]: \"); Serial.println(power_mW);\n  if(!ina226.overflow){\n    Serial.println(\"Values OK - no overflow\");\n  }\n  else{\n    Serial.println(\"Overflow! Choose higher current range\");\n  }\n  Serial.println();\n}\n\nvoid alert(){\n  limitEvent = true;\n  detachInterrupt(digitalPinToInterrupt(interruptPin));\n}<\/pre>\n<p>\u00a0<\/p>\n<\/div>\n<p>\n\n<h3 class=\"wp-block-heading\">Example 6: Limit and Conversion Alert<\/h3>\n\n<p>I hope you are still motivated &#8211; that is the last example. With the sketch Limit_And_Conversion_Alert.ino I want to show how you can use the limit and the conversion ready alarm side by side. Both alarms are activated as in the previous sketches.<\/p>\n<p>In the event of an alarm, you now want to be able to distinguish which condition triggered the alarm. In case of alarm, read the flags via <code>readAndClearFlags()<\/code> . This will update the variables limitAlert and convAltert and allow you to query them.<\/p>\n<\/p>\n<div class=\"scroll-paragraph\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-group=\"Limit_And_Conversion_Alert\" data-enlighter-title=\"Limit_And_Conversion_Alert\">#include &lt;Wire.h&gt;\n#include &lt;INA226_WE.h&gt;\n#define I2C_ADDRESS 0x40\n\nint interruptPin = 2;\nvolatile bool event = false;\n\n\/* There are several ways to create your INA226 object:\n * INA226_WE ina226 = INA226_WE(); -&gt; uses I2C Address = 0x40 \/ Wire\n * INA226_WE ina226 = INA226_WE(I2C_ADDRESS);   \n * INA226_WE ina226 = INA226_WE(&amp;Wire); -&gt; uses I2C_ADDRESS = 0x40, pass any Wire Object\n * INA226_WE ina226 = INA226_WE(&amp;Wire, I2C_ADDRESS); \n *\/\nINA226_WE ina226 = INA226_WE(I2C_ADDRESS);\n\nvoid setup() {\n  Serial.begin(115200);\n  pinMode(interruptPin, INPUT_PULLUP); \/\/ for modules without internal pullup\n  Wire.begin();\n  ina226.init();\n\n  \/\/ Conversion will be ready after conversion time x number of averages x 2\n  ina226.setAverage(INA226_AVERAGE_512); \n  ina226.setConversionTime(INA226_CONV_TIME_8244);\n  \/\/ ina226.setCorrectionFactor(0.95);\n  \n  Serial.println(\"INA226 Current Sensor Example Sketch - Limit_And_Conversion_Alert\");\n  \n  \/* In the default mode the limit interrupt flag will be deleted after the next measurement within limits. \n    With enableAltertLatch(), the flag will have to be deleted with readAndClearFlags(). \n  *\/\n  ina226.enableAlertLatch();\n  \n  \/* Set the alert type and the limit\n      * Mode *              * Description *           * limit unit *\n    INA226_SHUNT_OVER     Shunt Voltage over limit          mV\n    INA226_SHUNT_UNDER    Shunt Voltage under limit         mV\n    INA226_CURRENT_OVER   Current over limit                mA\n    INA226_CURRENT_UNDER  Current under limit               mA\n    INA226_BUS_OVER       Bus Voltage over limit            V\n    INA226_BUS_UNDER      Bus Voltage under limit           V\n    INA226_POWER_OVER     Power over limit                  mW\n  *\/\n  ina226.setAlertType(INA226_CURRENT_UNDER, 3.0); \/\/ alert, if current is below 3.0 mA\n  ina226.enableConvReadyAlert(); \/\/ In this example we also enable the conversion ready alert interrupt\n \n  attachInterrupt(digitalPinToInterrupt(interruptPin), alert, FALLING);\n}\n\nvoid loop() {\n  static unsigned long lastLimitAlert = 0;\n  if(event){\n    ina226.readAndClearFlags();\n    if(ina226.convAlert){\n      Serial.println(\"Conversion Alert!!!!\");\n      displayResults();\n    }\n    \n  \/* \n    The limit alert is fired after every single measurement. I does not\n    wait until the averaged value is ready. Therefore, I reduce the number\n    of outputs. \n  *\/\n    if(ina226.limitAlert){\n      if (millis() - lastLimitAlert &gt;= 1000) {\n        Serial.println(\"Limit Alert !!!!\");\n        lastLimitAlert = millis();\n      }\n    }\n    \n    event = false;\n    attachInterrupt(digitalPinToInterrupt(interruptPin), alert, FALLING); \n    ina226.readAndClearFlags(); \n  }  \n}\n\nvoid displayResults(){\n  float shuntVoltage_mV = 0.0;\n  float loadVoltage_V = 0.0;\n  float busVoltage_V = 0.0;\n  float current_mA = 0.0;\n  float power_mW = 0.0; \n\n  shuntVoltage_mV = ina226.getShuntVoltage_mV();\n  busVoltage_V = ina226.getBusVoltage_V();\n  current_mA = ina226.getCurrent_mA();\n  power_mW = ina226.getBusPower();\n  loadVoltage_V  = busVoltage_V + (shuntVoltage_mV\/1000);\n  \n  Serial.print(\"Shunt Voltage [mV]: \"); Serial.println(shuntVoltage_mV);\n  Serial.print(\"Bus Voltage [V]: \"); Serial.println(busVoltage_V);\n  Serial.print(\"Load Voltage [V]: \"); Serial.println(loadVoltage_V);\n  Serial.print(\"Current[mA]: \"); Serial.println(current_mA);\n  Serial.print(\"Bus Power [mW]: \"); Serial.println(power_mW);\n  if(!ina226.overflow){\n    Serial.println(\"Values OK - no overflow\");\n  }\n  else{\n    Serial.println(\"Overflow! Choose higher current range\");\n  }\n  Serial.println();  \n}\n\n\nvoid alert(){\n  event = true;\n  detachInterrupt(digitalPinToInterrupt(interruptPin));\n}<\/pre>\n<p>\u00a0<\/p>\n<\/div>\n<p>\n\n<h4 class=\"wp-block-heading\">Output of Limit_And_Conversion_Alert.ino<\/h4>\n\n<p>For the following output, I waited for a regular output within the limits and then switched off my load. As a result, the set limit is permanently exceeded.  Accordingly, the sketch outputs limit violations every second. Under the conditions set above, the sketch also issues a conversion ready alert approx. every 8 seconds:<\/p>\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/output_Limit_And_Conversion_Alert.png\"><img loading=\"lazy\" decoding=\"async\" width=\"701\" height=\"364\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/output_Limit_And_Conversion_Alert.png\" alt=\"\" class=\"wp-image-24912\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/output_Limit_And_Conversion_Alert.png 701w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/output_Limit_And_Conversion_Alert-300x156.png 300w\" sizes=\"auto, (max-width: 701px) 100vw, 701px\" \/><\/a><figcaption class=\"wp-element-caption\">Output of the Limit_And_Conversion_Alert.ino sketch <\/figcaption><\/figure>\n\n<h3 class=\"wp-block-heading\">Example 7: Continuous with alternative shunt size<\/h3>\n\n<p>A diligent contributor has added another feature to my library that allows you to use alternative shunts:<\/p>\n<ul>\n<li><code>setResistorRange(0.005, 10.0)<\/code> sets the resistance in ohms and the range in amperes. The maximum current Imax [A] = 0.0819175 \/ shuntSize (with shuntSize in Ohm) is the upper limit.<\/li>\n<li><code>setResistorRange(0.005)<\/code> specifies the resistance, and the maximum range is calculated from this: Imax [A] = 0.0819175 \/ shuntSize with shuntSize in ohms.<\/li>\n<\/ul>\n<p>The sketch works like the Continuous.ino sketch, but with the additional function. You can find it in the example sketches provided. <\/p>\n<p><strong>But aware<\/strong>: many INA226 modules with smaller shunts are scrap! I have written something about this <a href=\"https:\/\/github.com\/wollewald\/INA226_WE#quality-of-small-shunt-ina226-modules\" target=\"_blank\" rel=\"noopener\">here<\/a> on Github. <\/p>\n<\/p>\n<div class=\"scroll-paragraph\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-group=\"Continuous_With_Resistor_Value.ino\" data-enlighter-title=\"Continuous_With_Resistor_Value.ino\">#include &lt;Wire.h&gt;\n#include &lt;INA226_WE.h&gt;\n#define I2C_ADDRESS 0x40\n\n\/* There are several ways to create your INA226 object:\n * INA226_WE ina226 = INA226_WE(); -&gt; uses I2C Address = 0x40 \/ Wire\n * INA226_WE ina226 = INA226_WE(I2C_ADDRESS);   \n * INA226_WE ina226 = INA226_WE(&amp;Wire); -&gt; uses I2C_ADDRESS = 0x40, pass any Wire Object\n * INA226_WE ina226 = INA226_WE(&amp;Wire, I2C_ADDRESS); \n *\/\nINA226_WE ina226 = INA226_WE(I2C_ADDRESS);\n\nvoid setup() {\n  Serial.begin(115200);\n  while(!Serial); \/\/ wait until serial comes up on Arduino Leonardo or MKR WiFi 1010\n  Wire.begin();\n  ina226.init();\n\n  \/* Set Number of measurements for shunt and bus voltage which shall be averaged\n      * Mode *           * Number of samples *\n    INA226_AVERAGE_1            1 (default)\n    INA226_AVERAGE_4            4\n    INA226_AVERAGE_16          16\n    INA226_AVERAGE_64          64\n    INA226_AVERAGE_128        128\n    INA226_AVERAGE_256        256\n    INA226_AVERAGE_512        512\n    INA226_AVERAGE_1024      1024\n    *\/\n  \/\/ina226.setAverage(INA226_AVERAGE_16); \/\/ choose mode and uncomment for change of default\n\n  \/* Set conversion time in microseconds\n    One set of shunt and bus voltage conversion will take: \n    number of samples to be averaged x conversion time x 2\n     \n    * Mode *                  * conversion time *\n    INA226_CONV_TIME_140          140 \u00b5s\n    INA226_CONV_TIME_204          204 \u00b5s\n    INA226_CONV_TIME_332          332 \u00b5s\n    INA226_CONV_TIME_588          588 \u00b5s\n    INA226_CONV_TIME_1100         1.1 ms (default)\n    INA226_CONV_TIME_2116       2.116 ms\n    INA226_CONV_TIME_4156       4.156 ms\n    INA226_CONV_TIME_8244       8.244 ms  \n  *\/\n  \/\/ina226.setConversionTime(INA226_CONV_TIME_1100); \/\/choose conversion time and uncomment for change of default\n  \n  \/* Set measure mode\n    INA226_POWER_DOWN              - INA226 switched off\n    INA226_TRIGGERED               - on demand, both current and bus voltage\n    INA226_TRIGGERED_CURRENT_ONLY  - on demand, current only\n    INA226_TRIGGERERD_BUS_ONLY     - on demand, bus voltage only\n    INA226_CONTINUOUS              - continuous, both current and bus voltage (default)\n    INA226_CONTINUOUS_CURRENT_ONLY - continuous, current only\n    INA226_CONTINUOUS_BUS_ONLY     - continuous, bus voltage only\n  *\/\n  \/\/ina226.setMeasureMode(INA226_CONTINUOUS); \/\/ choose mode and uncomment for change of default\n  \n  \/* Set Resistor and Current Range\n    Most INA226 modules use a 0.1 ohms shunt. If you have a board with a different shunt you need \n    to set it with setResistorRange(). You pass the shunt value in ohms. The maximum current you \n    can measure is Imax [A] = 0.0819175 \/ shuntSize. \n    If you only expect currents lower than this Imax, you can also pass the expected Imax as a \n    second parameter. The resolution is determined by the shunt register LSB (2.5 \u00b5V). However,\n    passing a smaller Imax may result in a little higher resolution when the current is calculated.\n  *\/\n  \/\/ina226.setResistorRange(0.005,10.0); \/\/ Example: shunt is 5 mOhm and expected Imax is 10 A\n  ina226.setResistorRange(0.005); \/\/ Shunt is 5 mOhm, Imax is 16.3835 by default\n  \n  \/* If the current values delivered by the INA226 differ by a constant factor\n    from values obtained with calibrated equipment you can define a correction factor.\n    Correction factor = current measured with calibrated device \/ current measured by INA226\n    Be aware that Imax depends on the real shunt size.\n  *\/\n  \/\/ ina226.setCorrectionFactor(0.95);\n  \n  Serial.println(\"INA226 Current Sensor Example Sketch - Continuous\");\n  \n  ina226.waitUntilConversionCompleted(); \/\/if you comment this line the first data might be zero\n}\n\nvoid loop() {\n  float shuntVoltage_mV = 0.0;\n  float loadVoltage_V = 0.0;\n  float busVoltage_V = 0.0;\n  float current_mA = 0.0;\n  float power_mW = 0.0; \n\n  ina226.readAndClearFlags();\n  shuntVoltage_mV = ina226.getShuntVoltage_mV();\n  busVoltage_V = ina226.getBusVoltage_V();\n  current_mA = ina226.getCurrent_mA();\n  power_mW = ina226.getBusPower();\n  loadVoltage_V  = busVoltage_V + (shuntVoltage_mV\/1000);\n  \n  Serial.print(\"Shunt Voltage [mV]: \"); Serial.println(shuntVoltage_mV);\n  Serial.print(\"Bus Voltage [V]: \"); Serial.println(busVoltage_V);\n  Serial.print(\"Load Voltage [V]: \"); Serial.println(loadVoltage_V);\n  Serial.print(\"Current[mA]: \"); Serial.println(current_mA);\n  Serial.print(\"Bus Power [mW]: \"); Serial.println(power_mW);\n  if(!ina226.overflow){\n    Serial.println(\"Values OK - no overflow\");\n  }\n  else{\n    Serial.println(\"Overflow! Choose higher current range\");\n  }\n  Serial.println();\n  \n  delay(3000);\n}<\/pre>\n<p>\u00a0<\/p>\n<\/div>\n<p>\n\n<h3 class=\"wp-block-heading\">All functions at a glance<\/h3>\n\n<p>Here you can see all the functions at a glance. I also use the table for documentation on GitHub.<\/p>\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/public_functions_ina226.webp\"><img loading=\"lazy\" decoding=\"async\" width=\"918\" height=\"1084\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/public_functions_ina226.webp\" alt=\"\" class=\"wp-image-24914\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/public_functions_ina226.webp 918w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/public_functions_ina226-254x300.webp 254w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/public_functions_ina226-867x1024.webp 867w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/public_functions_ina226-768x907.webp 768w\" sizes=\"auto, (max-width: 918px) 100vw, 918px\" \/><\/a><figcaption class=\"wp-element-caption\">List of (public) functions of the INA226_WE library<\/figcaption><\/figure>\n\n<h2 class=\"wp-block-heading\">Details of the library and the registers of the INA226<\/h2>\n\n<p>If you still want to know more, you can now go a little deeper into the INA226 and the library.<\/p>\n\n<h3 class=\"wp-block-heading\">The registers of the INA226<\/h3>\n\n<p>The INA226 has 10 registers, which is significantly more than the INA219 with its 6 registers. All registers are 16 bits.<\/p>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Registers_of_INA226-1024x553.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"553\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Registers_of_INA226-1024x553.png\" alt=\"Register of INA226\" class=\"wp-image-6832\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Registers_of_INA226-1024x553.png 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Registers_of_INA226-300x162.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Registers_of_INA226-768x415.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Registers_of_INA226.png 1136w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Register of INA226<\/figcaption><\/figure>\n\n<h4 class=\"wp-block-heading\">Configuration Register<\/h4>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Conf_Reg_INA226-1024x81.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"81\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Conf_Reg_INA226-1024x81.png\" alt=\"Configuration register of the INA226\" class=\"wp-image-6831\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Conf_Reg_INA226-1024x81.png 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Conf_Reg_INA226-300x24.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Conf_Reg_INA226-768x61.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Conf_Reg_INA226-1320x105.png 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Conf_Reg_INA226.png 1512w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n<p>In the configuration register you can make basic settings:<\/p>\n<ul>\n<li>RST &#8211; Reset Bit: if it is set, a reset is triggered.<\/li>\n<li>AVG<em>X &#8211; <\/em>Average Bits: determine the number of individual measurements to be averaged.<\/li>\n<li>VBUSCT<em>X &#8211; <\/em>Bus Voltage Conversion Time Bits: see table.<\/li>\n<li>VSHCT<em>X<\/em> &#8211; Shunt Voltage Conversion Time Bits: see table.\n<ul>\n<li>I have made the simplification that only one conversion time can be selected, it then applies equally to the conversion of the bus and the shunt voltage.<\/li>\n<\/ul>\n<\/li>\n<li>MODE<em>X<\/em> &#8211; MODE Bits: set the mode, see table.<\/li>\n<\/ul>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Averages_INA226.png\"><img loading=\"lazy\" decoding=\"async\" width=\"924\" height=\"355\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Averages_INA226.png\" alt=\"Average Bits of the INA226\" class=\"wp-image-6835\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Averages_INA226.png 924w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Averages_INA226-300x115.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Averages_INA226-768x295.png 768w\" sizes=\"auto, (max-width: 924px) 100vw, 924px\" \/><\/a><figcaption class=\"wp-element-caption\">Average Bits<\/figcaption><\/figure>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/ConvTimeSettings_engl-1024x358.png\"><img decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/ConvTimeSettings_engl-1024x358.png\" alt=\"Shunt and Bus Voltage Conversion Time Bits of the INA226\" class=\"wp-image-6836\"\/><\/a><figcaption class=\"wp-element-caption\">Shunt and Bus Voltage Conversion Time Bits<\/figcaption><\/figure>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Mode_Setting_INA226-1-1024x366.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"366\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Mode_Setting_INA226-1-1024x366.png\" alt=\"\" class=\"wp-image-24916\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Mode_Setting_INA226-1-1024x366.png 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Mode_Setting_INA226-1-300x107.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Mode_Setting_INA226-1-768x274.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Mode_Setting_INA226-1.png 1111w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Mode Bits <\/figcaption><\/figure>\n\n<h4 class=\"wp-block-heading\">Mask\/Enable Register<\/h4>\n\n<p>I jump to the Mask\/Enable Register because this is the other register for settings.<\/p>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Mask_En_Reg-1024x77.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"77\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Mask_En_Reg-1024x77.png\" alt=\"Mask\/Enable Register of INA226&#10;\" class=\"wp-image-6844\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Mask_En_Reg-1024x77.png 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Mask_En_Reg-300x23.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Mask_En_Reg-768x58.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Mask_En_Reg-1320x99.png 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Mask_En_Reg.png 1373w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n<p>Bits 10 to 15 are used to activate the alarms:<\/p>\n<ul>\n<li>SOL \/ SUL: Shunt Voltage Over \/ Under Limit Alert<\/li>\n<li>BOL \/ BUL: Bus Voltage Over \/ Under Limit Alert<\/li>\n<li>POL: Power Over Limit Alert<\/li>\n<li>CNVR: Conversion Ready Alert<\/li>\n<\/ul>\n<p>You can only activate one of the limit alerts. If you set several bits, then the highest applies. You can only activate the Conversion Ready Alarm in parallel.<\/p>\n<p>In my library I have implemented an additional Current Over and Current Under Alarm. Internally, the SOL or SUL bit is set and the current limit is converted into a shunt voltage limit.<\/p>\n<p>Further settings can be made with the APOL and the LEN bit:<\/p>\n<ul>\n<li>APOL: Alert Pin Polarity Bit &#8211; polarity of the alarm pin. Default is active-high (APOL = 0).<\/li>\n<li>LEN: Latch Enable Bit. By default, Latch is disabled (LEN = 0). This means that the alarm pin is deactivated and the alarm flag bit is deleted as soon as an OK measurement occurs (no limit exceeded). If LEN is set, the alarm pin remains activated and the alarm flag bit is set until the Mask\/Enable register is read ( <code>readAndClearFlags()<\/code> ).<\/li>\n<\/ul>\n<p>The INA226 sets three flags, depending on the setting and measurement results:<\/p>\n<ul>\n<li>AFF: Alarm Function Flag &#8211; a limit has been exceeded.<\/li>\n<li>CVRF: Conversion Ready Flag &#8211; measurement results are available.<\/li>\n<li>OVF: Overflow Flag &#8211; a data register has overflowed.<\/li>\n<\/ul>\n<p>The CVRF bit is deleted when the Mask\/Enable Register is read or Configuration Register is described.<\/p>\n<p>I programmed the function <code>readAndClearFlags()<\/code> to store the state of AFF, CVRF and OVF in the limitAlert, convAlert, and overflow variables.<\/p>\n\n<h4 class=\"wp-block-heading\">Shunt Voltage Register<\/h4>\n\n<p>The Shunt Voltage Register contains the shunt voltage with an LSB (least significant bit) of 2.5 \u00b5V. In other words, the resolution of the shunt register is 2.5 \u00b5V per unit. Because the register has a sign bit, the value range of the shunt voltage is limited to:&nbsp;<\/p>\n<\/p>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 23px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/ql-cache\/quicklatex.com-900f9da2fae8af702f7d2a718381d224_l3.png\" height=\"23\" width=\"463\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#091; &#115;&#104;&#117;&#110;&#116;&#86;&#111;&#108;&#116;&#97;&#103;&#101;&#82;&#97;&#110;&#103;&#101;&#32;&#61;&#32;&#92;&#112;&#109;&#32;&#40;&#50;&#94;&#123;&#49;&#53;&#125;&#45;&#49;&#41;&#92;&#99;&#100;&#111;&#116;&#32;&#50;&#44;&#92;&#33;&#53;&#32;&#92;&#116;&#101;&#120;&#116;&#123;&#92;&#32;&micro;&#92;&#33;&#86;&#125;&#61;&#56;&#49;&#44;&#92;&#33;&#57;&#49;&#55;&#53;&#32;&#92;&#116;&#101;&#120;&#116;&#123;&#92;&#32;&#109;&#92;&#33;&#86;&#125; &#92;&#093;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p>\n<p>\n\n<p>By modifying the shunt you could theoretically change the maximum measurable current. However, you have no choice with the module, and you have to live with the 0.1 ohms. This results in a <strong>measuring range of +\/- 819,175 mA for the current.<\/strong> In the case of INA219, on the other hand, the current LSB is 10 V. This means that the maximum measurable current is four times larger, but with a lower resolution.&nbsp;<\/p>\n\n<h4 class=\"wp-block-heading\">Bus Voltage Register<\/h4>\n\n<p>The INA226 saves the result of the bus voltage conversion to the Bus Voltage Register. Only 15 bits are used by the Bus Voltage Register &#8211; the sign is always positive. The LSB is 1.25 mV, resulting in a <strong>maximum bus voltage of 40.96 V. <\/strong><\/p>\n\n<h4 class=\"wp-block-heading\">Current Register<\/h4>\n\n<p>The INA226 stores the current calculated from the shunt voltage in the Current Register. This is where things get a little complicated, as a calibration factor CAL comes into play, which depends on the maximum expected current and the size of the shunt:<\/p>\n<\/p>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 42px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/ql-cache\/quicklatex.com-5dce216f77ae098325d4e9f9ef78e438_l3.png\" height=\"42\" width=\"247\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#091; &#67;&#92;&#33;&#65;&#76;&#32;&#61;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#48;&#44;&#92;&#33;&#48;&#48;&#53;&#49;&#50;&#125;&#123;&#99;&#117;&#114;&#114;&#101;&#110;&#116;&#92;&#95;&#76;&#83;&#66;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#82;&#95;&#123;&#83;&#104;&#117;&#110;&#116;&#125;&#125;&#92;&#92; &#92;&#093;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p>\n<p>\n<\/p>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 39px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/ql-cache\/quicklatex.com-f5adb5f3d787ce78b2cb681e4a102876_l3.png\" height=\"39\" width=\"373\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#091; &#99;&#117;&#114;&#114;&#101;&#110;&#116;&#92;&#95;&#76;&#83;&#66;&#32;&#61;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#109;&#97;&#120;&#105;&#109;&#117;&#109;&#92;&#32;&#101;&#120;&#112;&#101;&#99;&#116;&#101;&#100;&#92;&#32;&#99;&#117;&#114;&#114;&#101;&#110;&#116;&#32;&#125;&#123;&#50;&#94;&#123;&#49;&#53;&#125;&#125; &#92;&#093;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p>\n<p>\n\n<p>When calculating the calibration value, you start with the maximum expected current. For my library, I have selected 0.8192 amperes as the maximum.&nbsp; The formula for CAL would give an uncomfortable value for 0.819175, so I rounded up a little. The content of the Current Register is as follows:<\/p>\n<\/p>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 40px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/ql-cache\/quicklatex.com-571cb2ee0157a44d49f4994a8d584d87_l3.png\" height=\"40\" width=\"402\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#091; &#99;&#117;&#114;&#114;&#101;&#110;&#116;&#82;&#101;&#103;&#105;&#115;&#116;&#101;&#114;&#32;&#61;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#115;&#104;&#117;&#110;&#116;&#86;&#111;&#108;&#116;&#97;&#103;&#101;&#82;&#101;&#103;&#105;&#115;&#116;&#101;&#114;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#67;&#92;&#33;&#65;&#76;&#125;&#123;&#50;&#48;&#52;&#56;&#125; &#92;&#093;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p>\n<p>\n\n<p>In the end, you need to multiply the content of the Current Register by the Current_LSB to get the current.<\/p>\n<p>The library automatically calculates the calibration factor for other shunt sizes.<\/p>\n\n<h4 class=\"wp-block-heading\">Power Register<\/h4>\n\n<p>The Power Register contains the calculated power according to the following formula:<\/p>\n<\/p>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 39px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/ql-cache\/quicklatex.com-e96c68d05b861e474d8338f617270694_l3.png\" height=\"39\" width=\"467\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#091; &#112;&#111;&#119;&#101;&#114;&#82;&#101;&#103;&#105;&#115;&#116;&#101;&#114;&#32;&#61;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#99;&#117;&#114;&#114;&#101;&#110;&#116;&#82;&#101;&#103;&#105;&#115;&#116;&#101;&#114;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#98;&#117;&#115;&#86;&#111;&#108;&#116;&#97;&#103;&#101;&#82;&#101;&#103;&#105;&#115;&#116;&#101;&#114;&#125;&#123;&#50;&#48;&#48;&#48;&#48;&#125; &#92;&#093;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p>\n<p>\n\n<p>Finally, the power is the content of the Power Register, multiplied by the Power_LSB. The Power_LSB is (internally defined):<\/p>\n<\/p>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 17px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/ql-cache\/quicklatex.com-79f6a57c530595605db9ca8ab5bd0aa1_l3.png\" height=\"17\" width=\"267\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#091; &#112;&#111;&#119;&#101;&#114;&#92;&#95;&#76;&#83;&#66;&#32;&#61;&#32;&#99;&#117;&#114;&#114;&#101;&#110;&#116;&#92;&#95;&#76;&#83;&#66;&#92;&#99;&#100;&#111;&#116;&#32;&#50;&#53; &#92;&#093;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p>\n<p>\n\n<h4 class=\"wp-block-heading\">Calibration Register<\/h4>\n\n<p>The Calibration Register contains the above-mentioned calibration value.<\/p>\n\n<h4 class=\"wp-block-heading\">Alert Limit Register<\/h4>\n\n<p>You enter the alarm limit in the Alert Limit Register. I have implemented this in such a way that you can pass the limits directly via the function <code>setAlertType()<\/code> in the respective designated units.<\/p>\n\n<h3 class=\"wp-block-heading\">Calculation of calibration factors and LSBs<\/h3>\n\n<p>The library converts the content of the data registers into the desired units with the LSBs and other factors:<\/p>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/Recalculations__INA266.png\"><img decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/Recalculations__INA266.png\" alt=\"Conversion of data register content\" class=\"wp-image-6875\"\/><\/a><figcaption class=\"wp-element-caption\">Conversion of data register content<\/figcaption><\/figure>\n\n<p>To get handy convenient factors, I introduced a Current Divider and a Power Multiplier:<\/p>\n<\/p>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 39px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/ql-cache\/quicklatex.com-3d3e50faaf91ca29b8514a0631305cff_l3.png\" height=\"39\" width=\"274\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#091; &#99;&#117;&#114;&#114;&#101;&#110;&#116;&#92;&#32;&#92;&#116;&#101;&#120;&#116;&#123;&#091;&#109;&#65;&#093;&#125;&#61;&#92;&#102;&#114;&#97;&#99;&#123;&#99;&#117;&#114;&#114;&#101;&#110;&#116;&#82;&#101;&#103;&#105;&#115;&#116;&#101;&#114;&#125;&#123;&#99;&#117;&#114;&#114;&#101;&#110;&#116;&#68;&#105;&#118;&#105;&#100;&#101;&#114;&#125;&#92;&#32;&#92;&#32;&#92;&#92; &#92;&#093;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p>\n<p>\n<\/p>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 39px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/ql-cache\/quicklatex.com-625b32cff27f5a00c93e8012f1d0e7cb_l3.png\" height=\"39\" width=\"407\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#091; &#92;&#116;&#101;&#120;&#116;&#123;&#109;&#105;&#116;&#47;&#119;&#105;&#116;&#104;&#125;&#92;&#32;&#92;&#32;&#99;&#117;&#114;&#114;&#101;&#110;&#116;&#68;&#105;&#118;&#105;&#100;&#101;&#114;&#32;&#61;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#49;&#125;&#123;&#99;&#117;&#114;&#114;&#101;&#110;&#116;&#92;&#95;&#76;&#83;&#66;&#92;&#99;&#100;&#111;&#116;&#32;&#49;&#48;&#48;&#48;&#125; &#92;&#093;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p>\n<p>\n\n<p>and<\/p>\n<\/p>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 19px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/ql-cache\/quicklatex.com-4464fd1ff75048a791110b27c92cae82_l3.png\" height=\"19\" width=\"404\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#091; &#112;&#111;&#119;&#101;&#114;&#92;&#32;&#92;&#116;&#101;&#120;&#116;&#123;&#091;&#109;&#87;&#093;&#125;&#32;&#61;&#32;&#112;&#111;&#119;&#101;&#114;&#82;&#101;&#103;&#105;&#115;&#116;&#101;&#114;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#112;&#111;&#119;&#101;&#114;&#77;&#117;&#108;&#116;&#105;&#112;&#108;&#105;&#101;&#114; &#92;&#093;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p>\n<p>\n<\/p>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 17px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/ql-cache\/quicklatex.com-917822048443c9f48d79c1176aa3942c_l3.png\" height=\"17\" width=\"313\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#091; &#112;&#111;&#119;&#101;&#114;&#77;&#117;&#108;&#116;&#105;&#112;&#108;&#105;&#101;&#114;&#32;&#61;&#32;&#112;&#111;&#119;&#101;&#114;&#92;&#95;&#76;&#83;&#66;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#49;&#48;&#48;&#48; &#92;&#093;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p>\n<p>\n\n<p>I implemented the following values in the library:<\/p>\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Calculations_INA226.webp\"><img loading=\"lazy\" decoding=\"async\" width=\"847\" height=\"325\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Calculations_INA226.webp\" alt=\"\" class=\"wp-image-19633\" style=\"width:623px;height:auto\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Calculations_INA226.webp 847w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Calculations_INA226-300x115.webp 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Calculations_INA226-768x295.webp 768w\" sizes=\"auto, (max-width: 847px) 100vw, 847px\" \/><\/a><figcaption class=\"wp-element-caption\">Values for the implemented power ranges<\/figcaption><\/figure>\n\n<h2 class=\"wp-block-heading\">Acknowledgement<\/h2>\n\n<p>The picture of the current meter is from the <a href=\"https:\/\/pixabay.com\/photos\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=691809\" target=\"_blank\" rel=\"noopener noreferrer\">Free-Photos<\/a> of Pixabay. I also found the alarm light from <a href=\"https:\/\/pixabay.com\/de\/users\/Alexey_Hulsov-388655\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=5027727\" target=\"_blank\" rel=\"noopener noreferrer\">Alexey Hulsov<\/a> and the display from the <a href=\"https:\/\/pixabay.com\/de\/users\/OpenClipart-Vectors-30363\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=1294526\" target=\"_blank\" rel=\"noopener noreferrer\">OpenClipart vectors<\/a> on Pixabay.<\/p>\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The INA226 is a current and power sensor which, in contrast to the INA219, is equipped with an alarm pin for limit violations. I present the INA226 module and my associated library. <\/p>\n","protected":false},"author":1,"featured_media":8621,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[574,572],"tags":[1231,1222,1229,1226,1234,1230,1233],"class_list":["post-10535","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-current-voltage","category-sensors","tag-continuous-mode","tag-current-sensor","tag-ina226-library-2","tag-ina226-module","tag-limit-alert-en","tag-shunt-en","tag-triggered-mode-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>INA226 Current and Power Sensor &#8226; Wolles Elektronikkiste<\/title>\n<meta name=\"description\" content=\"The INA226 is a current and power sensor which, in contrast to the INA219, is equipped with an alarm pin for limit violations.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"INA226 Current and Power Sensor &#8226; Wolles Elektronikkiste\" \/>\n<meta property=\"og:description\" content=\"The INA226 is a current and power sensor which, in contrast to the INA219, is equipped with an alarm pin for limit violations.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor\" \/>\n<meta property=\"og:site_name\" content=\"Wolles Elektronikkiste\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-03T15:06:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-27T14:48:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Beitragsbild_INA226.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1300\" \/>\n\t<meta property=\"og:image:height\" content=\"1300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Wolfgang Ewald\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Wolfgang Ewald\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"33 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ina226-current-and-power-sensor#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ina226-current-and-power-sensor\"},\"author\":{\"name\":\"Wolfgang Ewald\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"headline\":\"INA226 Current and Power Sensor\",\"datePublished\":\"2021-01-03T15:06:51+00:00\",\"dateModified\":\"2025-09-27T14:48:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ina226-current-and-power-sensor\"},\"wordCount\":3050,\"commentCount\":135,\"publisher\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"image\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ina226-current-and-power-sensor#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Beitragsbild_INA226.png\",\"keywords\":[\"continuous Mode\",\"current sensor\",\"INA226 library\",\"INA226 module\",\"limit alert\",\"shunt\",\"triggered mode\"],\"articleSection\":[\"Current, voltage\",\"Sensors\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ina226-current-and-power-sensor#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ina226-current-and-power-sensor\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ina226-current-and-power-sensor\",\"name\":\"INA226 Current and Power Sensor &#8226; Wolles Elektronikkiste\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ina226-current-and-power-sensor#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ina226-current-and-power-sensor#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Beitragsbild_INA226.png\",\"datePublished\":\"2021-01-03T15:06:51+00:00\",\"dateModified\":\"2025-09-27T14:48:46+00:00\",\"description\":\"The INA226 is a current and power sensor which, in contrast to the INA219, is equipped with an alarm pin for limit violations.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ina226-current-and-power-sensor#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ina226-current-and-power-sensor\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ina226-current-and-power-sensor#primaryimage\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Beitragsbild_INA226.png\",\"contentUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Beitragsbild_INA226.png\",\"width\":1300,\"height\":1300},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ina226-current-and-power-sensor#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Startseite\",\"item\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"INA226 Current and Power Sensor\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#website\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\",\"name\":\"Wolles Elektronikkiste\",\"description\":\"Die wunderbare Welt der Elektronik\",\"publisher\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\",\"name\":\"Wolfgang Ewald\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\",\"contentUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\",\"width\":512,\"height\":512,\"caption\":\"Wolfgang Ewald\"},\"logo\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"INA226 Current and Power Sensor &#8226; Wolles Elektronikkiste","description":"The INA226 is a current and power sensor which, in contrast to the INA219, is equipped with an alarm pin for limit violations.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor","og_locale":"en_US","og_type":"article","og_title":"INA226 Current and Power Sensor &#8226; Wolles Elektronikkiste","og_description":"The INA226 is a current and power sensor which, in contrast to the INA219, is equipped with an alarm pin for limit violations.","og_url":"https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor","og_site_name":"Wolles Elektronikkiste","article_published_time":"2021-01-03T15:06:51+00:00","article_modified_time":"2025-09-27T14:48:46+00:00","og_image":[{"width":1300,"height":1300,"url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Beitragsbild_INA226.png","type":"image\/png"}],"author":"Wolfgang Ewald","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Wolfgang Ewald","Est. reading time":"33 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor#article","isPartOf":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor"},"author":{"name":"Wolfgang Ewald","@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"headline":"INA226 Current and Power Sensor","datePublished":"2021-01-03T15:06:51+00:00","dateModified":"2025-09-27T14:48:46+00:00","mainEntityOfPage":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor"},"wordCount":3050,"commentCount":135,"publisher":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"image":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor#primaryimage"},"thumbnailUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Beitragsbild_INA226.png","keywords":["continuous Mode","current sensor","INA226 library","INA226 module","limit alert","shunt","triggered mode"],"articleSection":["Current, voltage","Sensors"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor#respond"]}]},{"@type":"WebPage","@id":"https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor","url":"https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor","name":"INA226 Current and Power Sensor &#8226; Wolles Elektronikkiste","isPartOf":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#website"},"primaryImageOfPage":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor#primaryimage"},"image":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor#primaryimage"},"thumbnailUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Beitragsbild_INA226.png","datePublished":"2021-01-03T15:06:51+00:00","dateModified":"2025-09-27T14:48:46+00:00","description":"The INA226 is a current and power sensor which, in contrast to the INA219, is equipped with an alarm pin for limit violations.","breadcrumb":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor#primaryimage","url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Beitragsbild_INA226.png","contentUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/Beitragsbild_INA226.png","width":1300,"height":1300},{"@type":"BreadcrumbList","@id":"https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Startseite","item":"https:\/\/wolles-elektronikkiste.de\/en"},{"@type":"ListItem","position":2,"name":"INA226 Current and Power Sensor"}]},{"@type":"WebSite","@id":"https:\/\/wolles-elektronikkiste.de\/en#website","url":"https:\/\/wolles-elektronikkiste.de\/en","name":"Wolles Elektronikkiste","description":"Die wunderbare Welt der Elektronik","publisher":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wolles-elektronikkiste.de\/en?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46","name":"Wolfgang Ewald","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png","url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png","contentUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png","width":512,"height":512,"caption":"Wolfgang Ewald"},"logo":{"@id":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png"}}]}},"_links":{"self":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts\/10535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/comments?post=10535"}],"version-history":[{"count":8,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts\/10535\/revisions"}],"predecessor-version":[{"id":24924,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts\/10535\/revisions\/24924"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/media\/8621"}],"wp:attachment":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/media?parent=10535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/categories?post=10535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/tags?post=10535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}