zharijs / fdc2214 Goto Github PK
View Code? Open in Web Editor NEWTi FDC2112, FDC2114, FDC2212 and FDC2214 capacitative sensor library for Arduino
License: The Unlicense
Ti FDC2112, FDC2114, FDC2212 and FDC2214 capacitative sensor library for Arduino
License: The Unlicense
I appreciate your uploading the library of FDC2214.
This is very nice and we can make some interesting gadgets with FDC2214 and your library.
I am sorry, but I have a small question.
How to get the data of ch2 and ch3?
I changed two parts as;
(1)"capsense.begin(0xF, 0x4, 0x5)"
(2)"#define CHAN_COUNT 4 "
But the value of ch1, ch2 and ch3 show same value.
////////////////////
FDC2x1x test
Sensor OK
15500397, 15085240, 15085240, 15085240
15502770, 15085022, 15085022, 15085022
15503196, 15084950, 15084950, 15084950
15503481, 15084928, 15084928, 15084928
15503504, 15084836, 15084836, 15084836
15503656, 15084807, 15084807, 15084807
////////////////////
Is there any method to get data of ch2 and ch3 ?
I think which is because of multiple while !Wire.available() statement - which keep looping endlessly in various read functions.
Can someone please investigate this and suggest a fix. if coding help is needed, am happy to support - but will need guidance on how to do that here
Hello everybody,
maybe this is the wrong place to ask for such a topic. Sorry in advanced if so.
What needs to be changed to use the libary on a esp32?
Best regards
Hello!
Has anyone tested this on the FDC2112?
I've connected FDC2112 to an Arduino as follows:
Arduino | Level shifter | FDC2112
5V ---| HV LV |--- 3.3V
3.3V ---|---------------|-'
GND ---| GND GND |--- GND
A4 ---| HV1 LV1 |--- SDA
A5 ---| HV2 LV2 |--- SCL
I've run testFDC-Serial.ino
:
FDC2214/examples/testFDC-Serial/testFDC-Serial.ino
Lines 48 to 68 in 8dc2368
with the following modifications:
Uncomment
This results in the 2 channels only ever transmitting 0s. Setting intOsc
to true on line 48 results in channel 0 transmitting 40000 , 30000, or 20000 (I am using this skin capacitance sensor (schematic)).
This is obviously a very low resolution, much less than the advertised 12 bits. I've tried changing the MSB address, but unfortunately all values between 0x00-0x07 are just FFFs (i.e. channel 0 transmits FFF0000 for FDC2214_DATA_CH0_MSB being set to any of 0x00-0x07).
I have read your notes, but if you want to make the code better, there are some issues with the usage of the Wire library.
There is no need to wait after a Wire.requestFrom().
A Wire.requestFrom() should not be followed by a Wire.endTransmission().
Explanation: Common-mistakes, number 1 and 2.
See also my explanation of the functions.
When reading 32 bits, you do a Wire.request() for only 2 bytes.
Reading 16 bits could be like this:
// Read 2 byte from the FDC at 'address'
uint16_t FDC2214::read16FDC(uint16_t address) {
uint16_t data = 0; // default zero
Wire.beginTransmission(_i2caddr);
Wire.write(address);
Wire.endTransmission(false); //restart
Wire.requestFrom(_i2caddr, (uint8_t) 2);
if (Wire.available() == 2) {
data = Wire.read();
data <<= 8;
data |= Wire.read();
}
return data;
}
Reading 32 bits could be like this:
// Read 4 bytes from the FDC at 'address'
uint32_t FDC2214::read32FDC(uint16_t address) {
uint32_t retVal = 0;
Wire.beginTransmission(_i2caddr);
Wire.write(address);
Wire.endTransmission(false);
Wire.requestFrom(_i2caddr, (uint8_t) 4); // read 4 bytes
if (Wire.available() == 4) {
retVal |= (uint32_t) Wire.read() << 24;
retVal |= (uint32_t) Wire.read() << 16;
retVal |= (uint32_t) Wire.read() << 8;
retVal |= (uint32_t) Wire.read();
}
return retVal;
}
The extra variable "data" is not needed. If there are four bytes available, the Wire.read() returns a signed integer with a value of 0 to 255. It is never -1 when only those four (available) bytes are read.
I followed the example code, but it didn't work, so I'm sending you an email.
Hi, i am using this for FDC2112 , not 2212. Need a couple of clarifciations :-
Reason for the query is that while i am getting data back, the values are way to high, and not corresponding to the resonant frequency expected.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.