MKW30Z Capacitive touch TSI pin circuit

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MKW30Z Capacitive touch TSI pin circuit

3,210 Views
lucianfiran
Contributor V

KW40Z_Connectivity_Software_1.0.1 (KSDK_1.3.0); IAR 7.50;

On a MKW30Z requiring one pin for capacitive touch TSI sensing circuit PTC3 muxed to TSI0_CH15

pastedImage_3.png

The TSI plate is not mounted on PCB, but via a small coax cable less than 10 cm to a brass metal knob on the metal case isolated from the case.

pastedImage_2.png

The reference article AN3863: Designing Touch Sensing does not give references for outside pcb sensors.

http://www.nxp.com/assets/documents/data/en/application-notes/AN3863.pdf 

There are some specifications on how to adapt the button ?

Pull-up resistor is required ?

There is a need for additional parallel capacitance ?

16 Replies

2,585 Views
lucianfiran
Contributor V


Tested with different configs:
(R13 pull up to 3.3V, R14 series to input, Cp parallel cap, CPSUY1 Y cap of the power supply)

1------
R13 = np
R14 = 47R
Cp = np
R81 = 0R
CPSUY1 = 2.2nF

2------
R13 = 1meg
R14 = 47R
Cp = np
R81 = 0R
CPSUY1 = 2.2nF

(MPR084 has 780K pull up resistors)

3------
R13 = TS4148-0805 (diode)
R14 = 100R
Cp  = np
R81 = 100R
CPSUY1 = 2.2nF

4------
R13 = np
R14 = 100R
Cp  = 1pF
R81 = 100R
CPSUY1 = 2.2nF

TSI Seems to work ok.

For some location the threshold was increased from 10 to 20. (because of false positives)

It's harder to have only one TSI btn because you can not a good low average, as one channel is sampled.

0 Kudos
Reply

2,585 Views
michael_galda
NXP Employee
NXP Employee

Hi Lucian,

- Regarding the sensitivity tuning, immunity, jitter, etc...

We allready have the Touch Sensing library, which solves all of the issues.

At the first glance, it may be a bit large stack for controlling just single TSI button.

But we have the keydetectors and FreeMASTER running for tuning, which will be beneficial for you.

For the KSDK1.3. Download the version v.1.1.1

http://www.nxp.com/products/software-and-tools/hardware-development-tools/freedom-development-boards...

This is the instalation package containing the examples for Kinetis-L devices. So that the TSI v4 is already supported. But KW30 is not supported so far.

Thanks,

Michael

2,585 Views
michael_galda
NXP Employee
NXP Employee

Hi Lucian,
Sorry for the delay,

Let me study the etails you have provided to me.

Thanks,

Michael

0 Kudos
Reply

2,585 Views
michael_galda
NXP Employee
NXP Employee

Hi Lucian,

regarding the schematic

- Remove the pull-up and the parallel resistor.

These don't have sense for the TSI capacitive method and they can decrease the sensitivity.

R14 is OK and can be increased up to ~500Ohms

I don't know if we need R81

No there is no need for parallel capacitance.

- Sometimes we add this to improve the ESD/EMC immunity (~50pF), but it can decrease the dynamic range / sensitivity.

If the physical electrode size is large (good analog senistivity), you can use it in case of EMC immunity issues.

What I don't like is that you have used the TSI pin neighbouring to the hi-speed SPI_SCK signal. Which can cause some cross-talks.

2,585 Views
lucianfiran
Contributor V

About ESD/EMC immunity (~50pF) parallel capacitor.

(but it can decrease the dynamic range / sensitivity)

What is the range for it ?

A 10pF will have better dynamic range / sensitivity than 50pF ?

0 Kudos
Reply

2,585 Views
michael_galda
NXP Employee
NXP Employee

HI Lucian,

Yes 10pF will be OK. But you can try the 47pF as well (max. value). I guess the physical electrode size is large, so with this large electrode you will get good sensitivity, I hope.

I can see a transil protection diode on the input, which is fine for your application. This can help against the potential ESD discharges.

