18M2 touch, details wanted/given

KTarke

Senior Member
18M2 touch, details wanted/given, SOLVED SENSORING LIQUID/DRY MATERIAL

Just got my first M2 chips, and had afew hours to experiment with touch sensors.
Seems promising, that the chip could sense also "more difficult" objects, than human parts...
My project is to sense level of non-conductive, dry material (wood pellets). First tests with different kinds of sensorplates showed,that wood can be sensed. Even managed to put sensors on 50cm cables (getting only slight changes in readings, when cables were touched!)
I will soon share, what I found out,with pictures.

But in the meanwhile... could the Techs enlighten, what can be "done" with the values in the "touch 16 configuration byte"?
I red many Microchip datasheets and appnotes, but did not find an answer there... (or did not undestand :confused: )
Oscillation count and counter prescalar were not explained, and appnote 1171 says about oscillator range, that "designer must decide"...
It would be nice to know, how those three things affect the sensitivity.
 
Last edited:

westaust55

Moderator
From the little reading I have done the M-touch feature is possibly more orientated to sensing human/animal parts (still attached :) ) than other materials.
There have already been some posts by others here giving their experiences with sensing other materials.
Wood even when "dry" usually still has around 10 to 20% moisture (far greater when green/wet and thus makes a possible good alternate to a finger.

Technical has recently mentioned that the touch readings are affected by the PIC clock frequency.
 

Grogster

Senior Member
I've only played for a short time with the touch sensor features, but can certainly see where it could be very useful, as you don't have to buy buttons, you can make them out of PCB pads. This also makes assembly much quicker, and you don't have to drill holes for your switches either. :)

My test code was simply:

Code:
start:
  touch C.2,b1
    if b1<255 then low B.1
  else
    high B.1
  endif
  goto start
I too would like to know how you de-sensitise the touch sensor command, but the above code worked for me, but I have only played with one pin so far...
 

KTarke

Senior Member
From the little reading I have done the M-touch feature is possibly more orientated to sensing human/animal parts (still attached :) ) than other materials.
There have already been some posts by others here giving their experiences with sensing other materials.
Wood even when "dry" usually still has around 10 to 20% moisture (far greater when green/wet and thus makes a possible good alternate to a finger.

Technical has recently mentioned that the touch readings are affected by the PIC clock frequency.
Yes, touch seems to be VERY useful in creating buttons (nice to get rid of soldering tiny push-buttons, and drilling holes for them, in the box)
In my short experience, sensitivity is good, when pointed by a finger.

I am interested of using touch to sense wooden material, and first-day experience is promising. A lot of testing ahead... normally the containers (where this stuff is) are made of steel. That will affect the sensors, too.

And yes, wood pellets contain a little moisture (7-10%).

Before I have time to tell more of my expiriments, this is good thing to share...
I noticed, that connected programming cable (usb,not the conventional) DOES affect the sensitivity! Without cable plugged, sensitivity is better.
So, I am testing now with a program, that shows the readings on a lcd, since debugging is not reliable.

Just now loading the newest Programming Editor... had (quite new) 5.3.3 on my machine, and took a while to understand, why the editor claimed a syntax error, when I tried to assign a B-port as a touch sensor... seems to be a bug in the older version.
Edit: No bug in PE, my typo...

BTW, has anyone tried the touch in those X2-parts, where it is possible?
(manual says, it is different type. More or less sensitive than "M2-type"?)
And, how long has it been in those parts? (I mean, is it a new feature, since some serial number... I didn't notice a "touch"-feature in X2-parts a year ago.Is the feature new, or just later documented?)
 
Last edited:

Technical

Technical Support
Staff member
There is no easy answer to this, as the various settings will make 'different differences' in varying hardware setups. The size of pad and it's insulating material, for instance, is just as important as the calibration settings.

The internal silicon "touch technology" is different in M2 and X2 parts. Therfore the calibration and results from each set of parts is different.

So it really is just a case of practical experimenting with the various settings (charge current, charge time etc) to see which work best in the proposed application.
 

KTarke

Senior Member
There is no easy answer to this, as the various settings will make 'different differences' in varying hardware setups. The size of pad and it's insulating material, for instance, is just as important as the calibration settings.

The internal silicon "touch technology" is different in M2 and X2 parts. Therfore the calibration and results from each set of parts is different.

So it really is just a case of practical experimenting with the various settings (charge current, charge time etc) to see which work best in the proposed application.
Thank You for your answer.
I have now "blindly" played with those config-bits, and had no improvement in what I was doing... (quite opposite). It seems, that the chosen default setting is quite good for general purposes.
I understand, that if there is some abnormal situations (for example sensing through a metal plate, which IS possible), "fine tuning" is needed.
I was after some guidelines, what those parameters mean, and in what direction changing them leads... but I suppose, there is no general answer to that (fine tuning is ment mostly for product-designers, and normal Picaxe user will do without)

I have now played with different kinds of sensor plates, to see which "tricks" can improve sensibility. Ofcourse, Picaxe's way of handling touch differs from the general approach (generating a high-pitch square wave, leading it to "the other part" of the sensor, and reading response from "the second part").
Picaxe connects to the sensor only by one wire, and therefore all normal "enchanged" sensor layouts do not help.
Just want to find out, which do help...

Will soon tell others too, what I've found out.
 

KTarke

Senior Member
Alright, here is what I have since learned by testing different kinds of sensors.
Hope, that I can help others, who want to do something else, than sensing a finger.

To be able to add more information more easily, I made a web page of my "report".

It is found here: http://ktarke.net/Touch.html
 

techElder

Well-known member
Have you tested the effect of a metallic 'digit' touching your sensors?

For instance, what happens to your readings if the sensor is touched by a 10mm steel rod like a drill bit? Or if a user 'touches' with the eraser end of a pencil or the writing end of a ball-point pen?
 

KTarke

Senior Member
Have you tested the effect of a metallic 'digit' touching your sensors?

For instance, what happens to your readings if the sensor is touched by a 10mm steel rod like a drill bit? Or if a user 'touches' with the eraser end of a pencil or the writing end of a ball-point pen?
Hadn't crossed my mind to do that... because I was searching sensors for non-conductive materials.

Since You asked, I tried! and the result was surprising.

I tested the two most sensitive sensors: "model B" in the picture, and the round 30mm made of thin pcb.

Here are figures, how much touch 16 reading rose, when touched.
First figure is from "model B", second one from the 30mm plate.

-finger, light touch with fingertip 37000, 17000
-finger, "thumb" (more area in contact) 37000, 47000
-"eraser end" of a whole metal ball-point-pen (bigger than the tip),held in hand 1000,1000
-eraser end of a wooden pencil,held in hand 40, 80
-10mm drill, held in hand 7600, 6300
-wood pellets (for reference) 500, 900

Seems, that touch is not very sensitive for metal at all, at least when factory settings are used (maybe tweaking the config byte affects just this... it would be nice to understand better those values)
 

techElder

Well-known member
Thank you!

Those results imply to me that one can 'filter' those kinds of touch people and more or less make the pads human touchable only.

The 10mm drill bit probably had the most reaction because your hand was nearer to the pad than on the others, too.
 

KTarke

Senior Member
Thank you!

Those results imply to me that one can 'filter' those kinds of touch people and more or less make the pads human touchable only.

The 10mm drill bit probably had the most reaction because your hand was nearer to the pad than on the others, too.
And massive piece of metal seems to "conduct" my own capacitance... teh metal pen was not massive enough.

Today a played with "antenna" shaped sensors. They are more sensitive, I had problems with readings, when the sensor detected my hand, or even my table THROUGH a box of wood pellets (much bigger box now, than in the picture on my page... I noticed, that I had too small amount of stuff to play with more sensitive sensors)

Picaxe's touch system seems to be so much more sensitive to a finger, than other things, that "false touches" are likely not a problem.
 

KTarke

Senior Member
I found out a more sensitive sensor to detect wood pellets. Now I can get several thousands rise in the measurement.
Picture and explanation is now updated on the page http://ktarke.net/Touch.html

Next I must test, how much means dust on the sensor, or someone touching the metal container, where the stuff is...

After that, the program.
Have to think, how to eliminate "jitter" ,when the level reaches the sensor... (detecting several on-off-on 's is usual at that point)
The most common way is to set flag, when the value first time reaches the level, wait a moment, and check if the value still is "over", and only after that take some action.
"waiting" is no more a problem, when 18M2 has parallel tasking...
But still, has anyone a more sophisticated idea to do the thing?
 

techElder

Well-known member
One way to reduced noise detection ("jitter") is to build a counter into your detection routine. If the counter increases to the end count, then you let it fall through to your "completed" statements. If there is "jitter" within the counter routine then you keep resetting the counter. Or something like that.
 

KTarke

Senior Member
One way to reduced noise detection ("jitter") is to build a counter into your detection routine. If the counter increases to the end count, then you let it fall through to your "completed" statements. If there is "jitter" within the counter routine then you keep resetting the counter. Or something like that.
Yes, I introduced myself to that method, when tried to "clean up" readings from a very sensitive sensor... I just think, that in this case there is a catch: algorithm may delay "action" too long, and the container may be overfilled.

Simplest way is to "wait" a little, to ensure, that the sensor is really covered with material (when filling, the pile shifts a lot. First I get a result, that the preset value is reached, then pile shifts, and next reading is again under the preset, and so on) This state lasts even ten seconds,sometimes more... until the sensor is really covered with material, and reading becomes stable.
When parallel tasking is possible (M2-parts), "wait" is acceptable, but with ,for example, X2 parts, I don't like "waiting" at all, because it holds up everything else, what should be checked meanwhile!

Wait is a Picaxe-problem, in commercial capacitive sensors the matter is normally handled just with "fixed 5 second shutdown-delay". (the sensor does not have to check anything else, while waiting!)

That is why, I was thinking, if there is a neater solution to cut out false readings.
One is to set several flags in a row. (check, that at least 5 readings in a row are over the preset, before doing nothing)
I just remember Hippy's lectures of code optimicing... and was therefore searching a better way to do this.
 

KTarke

Senior Member
SOLVED!

This was an important project for me, but it seems not to had much interest in the forum.

Anyway, I solved the problem, how to use "touch"-command in sensing something else than a finger!

Results can be found on my own site, here.

Sensing dry wood pellets solved!
Sensing water level solved!
Be my quests to use the sensor I developed, in Your own projects.

Next step is to develop code for adjusting "start point" for measurement in different kinds of situations.
It might be better to open a new thread to that, because coding seems to be much more interesting on the forum, than "real world" applications!
 

techElder

Well-known member
Ktarke, I've been watching your progress, but am preoccupied at the moment. I'll be working on my "non-finger" touch project soon.
 

mortifyu

New Member
Hi all,

I know this is a VERY old thread, but was wondering if anyone can point me to Ktarke's Touch.html page that doesn't appear to exist anymore so I can view his testing results etc.


Regards,
Mort.
 

techElder

Well-known member
From memory ( watch out! :D ), I don't remember Ktarke's page actually showing a solution, and Ktarke hasn't been back here since making that claim.

I'd be interested in your version of a touch project, though.
 

mortifyu

New Member
From memory ( watch out! :D ), I don't remember Ktarke's page actually showing a solution, and Ktarke hasn't been back here since making that claim.

I'd be interested in your version of a touch project, though.
Hi Tex,

I am looking at using TOUCH16 as a way in determining from DRY thru to SATURATED media 100% non-contact through plastic. I 'think' I have the sensing under control, however my current issue is operating my circuit from a battery (varying the bench supply voltage) changes my sensed values as the voltage drops over time as one would expect.

With an 08M2, I am currently experimenting using a 100K pullup with a 1N4148 (cathode to GND) as a very low fixed external reference and then acquiring a value from this reference by a READADC10 (C.1) command and finally deducting this reference value from the TOUCH16 (C.4) value. As I am sure you would be aware, as the supply voltage drops, the ADC and TOUCH16 values go up and vice versa as the supply voltage increases.

I need to null out this varying factor as I would like to operate this particular sensing circuit from a CR2032 button cell.

This is a project I have been working on/off since early May 2019. The test circuit has, since May, been and continues to run 24/7 on a CR2032. By using NAP 5 in my CODE loop, I can confirm at 10-12-2019, the CR2032 is still holding up quite well at 2.92VDC measured at V+ (pin1) and GND (pin8) of the 08M2 with a FLUKE 79III whilst in it's ongoing operational state.

I am confident I am going the wrong way about trying to compensate the varying supply voltage as it is bluntly not working as I had hoped. It has dramatically helped, but there is still variance when varying the supply voltage. To avoid confusion of what I have mentioned above, I have one circuit running on a CR2032 and another identical circuit I am working on with the bench supply. The circuit running on the battery does not currently have the 100K pullup & 1N4148 reference. Perhaps you could lend a suggestive hand with this problem?

For varying (pun intended :)) reasons I cannot disclose the ACTUAL program code, but here is some highly modified and extremely simplified code that expresses my dilemma.

Code:
init:
disablebod
setfreq m32

symbol onthreshold=24330
symbol offthreshold=24260



main:
readadc10 c.1,w4
touch16 [%00010001],c.4,w1

let w2=w1-w4

sertxd("Ref: ",#w4,", Sense: ",#w2,cr)

if w2>onthreshold then gosub wet

nap 5

goto main



wet:
high c.2

readadc10 c.1,w4
touch16 [%00010001],c.4,w1

let w2=w1-w4

sertxd("ON - Ref: ",#w4,", Sense: ",#w2,cr)

if w2<offthreshold then low c.2 return endif

goto wet
Another issue I have identified is that the values sensed are different from having the AXE027 programming cable plugged into the circuit or not. That too is a bit of an unhelpful bummer.

I am expecting you to talk of the FVR. I haven't really got my head around using the FVR. I had a play with it but found while varying the supply voltage, the FVR value always remained the same and that didn't make sense to me. Hence the 100K/1N4148 as reference.


Regards,
Mort.
 
Top