The MCP3421 ADC can be used for various high accuracy analog-to-digital data conversion applications where ease of use, low power consumption and small footprint are major considerations.The MCP3421 is a single channel low-noise, high accuracy delta-sigma A/D converter with differential inputs and up to 18 bits of resolution in a small SOT-23-6 package.
The on-board precision 2.048V reference voltage enables a differential input range of ±2.048V. The device uses a two-wire I2C™ compatible interface and operates from a single power supply ranging from 2.7V to 5.5V. The MCP3421 ADC performs conversions at rates of 3.75, 15, 60 or 240 samples per second with corresponding resolutions of 18, 16, 14 and 12 bits. The onboard programmable gain amplifier (PGA) provides gain up to 8x. The device has two conversion modes: Continuous mode and One-Shot mode. In One-Shot mode, the device enters a low current standby mode automatically after a conversion, greatly reducing power use.
-
- 18-bit resolution
- Small 6-lead SOT-23 packaging
- Differential input operation
- On-board voltage reference with 5 ppm/°C drift
- On-board PGA, gains of 1, 2, 4, 8
- Programmable data rate options
- 3.75 SPS (18 bits)
- 15 SPS (16 bits)
- 60 SPS (14 bits)
- 240 SPS (12 bits)
- INL 10 ppm of FSR max
- Low current consumption, 145 µA at 3V
- One-shot or continuous conversion options
- Supports I2C™ serial interface
- Extended temperature range: -40°C to +125°C
Parts List
Connection
Its an I2C device – I connected the VIN- to Gnd and Vin+ to Pin 6
Arduino Due | VEML6040 module |
3v3 | Vcc |
Gnd | Gnd |
SDA – 20 | SDA |
SCL – 21 | SCL |
Code
You need to download and install the following library – https://github.com/uChip/MCP342X
[codesyntax lang=”cpp”]
// Include libraries this sketch will use #include <Wire.h> #include <MCP342X.h> // Instantiate objects used in this project MCP342X myADC; int outputPin = 6; void setup() { Wire.begin(); // join I2C bus TWBR = 12; // 400 kHz (maximum) Serial.begin(9600); // Open serial connection to send info to the host while (!Serial) {} // wait for Serial comms to become ready Serial.println("Starting up"); Serial.println("Testing device connection..."); Serial.println(myADC.testConnection() ? "MCP342X connection successful" : "MCP342X connection failed"); myADC.configure( MCP342X_MODE_CONTINUOUS | MCP342X_CHANNEL_1 | MCP342X_SIZE_16BIT | MCP342X_GAIN_1X ); Serial.println(myADC.getConfigRegShdw(), HEX); } // End of setup() void loop() { static int16_t result; for(int i=0; i<=255; i++) { myADC.startConversion(); analogWrite(outputPin, i); myADC.getResult(&result); Serial.print(i); Serial.print(" "); Serial.print(result); Serial.print(" "); Serial.println(result, HEX); } } // End of loop()
[/codesyntax]
link
Datasheet – http://ww1.microchip.com/downloads/en/DeviceDoc/22003e.pdf