Mtouch switch using PIC 12F510


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    Join Date
    May 2011
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Mtouch switch using PIC 12F510

    What if I just use 1 sensor ? Is this the same ?

  2. #2
    Join Date
    May 2011
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Mtouch switch using PIC 12F510

    And what is the role of these resistors ?

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: Mtouch switch using PIC 12F510

    1,2,3,4,5,6,100, 100 000 sensor solution is the same.

    Rough explanation, your body act as a capacitor between the sensor and the circuit ground. By the time the Pin is low, if you add an small capacitance on the pin, set the pin high the read then pin, the pin will read low because the capacitor haven't got time to "charge"... period. simple. Really old way to do it.

    You can also do it with a spare CMOS input,Darlington transistor, FET, OpAmp... etc etc etc.

    Plug your home theater sound system, set it to line input, crank the volume to the max, insert a needle in the RCA center pin woohoo you got a signal!!!

    mTouch use ADC reading, probably more accurate and versatile... no real extra parts.... on both solution, you need a fairly good PCB design.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    May 2011
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Mtouch switch using PIC 12F510

    Hey mister,
    I almost understood what you did however there are some places I still don't really understand:








    data @3,3,0,2,1 ' table to convert 'Sensor' variable result to according
    ' LED blink. See Result list bellow

    => I don't really understand this code? what is the meaning of value: 3,3,0,2,1 ? is this loop variable will get this value ?



    ' 4. Keep only GPIO<2:0> bits => what is the meaning of keep only GPIO<2:0> bits ? Does it mean that we just read the value of GPIO bits?

    repeat
    Generator = 1 ' enable sensor power
    Sensor = GPIO ' read sensor
    Generator = 0 ' disable sensor power => this is send low level right ?

    Sensor = Sensor & 7 ' keep only Sensor bits => don't understand this is this the comparison ? and what value will sensor get?
    '
    until Sensor != 7 ' redo the test untill one sensor is touch
    '
    ' Now we will flash an LED to confirm wich sensor has been touch
    ' GPIO.0 => 1 Blink
    ' GPIO.1 => 2 Blink
    ' GPIO.2 => 3 Blink
    '
    read sensor,loop ' convert result to blink

    repeat
    LED = 1
    PAUSE 200
    lED = 0
    PAUSE 200
    loop = loop - 1
    until loop = 0

    => if in this case I use 220v light bulb and I want it lights until we touch again what should I do ?

  5. #5
    Join Date
    May 2011
    Posts
    10


    Did you find this post helpful? Yes | No

    Arrow Re: Mtouch switch using PIC 12F510

    Hey is this code true for the 220V light bulb ? I don't mention the syntax just the algorithm.(I familiar with C language )

    Code:
    While (1) do  'this creates an infinity loop'
    {
    repeat
            Generator = 1            ' enable sensor power
            Sensor = GPIO           ' read sensor
            Generator = 0            ' disable sensor power
            Sensor = Sensor & 7   ' keep only Sensor bits
    until Sensor != 7                    '        
    ' If the light bulb is lighting we will turn off it when we touch
    ' else we will turn on.
    
        if (LED == 1)
        LED = 0;
        else if (LED == 0)
        LED = 1;
    }

  6. #6
    Join Date
    May 2011
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Mtouch switch using PIC 12F510

    Nobody helps me check the code ?

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: Mtouch switch using PIC 12F510

    If you understand C, I would suggest to look for answers in C forums.

    Here we all do Basic and specifically Melabs Pic Basic.

    Ioannis

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts