Introduction: Interfacing ADC121C With Arduino Nano(I2C)

About: We are a group of makers. We work in IoT, IOS app, android app, embedded design, sensor design, raspberry pi, arduino, beaglebone, particle electron, particle photon, Bluetooth.

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.

Step 1: Overview

  1. ADC121C021 is a I2C-Compatible10-Bit Analog-to-Digital convertor
  2. DATASHEET Link: http://www.ti.com/lit/ds/symlink/adc121c021.pdf
  3. This project measure voltage ranging from (1v to 5v)

Step 2: What You Need / Links

  1. Arduino Nano Link:https://store.arduino.cc/
  2. I²C Shield for Arduino Nano Link:https://www.controleverything.com/content/I2C-Mast...
  3. 1-Channel 12-Bit Analog to Digital Conversion Link:https://www.controleverything.com/content/Analog-D...

  4. USB Cable Type A to Micro Type B 6 Feet Long Link:https://www.controleverything.com/content/USB-Cabl...

  5. I²C Cable Link:https://www.controleverything.com/content/I2C-Cabl...
  6. Battery max upto 5 volts

Step 3: Circuit Diagram

Step 4: 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.");

}}

Step 5:

For further quires Feel free to visit our site:

www.dcubetechnologies.com