cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

New Contributor

Hello PSoC developers!

I am using PSoC 5LP (devkit) and I would like to implement a proximity sensor that returns '1' when a finger threshold is reached, e.g. signal value of 100. 

This value 100, which is derived from the raw signal and the baseline value, is stored in sensorSignal array.

I have noticed that the sensorSignal is used in CapSense_CheckIsSensorActive(uint8 sensor) function, which I use to check if the finger threshold has been reached. During debugging I have noticed that sensorSignal is always 0, even though the raw data and the baseline are correctly measured and updated.

My questions are:

How does the CapSense_CheckIsSensorActive ever return '1' when the sensorSignal only gets updated when a baseline is updated (accroding to datasheet of CapSense component)? 

In general, how does one obtain a flag ('0' or '1') when the finger threshold has been reached?

Best regards,

Matija.

 

0 Likes
Reply
1 Solution
Moderator
Moderator

Hi @matvarg

 

In CapSense, it is only raw counts that are measured by the CapSense hardware. Everything else has to be firmware processed. And for this, it is mandatory to call the UpdateSensorBaseline  or UpdateEnabledBaselines for the firmware to process the signal level, baseline updates etc. 

 

Just so that I cover all the approaches, you can do the functionality of UpdateSensorBaseline  on your own as well. In the picture shared in my first response, you can see the implementation of this signal calculation. You can do this in your application firmware, but it adds complexity which is not necessarily required. 

 

Also, note that auto-tune will only configure the hardware and firmware parameters. You still need to call UpdateSensorBaseline for the raw counts to be processed even if you use auto tune.

 

Best regards, 
Hari

View solution in original post

0 Likes
Reply
5 Replies
Moderator
Moderator

Hi @matvarg

 

The signal value is only updated if the raw count is greater than the baseline by a factor greater than noise threshold. That is, RawCount - Baseline > Noise Threshold for the signal values to be updated. You can check the CapSense_CSD_UpdateSensorBaseline API for this logic. 

Harigovind_0-1610512024411.png

 

You can use the CapSense_CSD_CheckIsSensorActive API to get a status of 1 or 0 based on the signal level. The signal level must be greater than finger threshold + hysteresis for this API to return 1, indicating that the sensor is active.

 

Best regards, 
Hari

0 Likes
Reply
New Contributor

Thank you for the answers @Hari!

I am currently using the CheckIsSensorActive function to check if there is a finger touch and it is always returning zero (due to the missing sensorSignal update that we discussed above).

I am not sure if I want to call UpdateSensorBaseline just to get the sensorSignal updated. It doesn't make sense to me. Another remark, using Auto Tune option would be my last option because I need to have the baseline value under control. 

How would you get the CheckIsSensorActive function to return '1' when finger is touching the sensor (without Auto Tune) ?

0 Likes
Reply
Moderator
Moderator

Hi @matvarg

 

In CapSense, it is only raw counts that are measured by the CapSense hardware. Everything else has to be firmware processed. And for this, it is mandatory to call the UpdateSensorBaseline  or UpdateEnabledBaselines for the firmware to process the signal level, baseline updates etc. 

 

Just so that I cover all the approaches, you can do the functionality of UpdateSensorBaseline  on your own as well. In the picture shared in my first response, you can see the implementation of this signal calculation. You can do this in your application firmware, but it adds complexity which is not necessarily required. 

 

Also, note that auto-tune will only configure the hardware and firmware parameters. You still need to call UpdateSensorBaseline for the raw counts to be processed even if you use auto tune.

 

Best regards, 
Hari

View solution in original post

0 Likes
Reply
New Contributor

Hi @Hari,

Thank you very much for the clarifications. Following your suggestion, I will most likely implement my own update of the sensorSignal array because the update of the baseline is not desired.

If some Cypress API developers are reading this: It would be nice to have just the UpdateSensorSignal function without changing the baseline 🙂

Best regards, 

Matija. 

0 Likes
Reply
Moderator
Moderator

Hi @matvarg

 

If your requirement is just to maintain a constant baseline, you can achieve so by setting a very low value to noise threshold.

The way CapSense firmware works is that the baseline is updated only if the rawcounts - baseline (signal level) is less than the noise threshold so that any constant noise sources or environment effects are cancelled out by the baseline update. 

 

Best regards, 
Hari