Need a cheap touch sensor idea.. here it is


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    Join Date
    Apr 2011
    Posts
    4


    Did you find this post helpful? Yes | No

    Smile Re: Need a cheap touch sensor idea.. here it is

    helo

    I have tried to edit that code on Micro baisc pro but it doesn't understand it.

    replay this error message "@ is not a valid Identifier"

    Please help me what app to use to edit this code and convert it to hex file..

    Thanks and Regards

    mrelectric

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: Need a cheap touch sensor idea.. here it is

    Quote Originally Posted by mrelectric View Post
    helo

    I have tried to edit that code on Micro baisc pro but it doesn't understand it.

    replay this error message "@ is not a valid Identifier"

    Please help me what app to use to edit this code and convert it to hex file..

    Thanks and Regards

    mrelectric
    You need the PicBasic Pro applicaton. You can get it here http:\\www.melabs.com

  3. #3
    Join Date
    Apr 2011
    Posts
    4


    Did you find this post helpful? Yes | No

    Smile Re: Need a cheap touch sensor idea.. here it is

    Thanks alot it is now works properly ...




    First Question:

    what I need to change in code to use PIC16F84A instead of current one ...






    Second Question:

    what the code needed to make each touch of a sensor run a different device for example I

    have 3 electric devices.

    like Television and recorder and wash machine.

    Touch Sensor1 = Run First Device if it OFF or OFF the first device if it ON.

    Touch Sensor2 = Run Second Device if it OFF or OFF the Second device if it ON.

    Touch Sensor3 = Run Third Device if it OFF or OFF the Third device if it ON.


    and make the default condition for all devices is OFF.





    Third Question:


    Does I Need a Relay for Each Device Or can figure out a way without using it .. take in consideration these devices use AC 220 VOLT







    Fourth Question:

    Does the 3 copper plate sens the touch if I Cover them by one plate of Glass

    or that will make a disruption so the touch will affect all of three sensors.

    That mean it should be a different 3 plates of glass I Mean 1 Plate for each Copper Sensor for

    avoiding disruption but this way will be very bad looking.


    I am very glad for helping me.

    God bless you...


    Thanks and regards..
    Last edited by mrelectric; - 3rd April 2011 at 23:34.

  4. #4
    Join Date
    Apr 2011
    Posts
    4


    Did you find this post helpful? Yes | No

    Unhappy Re: Need a cheap touch sensor idea.. here it is

    Mr. scalerobotics Please Help

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


    Did you find this post helpful? Yes | No

    Default Re: Need a cheap touch sensor idea.. here it is

    Since you may live in a different time zone and the service here is free, you can't expect a person to give you support 24/7, right?

    Then I see you are asking question about 220Vac wiring. I feel that you are not experienced on such circuits, so to save your life, STAY AWAY from Mains Line. It is very dangerous.

    And to answer you question, yes you need seperate relays for each load.

    But i repeat, have someone that knows what is doing to help you out. Do not do it alone.

    Ioannis

  6. #6
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: Need a cheap touch sensor idea.. here it is

    Quote Originally Posted by mrelectric View Post
    First Question:

    what I need to change in code to use PIC16F84A instead of current one ...
    The 12F's have a GPIO port, most other chips have PORTA,PORTB etc. So that would have to be changed. Also your configs would have to be changed for the chip you are using. This is pretty much a topic of its own. Normally, one would look at the data sheet for the chip you are using, and see what settings would need to be applied to that chip. There is also no comparator on the 84, so you can comment that out.

    Second Question:

    what the code needed to make each touch of a sensor run a different device for example I

    have 3 electric devices.

    like Television and recorder and wash machine.

    Touch Sensor1 = Run First Device if it OFF or OFF the first device if it ON.

    Touch Sensor2 = Run Second Device if it OFF or OFF the Second device if it ON.

    Touch Sensor3 = Run Third Device if it OFF or OFF the Third device if it ON.


    and make the default condition for all devices is OFF.
    Why don't you play with the code with some LED's and try for yourself?

    Third Question:


    Does I Need a Relay for Each Device Or can figure out a way without using it .. take in consideration these devices use AC 220 VOLT
    I would like to take some time to point at some great advice Ioannis gave you above. Your work on 220 could kill you, or the equipment you make, could kill others.

    Yes, you would need some large (pretty expensive) relays to run this kind of equipment.

    Fourth Question:

    Does the 3 copper plate sens the touch if I Cover them by one plate of Glass

    or that will make a disruption so the touch will affect all of three sensors.

    That mean it should be a different 3 plates of glass I Mean 1 Plate for each Copper Sensor for

    avoiding disruption but this way will be very bad looking.
    I know the capacitive touch sensors that are built into the newer chips (the 16F84 is one of the oldest most outdated chips around) does have the ability to sense over vinly, or through plexiglass. I am not sure Steve's cheap sensor idea has this capability, as I have never tried it. You could test it and see. If not, you may want to splurge, and spend $1.25 for one of the newer PIC chips with capacitive touch built in

    As we always recommend, start out small. Blink an led. Then see if you can get Steve's code working on a chip to your liking. Once you figure out how to make it blink and LED, then think about how you might modify it to better fit your ideas.

    But once again, working with 220 is very dangerous, and can kill your equipment, you, and others using your home made equipment.

    And if you were looking for a cheap project, all the equipment you need to turn on and off these large amperage devices, will be rather expensive.

    Here is his code edited for your chip. You will have to work on the configuration part though.

    Code:
    '   Few cents touch sensor
    '   ======================
    '   Using : Untested for PIC16F84A 
    '    
    '   Circuit is quite simple. One pin(GP4) is used as a signal generator.
    '   This pin send signal to all "virtual push button" (GPIO<2:0>)
    '   via 3 X 22K resistor. The touch sensor could be almost everything 
    '   conductive.  
    '
    '   Once a sensor is touched, the program will blink a LED as follow
    '                            PORTB.0 => 1 Blink
    '                            PORTB.1 => 2 Blink
    '                            PORTB.2 => 3 Blink
    
    
    '   PIC config and programming mode
    '   ===============================
        '
    ;    @ DEVICE  PIC12F629,INTRC_OSC_NOCLKOUT ' internal RC osc
    ;    @ DEVICE  PIC12F629,MCLR_OFF           ' Disable external MCLR
    ;    @ DEVICE  PIC12F629,WDT_OFF            ' Disable WatchDog timer
    ;    @ DEVICE  PIC12F629,PROTECT_OFF        ' Disable device protect
    ;    @ DEVICE  PIC12F629,CPD_OFF            ' Disable Code-Protect
     ;   @ DEVICE  PIC12F629,PWRT_ON            ' Enable Power-up timer
    ;    @ DEVICE  PIC12F629,BOD_ON             ' Enable Brown-out detect
    
    '   I/O Alias definition
    '   ====================
        '
        LED        VAR PORTB.5
        Generator  var PORTB.4
        
    '   Hardware definition
    '   ===================
        '                           
        TRISB = $0F ' PORTB<3:0> as input
                     ' PORTB<5:4> as output
                     '
    ;    CMCON  = 7   ' Disable internal comparator
        
    '   Variable definition
    '   ===================
        '
        Sensor var byte
        LOOP1   var byte
    
    '   EEPROM assignement
    '   ==================
        '
        data @3,3,0,2,1 ' table to convert 'Sensor' variable result to according
                        ' LED blink. See Result list bellow
        
    '   Software/hardware initialisation
    '   ================================
        '
        led = 0
        generator = 0
        
                
    Start:
        ' /////////////////////////////////|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
        ' /                              Start                                    \ 
        ' /////////////////////////////////|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
        '
        ' Short explanation of the whole thing.
        '       1. Send a high level to all sensor input => PORTB<2:0>
        '       2. Read PORTB port 
        '       3. Send a low level to all sensor input
        '       4. Keep only PORTB<2:0> bits
        '       5. Test result
        '
        ' If no sensor has been touched, the result will be 7 => 0000 0111, case
        ' else, the body capacitance will introduce sufficient delay between
        ' step 1 and 2 wich will keep the according bit to 0.  
        '
        ' Results will be as follow
        '               NoSensor => 0000 0111 => 7
        '               PORTB.0   => 0000 0110 => 6
        '               PORTB.1   => 0000 0101 => 5
        '               PORTB.2   => 0000 0011 => 3
        '
        repeat
            Generator = 1       ' enable sensor power
            Sensor = PORTB       ' read sensor
            Generator = 0       ' disable sensor power
            Sensor = Sensor & 7 ' keep only Sensor bits
                                '        
            until Sensor != 7   ' redo the test untill one sensor is touch
        '
        ' Now we will flash an LED to confirm wich sensor has been touch
        '                      PORTB.0 => 1 Blink
        '                      PORTB.1 => 2 Blink
        '                      PORTB.2 => 3 Blink
        '
        read sensor,LOOP1 ' convert result to blink
        repeat
            LED = 1
            PAUSE 200
            lED = 0
            PAUSE 200
            LOOP1 = LOOP1 - 1
            until LOOP1 = 0
    
        goto start ' do it again...
    Last edited by ScaleRobotics; - 4th April 2011 at 15:37.

  7. #7
    Join Date
    Apr 2011
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: Need a cheap touch sensor idea.. here it is

    Thanks alot for your's precious advices .....

    I have good experience to avoid such accidents but thanks for yours attention.

    I will apply all the steps and re tell you about my result ...

    Thanks and regards...

  8. #8
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Need a cheap touch sensor idea.. here it is

    Mister_e
    Just curious why you chose 22k resistors for R1, R2 and R3? Was there any math involved or was it experience?

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


    Did you find this post helpful? Yes | No

    Default Re: Need a cheap touch sensor idea.. here it is

    trial/error, not much.
    Steve

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

Similar Threads

  1. Any Ideas for a cheap touch sensor??????
    By rsocor01 in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 19th October 2013, 00:33
  2. Touch screen 4-wire interface
    By Demon in forum General
    Replies: 6
    Last Post: - 31st December 2011, 18:02
  3. Relaxation oscillators (for capacititive touch sensing)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 24
    Last Post: - 6th December 2009, 22:03
  4. touch switch dimmer
    By helmut in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 18th August 2007, 11:25
  5. Touch Screen Wish List!!!
    By Amity in forum PBP Wish List
    Replies: 2
    Last Post: - 15th September 2005, 14:40

Members who have read this thread : 1

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