meta data for this page
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| sensor:ina_moduls [2026/03/28 18:02] – created vamsan | sensor:ina_moduls [2026/03/28 21:26] (current) – [INA260: high-precision digital power monitor] vamsan | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ==== lamaPLC: | + | ====== lamaPLC: |
| - | {{ : | + | Several INA series ICs have excellent Arduino support, with libraries provided by Adafruit and the community. The following table summarizes the most popular models and their technical specifications |
| - | **36V, 16-bit, | + | |< |
| + | ^IC Model^ADC Res.^Max Bus Voltage^Shunt Voltage Range^PGA^Alert Pin^Communication^Arduino Library^Key Functionality| | ||
| + | ^[[# | ||
| + | ^[[# | ||
| + | ^[[# | ||
| + | ^[[# | ||
| + | ^[[# | ||
| + | ^[[# | ||
| + | ^[[# | ||
| - | The INA226 | + | ==== INA219: digital current, voltage, and power monitor with I²C communication ==== |
| + | {{anchor: | ||
| + | {{ : | ||
| + | The INA219 | ||
| - | The INA226 is a current shunt and power monitor with an I²C or SMBUS-compatible interface. The device monitors both a shunt voltage drop and bus supply voltage. Programmable calibration value, conversion times, and averaging, combined with an internal multiplier, enable direct readouts of current in amperes and power in watts. The INA226 senses current on the common-mode bus, which can vary from **0V to 36V**, independent of the supply voltage. The device operates from a 2.7V to 5.5V supply, drawing a typical supply current of 330 μA. The device is specified for an operating temperature range of –40°C to 125°C and features up to 16 programmable addresses via an I2C-compatible interface. | + | === INA219: Key Specifications === |
| + | | ||
| + | | ||
| + | * **Current Draw:** Maximum | ||
| + | * **Accuracy: | ||
| + | * **Interface: | ||
| + | * **ADC Resolution: | ||
| + | * **Temperature Range:** Operates from –40°C to 125°C. | ||
| - | The INA226 supports the fast mode (1 kHz to 400 kHz) and high-speed mode (1 kHz to 2.94 MHz) transmission protocols. All data bytes are transmitted in most significant byte-first order. | ||
| - | {{ :sensor:ina_226_1.png?800 |INA226}} | + | === INA219: Pin Description === |
| + | {{ :sensor:ina219_5.png?200|INA219}} | ||
| - | {{page>:tarhal}} | + | |<100%>| |
| + | ^Pin^Name^Type^Description| | ||
| + | ^1|VCC|Power|Supply Voltage: Powers the chip (3.0V to 5.5V).| | ||
| + | ^2|GND|Power|Ground: | ||
| + | ^3|SCL|Digital I/O|I²C Clock: Serial clock line for communication.| | ||
| + | ^4|SDA|Digital I/O|I²C Data: Serial data line for communication.| | ||
| + | ^5|V+ \\ (IN+)|Analog Input|Positive Shunt: Connect to the power source side.| | ||
| + | ^6|V- \\ (IN-)|Analog Input|Negative Shunt: Connect to the load side.| | ||
| + | ^7|A0|Digital Input|Address 0: Connect to GND, VS, SDA, or SCL to set I²C address.| | ||
| + | ^8|A1|Digital Input|Address 1: Connect to GND, VS, SDA, or SCL to set I²C address.| | ||
| - | {{ :sensor:ina_226_2.png?800 |INA226}} | + | **Important Considerations** |
| + | |||
| + | * **Maximum Limits:** Do not exceed 26V or 3.2A, or the shunt resistor might be damaged. | ||
| + | * **I²C Address:** The default address is 0x40. You can bridge solder pads on the board to change it to 0x41, 0x44, or 0x45 to use multiple sensors. | ||
| + | * **Negative Current Readings:** If current reads negative, you have swapped the Vin+ and Vin- connections. | ||
| + | * **Precision: | ||
| + | |||
| + | **Standard Breakout Board Address Table** | ||
| + | |||
| + | The INA219 current sensor has a base I2C address of 0x40. Most breakout boards, like those from Adafruit, feature two address jumpers (A0 and A1) that allow you to set up to four unique addresses by bridging them with solder. | ||
| + | |||
| + | ^Address^A1 Jumper^A0 Jumper^Description| | ||
| + | ^**0x40**|Open|Open|Default address| | ||
| + | ^0x41|Open|Closed|Bridge A0| | ||
| + | ^0x44|Closed|Open|Bridge A1| | ||
| + | ^0x45|Closed|Closed|Bridge A0 and A1| | ||
| + | |||
| + | === INA219 Arduino example code === | ||
| + | <code c> | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | Adafruit_INA219 ina219; | ||
| + | |||
| + | void setup(void) { | ||
| + | Serial.begin(115200); | ||
| + | if (!ina219.begin()) { | ||
| + | Serial.println(" | ||
| + | while (1); | ||
| + | } | ||
| + | // Optional: Set calibration for higher precision (e.g., 32V 1A) | ||
| + | // ina219.setCalibration_32V_1A(); | ||
| + | } | ||
| + | |||
| + | void loop(void) { | ||
| + | float shuntvoltage = 0; | ||
| + | float busvoltage = 0; | ||
| + | float current_mA = 0; | ||
| + | float loadvoltage = 0; | ||
| + | float power_mW = 0; | ||
| + | |||
| + | shuntvoltage = ina219.getShuntVoltage_mV(); | ||
| + | busvoltage = ina219.getBusVoltage_V(); | ||
| + | current_mA = ina219.getCurrent_mA(); | ||
| + | power_mW = ina219.getPower_mW(); | ||
| + | loadvoltage = busvoltage + (shuntvoltage / 1000); | ||
| + | |||
| + | Serial.print(" | ||
| + | Serial.print(" | ||
| + | Serial.print(" | ||
| + | Serial.println("" | ||
| + | delay(1000); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== INA226: current/ | ||
| + | {{anchor: | ||
| + | {{ :sensor:ina_226_3.png?100|INA226}} | ||
| + | **36V, 16-bit, ultra-precise i²c output current/ | ||
| + | |||
| + | The INA226 is a current shunt and power monitor with an I²C or SMBUS-compatible interface. It monitors both a shunt-voltage drop and the bus supply voltage. Programmable calibration values, conversion times, and averaging, combined with an internal multiplier, enable direct readouts of current in amperes and power in watts. | ||
| + | |||
| + | The INA226 is a current shunt and power monitor with an I²C or SMBUS-compatible interface. The device monitors both a shunt voltage drop and bus supply voltage. Programmable calibration value, conversion times, and averaging, combined with an internal multiplier, enable direct readouts of current in amperes and power in watts. The INA226 senses current on the common-mode bus, which can range from **0V to 36V**, independent of the supply voltage. The device operates from a 2.7V to 5.5V supply, drawing a typical supply current of 330 μA. The device is specified for an operating temperature range of –40°C to 125°C and features up to 16 programmable addresses via an I2C-compatible interface. | ||
| + | |||
| + | The INA226 supports the fast mode (1 kHz to 400 kHz) and high-speed mode (1 kHz to 2.94 MHz) transmission protocols. All data bytes are transmitted in most significant byte-first order. | ||
| - | === INA226 Features === | + | === INA226: Features === |
| - | * Senses Bus Voltages: 0 V .. 36 V | + | |
| - | * Shunt Voltage Maximum: 81.9 V | + | |
| - | * Current Maximum: 20 A | + | |
| * High-Side or Low-Side Sensing | * High-Side or Low-Side Sensing | ||
| * Reports Current, Voltage, and Power | * Reports Current, Voltage, and Power | ||
| - | * High Accuracy: | + | |
| * 0.1% Gain Error (Max) | * 0.1% Gain Error (Max) | ||
| * 10 μV Offset (Max) | * 10 μV Offset (Max) | ||
| Line 29: | Line 120: | ||
| * Operates from 2.7V to 5.5V Power Supply | * Operates from 2.7V to 5.5V Power Supply | ||
| * 10-Pin, DGS (VSSOP) Package | * 10-Pin, DGS (VSSOP) Package | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | {{page>: | ||
| + | |||
| + | {{ : | ||
| === INA226 Pin Description === | === INA226 Pin Description === | ||
| Line 57: | Line 154: | ||
| The default address is **0x40** (when both pins are connected to GND). | The default address is **0x40** (when both pins are connected to GND). | ||
| + | |< | ||
| ^A1 Pin^A0 Pin^Hex Address| | ^A1 Pin^A0 Pin^Hex Address| | ||
| ^GND|GND|**0x40**| | ^GND|GND|**0x40**| | ||
| Line 137: | Line 235: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | ==== INA228: ultra-precise, | ||
| + | {{anchor: | ||
| + | {{ : | ||
| + | |||
| + | The INA228 is an ultra-precise, | ||
| + | |||
| + | **Key Specifications** | ||
| + | |||
| + | * **ADC Resolution: | ||
| + | * **Bus Voltage:** Supports 0V to 85V (more than double the INA226' | ||
| + | * **Measured Data:** Reports current, bus voltage, temperature, | ||
| + | * **Temperature Sensor:** Integrated sensor with ±1°C accuracy for die temperature monitoring. | ||
| + | * **Precision: | ||
| + | * **Interface: | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | === INA228 Pin Description === | ||
| + | |||
| + | |< 100%>| | ||
| + | ^Pin No.^Name^Type^Description| | ||
| + | ^1|A1|Digital Input|Address Pin: Connect to GND, VS, SDA, or SCL to set the I²C address.| | ||
| + | ^2|A0|Digital Input|Address Pin: Works with A1 to configure one of 16 possible addresses.| | ||
| + | ^3|Alert|Digital Output|Open-drain Alert: Triggers on over/under voltage, current, or power limits.| | ||
| + | ^4|SDA|Digital I/O|Serial Data: Bidirectional I²C/SMBUS data line.| | ||
| + | ^5|SCL|Digital I/O|Serial Clock: I²C/SMBUS clock input.| | ||
| + | ^6|VS|Power|Supply Voltage: 2.7V to 5.5V to power the device.| | ||
| + | ^7|GND|Analog|Ground: | ||
| + | ^8|VBUS|Analog Input|Bus Voltage Input: Monitors the 0V to 85V bus voltage.| | ||
| + | ^9|IN–|Analog Input|Negative Shunt Input: Connect to the load side of the shunt resistor.| | ||
| + | ^10|IN+|Analog Input|Positive Shunt Input: Connect to the supply side of the shunt resistor.| | ||
| + | |||
| + | === INA228 Arduino example code === | ||
| + | This sketch initializes the sensor and prints real-time power data to the Serial Monitor at 115200 baud. | ||
| + | |||
| + | <code c> | ||
| + | #include < | ||
| + | // Initialize with default I2C address 0x40 | ||
| + | Adafruit_INA228 ina228 = Adafruit_INA228(); | ||
| + | |||
| + | void setup() { | ||
| + | Serial.begin(115200); | ||
| + | if (!ina228.begin()) { | ||
| + | Serial.println(" | ||
| + | while (1) delay(10); | ||
| + | } | ||
| + | // Configure: Shunt Resistance = 0.015 Ohms, Max Expected Current = 10A | ||
| + | ina228.setShunt(0.015, | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | Serial.print(" | ||
| + | Serial.print(" | ||
| + | delay(1000); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== INA237: is an ultra-precise, | ||
| + | {{anchor: | ||
| + | {{ : | ||
| + | The INA237 is an ultra-precise, | ||
| + | |||
| + | **Key Specifications** | ||
| + | |||
| + | * **Resolution: | ||
| + | * **Bus Voltage Range:** Monitors from 0V to 85V. | ||
| + | * **Common-Mode Range:** Operates from –0.3V to +85V. | ||
| + | * **Interface: | ||
| + | * **Integrated Temperature Sensor:** Provides die temperature readings with ±1°C accuracy. | ||
| + | * **Alert Feature:** Features a fast 75 µs alert response for over/under limit detection. | ||
| + | |||
| + | === INA237 Pin Description === | ||
| + | The INA237 uses the same pinout as the INA228 and INA238, making them hardware-equivalent in many designs. | ||
| + | |||
| + | ^Pin No.^Name^Type^Description| | ||
| + | ^1|A1|Digital Input|Address Pin: Sets the I2C address (connect to GND, VS, SDA, or SCL).| | ||
| + | ^2|A0|Digital Input|Address Pin: Used with A1 to select 1 of 16 addresses.| | ||
| + | ^3|Alert|Digital Output|Alert Output: Open-drain pin for diagnostic reports or conversion-ready signals.| | ||
| + | ^4|SDA|Digital I/O|Serial Data: Bidirectional data line for I2C communication.| | ||
| + | ^5|SCL|Digital I/O|Serial Clock: Clock input for I2C communication.| | ||
| + | ^6|VS|Power|Supply Voltage: Powers the device (2.7V to 5.5V).| | ||
| + | ^7|GND|Power|Ground: | ||
| + | ^8|VBUS|Analog Input|Bus Voltage: Sense input for monitoring the 0V to 85V bus voltage.| | ||
| + | ^9|IN–|Analog Input|Negative Shunt Input: Connect to the load side of the shunt resistor.| | ||
| + | ^10|IN+|Analog Input|Positive Shunt Input: Connect to the supply side of the shunt resistor.| | ||
| + | |||
| + | === INA237 Arduino example code === | ||
| + | This code initializes the sensor and prints the Bus Voltage, Current, and Power to the Serial Monitor. | ||
| + | |||
| + | <code c> | ||
| + | #include < | ||
| + | |||
| + | // Initialize sensor (Default address is 0x40) | ||
| + | Adafruit_INA237 ina237 = Adafruit_INA237(); | ||
| + | |||
| + | void setup() { | ||
| + | Serial.begin(115200); | ||
| + | while (!Serial) delay(10); // Wait for Serial Monitor | ||
| + | |||
| + | Serial.println(" | ||
| + | |||
| + | if (!ina237.begin()) { | ||
| + | Serial.println(" | ||
| + | while (1) delay(10); | ||
| + | } | ||
| + | |||
| + | // --- CALIBRATION --- | ||
| + | // setShunt(Shunt Resistance in Ohms, Max Expected Current in Amps) | ||
| + | // Example: 0.1 Ohm resistor, 2 Amp max current | ||
| + | ina237.setShunt(0.1, | ||
| + | |||
| + | Serial.println(" | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | // Read values from the sensor | ||
| + | float voltage_V = ina237.getBusVoltage_V(); | ||
| + | float current_mA = ina237.getCurrent_mA(); | ||
| + | float power_mW = ina237.getPower_mW(); | ||
| + | float temp_C = ina237.getDieTemperature_C(); | ||
| + | |||
| + | // Print results | ||
| + | Serial.print(" | ||
| + | Serial.print(" | ||
| + | Serial.print(" | ||
| + | Serial.print(" | ||
| + | Serial.println(" | ||
| + | |||
| + | delay(2000); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== INA238: Ultra-precise digital power monitor 16-bit delta-sigma ADC with I²C communication ==== | ||
| + | {{anchor: | ||
| + | {{ : | ||
| + | The INA238 is an ultra-precise digital power monitor featuring a 16-bit delta-sigma ADC designed for high-side or low-side current sensing in high-voltage systems up to 85V. | ||
| + | |||
| + | **Key Specifications** | ||
| + | |||
| + | * **Common-Mode Range:** Operates from –0.3V to +85V. | ||
| + | * **Precision: | ||
| + | * **Integrated Temperature Sensor:** Integrated die temperature sensing with ±1°C accuracy. | ||
| + | * **ADC Settings:** Selectable conversion times (50 µs to 4.12 ms) and sample averaging (1x to 1024x) to reduce noise. | ||
| + | * **High-Speed Interface: | ||
| + | * **Fast Response:** Provides a 75 µs alert response for rapid limit detection. | ||
| + | |||
| + | === INA238 Pin Description === | ||
| + | |< 100%>| | ||
| + | ^Pin No.^Name^Type^Description| | ||
| + | ^1|A1|Digital Input|Address Pin 1: Sets the I²C address by connecting to GND, VS, SDA, or SCL.| | ||
| + | ^2|A0|Digital Input|Address Pin 0: Used with A1 to select 1 of 16 possible I2C addresses.| | ||
| + | ^3|Alert|Digital Output|Alert Output: Open-drain pin for over/under limit notifications or conversion-ready status.| | ||
| + | ^4|SDA|Digital I/O|Serial Data: Bidirectional I²C/SMBUS data line.| | ||
| + | ^5|SCL|Digital I/O|Serial Clock: I²C/SMBUS clock input.| | ||
| + | ^6|VS|Power|Supply Voltage: 2.7V to 5.5V input to power the device.| | ||
| + | ^7|GND|Power|Ground: | ||
| + | ^8|VBUS|Analog Input|Bus Voltage: Monitors the 0V to 85V bus voltage.| | ||
| + | ^9|IN–|Analog Input|Negative Shunt Input: Connect to the load side of the shunt resistor.| | ||
| + | ^10|IN+|Analog Input|Positive Shunt Input: Connect to the supply side of the shunt resistor.| | ||
| + | |||
| + | === INA238 Arduino example code === | ||
| + | The INA238 uses the same 16-bit register structure as the INA237, so the code is nearly identical. You can use the Adafruit INA238 library for a quick setup. | ||
| + | |||
| + | <code c> | ||
| + | #include < | ||
| + | |||
| + | // Create the sensor object (Default I2C address is 0x40) | ||
| + | Adafruit_INA238 ina238 = Adafruit_INA238(); | ||
| + | |||
| + | void setup() { | ||
| + | Serial.begin(115200); | ||
| + | while (!Serial) delay(10); // Wait for Serial Monitor | ||
| + | |||
| + | Serial.println(" | ||
| + | |||
| + | // Try to initialize the chip | ||
| + | if (!ina238.begin()) { | ||
| + | Serial.println(" | ||
| + | while (1) delay(10); | ||
| + | } | ||
| + | |||
| + | // --- CALIBRATION --- | ||
| + | // setShunt(Shunt Resistance in Ohms, Max Expected Current in Amps) | ||
| + | // Example: 0.1 Ohm resistor, 1.0 Amp max current | ||
| + | ina238.setShunt(0.1, | ||
| + | |||
| + | Serial.println(" | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | // Read sensor data | ||
| + | float bus_v = ina238.getBusVoltage_V(); | ||
| + | float current_ma = ina238.getCurrent_mA(); | ||
| + | float power_mw = ina238.getPower_mW(); | ||
| + | float die_temp = ina238.getDieTemperature_C(); | ||
| + | |||
| + | // Print results to Serial Monitor | ||
| + | Serial.print(" | ||
| + | Serial.print(" | ||
| + | Serial.print(" | ||
| + | Serial.print(" | ||
| + | Serial.println(" | ||
| + | |||
| + | delay(1000); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | **Tips for the INA238** | ||
| + | |||
| + | * **Precision: | ||
| + | * **I²C Address:** If you have changed the A0/A1 jumpers, pass the address to the begin function: // | ||
| + | * **Alert Pin:** You can use the library to set high/low thresholds that trigger the physical Alert pin on the chip for over-current protection. | ||
| + | |||
| + | ==== INA260: high-precision digital power monitor with I²C communication ==== | ||
| + | {{anchor: | ||
| + | {{ : | ||
| + | The INA260 is a high-precision digital power monitor that stands out for its integrated precision shunt resistor. This makes it a //" | ||
| + | |||
| + | **Key Specifications** | ||
| + | |||
| + | * **Integrated Shunt:** Features a 2 mΩ resistor with 0.1% tolerance. | ||
| + | * **Current Range:** Can handle up to ±15A continuous current. | ||
| + | * **Bus Voltage:** Senses from 0V to 36V, independent of its own supply voltage. | ||
| + | * **Supply Voltage:** Operates on 2.7V to 5.5V. | ||
| + | * **Accuracy: | ||
| + | * **Interface: | ||
| + | |||
| + | === INA260 Pin Description === | ||
| + | {{anchor: | ||
| + | Although the chip features 16 pins, many breakout boards simplify this layout. The original chip pinout includes several high-current pins, which help ensure low resistance and better heat dissipation. | ||
| + | |||
| + | ^Pin No.^Name^Type^Description| | ||
| + | ^1, 2, 3|IN+|Analog Input|Positive Current Path: Connect to the supply for high-side sensing.| | ||
| + | ^4|A1|Digital Input|Address Pin: Connect to GND, VS, SDA, or SCL to set the I²C address.| | ||
| + | ^5|A0|Digital Input|Address Pin: Used with A1 to configure 1 of 16 addresses.| | ||
| + | ^6, 11|GND|Power|Ground: | ||
| + | ^7|ALERT|Digital Output|Alert Pin: Open-drain output for over-limit or conversion-ready signals.| | ||
| + | ^8|SDA|Digital I/O|Serial Data: Bidirectional I²C data line.| | ||
| + | ^9|SCL|Digital I/O|Serial Clock: I²C clock input.| | ||
| + | ^10|VS|Power|Supply Voltage: 2.7V to 5.5V to power the sensor logic.| | ||
| + | ^12|VBUS|Analog Input|Bus Voltage Sense: Measures the actual voltage of the line (0V to 36V).| | ||
| + | ^14, 15, 16|IN–|Analog Input|Negative Current Path: Connect to the load for high-side sensing.| | ||
| + | |||
| + | === INA260 Arduino example code === | ||
| + | This sketch initializes the sensor and prints Voltage, Current, and Power to the Serial Monitor at 115200 baud | ||
| + | |||
| + | <code c> | ||
| + | #include < | ||
| + | |||
| + | // Create the sensor object | ||
| + | Adafruit_INA260 ina260 = Adafruit_INA260(); | ||
| + | |||
| + | void setup() { | ||
| + | Serial.begin(115200); | ||
| + | while (!Serial) delay(10); // Wait for Serial Monitor to open | ||
| + | |||
| + | Serial.println(" | ||
| + | |||
| + | // Default I2C address is 0x40 | ||
| + | if (!ina260.begin()) { | ||
| + | Serial.println(" | ||
| + | while (1); | ||
| + | } | ||
| + | |||
| + | Serial.println(" | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | // Read and print Voltage (mV) | ||
| + | Serial.print(" | ||
| + | Serial.print(ina260.readBusVoltage()); | ||
| + | Serial.println(" | ||
| + | |||
| + | // Read and print Current (mA) | ||
| + | Serial.print(" | ||
| + | Serial.print(ina260.readCurrent()); | ||
| + | Serial.println(" | ||
| + | |||
| + | // Read and print Power (mW) | ||
| + | Serial.print(" | ||
| + | Serial.print(ina260.readPower()); | ||
| + | Serial.println(" | ||
| + | |||
| + | Serial.println("" | ||
| + | delay(1000); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | **Pro Tips for INA260** | ||
| + | |||
| + | * **No Calibration Needed:** Unlike the INA219 or INA226, you do not need to call a setShunt function because the resistor is built-in and factory-calibrated. | ||
| + | * **Averaging: | ||
| + | * **High Current:** Since the INA260 handles up to 15A, ensure your wiring (the wires going to IN+ and IN-) is thick enough to handle the load without overheating. | ||
| + | |||
| + | ==== INA3221: current and bus voltage monitor with 3 channels I²C communication ==== | ||
| + | {{anchor: | ||
| + | {{ : | ||
| + | The INA3221 is a high-side current and bus voltage monitor with three independent channels and an I²C-compatible interface. It is essentially a triple-channel version of the popular INA219, allowing you to monitor three separate power rails with a single chip. | ||
| + | |||
| + | **Key Specifications** | ||
| + | |||
| + | * **Channels: | ||
| + | * **Bus Voltage Range:** Senses from 0V to 26V. | ||
| + | * **Supply Voltage:** Operates on a single 2.7V to 5.5V supply. | ||
| + | * **Resolution: | ||
| + | * **Current Sensing:** Measures current by detecting the voltage drop across an external shunt resistor (up to ±163.8 mV). | ||
| + | * **Power Consumption: | ||
| + | * **Interface: | ||
| + | |||
| + | === INA3221 Pin Description === | ||
| + | The INA3221 features several specialized alert pins not found on simpler monitors. | ||
| + | {{ : | ||
| + | ^Pin Name^Type^Description| | ||
| + | ^IN+ [1, 2, 3]|Analog Input|Positive Shunt Input: Connect to the supply side of the shunt resistor for each channel.| | ||
| + | ^IN- [1, 2, 3]|Analog Input|Negative Shunt Input: Connect to the load side. Bus voltage is also measured here.| | ||
| + | ^VS|Power|Supply Voltage: 2.7V to 5.5V.| | ||
| + | ^GND|Power|Ground: | ||
| + | ^SCL/ | ||
| + | ^A0|Digital Input|Address Select: Tie to GND, VS, SDA, or SCL to set the I²C address.| | ||
| + | ^Critical|Digital Output|Critical Alert: Triggers immediately when a programmed current limit is exceeded.| | ||
| + | ^Warning|Digital Output|Warning Alert: Triggers based on an averaged current value to avoid false alarms.| | ||
| + | ^PV (Power Valid)|Digital Output|Goes high once all enabled channels reach a predefined voltage (default 10V).| | ||
| + | ^TC (Timing Control)|Digital Output|Monitors power-supply sequencing at power-up.| | ||
| + | |||
| + | **Important Usage Notes** | ||
| + | |||
| + | * **Common Ground:** All monitored loads and the INA3221 must share the same ground reference. | ||
| + | * **High-Side Sensing:** Intended for high-side sensing (resistor between supply and load), though low-side sensing is possible but less typical for this chip. | ||
| + | * **Standard Breakout Performance: | ||
| + | |||
| + | === INA3221 I2C Address Map === | ||
| + | |||
| + | ^A0 Pin Connection^Hex Address^Decimal| | ||
| + | ^GND (Ground)|0x40|64| | ||
| + | ^VS (VCC)|0x41|65| | ||
| + | ^SDA|0x42|66| | ||
| + | ^SCL|0x43|67| | ||
| + | |||
| + | **Wiring Reminder** | ||
| + | |||
| + | The INA3221 is primarily for high-side sensing. Connect your power source to IN+ and your load to IN- for each channel you wish to monitor. | ||
| + | |||
| + | === INA3221 Arduino example code === | ||
| + | To use the INA3221 with an Arduino, the Adafruit INA3221 Library is highly recommended for its ease of use and support for all three channels. | ||
| + | |||
| + | This sketch initializes the sensor and prints the voltage and current for all three channels to the Serial Monitor at 115200 baud. | ||
| + | |||
| + | <code c> | ||
| + | #include < | ||
| + | |||
| + | // Initialize sensor (Default address 0x40) | ||
| + | Adafruit_INA3221 ina3221; | ||
| + | |||
| + | void setup() { | ||
| + | Serial.begin(115200); | ||
| + | while (!Serial) delay(10); // Wait for Serial Monitor | ||
| + | |||
| + | Serial.println(" | ||
| + | |||
| + | if (!ina3221.begin()) { | ||
| + | Serial.println(" | ||
| + | while (1) delay(10); | ||
| + | } | ||
| + | |||
| + | // Set shunt resistance for all channels (Standard modules use 0.1 or 0.05 Ohms) | ||
| + | // For 0.1 Ohm shunts: | ||
| + | for (uint8_t i = 0; i < 3; i++) { | ||
| + | ina3221.setShuntResistance(i, | ||
| + | } | ||
| + | |||
| + | Serial.println(" | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | for (uint8_t i = 0; i < 3; i++) { | ||
| + | float voltage = ina3221.getBusVoltage(i); | ||
| + | float current_mA = ina3221.getCurrentAmps(i) * 1000.0; // Convert to mA | ||
| + | |||
| + | Serial.print(" | ||
| + | Serial.print(": | ||
| + | Serial.print(current_mA, | ||
| + | } | ||
| + | Serial.println(" | ||
| + | delay(2000); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | **Key Functions** | ||
| + | |||
| + | * **setShuntResistance(channel, | ||
| + | * **getBusVoltage(channel): | ||
| + | * **getCurrentAmps(channel): | ||
| + | * **setAveragingMode(mode): | ||
| + | |||
| + | |||
| + | |||
| ===== I²C topics on lamaPLC ===== | ===== I²C topics on lamaPLC ===== | ||
| {{topic> | {{topic> | ||
| \\ | \\ | ||
| - | {{tag> | + | {{tag> |
| \\ | \\ | ||
| This page has been accessed for: Today: {{counter|today}}, | This page has been accessed for: Today: {{counter|today}}, | ||