Regarding the Calibration in the SW.

-Select the most sensitive HW settings, by experiment. This will be fixed.

-In the SW startup, basic calibration has to be done at the beginning. You get a delta signal threshold here.

-But your SW has to track the signal baseline (iddle signal level) during the run time, using the moving average, because it moves a bit during a long time.
The Delta signal (delta between the touched and released state) doesn't change very lot over the time, and it serves as a threshold.

BUT everything is relatively to the Baseline signal which floats over the time.

Thanks,

Michael

2,585 Views
lucianfiran
Contributor V

Hi Michael,

And some extra questions:

There is some how to set these values ?

  /* Set up the HW configuration for normal mode of TSI */
  /* FSL_FEATURE_TSI_VERSION == 4 */
  static const tsi_config_t tsi_HwConfig =
  {
    .ps = kTsiElecOscPrescaler_2div,           /*!< Electrode oscillator frequency divided by 2 */
    .extchrg = kTsiExtOscChargeCurrent_16uA,   /*!< External oscillator charge current is 16uA */
    .refchrg = kTsiRefOscChargeCurrent_16uA,   /*!< Reference oscillator charge current is 16uA */
    .nscn = kTsiConsecutiveScansNumber_8time,  /*!< 8 times consecutive scan */
    .mode = kTsiAnalogModeSel_Capacitive,      /*!< Active TSI capacitive sensing mode */
    .dvolt = kTsiOscVolRails_Dv_029, /*!< DV = 0.29 V; VP = 0.95 V; Vm = 0.67 V */
    .thresh = 100,
    .thresl = 200,
  };

Also about Fig B I see some other references:

pastedImage_4.png

AN0040.pdf 
A series resistor of 100 Ohm - 1 kOhm
A typical resistor value is 1 kΩ, but the value can range from 100 Ω to 10 kΩ

What about Envelope detector techniques ?

Thank you,

Lucian

0 Kudos
Reply

2,585 Views
michael_galda
NXP Employee
NXP Employee

  static const tsi_config_t tsi_HwConfig =
  {
    .ps = kTsiElecOscPrescaler_2div,           /*!< Electrode oscillator frequency divided by 2 */
    .extchrg = kTsiExtOscChargeCurrent_16uA,   /*!< External oscillator charge current is 16uA */
    .refchrg = kTsiRefOscChargeCurrent_16uA,   /*!< Reference oscillator charge current is 16uA */
    .nscn = kTsiConsecutiveScansNumber_8time,  /*!< 8 times consecutive scan */
    .mode = kTsiAnalogModeSel_Capacitive,      /*!< Active TSI capacitive sensing mode */
    .dvolt = kTsiOscVolRails_Dv_029, /*!< DV = 0.29 V; VP = 0.95 V; Vm = 0.67 V */
    .thresh = 100,
    .thresl = 200,
  };

Hi Lucian,

It is a RO (relaxation based) CAP sensing mode. It means that you loading the external oscillator and change its oscillation frequency.

Just a few parameters are important for the basic analog tunning.

-extchrg, is the external current generated on electrode. If this current is DECREASED (weaker oscillator signal), then the sensitivitivity INCREASES, because you can influence this weak signal much easier by the external loading

-refchrg is the internal oscillator reference, INCREASING this current causing internal ref. oscillator ticks on faster frequency. Use 16uA or 32uA for best sensitivity and play with the extchrg to get the appropriate sensitivity.

-ps & nscn are acting as prescaler. If you set larger .ps, then the Accumulation time will be longer, resultiong to the higher accumulated numbers. But be carefull to stay in the 16-bit TSI counter range (65535)

So basically the accumulated counter TSCNT value (SENSITIVITY) will be proportional to the following value:

ExtCap * (refchrg/extchrg) * PS * NSCN < 65535

If you download the NXP TOuch sensing library, you can run the FreeMASTER and watch the signals here.

Then you can play with the sensitivity easily.

Ideally, if you touch, the Delta signal value should be several Thousands of counts, where the signal doesn't attack very high levels, i.e. above the 50.000 counts (To have some reserves for signal offset changes due enviromental changes)

