View previous topic :: View next topic |
Author |
Message |
ressas
Joined: 15 Nov 2019 Posts: 135
|
|
Posted: Thu Apr 09, 2020 8:50 am |
|
|
Hello again.
I noticed something while reading the Appnotes.
In the circuit I designed, I combined all the electrodes.
https://www.nxp.com/docs/en/fact-sheet/MPR121FS.pdf
I saw the proximity sensing section in the document below.
Combine the electrodes for Mpr03x.
I guess it does not combine the electrodes for mpr121.
Have I got it right ?
Should I combine all electrodes for proximity sensing?
If I am not going to combine, which electrode will I use for prox? |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9113 Location: Greensville,Ontario
|
|
Posted: Fri Apr 10, 2020 5:15 am |
|
|
Curious was I, so I downloaded the datasheet PDF.
In chapter 5.11, Electrode Configuration Registers....0x5E, details the 3 choices available for the ELEPROX_EN config.0+1,10, 0+1+2+3 or all 12 can be used.
I'm sure there are other 'configuration' details.
Hope this helps.
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19225
|
|
Posted: Fri Apr 10, 2020 6:40 am |
|
|
and presumably since he refers to 'proximity' he is using the 13th
'simulated' electrode value, which combines the results from the 12
physical electrodes.
I realise looking at what was said, you may be misunderstanding what
the chip 'does'. The actual electrode reading _will_ drift. The baseline
filter adjusts the value this is compared with for the touch detection
event. The value from the sample register needs the baseline value
subtracted from it.
The threshold for touch detection is defined as a 'delta' value from the
corresponding 'baseline' value. The internal comparison subtracts the
baseline from the reading, and if this is greater than the programmed
touch threshold a 'touch' is signaled. If you want to directly read the
reading and work with it, you need to be subtracting the baseline yourself.
Look at figure 5 in the data sheet, which shows how the reading and
baseline will vary, and how the two 'threshold' values track the baseline
and are then used for touch/release detection. |
|
|
ressas
Joined: 15 Nov 2019 Posts: 135
|
|
Posted: Fri Apr 10, 2020 12:35 pm |
|
|
Thank you. For the first time in my life, I read a datasheet from start to finish. As you said, it uses baseline data to compare it.
However, I could not understand;
how will electrode connections be hardware?
All will be separate for Touch applications.
But for proximity, is the value of the 13th channel the average of the capacitance value measured by all electrodes?
In the proximity section of datasheet;
What does "electrode combining" want to tell ?
https://www.nxp.com/docs/en/fact-sheet/MPR121FS.pdf |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19225
|
|
Posted: Sat Apr 11, 2020 1:19 am |
|
|
OK.
First thing. The sensitivity of capacitive sensing solutions, is massively
affected by the design of the electrodes. Good electrode design can easily
quadruple the sensitivity. Also the design affects the ability to ignore things
in different directions, and discriminate between different pads. National
(nxp), do a very good design guide AN3863, and Microchip also have a
guide (AN2934).
Generally:
Keep the tracks to the pads thin.
Ground plane under the pads allows you to stop sensing in this direction,
but must be a hatched plane, not a solid plane or sensitivity will plummet.
If you are sensing 'fingers', having the pad reasonably finger shaped will help.
Keep pads a good distance apart.
Then on the question:
" is the value of the 13th channel the average of the capacitance value measured by all electrodes?".
The manufacturer very carefully does not say 'how' this signal is actually
generated. It says it is combined from the 12 physical electrodes, but
not what actual method of combination is used. It talks as if the electrical
multiplexer is switched so all 12 electrodes are connected in parallel
when this reading is made. So not the 'average', but the 'sum'. Means
it'll be less sensitive to an individual electrode's change, but will be quite
good for detecting when something is close enough to the electrodes to
potentially be triggering a reading. |
|
|
ressas
Joined: 15 Nov 2019 Posts: 135
|
|
Posted: Sat Apr 11, 2020 1:32 pm |
|
|
Hmm. I learned useful information in your answer.
I will read the appnotes. Instead of merging 12 channels, I think to divide a circle into 12 parts.
So there will be very close measurement values.
Then, I increase the distance between the electrodes and make different experiments.
I'll let you know the result.
Thank you |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9113 Location: Greensville,Ontario
|
|
Posted: Sun Apr 12, 2020 4:48 am |
|
|
Great,,, now I'm wondering if I can make a PIC based Theramin....(old Space movie music machine).
Seems 'simple' enough.. cap sensors, generate frequency and volume, DAC output.
Yet another pet PIC project I don't have time for....
It'd be a good' term projec't for a student though.... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19225
|
|
Posted: Sun Apr 12, 2020 6:02 am |
|
|
Yes.
I did a basic one a couple of years ago.
Having built a 'real' one perhaps forty years ago, it was a 'I wonder how
good this would be' experiment. It was quite a bit smaller than the older one,
but worked fairly well. |
|
|
ressas
Joined: 15 Nov 2019 Posts: 135
|
|
Posted: Sun Apr 12, 2020 8:12 am |
|
|
It was the first time I heard the word Theremin.
I listened to Youtube.
https://www.youtube.com/watch?v=K6KbEnGnymk
A magical voice.
Ttelmah , temtronic and PCM programmer.
I have a lot to learn from masters like you.
How about sharing your experiences with us on a platform like youtube?
You are of course very helpful in this form.
But Youtube would be nice to be systematic.
Even I am trying to explain something on youtube with little knowledge.
Masters like you will share much more useful information.
Experience is the biggest heritage.
|
|
|
ressas
Joined: 15 Nov 2019 Posts: 135
|
|
Posted: Fri May 01, 2020 12:36 am |
|
|
Hello there. I failed my trials.
I couldn't prevent the value from slipping.
I wonder if I heat the PCBs in my oven for a few hours. Can you guarantee it won't slip? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19225
|
|
Posted: Fri May 01, 2020 12:49 am |
|
|
No.
The point is you need to write the code to correct for this. If the filter is
setup correctly, the baseline value (which is 1/4 the size of the rest of
the readings), will adjust. You then need to take your reading, and
subtract this baseline(*4), to give the reading you use. The 'raw'
(uncorrected) reading is _going_ to drift.
The chip does this itself if you use the comparators, but not for the
raw reading which you are trying to use. |
|
|
ressas
Joined: 15 Nov 2019 Posts: 135
|
|
Posted: Tue May 05, 2020 12:15 am |
|
|
Can you explain what you are saying with the algorithm example?
A similar algorithm is given in the link below.
https://e2e.ti.com/blogs_/b/analogwire/archive/2015/11/23/capacitive-sensing-simple-algorithm-for-proximity-sensing
I could not fully apply this algorithm to the C language.
The reason for this was that absolute value (abs) ccs c does not work.
I examined the corrections related to abs issue in the form. But it didn't work exactly.
I guess it will help me if you express the processes you said by algorithm.
My algorithm was as follows;
When there is an object; value = 240
if (value <= 240)
printf (object exists)
else if (value> 240)
printf (no object)
Then, as I understand from the link above, it is wrong to reference a fixed value.
Instant changes should be taken as reference. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19225
|
|
Posted: Tue May 05, 2020 1:27 am |
|
|
CCS's ABS function works fine, has done for perhaps 10 years....
Remember the incoming numbers need to be signed, or floats.
Also you have to include <stdlib.h>.
The point is that you need to read the baseline value, and use this
to set the levels that you test against, or subtract it from the raw reading.
Think of it like trying to measure the height of the mast of a ship at sea.
If you are measuring the height using something like GPS, to actually
get the 'height' of the mast, you have to subtract the sea level height
when you measure. This is the baseline reading the chip returns. The
baseline should be moving to match the actual changes you are seeing.
As already said though 'beware' that the baseline is 1/4 the other
readings, so needs to be multiplied by four before use. |
|
|
ressas
Joined: 15 Nov 2019 Posts: 135
|
|
Posted: Tue May 05, 2020 2:58 am |
|
|
Yes, I tried the variables again by "signed" and I saw that the abs function is working. Maybe I should leave this job because I don't even know the basic C rules.
And thankyou.
I bought the code I wrote from the appnote below.
So I think it's unlikely that there will be an error in my code.
https://www.nxp.com/docs/en/application-note/AN4600.pdf
The values I get are as follows;
value = 230 => object detected
value = 240 => none object
Value shift(The value changes by itself when there is no change in the environment.)
new value now;
value = 240 => object detected
value = 250 => none object
a few minutes
Value shift(The value changes by itself when there is no change in the environment.)
value = 230 => object detected
value = 240 => none object
this loops repeats.
therefore, it is perceived as if there is an object without being detected. When there is an object, it is perceived as an object. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19225
|
|
Posted: Tue May 05, 2020 3:15 am |
|
|
That is why you need to use the baseline value.
This will shift to correct for the drift. That it what is there for.
The detector itself if you use it's switch output includes the baseline
in it's workings (the comparator works from this). If you want to read the
values directly, you need to take the baseline reading as well, and subtract
this to get the value to use.....
The baseline values are 8bit values stored in E0BV to E12BV.
read the ones for the channels you are using, multiply by 4 (remember
need to be in int16 variables for this), and subtract these from the
channel reading. The result is what you should be looking at.
It'll still drift around a little, but probably only a very few counts.
(How well it tracks is dependant on the settings being right). |
|
|
|