Introduction: Current Monitoring Via Arduino Nano (I2C)
Hello,
Good Greetings..!!
Here I (Somanshu Choudhary) on the behalf of Dcube tech ventures going to monitor current using Arduino nano, it is one of the applications of I2C protocol to read analog data of Current Sensor TA12-200.
Step 1: Overview
- TA12-200 is an AC current sensor
- DATASHEET Link:http://berg.hatenablog.com/entry/2013/04/21/204441
- This project measure AC current values
Step 2: What You Need / Links
- Arduino Nano
- I²C Shield for Arduino Nano
- USB Cable Type A to Micro Type B 6 Feet Long
I²C AC current Sensor via ADC121C 12-Bit ADC I²C Mini Module
CFL or Light bulb.
PCV cables.
Step 3: Circuit Diagram
Step 4: Programming / Code
#include
void setup()
{
// I2C address of the ADC121C021, 0x50 interfaced with TA12-200
#define ADC_ADDR 0x50
// Join I2c Bus as master
Wire.begin();
// Start serial communication for serial console output
Serial.begin(9600);
}
void loop()
{
// Begin transmission with given device on I2C bus
Wire.beginTransmission(ADC_ADDR);
// Calling conversion result register, 0x00(0)
Wire.write(0x00);
//delay(500);
// Request 2 bytes
Wire.requestFrom(ADC_ADDR, 2);
// Read the bytes if they are available
if(Wire.available() == 2)
{
int msb = Wire.read();
int lsb = Wire.read();
// End transmission and release I2C bus
Wire.endTransmission();
// Calculating value
int rawADC = msb * 256 + lsb;
rawADC = rawADC & 0x0fff;
// Output to the screen
Serial.print("ADC Value : ");
Serial.println(rawADC);
}
else
{
Serial.println("Not enough bytes available on wire.");
}
delay(100);
}
///////////////////////////////////////////////////////////////////////////NOTE///////////////////////////////////////////////////////////////////////////////////////////////////
// These values are in mili amps
// You can also find rms value of current by finding maxinmum reading and divide it by 1.414
Step 5:
For further quires Feel free to visit our site: