Library for Texas Instruments FDC2xxx family capacitative sensor front-ends.
- FDC2112
- FDC2114
- FDC2212
- FDC2214
- 1.0 - 1 - Initial release
- 1.1 - 1 - Fixed channel 2 and 3 support.
- 1.1 - 2 - Added support for internal oscillator. Not reccomended for any fairly precise aplication.
- 1.2 - 1 - RJH - Removed redundent code and applied one recommended update
Include header, Make instance, Init and acquire data.
#include "FDC2214.h"
FDC2214 capsense(FDC2214_I2C_ADDR_0); // Use FDC2214_I2C_ADDR_1 for ADDR = VCC
...
void setup() {
...
Wire.begin();
bool capOk = capsense.begin(0x3, 0x4, 0x5, false); //setup first two channels, autoscan with 2 channels, deglitch at 10MHz, use external oscillator
...
}
void loop(){
...
unsigned long capa[i] = capsense.getReading28(i);
...
}
FDC2xxx family is 3.3V powered, unlike most of Arduinos, that are powered form 5V. To use this chip with Arduino, you will have to either:
- use 3.3V version of Arduino, like Arduino Pro Mini 8MHz 3.3V
- use I2C level shifter to interface the FDC chip with arduino.
To run examples, connect FDC with arduino as follows:
- ARDUINO <--> FDC
- A4 <-------> SDA
- A5 --------> SCL
- GND -------> ADR
- GND -------> SD
To view nice real-time graph of the sensor output, it is highly recommended to use tool like SerialPlot. https://github.com/hyOzd/serialplot
#Have Fun