Thanks,

Michael

2,585 Views
michael_galda
NXP Employee
NXP Employee

Hi Lucian,

Can you provide me your company email address, please?

I'd like to share some infor with you directly, outside the community,

Thanks,

Michael

0 Kudos
Reply

2,585 Views
lucianfiran
Contributor V

Hi Michael,

On my layout I can cope with a few topologies like:  Fig A  (R2  0-10R)

pastedImage_1.png

Or can add additional protection to Vcc 3.3

pastedImage_3.png

Or can I fully decouple DC component from touch button ?

pastedImage_4.png

0 Kudos
Reply

2,585 Views
michael_galda
NXP Employee
NXP Employee

Hi Lucian,

My colleague here worked on the similar Reference design here a few years ago.

I will ask him for details, Or if we can share some materials / documents & SW with you.

Thanks,

Michael

0 Kudos
Reply

2,585 Views
lucianfiran
Contributor V

Hi Michael,

My HW circuit looks like this:

pastedImage_1.png

My sensor size is disc 19.45mm diameter; surface 297mm2 - brass.
(~Optimal 15 mm x 15 mm - diagonal 21,213mm; surface 225 mm2)
Sensor traces length to connector 23mm. Coax wire to sensor 150mm.pastedImage_2.png

The sensor is isolated from metal case:

pastedImage_4.png

R2 is to protect from earth injection to gnd.

How should the earth be connected ?

Techniques for Robust Touch Sensing Design | DigiKey 


Main goals keep sensitivities high and noise low.
Sensitivities is inverse proportional to offset (system) capacitance measured by sensor.

I can see some possible SW approaches :

(KSDK demo)
1. after reset, some untouched value (low) can be measured and considered reference avgUntouch,
than the threshold constant (10) is added for the comparing process (avgMeasure > avgUntouch+10).
Here the moving average refers to all active channels.
But I only have one channel.


2. via Bluetooth connection the client could set the threshold constant - like a sensitivity value.

3. via Bluetooth the user can activate a calibration for low (un-touch), then for high (touched)
Then the threshold can be updated to 1/2*(low+high)
( or using the sensitivity  1/sensitivity*(low+high) )

4. Sensitivity is strong correlated to with temperature ? - the chip can measure the temperature.

What about humidity like rainy /sunny days ?

 

5. Also the sampling rate can be varied - 50ms 100ms or 150ms - as we need short push and long push events.

6. threshold hysteresis

7. jittering and filtering ?

Best Regards,

Lucian

0 Kudos
Reply

2,585 Views
michael_galda
NXP Employee
NXP Employee

Lucian,

I understand how the knob is connected and isolated.

What is not clear for me right now is:

- How is the KW30 MCU supplied, what kind of power supply is used?

- Is there a trafo / capacitive power supply or switching power supply with isolating transformer used?

In other words, is that galvanically isolated from the mains / hot line?

0 Kudos
Reply

2,585 Views
lucianfiran
Contributor V

In this app - the MKW30Z is supplied via SMPS AC/DC convertor, there is no battery.

There is galvanic isolation from mains.

There is a 2.2nF Y capacitor for grounds separation ESD flow (AC GND -> 3.3V logic GND)

0 Kudos
Reply

2,585 Views
lucianfiran
Contributor V

Hi Michael,

Ok R13 will not be mounted.

R81 should act like a fuse 1R ~ 10R  (protect for external ESD injection)

The environment is quite nosy - did not have any other better choice -

we use all pins of the MKW30Z (has less fewer pins than MKW40Z ...)

pastedImage_1.png

Yes the physical electrode size is large made of brass, isolated from metal head.

(like a brass knob)

pastedImage_4.png

A coax wire is use between the knob and PCB.

R14 and R18 can changed to capacitors so the knob is decoupled by the circuit ?

Thank you,

Lucian.

0 Kudos
Reply

2,585 Views
lucianfiran
Contributor V

Parallel resistor is actually not mounted and was planed as a pad for a parallel capacitor.

0 Kudos
Reply