-
Video demonstration of touch interface
03/07/2017 at 04:54 • 0 comments -
Reading touch sensors
03/06/2017 at 07:52 • 0 commentsIn order to read touch sensors (they will be implemented as part of PCB) we need to connect internal pull-ups to those pins then to read we should set pins out, clear pins and set pins in then read a few times (until parasitic capacitor is fully charged through internal pull-up) and analyze (touched pads charge longer):
int tch[4],cc[5],c,i; ConfigCNBPullups(CNB8_PULLUP_ENABLE|CNB9_PULLUP_ENABLE|CNB10_PULLUP_ENABLE|CNB11_PULLUP_ENABLE); .... // somewhere in the game loop: tch[0]=tch[1]=tch[2]=tch[3]=5; mPORTBSetPinsDigitalOut(BIT_8|BIT_9|BIT_10|BIT_11); mPORTBClearBits(BIT_8|BIT_9|BIT_10|BIT_11); mPORTBSetPinsDigitalIn(BIT_8|BIT_9|BIT_10|BIT_11); cc[0] = mPORTBRead(); cc[1] = mPORTBRead(); cc[2] = mPORTBRead(); cc[3] = mPORTBRead(); cc[4] = mPORTBRead(); for(i=0;i<5;i++) { c = cc[i]; if((c&BIT_8) && tch[0]==5) tch[0]=i; if((c&BIT_9) && tch[1]==5) tch[1]=i; if((c&BIT_10) && tch[2]==5) tch[2]=i; if((c&BIT_11) && tch[3]==5) tch[3]=i; }
tch[4] are states for 4 touch sensors - if respective number is greater than 1 then sensor is "touched". Experiment showed that if nothing is touched array will have all 1s, but if one or more sensors touched - respective value will go up (usually 3 if one sensor was touched or 2 if more than one sensor were touched). Interesting fact that it's relatively easy to detect intermediate finger position when it touches 2 neighboring sensors so with 4 pads we got 8 positions (or even 9 if we count center position as well). -
First run
03/06/2017 at 06:02 • 0 commentsXorya-touch in action (connected to TV and PICKit3):
for now it shows static image 320x200 with 2 half-frames (it's drawn as 160x400 with interlace):
-
Xorya-touch
03/06/2017 at 05:59 • 0 commentsThis is the next prototype of #XORYA - extremely low cost game console on PIC32 with capacitance touch interface where 4 pads connected to RB8, RB9, RB10 and RB11 (and there is a ground ring around them):
Pads covered by scotch tape because we will measure capacitance of the "touch"...