Page 4
Disclaimer For physical injuries and possessions loss caused by those reasons which are not related to product quality, such as operating without following manual guide, natural disasters or force majeure, we take no responsibility for that. Under the supervision of Seeed Technology Inc., this manual has been compiled and published which covered the latest product description and specification.
1. Introduction Grove - I2C ADC is a 12-bit precision ADC module based on ADC121C021. It helps you increase the accuracy of value collected from analog sensor by providing a constant reference voltage. Because its address is changeable, you can use up to 9 I2C ADC at the same time at most. At the other hand, this module provides auto sleep function which lowers the power consumption considerably.
4. Interface functions J1: used to connect Arduino IIC Interface as Grove - I2C ADC output interface. J2: used to connect analog sensor as Grove - I2C ADC input interface. U1: ADC121C021 IC, 12-Bit Analog-to-Digital Converter The black line area is used to set the IIC address. ADDR0 and ADDR1 are shipped connected to L. You can change them to "H"...
5. Usage With Arduino Grove - I2C ADC has two interfaces: input socket (J2) and output socket (J1). Connect an analog sensor to its input socket and connect the I2C ADC to Arduino or Seeeduino also via Grove cables. Take Grove - Gas Sensor as an example, and now we learn how to read sensor data using Grove - I2C ADC. The hardware installation should be like this: Now you can read the gas sensor value using the code below.
Page 10
#define REG_ADDR_CONVH 0x07 unsigned int getData; float analogVal=0; // convert void init_adc() Wire.beginTransmission(ADDR_ADC121); // transmit to device Wire.write(REG_ADDR_CONFIG); // Configuration Register Wire.write(0x20); Wire.endTransmission(); void read_adc() //unsigned int *data Wire.beginTransmission(ADDR_ADC121); // transmit to device Wire.write(REG_ADDR_RESULT); // get result Wire.endTransmission(); Wire.requestFrom(ADDR_ADC121, 2); // request 2byte from device delay(1);...
Page 11
delay(50); In the code above, we defined the Vref as 3.0V which is decided by the I2C ADC module. This reference voltage is more accurate than one generated by microcontroller. And you can make that more accurate by measuring the voltage between VA and GND and use that value to replace 3.00 in the code above. Now you can upload the code.
With Beaglebone Green To begin editing programs that live on BBG, you can use the Cloud9 IDE. As a simple exercise to become familiar with Cloud9 IDE, creating a simple application to blink one of the 4 user programmable LEDs on the BeagleBone is a good start. If this is your first time to use Cloud9 IDE, please follow this link.
Page 13
i2c.write8(REG_ADDR_CONFIG, 0x20) read_adc(self): "Read ADC data 0-4095." data_list = i2c.readList(REG_ADDR_RESULT, 2) #print 'data list', data_list data = ((data_list[0] & 0x0f) << | data_list[1]) & 0xfff return data __name__ == '__main__': # Connect the Grove - I2C ADC to I2C Grove port of Beaglebone Green. = I2cAdc() while True:...
6. Reference I2C Address Setting The ADC I2C has a seven-bit hardware address which is decided by ADR0 and ADR1. ADR0 and ADR1 are connected to L inside the board as default. But you can change it. For example, use a knife to cut off the connection between L and ADR0(as the picture shown below), then you make the state of ADR0 into Floating(connected to nothing).
* The Gas Sensor detect the related Gas density, * Arduino get the result by analogread. the gas Density is * 0~1, larger the output is, the denser the gas. * Connect the Sensor to A0 in this demo; * By: http://www.seeedstudio.com #define Vref 4.95 void setup() {...
Page 16
Serial.begin(9600); void loop() { float vol; sensorValue = analogRead(A0); vol=(float)sensorValue/1023*Vref; Serial.print("The sensorValue is "); Serial.println(sensorValue); Serial.print("The analog value is "); Serial.print(vol); Serial.println("V"); delay(100); The result is: As default, Vref is generated by Arduino which is theoretically 5V. But actually that is a value afloat which results the deviation of the final data.
Page 17
To contrast, in the same condition, sensor values collected by the circuit with Grove - I2C ADC in the scope is shown below: In order to find out which result is more close to the actual condition, here we use a multimeter to measure the voltage between the pin SIG and pin GND of the sensor.
Need help?
Do you have a question about the Grove-I2C ADC and is the answer not in the manual?
Questions and answers