Interfacing ADC121C With Arduino Nano(I2C)
by Dcube Tech Ventures in Circuits > Arduino
2960 Views, 0 Favorites, 0 Comments
Interfacing ADC121C With Arduino Nano(I2C)
Hello,
Good Greetings..!!
Today I (Somanshu Choudhary) on the behalf of Dcube tech ventures going to control ADC121C device using Arduino , it is one of the applications of I2C protocol to read analog data via Arduino.
Overview
- ADC121C021 is a I2C-Compatible10-Bit Analog-to-Digital convertor
- DATASHEET Link: http://www.ti.com/lit/ds/symlink/adc121c021.pdf
- This project measure voltage ranging from (1v to 5v)
What You Need / Links
- Arduino Nano Link:https://store.arduino.cc/
- I²C Shield for Arduino Nano Link:https://www.controleverything.com/content/I2C-Mast...
-
1-Channel 12-Bit Analog to Digital Conversion Link:https://www.controleverything.com/content/Analog-D...
-
USB Cable Type A to Micro Type B 6 Feet Long Link:https://www.controleverything.com/content/USB-Cabl...
- I²C Cable Link:https://www.controleverything.com/content/I2C-Cabl...
- Battery max upto 5 volts
Circuit Diagram
Programming
ARDUINO CODE :
#include
void setup() {
// I2C address of the ADC121C021
#define ADC_ADDR 0x50
// Join I2C Bus as master
Wire.begin();
// Start serial communication and set baud rate Serial.begin(9600); }
void loop()
{
// Begin transmission with given device on I2C bus
Wire.beginTransmission(ADC_ADDR);
// Calling conversion result register, 0x00 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();
// Converting value
int rawADC = msb * 256 + lsb;
rawADC = rawADC & 0x0fff;
double volt = rawADC * 5.0 / 4096.0;
// Output to the screen
Serial.print("volt Value : ");
Serial.println(volt);
}
else
{
Serial.println("Not enough bytes available on wire.");
}}
For further quires Feel free to visit our site: