Erratic Touch sensors on 08m2+

Joel Grant

New Member
Hi Guys,
I am new to this so please try to be simple when explaining.
I have a 08m2+ and have been trying for days to calibrate 2 touch sensors. I am using the flow chart at this point. I just can not seem to get it to be consistent by any means. reading the forums it sounds as if touch sensors can be programed to self calibrate. Is this possible with the flow chart? And is there any basic code samples to try?
Joel
 

rq3

Senior Member
Hi Guys,
I am new to this so please try to be simple when explaining.
I have a 08m2+ and have been trying for days to calibrate 2 touch sensors. I am using the flow chart at this point. I just can not seem to get it to be consistent by any means. reading the forums it sounds as if touch sensors can be programed to self calibrate. Is this possible with the flow chart? And is there any basic code samples to try?
Joel
Joel, I've never tried the flowchart approach, but I have successfully used the touch capability. And they are "touchy". I suspect that the flowchart will not give you access to the "lower level" control of the touch switches that regular programming might do.

At the most simple level, self calibration assumes that none of the switches are touched when the picaxe powers up. It reads and stores the touch value at power up, and then polls and compares that value during a "touch" to get a valid reading.

There are variables in the touch command (see the manual) that can allow you to get enough of a difference between "touch" and "no-touch" so that the Picaxe can determine whether to "re-set" the un-touched condition every few seconds or so.

Be very careful of overflow in the touch result. It's possible (in fact likely) that touching a switch will cause it to "roll over". For example, you may have the touch switch set to react to 200 as a valid touch. If conditions change (and they will) a valid touch may result in a value of 257, which rolls over to a value of 2 (untouched).

It's tricky, but most definately doable!
 

erco

Senior Member
It's tricky, but most definitely doable!
+1/ Half art, half science. Numbers will change from day to day with humidity (seriously). If your sensor pads or wires shift that will undo all your calibration. You need to autocalibrate every time you turn it on, or regularly periodically if it's on permanently. Hard coding threshold values will bring a fair amount of frustration.

These cheap hardware touch switches work far better and require no calibration: https://www.youtube.com/watch?v=qYxNeyRnkxw
 

Joel Grant

New Member
Thanks Guys,
I will have another go and see how it turns out probably with the code rather then the flow chart. I will also keep a eye out for the stand alone touch switches on ebay.
Joel
 
I have done some experiments with touch sensing on pin c.4 on a 8M2+ , see the thread 'Use of touch pins" 15-0-2016 'Touch sensor'. I had the same experience as you, but I also tried using direct galvanic pin contact via a resistor. That worked well, even if the forum adviced against it. Nevertheless, I am now using this in a school project with a 10 kohm series resistance on a number of 8M2LE (20 pcs). It works really well; no calibration needed .. the touch cmd gives <10 with no touch, and >250 with, consistently. I have only tried this with c.4 as the single touch pin. As touch "plate" I use a round head stainless steel pin intended for furniture upholstery.
I will probably be using this method in a commercial product in the near furure.
 

erco

Senior Member
@Joel: I doubt if you have "Dollar Tree" stores in Samoa, but I was thinking of you as I hacked my "find of the day". Super easy to use and ready to go.

 

Attachments

Joel Grant

New Member
Hi again guys,
I have revisited this project and still am having trouble with the touch switches. I realise the touch pins should not be pulled down to earth but I am wondering if I only slightly pulled them down ie.10meg ohm if this would help stop the false triggering of the touch switches.
Thanks
Joel
 

hippy

Technical Support
Staff member
I am wondering if I only slightly pulled them down ie.10meg ohm if this would help stop the false triggering of the touch switches.
The best thing to do is probably to try it. Others would likely have to do that just to give an answer and, given the apparent variability of touch sensor behaviour, their results may differ from your own.
 

AllyCat

Senior Member
Hi,

The "touch" system basically counts the number of cycles of an oscillator during a short period of time. The only thing that adding a resistor might do is to stop the oscillator and give a "zero" output all the time. :(

Adding a small capacitor (probably only a few tens of p)F between the touch pin and ground might help to reduce "false triggering". But you don't appear to have posted, or linked to, any "flow chart" or program code, so we can only guess.

Using the (recommended) touch16 command instead of touch might help.

Cheers, Alan.
 
Top