meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| sensor:ina_moduls [2026/03/28 20:20] – [INA238 Arduino example code] vamsan | sensor:ina_moduls [2026/03/28 21:26] (current) – [INA260: high-precision digital power monitor] vamsan | ||
|---|---|---|---|
| Line 368: | Line 368: | ||
| </ | </ | ||
| - | ==== INA238: Ultra-precise digital power monitor 16-bit delta-sigma ADC ==== | + | ==== INA238: Ultra-precise digital power monitor 16-bit delta-sigma ADC with I²C communication |
| {{anchor: | {{anchor: | ||
| {{ : | {{ : | ||
| Line 448: | Line 448: | ||
| * **I²C Address:** If you have changed the A0/A1 jumpers, pass the address to the begin function: // | * **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. | * **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> | ||