Hi ,
We are using the MPR121 for proximity sensor. One big electrode is connected to ELE0 of MPR121 for touch sensing.
The configuration works good but sometimes (usually 5-6 times during a day) we get wrong touch detection (touch detection occurs without touching the electrode).
The configurations of the registers are taken from application note AN3893.
Are we doing something wrong?
Thank you for your help
Regards,
Dima.
void ProxInit()
{
//Reset MPR121 if not reset correctly
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x80,0x63); //Soft reset
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x5E,0x00); //Stop mode
//touch pad baseline filter
//rising
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x2B,0x01); //0xFF// MAX HALF DELTA Rising
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x2C,0x01); //0xFF// NOISE HALF DELTA Rising
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x2D,0x00); // NOISE COUNT LIMIT Rising
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x2E,0x00); // DELAY LIMIT Rising
//falling
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x2F,0x01); // MAX HALF DELTA Falling
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x30,0x01); // NOISE HALF DELTA Falling
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x31,0xFF); // NOISE COUNT LIMIT Falling
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x32,0x02); // DELAY LIMIT Falling
//touched
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x33,0x00); // Noise half delta touched
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x34,0x00); // Noise counts touched
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x35,0x00); //Filter delay touched
//Touch pad threshold
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x41,200); // ELE0 TOUCH THRESHOLD
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x42,190); // ELE0 RELEASE THRESHOLD
// Debounce Register
DebounceNumberTouch = 0;
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x5B,DebounceNumberTouch);
//AFE configuration
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x5D,0x04);
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x5C,0xC0);
//Auto configuration
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x7B,0xCB);
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x7D,0xE4);
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x7E,0x94);
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x7F,0xCD);
//GPIO for LED's configuration
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x73,0x0F); //GPIO Control 0
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x74,0x0F); //GPIO Control 1
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x76,0x0F); //GPIO Direction
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x77,0x0F); //GPIO Enable
Elec_Config_Prox_Reg = 0x91;
I2C_ByteWrite(PROX_I2C_COMPONENT_ADDR,0x5E,Elec_Config_Prox_Reg);
}
Dear Jose,
Thank you for the reply.
What we have seen is that right now, our threshold is actually 0, that is any change, will result in detection.
We have also checked and found that in our mechanical setup, we actually detect a touch with just a difference of 1, so we actually need the 0 threshold.
We use the auto calibraion and baseline filter.
1) The question is if there is anything we can do in order to make the sensitivity better, perhaps tweaking some of the parameters manually.
2)Also, Please advise if we are using the baseline filter correctly. perhaps for our use we can use it in a better way..
Best Regards,
Dima.
Hi Dima,
For your first question, sensitivity of the MPR121 is relative to the capacitance range being measured. Given the ADC value, current and time and settings capacitance can be calculated, please take a look at page 3 of the Application Note AN3889 for more details: www.nxp.com/files/sensors/doc/app_note/AN3889.pdf
And for the second question, baseline configuration seems to be correct, but if you want to test with another configuration, I can share a portion of the initialization cade that I use for my typical tests:
//touch pad baseline filter
//rising
IIC_ByteWrite(0x2B,0x01); // MAX HALF DELTA Rising
IIC_ByteWrite(0x2C,0x01); // NOISE HALF DELTA Rising
IIC_ByteWrite(0x2D,0x0E); // NOISE COUNT LIMIT Rising
IIC_ByteWrite(0x2E,0x00); // DELAY LIMIT Rising
//falling
IIC_ByteWrite(0x2F,0x01); // MAX HALF DELTA Falling
IIC_ByteWrite(0x30,0x05); // NOISE HALF DELTA Falling
IIC_ByteWrite(0x31,0x01); // NOISE COUNT LIMIT Falling
IIC_ByteWrite(0x32,0x00); // DELAY LIMIT Falling
//touched
IIC_ByteWrite(0x33,0x00); // Noise half delta touched
IIC_ByteWrite(0x34,0x00); // Noise counts touched
IIC_ByteWrite(0x35,0x00); // Filter delay touched
Have a great day,
Jose
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Dima,
I don’t think that you are doing something wrong, the configuration that you sent seems to be correct and since the system works good (but sometimes), I assume that the HW configuration is correct.
What I think that you can do to avoid these undesired touch detection, is, since big electrodes are more sensitive, you may need to adjust the touch/release thresholds. Make some test by increasing the thresholds to a level that works for the touch detection of your system, but avoids undesired touches.
Have a great day,
Jose
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------