{"id":10631,"date":"2021-01-06T23:34:51","date_gmt":"2021-01-06T23:34:51","guid":{"rendered":"https:\/\/wolles-elektronikkiste.de\/current-sensor-how-to-build-it-yourself"},"modified":"2024-10-29T11:25:07","modified_gmt":"2024-10-29T11:25:07","slug":"current-sensor-how-to-build-it-yourself","status":"publish","type":"post","link":"https:\/\/wolles-elektronikkiste.de\/en\/current-sensor-how-to-build-it-yourself","title":{"rendered":"Current Sensor &#8211; how to build it yourself"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">About this post<\/h2>\n\n<p>In previous articles I had introduced the current and power sensors <a href=\"https:\/\/wolles-elektronikkiste.de\/en\/ina219-current-and-power-sensor\" target=\"_blank\" rel=\"noopener noreferrer\">INA219<\/a> and <a href=\"https:\/\/wolles-elektronikkiste.de\/en\/ina226-current-and-power-sensor\" target=\"_blank\" rel=\"noopener noreferrer\">INA226<\/a>. These work according to the simple principle that the current to be measured is passed through a low-impedance resistor (shunt). According to Ohm&#8217;s law, the current is determined by the voltage drop. The idea is that you could build such a current sensor yourself and that&#8217;s what this article is all about.<\/p>\r\n\r\n<p>The only hurdle is to measure low voltage drop. In the modules that I have dealt with so far, the shunt had a resistor of 0.1 ohms. Even with a fairly high current of, for example, an ampere, the voltage drop is just one hundred millivolts. A direct measurement with the A\/D converter of the Arduino UNO would therefore be far too rough.<\/p>\r\n\r\n<p>So the voltage signal needs to be amplified. I tried two ways:<\/p>\r\n<ul>\r\n \t<li>Amplification and A\/D conversion via the <a href=\"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier\" target=\"_blank\" rel=\"noopener noreferrer\">ADS1115<\/a>.<\/li>\r\n \t<li>Amplification with an operational amplifier (op amp), A\/D conversion via the Arduino.<\/li>\r\n<\/ul>\n\n<h2 class=\"wp-block-heading\">Selection and use of the shunt<\/h2>\n\n<h3 class=\"wp-block-heading\">The agony of choice<\/h3>\n\n<p>As with the INA219 and INA226, I chose 0.1 ohms for the shunt. The smaller the resistance, the smaller the signal. The greater the resistance, the greater the interference with the system to be measured. So selection is always a compromise.<\/p>\r\n<p>For the measurement of huge currents, you can purchase specially designed shunt resistors (e.g. <a href=\"https:\/\/smile.amazon.de\/s?k=shunt+widerstand&amp;__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&amp;crid=1WT86G81KZ4S6&amp;sprefix=shunt%2Caps%2C170&amp;ref=nb_sb_ss_ac-o-p_1_5\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>). I chose a classic metal film resistor, but in a larger version that can be loaded with up to 2 watts. Normally, resistors have a typical power handling of 0.25 watts.<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Shunt-1024x382.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"382\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Shunt-1024x382.jpg\" alt=\"0.1 ohms shunt for the current sensor\" class=\"wp-image-7097\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Shunt-1024x382.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Shunt-300x112.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Shunt-768x286.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Shunt-1536x573.jpg 1536w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Shunt-1320x492.jpg 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Shunt.jpg 1800w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Above: Resistor 0.1 Ohm, 2 watts, bottom: common 0.25 watts resistor<\/figcaption><\/figure>\n\n<h3 class=\"wp-block-heading\">Installation of the shunt<\/h3>\n\n<p>In my first attempts to build a current sensor, I was initially disappointed because I could not determine reproducible readings. The reason was that the contact between my shunt and the breadboard itself presented a significant resistance. A small &#8220;jerk&#8221; at the shunt immediately changed the readings.&nbsp; Normally, the contact resistance does not matter, but with 0.1 ohms it is different.<\/p>\r\n<p>As a solution, I soldered the shunt firmly on a board:<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Shunt_mit_Anschluss-1024x508.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"508\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Shunt_mit_Anschluss-1024x508.jpg\" alt=\"Built-in shunt: 2 connections for the current, 2 connections for voltage measurement\" class=\"wp-image-7098\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Shunt_mit_Anschluss-1024x508.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Shunt_mit_Anschluss-300x149.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Shunt_mit_Anschluss-768x381.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Shunt_mit_Anschluss-1536x762.jpg 1536w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Shunt_mit_Anschluss-2048x1016.jpg 2048w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Shunt_mit_Anschluss-1320x655.jpg 1320w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Built-in shunt: 2 connections for the current, 2 connections for voltage measurement<\/figcaption><\/figure>\n\n<p>The rest I connected with jumper cables. These appear to have lower contact resistances. In any case, I obtained very reproducible measured values afterwards.<\/p>\r\n\n<h2 class=\"wp-block-heading\">Current sensor based on the ADS1115<\/h2>\n\n<p>I introduced the ADS1115 in <a href=\"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier\" target=\"_blank\" rel=\"noopener noreferrer\">my last post<\/a>. You can download my library (ADS1115_WE) <a href=\"https:\/\/github.com\/wollewald\/ADS1115_WE\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> from GitHub or directly install it via the library manager of the Arduino IDE. I do not go into the details again, but I would like to mention again that the ADS1115 has an internal amplifier and a resolution of 16 bits. This makes it easy to measure even small voltages.&nbsp;<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/various_ads1115_modules-1024x316.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"316\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/various_ads1115_modules-1024x316.jpg\" alt=\"Various ADS1115 modules for the current sensor\" class=\"wp-image-7096\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/various_ads1115_modules-1024x316.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/various_ads1115_modules-300x93.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/various_ads1115_modules-768x237.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/various_ads1115_modules-1536x474.jpg 1536w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/various_ads1115_modules-1320x408.jpg 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/various_ads1115_modules.jpg 1800w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Various ADS1115 modules<\/figcaption><\/figure>\n\n<h3 class=\"wp-block-heading\">Wiring<\/h3>\n\n<p>I supplied the ADS1115 with the 5 volts of the Arduino UNO. Communication is via I2C. I didn&#8217;t need pull-up resistors for the I2C lines, but this can be different with other modules.<\/p>\r\n<p>I put the shunt in before of the consumer on the high voltage side (high-side configuration). You can, of course, place it behind as well (low-side). I measured the shunt voltage via channels A0 and A1 of the ADS1115. The voltage drop across the consumer (bus voltage) was measured with channels A2 and A3. The power consumption of the consumer can be calculated from the current and the bus voltage.<\/p>\r\n<p>If, like me, you use a separate power supply for the consumer, then you must ensure a common ground.<\/p>\r\n<p><strong><span style=\"text-decoration: underline;\">Attention:<\/span> the voltage at the inputs A0 &#8211; A4 must not exceed the supply voltage of the ADS1115 by more than 0.3 volts. In this example, that would be 5.3 volts. If the bus voltage is higher, you have to use suitable voltage before the inputs (i.e. here A2 and A3)! Otherwise you will destroy the ADS1115!<\/strong><\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/Wiring_current_sensor_ADS1115.png\"><img decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/Wiring_current_sensor_ADS1115-1024x619.png\" alt=\"Current sensor based on the ADS1115\" class=\"wp-image-7099\"\/><\/a><figcaption class=\"wp-element-caption\">Current sensor based on the ADS1115<\/figcaption><\/figure>\n\n<h3 class=\"wp-block-heading\">Calibration<\/h3>\n\n<p>Since we cannot take for granted that our shunt has a resistance of exactly 0.1 ohms, the sensor circuit must be calibrated. For this purpose, I used a multimeter for current measurement and determined the shunt voltage for different power consumers. For small currents I have taken LEDs, for slightly larger currents a gas sensor (because I had it just at hand).&nbsp; Here&#8217;s what it looked like:<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Schaltung_Stromsensor-1024x768.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Schaltung_Stromsensor-1024x768.jpg\" alt=\"\" class=\"wp-image-7100\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Schaltung_Stromsensor-1024x768.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Schaltung_Stromsensor-300x225.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Schaltung_Stromsensor-768x576.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Schaltung_Stromsensor-1536x1152.jpg 1536w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Schaltung_Stromsensor-1320x990.jpg 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Schaltung_Stromsensor.jpg 1805w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Breadboard circuit<\/figcaption><\/figure>\n\n<h4 class=\"wp-block-heading\">The sketch for calibration<\/h4>\n\n<p>Only the shunt voltage is of interest for calibration. I have chosen the continuous mode and the highest gain (i.e. the smallest voltage range). <\/p>\r\n\n<div class=\"scroll-paragraph-long\">\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-group=\"Shunt_Spannung_ADS1115.ino\" data-enlighter-title=\"Shunt_Spannung_ADS1115.ino\">#include&lt;ADS1115_WE.h&gt; \r\n#include&lt;Wire.h&gt;\r\n#define I2C_ADDRESS 0x48\r\n\r\nADS1115_WE adc(I2C_ADDRESS);\r\n\r\nvoid setup() {\r\n  Wire.begin();\r\n  Serial.begin(9600);\r\n  if(!adc.init()){\r\n    Serial.println(\"ADS1115 not connected!\");\r\n  }\r\n\r\n  \/* Set the voltage range of the ADC to adjust the gain\r\n   * Please note that you must not apply more than VDD + 0.3V to the input pins!\r\n   * \r\n   * ADS1115_RANGE_6144  -&gt;  +\/- 6144 mV\r\n   * ADS1115_RANGE_4096  -&gt;  +\/- 4096 mV\r\n   * ADS1115_RANGE_2048  -&gt;  +\/- 2048 mV (default)\r\n   * ADS1115_RANGE_1024  -&gt;  +\/- 1024 mV\r\n   * ADS1115_RANGE_0512  -&gt;  +\/- 512 mV\r\n   * ADS1115_RANGE_0256  -&gt;  +\/- 256 mV\r\n   *\/\r\n  adc.setVoltageRange_mV(ADS1115_RANGE_0256); \/\/comment line\/change paramater to change range\r\n\r\n  adc.setCompareChannels(ADS1115_COMP_0_1); \/\/comment line\/change paramater to change channel\r\n\r\n  adc.setMeasureMode(ADS1115_CONTINUOUS); \/\/comment line\/change parameter to change mode\r\n\r\n  Serial.println(\"Stromsensor - Shuntspannung\");\r\n  Serial.println();\r\n}\r\n\r\nvoid loop() {\r\n  float voltage = 0.0;\r\n  voltage = adc.getResult_mV(); \/\/ alternative: getResult_mV for Millivolt\r\n  Serial.print(\"Shuntspannung [mV]: \");\r\n  Serial.println(voltage);\r\n  Serial.println(\"-------------------------------\");\r\n  delay(2000);\r\n}<\/pre>\r\n<p>&nbsp;<\/p>\r\n<\/div>\r\n\n<h4 class=\"wp-block-heading\">The result of the calibration<\/h4>\n\n<p>The calibration resulted in a nice, straight regression line with only small deviations. <\/p>\r\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/shunt_voltage_current.png\"><img decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/shunt_voltage_current.png\" alt=\"Shuntspannung vs. Strom zur Kalibrierung des Stromsensors\" class=\"wp-image-10681\" style=\"width:432px;height:235px\"\/><\/a><figcaption class=\"wp-element-caption\">Shuntspannung vs. Strom zur Kalibrierung des Stromsensors<\/figcaption><\/figure>\n<\/div>\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/Shuntvoltage_vs_current_curve.png\"><img decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/Shuntvoltage_vs_current_curve-1024x619.png\" alt=\"\" class=\"wp-image-7104\"\/><\/a><\/figure>\n\n<h3 class=\"wp-block-heading\">The full current sensor sketch<\/h3>\n\n<p>From shunt voltages and the calibration factor (current \/ shunt voltage ratio = approx. 9.67) unknown currents can be determined. The power of the consumer is determined by the current I and the bus voltage U<sub>Bus<\/sub>:<\/p>\r\n\n<p><\/p>\r\n<p><p class=\"ql-center-displayed-equation\" style=\"line-height: 16px;\"><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-61b00aca8359eddedc89b0261fd8b5a1_l3.png\" height=\"16\" width=\"170\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#91; &#80;&#95;&#123;&#67;&#111;&#110;&#115;&#117;&#109;&#101;&#114;&#125;&#61;&#73;&#92;&#99;&#100;&#111;&#116;&#32;&#85;&#95;&#123;&#66;&#117;&#115;&#125; &#92;&#93;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p><\/p>\r\n\r\n\n<p>Since the bus voltage is considerably higher than the shunt voltage, these measurements are carried out with different gain factors.<\/p>\r\n<p>I have chosen the &#8220;Single-Shot&#8221; mode (i.e. measurement on request). On the one hand, this mode is more energy-efficient, and on the other hand, it ensures via the  <code>isBusy()<\/code> function that no outdated values are read. <\/p>\r\n\n<div class=\"scroll-paragraph-long\">\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-group=\"Stromsensor_ADS1115_komplett.ino\" data-enlighter-title=\"Stromsensor_ADS1115_komplett.ino\">#include&lt;ADS1115_WE.h&gt; \r\n#include&lt;Wire.h&gt;\r\n#define I2C_ADDRESS 0x48\r\nADS1115_WE adc(I2C_ADDRESS);\r\n\r\nconst float voltageToCurrent = 9.67;\r\n\r\nvoid setup() {\r\n  Wire.begin();\r\n  Serial.begin(9600);\r\n  if(!adc.init()){\r\n    Serial.println(\"ADS1115 not connected!\");\r\n  }\r\n\r\n  \/* Set the voltage range of the ADC to adjust the gain\r\n   * Please note that you must not apply more than VDD + 0.3V to the input pins!\r\n   * \r\n   * ADS1115_RANGE_6144  -&gt;  +\/- 6144 mV\r\n   * ADS1115_RANGE_4096  -&gt;  +\/- 4096 mV\r\n   * ADS1115_RANGE_2048  -&gt;  +\/- 2048 mV (default)\r\n   * ADS1115_RANGE_1024  -&gt;  +\/- 1024 mV\r\n   * ADS1115_RANGE_0512  -&gt;  +\/- 512 mV\r\n   * ADS1115_RANGE_0256  -&gt;  +\/- 256 mV\r\n   *\/\r\n  \/\/adc.setVoltageRange_mV(ADS1115_RANGE_6144); \/\/comment line\/change paramater to change range\r\n\r\n  \/* Set the inputs to be compared\r\n   *  \r\n   *  ADS1115_COMP_0_1    -&gt;  compares 0 with 1 (default)\r\n   *  ADS1115_COMP_0_3    -&gt;  compares 0 with 3\r\n   *  ADS1115_COMP_1_3    -&gt;  compares 1 with 3\r\n   *  ADS1115_COMP_2_3    -&gt;  compares 2 with 3\r\n   *  ADS1115_COMP_0_GND  -&gt;  compares 0 with GND\r\n   *  ADS1115_COMP_1_GND  -&gt;  compares 1 with GND\r\n   *  ADS1115_COMP_2_GND  -&gt;  compares 2 with GND\r\n   *  ADS1115_COMP_3_GND  -&gt;  compares 3 with GND\r\n   *\/\r\n  \/\/adc.setCompareChannels(ADS1115_COMP_0_GND); \/\/uncomment if you want to change the default\r\n\r\n  Serial.println(\"Strom- und Leistungssensor mit ADS1115\");\r\n  Serial.println();\r\n}\r\n\r\nvoid loop() {\r\n  float voltage = 0.0;\r\n\r\n  adc.setCompareChannels(ADS1115_COMP_0_1);\r\n  adc.setVoltageRange_mV(ADS1115_RANGE_0256);\r\n  adc.startSingleMeasurement();\r\n  while(adc.isBusy()){}\r\n  voltage = adc.getResult_mV(); \r\n  Serial.print(\"Shuntspannung [mV]: \"); \/\/ Shunt voltage\r\n  Serial.println(voltage);\r\n\r\n  float current_mA = voltage * voltageToCurrent;\r\n  Serial.print(\"Busstrom      [mA]: \"); \/\/ Bus current\r\n  Serial.println(current_mA);\r\n\r\n  adc.setVoltageRange_mV(ADS1115_RANGE_6144);\r\n  adc.setCompareChannels(ADS1115_COMP_2_3);\r\n  adc.startSingleMeasurement();\r\n  while(adc.isBusy()){}\r\n  voltage = adc.getResult_V(); \r\n  Serial.print(\"Busspannung    [V]: \"); \/\/ Bus voltage\r\n  Serial.println(voltage);\r\n\r\n  float power_mW = voltage * current_mA;\r\n  Serial.print(\"Leistung      [mW]: \"); \/\/ Power\r\n  Serial.println(power_mW);\r\n\r\n  Serial.println(\"-------------------------------\");\r\n  delay(2000);\r\n}<\/pre>\r\n<p>\u00a0<\/p>\r\n<\/div>\r\n\n<p>Here&#8217;s what the output looks like on the serial monitor:<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/Output_Current_Sensor.png\"><img decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/Output_Current_Sensor.png\" alt=\"Output of Stromsensor_ADS1115_komplett.ino\" class=\"wp-image-7106\"\/><\/a><figcaption class=\"wp-element-caption\">Output of Stromsensor_ADS1115_komplett.ino<\/figcaption><\/figure>\n\n<h3 class=\"wp-block-heading\">Monitoring of currents<\/h3>\n\n<p>The ADS1115 has an alert pin that you can configure to assert when defined thresholds are exceeded. When you connect the alert pin to an interrupt pin of the Arduino, you can easily monitor currents. With this you have (almost) the full functionality of an INA226 current sensor. You can find information on programming the alert pin in my post about the <a href=\"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier\" target=\"_blank\" rel=\"noopener noreferrer\">ADS1115<\/a>.<\/p>\r\n\n<h2 class=\"wp-block-heading\">Self built current sensor with operational amplifier<\/h2>\n\n<p>The results with shunt and ADS1115 did not look bad, but under the conditions I chose I only used about 10 % of the measuring range of the ADS1115 even at the highest gain. Depending on the resolution you require and the shunt voltages you generate, further amplification may be appropriate. An operational amplifier is ideal for this purpose.\u00a0<\/p>\r\n\n<h3 class=\"wp-block-heading\">What does an operational amplifier do?<\/h3>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/OPAMP-1024x594.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"594\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/OPAMP-1024x594.png\" alt=\"Operational amplifier, schematic\" class=\"wp-image-7113\" style=\"width:256px;height:149px\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/OPAMP-1024x594.png 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/OPAMP-300x174.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/OPAMP-768x446.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/OPAMP.png 1227w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Operational amplifier, schematic<\/figcaption><\/figure>\n<\/div>\n<p>Operational amplifiers (op amps) are extremely versatile components about which books can be written. Therefore, I cannot provide an introduction to this topic within the scope of this article. As an absolute minimum, however, you should know:<\/p>\r\n<ul>\r\n<li>Op amps are used for voltage amplification.<\/li>\r\n<li>They have an inverting (&#8220;-&#8220;) input, a non-inverting input (&#8220;+&#8221;) and an output (V<sub>OUT).<\/sub><\/li>\r\n<li>The power supply is mostly symmetrical (V+ \/ V-), but there are also applications with V+ \/ GND.\r\n<ul>\r\n<li>We are dealing here with the latter.<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>The op amp only gets its function by connecting it with other components.<\/li>\r\n<li>Op amps can be used as inverting or non-inverting amplifiers, as differential amplifiers, integrator amplifiers, etc.&nbsp;<\/li>\r\n<\/ul>\r\n<p>If you are a beginner and want to know more, I recommend <a href=\"https:\/\/www.electronics-tutorials.ws\/de\/operationsverstarker\/grundlagen.html\" target=\"_blank\" rel=\"noopener noreferrer\">this website<\/a>.<\/p>\r\n\n<h3 class=\"wp-block-heading\">Some op amp examples<\/h3>\n\n<p>Op amps are available in different designs. Mostly you get them as ICs containing several op amps. For this article, the <a href=\"http:\/\/ww1.microchip.com\/downloads\/en\/DeviceDoc\/MCP6001-1R-1U-2-4-1-MHz-Low-Power-Op-Amp-DS20001733L.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">MCP6002<\/a>, <a href=\"https:\/\/www.ti.com\/lit\/ds\/symlink\/lm358-n.pdf?ts=1595345804132&amp;ref_url=https%253A%252F%252Fwww.google.de%252F\" target=\"_blank\" rel=\"noopener noreferrer\">LM358<\/a> and the <a href=\"https:\/\/www.ti.com\/lit\/ds\/symlink\/tlv2462.pdf?ts=1595345739171&amp;ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FTLV2462\" target=\"_blank\" rel=\"noopener noreferrer\">TLV2462<\/a> were tried out. <\/p>\r\n<p>It should be noted up front that I had problems with linearity at low voltages with the TLV2462.<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/opamps-1024x294.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"294\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/opamps-1024x294.jpg\" alt=\"Op amps for the current sensor: TLV2462, LM358, MCP6002\" class=\"wp-image-7109\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/opamps-1024x294.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/opamps-300x86.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/opamps-768x220.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/opamps-1536x441.jpg 1536w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/opamps-1320x379.jpg 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/opamps.jpg 1900w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Op amps for the current sensor: TLV2462, LM358, MCP6002<\/figcaption><\/figure>\n\n<p>All mentioned representatives have 2 op amps and have the same pinout:&nbsp;<\/p>\r\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/opamp_pinout.png\"><img loading=\"lazy\" decoding=\"async\" width=\"865\" height=\"589\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/opamp_pinout.png\" alt=\"Pinout for the MCP6002, LM358 and TLV2462\" class=\"wp-image-7110\" style=\"width:433px;height:295px\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/opamp_pinout.png 865w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/opamp_pinout-300x204.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/opamp_pinout-768x523.png 768w\" sizes=\"auto, (max-width: 865px) 100vw, 865px\" \/><\/a><figcaption class=\"wp-element-caption\">Pinout for the MCP6002, LM358 and TLV2462<\/figcaption><\/figure>\n<\/div>\n<h3 class=\"wp-block-heading\">The op amp as differential amplifier <\/h3>\n\n<p>For the amplification of the shunt voltage I used the op amp as a differential amplifier. To amplify the voltage difference between V<sub>1<\/sub> and V<sub>2,<\/sub> the op amp is connected as follows:<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Differenzverstaerker-1024x598.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"598\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Differenzverstaerker-1024x598.png\" alt=\"Amplifier circuit for the current sensor: Differential amplifier\" class=\"wp-image-7111\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Differenzverstaerker-1024x598.png 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Differenzverstaerker-300x175.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Differenzverstaerker-768x448.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Differenzverstaerker.png 1031w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Amplifier circuit for the current sensor: Differential amplifier<\/figcaption><\/figure>\n\n<p>If R<sub>1<\/sub> is R<sub>2<\/sub> and R<sub>3<\/sub> equals R<sub>4<\/sub>, then V<sub>OUT<\/sub> is:<\/p>\r\n\n<p><p class=\"ql-center-displayed-equation\" style=\"line-height: 41px;\"><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-23109455551d2d6bb400633da908f7aa_l3.png\" height=\"41\" width=\"184\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#91; &#86;&#95;&#123;&#79;&#85;&#84;&#125;&#61;&#92;&#102;&#114;&#97;&#99;&#123;&#82;&#95;&#51;&#125;&#123;&#82;&#95;&#49;&#125;&#92;&#99;&#100;&#111;&#116;&#40;&#86;&#95;&#50;&#45;&#86;&#95;&#49;&#41; &#92;&#93;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p><\/p>\r\n\n<p>If you want to know why, I recommend reading <a href=\"https:\/\/www.electronics-tutorials.ws\/de\/operationsverstarker\/differenzverstaerker.html\" target=\"_blank\" rel=\"noopener noreferrer\">this.<\/a> As R<sub>1<\/sub> or R<sub>2<\/sub> I have chosen 3.9 kOhm and 330 kOhm as R<sub>3<\/sub> or R<sub>4<\/sub>. Thus, the gain factor is theoretically 84.6. With a measuring range of up to 5 volts, shunt voltages of up to 5 V \/ 84.6 = 59.1 mV can be detected. This in turn corresponds to a maximum current of 591 mA.<\/p>\r\n<p><em>For those who are familiar with op amps:<\/em> I had initially tried to use the op amp as a non-inverting amplifier, as described <a href=\"https:\/\/www.electronics-tutorials.ws\/de\/operationsverstarker\/nicht-invertierender-operationsverstaerker.html\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>. I couldn&#8217;t get stable gain factors and the gain factors were much higher than calculated &#8211; does anyone have any idea what the issue might be? However, the differential amplifier circuit works very well.<\/p>\r\n\n<h3 class=\"wp-block-heading\">Calibration of the op amp based current sensor<\/h3>\n\n<h4 class=\"wp-block-heading\">Wiring<\/h4>\n\n<p>For calibration, we have to determine again practically how the increased shunt voltage depends on the current. So weou need a device for voltage measurement and one for current measurement. I used my multimeter for current measurement and the ADS1115 for voltage measurement. Of course, I could have used the A\/D converter of the Arduino directly for voltage measurement. However, I was interested in whether there is a linear dependence even for small voltages. And I wanted to use the high resolution of the ADS1115. It would be even easier to use two multimeters. But not everyone has that.<\/p>\r\n\n<p>This time, the shunt is positioned behind the consumer (low-side). All components have a common mass.<\/p>\r\n<p>With a separate power source for the consumer and above all with a separate mass, the high-side configuration can also be realized. For this case, the consumer&#8217;s VCC is connected to the mass of the rest of the circuit. The problem, however, is the measurement of the bus voltage, which then is in the negative range.&nbsp;<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/wiring_current_sensor_calib-1024x536.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"536\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/wiring_current_sensor_calib-1024x536.png\" alt=\"Current sensor calibration with the ADS1115\" class=\"wp-image-17233\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/wiring_current_sensor_calib-1024x536.png 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/wiring_current_sensor_calib-300x157.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/wiring_current_sensor_calib-768x402.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/wiring_current_sensor_calib-1320x690.png 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/wiring_current_sensor_calib.png 1432w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Current sensor calibration with the ADS1115<\/figcaption><\/figure>\n\n<p>As a test consumer with different currents, I again chose what was lying around on my table.<\/p>\r\n\n<h4 class=\"wp-block-heading\">Sketch for calibration<\/h4>\n\n<p>The sketch is specific to my type of calibration. If you have multiple multimeters, you don&#8217;t need a sketch at all, but measure directly.<\/p>\r\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-group=\"Shuntspannung_Opamp.ino\" data-enlighter-title=\"Shuntspannung_Opamp.ino\">#include&lt;ADS1115_WE.h&gt; \r\n#include&lt;Wire.h&gt;\r\n#define I2C_ADDRESS 0x48\r\n\r\nADS1115_WE adc(I2C_ADDRESS);\r\n\r\nvoid setup() {\r\n  Wire.begin();\r\n  Serial.begin(9600);\r\n  if(!adc.init()){\r\n    Serial.println(\"ADS1115 not connected!\");\r\n  }\r\n\r\n  \/* Set the voltage range of the ADC to adjust the gain\r\n   * Please note that you must not apply more than VDD + 0.3V to the input pins!\r\n   * \r\n   * ADS1115_RANGE_6144  -&gt;  +\/- 6144 mV\r\n   * ADS1115_RANGE_4096  -&gt;  +\/- 4096 mV\r\n   * ADS1115_RANGE_2048  -&gt;  +\/- 2048 mV (default)\r\n   * ADS1115_RANGE_1024  -&gt;  +\/- 1024 mV\r\n   * ADS1115_RANGE_0512  -&gt;  +\/- 512 mV\r\n   * ADS1115_RANGE_0256  -&gt;  +\/- 256 mV\r\n   *\/\r\n  adc.setVoltageRange_mV(ADS1115_RANGE_6144); \/\/comment line\/change paramater to change range\r\n\r\n  adc.setCompareChannels(ADS1115_COMP_0_GND); \/\/comment line\/change paramater to change channel\r\n\r\n  adc.setMeasureMode(ADS1115_CONTINUOUS); \/\/comment line\/change paramater to change mode\r\n\r\n  Serial.println(\"Stromsensor - Shuntspannung am Opamp\");\r\n  Serial.println();\r\n}\r\n\r\nvoid loop() {\r\n  float voltage = 0.0;\r\n  voltage = adc.getResult_mV(); \r\n  Serial.print(\"Shuntspannung [mV]: \");\r\n  Serial.println(voltage);\r\n  Serial.println(\"-------------------------------\");\r\n  delay(2000);\r\n}<\/pre>\r\n<p>&nbsp;<\/p>\r\n\n<h4 class=\"wp-block-heading\">Result of calibration<\/h4>\n\n<p>The measured values were all very close to regression line, at least this applies to the MCP6002 (results shown below) and the LM358. At 0 milliamperes, the amplified shunt voltage should be 0 millivolts. However, the op amps have an offset voltage on V<sub>OUT<\/sub>, which must be corrected accordingly.<\/p>\r\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/Amplified_Shuntvoltage_vs_current_table.png\"><img decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/Amplified_Shuntvoltage_vs_current_table.png\" alt=\"Measurement data for the calibration of the current sensor\" class=\"wp-image-7134\" style=\"width:402px;height:198px\"\/><\/a><figcaption class=\"wp-element-caption\">Measurement data for the calibration of the current sensor (determined with the MCP6002)<\/figcaption><\/figure>\n<\/div>\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/Amplified_Shunt_Voltage_vs_Current_curve.png\"><img decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/Amplified_Shunt_Voltage_vs_Current_curve-1024x623.png\" alt=\"\" class=\"wp-image-7136\"\/><\/a><\/figure>\n\n<p>With the TLV2462, the measured values &#8220;buckled&#8221; towards zero at small voltages. As if the offset voltage was disappearing. I don&#8217;t know why &#8211; I didn&#8217;t want to investigate further.<\/p>\r\n\n<h3 class=\"wp-block-heading\">The complete current sensor<\/h3>\n\n<p>The rest is simple. You can now measure the amplified shunt voltage directly at the Arduino and convert it into the current. The bus voltage is usually so high that you do not need to amplify it.<\/p>\r\n<p>If you measure the bus voltage at the consumer&#8217;s VCC, then there is also a small amount of shunt voltage in it. As a first approximation that is the current, multiplied by 0.1. Last but not least, you can easily calculate the performance.<\/p>\r\n\n<p>Here, for completeness, the circuit:<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/wiring__current_sensor_opamp.png\"><img decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/wiring__current_sensor_opamp-1024x579.png\" alt=\"The op amp based current sensor\" class=\"wp-image-7133\"\/><\/a><figcaption class=\"wp-element-caption\">The op amp based current sensor<\/figcaption><\/figure>\n\n<p>And here&#8217;s the full sketch:<\/p>\r\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-group=\"Stromsensor_Opamp_komplett.ino\" data-enlighter-title=\"Stromsensor_Opamp_komplett.ino\">const float calibrationFactor = 8.77;\r\nconst int offsetValue = 15;\r\nconst int opampVOutPin = A0;\r\nconst int busAnalogPin = A1;\r\n\r\nvoid setup(){\r\n  Serial.begin(9600);\r\n  Serial.println(\"Stromsensor mit OpAmp\");\r\n}\r\n\r\nvoid loop(){\r\n \r\n  float amplifiedShuntVoltage_mV = (analogRead(opampVOutPin) - offsetValue) * 5.0 \/ 1.024;\r\n  Serial.print(\"Verst\u00e4rkte Shuntspannung [mV]: \"); \/\/ Amplified shunt voltage\r\n  Serial.println(amplifiedShuntVoltage_mV);\r\n\r\n  float current_mA = amplifiedShuntVoltage_mV \/ calibrationFactor; \r\n  Serial.print(\"Strom [mA]                   : \"); \/\/ Current\r\n  Serial.println(current_mA);\r\n  \r\n  \/\/ Wir ziehen die Shuntspannung ab, um die reine Busspannung zu haben\r\n  float busVoltage_V = (analogRead(busAnalogPin) * 5.0 \/ 1024) - (current_mA * 0.1 \/ 1000);\r\n  Serial.print(\"Busspannung [V]              : \"); \/\/ Bus voltage\r\n  Serial.println(busVoltage_V);\r\n\r\n  float power_mW = busVoltage_V * current_mA;\r\n  Serial.print(\"Leistung [mW]                : \"); \/\/ Power\r\n  Serial.println(power_mW);\r\n\r\n  Serial.println(\"-------------------------------\");\r\n  delay(2000); \r\n}<\/pre>\r\n<p>&nbsp;<\/p>\r\n\n<h2 class=\"wp-block-heading\">Acknowledgement<\/h2>\n\n<p>I took the already used image of the electric meter for the post image from the <a href=\"https:\/\/pixabay.com\/photos\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=691809\">Free-Photos<\/a> section of Pixabay. I owe most of the tools to <a href=\"https:\/\/pixabay.com\/de\/users\/Clker-Free-Vector-Images-3736\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=33634\">Clker-Free-Vector-Images.<\/a> The drilling machine is from <a href=\"https:\/\/pixabay.com\/de\/users\/Painter06-3732158\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=3324116\">Francis Ray<\/a> on Pixabay. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article I show how you can build a shunt-based current sensor like the INA219 or INA226 yourself. I present two solutions. <\/p>\n","protected":false},"author":1,"featured_media":8649,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[574,571,572],"tags":[1242,556,1256,1254,1253,1250,1252,1248,1230],"class_list":["post-10631","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-current-voltage","category-projects","category-sensors","tag-ads1115-en","tag-arduino-en-2","tag-differential-amplifier","tag-lm358-en","tag-mcp6002-en","tag-op-amp-en","tag-operational-amplifier-en","tag-self-built-current-sensor","tag-shunt-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Current Sensor - how to build it yourself &#8226; Wolles Elektronikkiste<\/title>\n<meta name=\"description\" content=\"In this article I show how you can build a shunt-based current sensor like the INA219 or INA226 yourself. I present two solutions.\" \/>\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\/current-sensor-how-to-build-it-yourself\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Current Sensor - how to build it yourself &#8226; Wolles Elektronikkiste\" \/>\n<meta property=\"og:description\" content=\"In this article I show how you can build a shunt-based current sensor like the INA219 or INA226 yourself. I present two solutions.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wolles-elektronikkiste.de\/en\/current-sensor-how-to-build-it-yourself\" \/>\n<meta property=\"og:site_name\" content=\"Wolles Elektronikkiste\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-06T23:34:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-29T11:25:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Beitragsbild_Stromsensor.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=\"13 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/current-sensor-how-to-build-it-yourself#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/current-sensor-how-to-build-it-yourself\"},\"author\":{\"name\":\"Wolfgang Ewald\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"headline\":\"Current Sensor &#8211; how to build it yourself\",\"datePublished\":\"2021-01-06T23:34:51+00:00\",\"dateModified\":\"2024-10-29T11:25:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/current-sensor-how-to-build-it-yourself\"},\"wordCount\":1877,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"image\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/current-sensor-how-to-build-it-yourself#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/Beitragsbild_Stromsensor.png\",\"keywords\":[\"ADS1115\",\"Arduino\",\"differential amplifier\",\"LM358\",\"MCP6002\",\"op amp\",\"operational amplifier\",\"self built current sensor\",\"shunt\"],\"articleSection\":[\"Current, voltage\",\"Projects\",\"Sensors\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/current-sensor-how-to-build-it-yourself#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/current-sensor-how-to-build-it-yourself\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/current-sensor-how-to-build-it-yourself\",\"name\":\"Current Sensor - how to build it yourself &#8226; Wolles Elektronikkiste\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/current-sensor-how-to-build-it-yourself#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/current-sensor-how-to-build-it-yourself#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/Beitragsbild_Stromsensor.png\",\"datePublished\":\"2021-01-06T23:34:51+00:00\",\"dateModified\":\"2024-10-29T11:25:07+00:00\",\"description\":\"In this article I show how you can build a shunt-based current sensor like the INA219 or INA226 yourself. I present two solutions.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/current-sensor-how-to-build-it-yourself#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/current-sensor-how-to-build-it-yourself\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/current-sensor-how-to-build-it-yourself#primaryimage\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/Beitragsbild_Stromsensor.png\",\"contentUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/Beitragsbild_Stromsensor.png\",\"width\":1300,\"height\":1300},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/current-sensor-how-to-build-it-yourself#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Startseite\",\"item\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Current Sensor &#8211; how to build it yourself\"}]},{\"@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":"Current Sensor - how to build it yourself &#8226; Wolles Elektronikkiste","description":"In this article I show how you can build a shunt-based current sensor like the INA219 or INA226 yourself. I present two solutions.","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\/current-sensor-how-to-build-it-yourself","og_locale":"en_US","og_type":"article","og_title":"Current Sensor - how to build it yourself &#8226; Wolles Elektronikkiste","og_description":"In this article I show how you can build a shunt-based current sensor like the INA219 or INA226 yourself. I present two solutions.","og_url":"https:\/\/wolles-elektronikkiste.de\/en\/current-sensor-how-to-build-it-yourself","og_site_name":"Wolles Elektronikkiste","article_published_time":"2021-01-06T23:34:51+00:00","article_modified_time":"2024-10-29T11:25:07+00:00","og_image":[{"width":1300,"height":1300,"url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Beitragsbild_Stromsensor.png","type":"image\/png"}],"author":"Wolfgang Ewald","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Wolfgang Ewald","Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wolles-elektronikkiste.de\/en\/current-sensor-how-to-build-it-yourself#article","isPartOf":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/current-sensor-how-to-build-it-yourself"},"author":{"name":"Wolfgang Ewald","@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"headline":"Current Sensor &#8211; how to build it yourself","datePublished":"2021-01-06T23:34:51+00:00","dateModified":"2024-10-29T11:25:07+00:00","mainEntityOfPage":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/current-sensor-how-to-build-it-yourself"},"wordCount":1877,"commentCount":5,"publisher":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"image":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/current-sensor-how-to-build-it-yourself#primaryimage"},"thumbnailUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Beitragsbild_Stromsensor.png","keywords":["ADS1115","Arduino","differential amplifier","LM358","MCP6002","op amp","operational amplifier","self built current sensor","shunt"],"articleSection":["Current, voltage","Projects","Sensors"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/wolles-elektronikkiste.de\/en\/current-sensor-how-to-build-it-yourself#respond"]}]},{"@type":"WebPage","@id":"https:\/\/wolles-elektronikkiste.de\/en\/current-sensor-how-to-build-it-yourself","url":"https:\/\/wolles-elektronikkiste.de\/en\/current-sensor-how-to-build-it-yourself","name":"Current Sensor - how to build it yourself &#8226; Wolles Elektronikkiste","isPartOf":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#website"},"primaryImageOfPage":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/current-sensor-how-to-build-it-yourself#primaryimage"},"image":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/current-sensor-how-to-build-it-yourself#primaryimage"},"thumbnailUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Beitragsbild_Stromsensor.png","datePublished":"2021-01-06T23:34:51+00:00","dateModified":"2024-10-29T11:25:07+00:00","description":"In this article I show how you can build a shunt-based current sensor like the INA219 or INA226 yourself. I present two solutions.","breadcrumb":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/current-sensor-how-to-build-it-yourself#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wolles-elektronikkiste.de\/en\/current-sensor-how-to-build-it-yourself"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wolles-elektronikkiste.de\/en\/current-sensor-how-to-build-it-yourself#primaryimage","url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Beitragsbild_Stromsensor.png","contentUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Beitragsbild_Stromsensor.png","width":1300,"height":1300},{"@type":"BreadcrumbList","@id":"https:\/\/wolles-elektronikkiste.de\/en\/current-sensor-how-to-build-it-yourself#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Startseite","item":"https:\/\/wolles-elektronikkiste.de\/en"},{"@type":"ListItem","position":2,"name":"Current Sensor &#8211; how to build it yourself"}]},{"@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\/10631","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=10631"}],"version-history":[{"count":0,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts\/10631\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/media\/8649"}],"wp:attachment":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/media?parent=10631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/categories?post=10631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/tags?post=10631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}