Touch feature help

ac21

Member
So I went balls out on a project for work utilizing the touch feature of the 20m2, basically three buttons (copper wire strands rolled into a circle) behind some plexi glass, I got some base readings and some button pressed readings and wrote some code.
Little did i know that all my readings will change by next day(project undisturbed) thus rendering the code useless. Plus ive read that using the other pins will also effect. I know i can run calibration every so often but the issue is how often and what if a button is pressed during?
Has anyone dealt with this issue?
I have some ardunio pro minis and those offer a similar function using a input pin + output pin + resister has anyone worked with those and does the reading change in the same way ?
 

erco

Senior Member
Agreed, the numbers returned vary more than I'd like. Significantly day to day (humidity?), and drastically when the programming cable is connected or detached. You definitely need to calibrate at startup (with fingers far from the pads) and/or every day. It's great when they work, but there's an element of luck to getting them to work consistently.

For that very reason, I ordered one of these dedicated touchpad modules. Premade with LEDs and ready to go for $2.79 US. It should arrive any day now. http://www.ebay.com/itm/TTP226-8-Channel-Digital-Touch-Capacitive-Touch-Switch-Sensor-Module-HM-/181431842079

(Lots of other interesting sensors on that page, too.)





Someone's review:

 

Attachments

erco

Senior Member
Your sensor setup might be part of the problem. If your Plexiglas is thick and you sensor mass is small (you did say coiled wire) then your numbers won't change very much when you touch them. I typically use US pennies as sensors, just behind a piece of 2" wide packing tape. If you can make some changes to your setup and get a bigger change in reading, your calibration will be less finicky.
 

ac21

Member
The coil of wire has a diameter of a quarter.

I made some changes to code and i'ma see how it goes..

this code will run at startup and every 10 mins
Code:
w2 = 0
w3 = 0
w4 = 0

	for B18 = 1 to 40
		touch16 [%11111001], b.4, W8       ;w11
		Let w2 = W8 / 40 + w2
	next

	
	for B18 = 1 to 40
		touch16 [%11111001], b.5, W8 ;  w12
		Let w3 = W8 / 40 + w3
	next

	
	for B18 = 1 to 40
		touch16 [%11111001], b.3, W8      ;w13
		Let w4 = W8 / 40 + w4
	next
                                ; b.3 or w13 or w4 at rest has a min of 949 and max of 969 when pressed it has a min of 974 so thats min 974 - avg 959 = 15
	Let w2 = w2 + 20        ;w11
	Let w3 = w3 + 10      ; w12
	Let w4 = w4 + 15    ;w13

then this code will loop
Code:
w11 = 0
w12 = 0
w13 = 0		
		for B18 = 1 to 20
		touch16 [%11111001], b.4, W8
		Let w11 = W8 / 20 + w11
		next
		for B18 = 1 to 20
		touch16 [%11111001], b.5, W8
		Let w12 = W8 / 20 + w12
		next
		for B18 = 1 to 20
		touch16 [%11111001], b.3, W8
		Let w13 = W8 / 20 + w13
		next
					
	if w11 > w2 and w12 < w3 and w13 < w4  then horn
	if w12 > w3 and w11 < w2 and w13 < w4  then elight
	if w13 > w4 and w12 < w3 and w11 < w2  then sslight
 

techElder

Well-known member
AC21, I would suggest reading this code snippet for ideas on "calibration" of the touch sensor. This code was developed with the help of other forum members and works well for me.

I also suggest that you go away from your "coiled wire" sensor. You probably don't know the actual capacitance of that sensor, but I'd bet that it is a good antenna.

I used a 1 inch diameter piece of single-sided PCB material for my sensor. The copper side was positioned in contact with roughly 0.7 inch thick plexiglass. Actually, I had a "TOUCH ME" paper label sandwiched between them. There has been some interference from fluorescent fixtures, but my project was for outdoors use. I think the touch pad is a good antenna.

Works like sauce on barbeque for me.

CODE SNIPPET: http://www.picaxeforum.co.uk/showthread.php?21310-TOUCH-or-NO-TOUCH
 
Top