Giter Club home page Giter Club logo

fdc2214's People

Contributors

rharrison avatar zharijs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

fdc2214's Issues

How to get the data of ch2 and ch3?

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 ?

the data is always 0

Hello. I attached my FDC2214 to an arduino UNO or Leonardo, but it both couldn't work properly. In serial monitor, it shows 'Sensor OK' but the numbers it read are always "0,0,0,0"๏ผŒ what's the matter?
image

call of library blocks in case of issues with i2c

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

Suitable for ESP32?

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

Using with FDC2112, 1st channel transmits only 0x40000, 0x30000 and 0x20000

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:

// bool capOk = capsense.begin(0x3, 0x4, 0x5, false); //setup first two channels, autoscan with 2 channels, deglitch at 10MHz, external oscillator
// Start FDC2214 with 4 channels init
bool capOk = capsense.begin(0xF, 0x6, 0x5, false); //setup all four channels, autoscan with 4 channels, deglitch at 10MHz, external oscillator
// Start FDC2214 with 4 channels init
// bool capOk = capsense.begin(0xF, 0x6, 0x5, true); //setup all four channels, autoscan with 4 channels, deglitch at 10MHz, internal oscillator
if (capOk) Serial.println("Sensor OK");
else Serial.println("Sensor Fail");
}
// ### Tell aplication how many chanels will be smapled in main loop
#define CHAN_COUNT 4
// ###
void loop() {
unsigned long capa[CHAN_COUNT]; // variable to store data from FDC
for (int i = 0; i < CHAN_COUNT; i++){ // for each channel
// ### read 28bit data
capa[i]= capsense.getReading28(i);//
// ### Transmit data to serial in simple format readable by SerialPlot application.
Serial.print(capa[i]);

with the following modifications:

Uncomment

// bool capOk = capsense.begin(0x3, 0x4, 0x5, false); //setup first two channels, autoscan with 2 channels, deglitch at 10MHz, external oscillator

Comment out
bool capOk = capsense.begin(0xF, 0x6, 0x5, false); //setup all four channels, autoscan with 4 channels, deglitch at 10MHz, external oscillator

Change 4 to 2
Change 28 to 16
capa[i]= capsense.getReading28(i);//

Add HEX argument to print to see what's happening more clearly:

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).

Usage of Wire library.

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.

Claification on data returned using getReading16()

Hi, i am using this for FDC2112 , not 2212. Need a couple of clarifciations :-

  1. Does the getReading16 function return 12 MSBs of the result, or all 16 bits.
  2. What is the conversion required to changed the result to Capacitance value at the sensor assuing internal oscillator frequecy of 43.4 Mhz

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.