Home     Contact     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS     Terms of services     Privacy policy  
   
 Home      Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science   

13 January 2011
Author: Giorgos Lazaridis
DIY Resistance Touch Button


A typical 12V resistance touch sensor driving a 12V relay

A few days ago, i uploaded a theory page explaining how the touch sensors work. I presented different ways of touch sensing techniques, and i promised that i will post a circuit with many variations for each method. Well, here i begin with the first method, the resistance touch sensor.





Resistance Touch Momentary Button circuit

Here is the very simple and reliable resistance touch sensor schematic:





R1 is a simple protective resistor. On pins E1 and E2, the two electrodes are connected to perform the touch plates. T1 is a transistor amplifier. I choose to use a darlington pair transistor, because i want to have enough current amplification to drive loads such as a relay, even if your skin is completely dry. You could use a simple transistor as well if you plan to drive simple LEDs or other low current loads. The next transistor is a power switching transistor, able to deliver enough current for the relay. A capacitor is connected to its base, to eliminate bounces or other parasitic noise. It causes a slight ON-OFF delay, but it is extremely fast to notice.

The load is connected to pins L1 (positive) and L2 (ground). The current must be taken into account when connecting the load. 2N2222 can handle up to 800mA. Should you need more current, consider another transistor instead. R3 is a protective resistor for the T2. It should be selected according to the load.


In quiescence With the electrodes touchesd


In case that you want to control high current loads, you can use a relay. In that case, R3 can be totally omitted:





Do not forget the flyback diode! The diode must be connected parallel to the relay's coil, with reverse polarity. I have test the circuit with 5 and 12 volts, and works with no component change. Make sure that the relay has the same voltage for the coil as your power supply.


In quiescence The LEDs are switched through the 12v relay





Bill Of Materials
Resistors
R1Resistor 330 Ohm 1/4 Watt 5% Carbon Film 
R2Resistor 1 KOhm 1/4 Watt 5% Carbon Film 
R3Selected according to your load
Capacitors
C1Ceramic Capacitor 0.1 uF 50 Volts
Transistors
T1BC517 NPN Darlington Transistor 
T22N2222 Switching NPN Transistor 
Semiconductors
D11N4004 General Purpose Diode Rectifier 



Resistance Toggle Touch Switch circuit

Things are getting a little bit more stiffer here. The previous circuits act as pushbuttons. As long as the two electrodes are touched, the load is actuated. When released, the load is deactivated. To make a toggle switch, i added a D-Flip Flop, more specifically i added the CD4013 CMOS chip that i had in stock. It has two Flip-Flop modules. I will use one of them as an one-shot debouncer, and the other will be connected as a toggle Flip-Flop to drive the output. Here is the schematic: (click to enlarge)





So, E1 and E2 are the two electrodes, then comes the darlington pair amplifier to sense the touch. The next transistor is to provide enough current to drive both the Set input of the Flip Flop (B), and to load the capacitor C2. This capacitor is a large electrolytic, and this is the one that will generate the one-shot delay. When it is charged, it will hold the Set input HIGH, even if the electrodes are not touched any more. It will then slowly discharge through the parallel large discharging resistor R5. Changing this capacitor will result into more (if more capacitance) or less (if less capacitance) time interval of the one-shot action.

The output of the first Flip-Flop is then driven to the second Flip-Flop, which is connected as a toggle switch. This is done by driving the S and R inputs LOW, and giving a negative feedback to the D input. On each pulse of the Clock input (which comes from the first F-F), the output state is changed.

Finally, we only have to add a large resistor and connect an output transistor to the F-F. This resistor must be big enough to kinda separate the transistor from the feedback of the F-F, but not that large, because the transistor may not provide enough current for the load. If you need more, add a second amplification stage. The final transistor can be of any type, but i used the 2N2222 to drive high-current loads like a relay. Similarly as before, in case that you drive a relay, the R8 can be totally omitted. The load is connected to pins L1 (+) and L2 (Gnd).


Toggled ON Toggled OFF




Bill Of Materials
Resistors
R1Resistor 330 Ohm 1/4 Watt 5% Carbon Film 
R2Resistor 1 KOhm 1/4 Watt 5% Carbon Film 
R3Resistor 330 Ohm 1/4 Watt 5% Carbon Film 
R4Resistor 100 KOhm 1/4 Watt 5% Carbon Film 
R5Resistor 220 KOhm 1/4 Watt 5% Carbon Film 
R6Resistor 1 KOhm 1/4 Watt 5% Carbon Film 
R7Resistor 22 KOhm 1/4 Watt 5% Carbon Film 
Capacitors
C1Ceramic Capacitor 0.1 uF 50 Volts
C2Electrolytic Capacitor 4.7 uF 50 Volts
C3Electrolytic Capacitor 10 uF 50 Volts
Transistors
T1BC517 NPN Darlington Transistor 
T2BC338 NPN Silicon AF Transistors 
T32N2222 Switching NPN Transistor 
Integrated Circuits
IC1CD 4013 Dual D-Type Flip-Flop 






Comments

  Name

  Email (shall not be published)

  Website

Notify me of new posts via email


Write your comments below:
BEFORE you post a comment:You are welcome to comment for corrections and suggestions on this page. But if you have questions please use the forum instead to post it. Thank you.


      

  • At 1 October 2015, 9:24:11 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @swapnil It's a resistive sensor, it is not supposed to work under any sort of non conductive material. You need to make a capacitance sensor instead


  • At 20 June 2015, 9:54:17 user swapnil wrote:   [reply @ swapnil]
    • hey great work but i have faceing the problem with sensitivity of the ckt..it dose not work on any type of glass like acrylic glass etc.........give me solution


  • At 23 January 2015, 21:54:47 user Ivan Lazarov wrote:   [reply @ Ivan Lazarov]
    • OK problem solved.. when swapping the TIP with BC darlingtons earlier today I stupidly forgot to check that their bases and collectors are on different pins.. Now it is super sensitive. Detects my finger really really good. The only problem is that once the LED is on it goes low after about 4 sec. With 4.7uF cap discharging through 220k resistor this is a time constant of 1 sec so in four time constants the output is gone. This makes me think that there is something wrong with my 4013 flipflops, because their output is high as long as there is some charge in the capacitor.


  • At 23 January 2015, 21:19:57 user Ivan wrote:   [reply @ Ivan]
    • Hello,
      I'am designing a touch switch for several LED strips inside my PC case. The last design looks interesting. I implemented it with a TIP121 darlington, and BC547 which I found handy in the el. store in my uni. It works properly but is not particularly sensitive because the TIP has a dc current gain of only 1000. However today I got several BC517 as you listed above which are supposed to have a gain of 30000. When I try to use them the output stays permanently high and does not switch at all. Do you have any idea why is this happening.
      My idea is to design a small PCB and to use two very thin copper wires for electrodes going through the middle hexagon of the silverish snowflake of the logo of my Silverstone FT03 case. Here is URL to the build if interested what the logo looks like https://uk.pcpartpicker.com/b/bpWXsY . I am adding LED strips in two modes. Cool white color and red UV mode. I will switch between two with a regular switch and will control the brightness with a slide pot positioned in the CD hole, by varying the output of a LM317. I plan to use this design for turning the lights on and off by touching the logo of the case.


  • At 5 April 2012, 13:55:21 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @Colin Mitchell An emitter follower connection is not "bad" as you said. It may not be proper for your application, your supply. Indeed a CE connection could be more adaptive though. If you do not know how to change the connection, i can send you details.


  • At 4 April 2012, 20:55:38 user Colin Mitchell wrote:   [reply @ Colin Mitchell]
    • An emitter-follower design is very bad as you are losing over 2v in the base-emitter junctions. This means the supply should be 2v higher than the voltage of the relay for guaranteed operation.


  • At 28 October 2011, 12:24:31 user Kammenos wrote:   [reply @ Kammenos]
    • @Ant' R2, like R1 are used for security if something goes wrong.


  • At 28 October 2011, 12:20:11 user Ant' wrote:   [reply @ Ant']
    • Hi,
      unless you decide to use a PNP instead of a NPN in place of T2 (that would be a good idea insofar as there is 2.1V lost in T2's Vce), R2 is useless.


  • At 20 August 2011, 21:56:44 user diy-wannabe wrote:   [reply @ diy-wannabe]
    • I gave a shot at building the first circuit.
      However, I didn't have the right transistor but tried anyway with 3x 2n2222. With these part the led was alway on, and touching the led only made it brighter.
      Anyway, I solved this behaviour: Instead of 2 transistors as a darlington, I used only one 2n2222 as T1 and R2= 330ohm.

      anyone else had this problem too?
      transistor used had HFE (gain) ~180


  • At 29 July 2011, 12:26:44 user Kammenos wrote:   [reply @ Kammenos]
    • @Mahesha Padyana Hmmm good question. Normally it should operate, but you may need to decrease C1


  • At 29 July 2011, 12:23:14 user Mahesha Padyana wrote:   [reply @ Mahesha Padyana]
    • What is the fastest response we can get from these kind of switches? If I tap electrodes at the rate of say 50 mSec, can this circuit respond?
      Appreciate if someone could answer this question.


  • At 18 May 2011, 13:47:51 user Kammenos wrote:   [reply @ Kammenos]
    • @Poncho unfortunately i cannot help you to this. You need to do the interface yourself.


  • At 15 May 2011, 16:25:45 user Poncho wrote:   [reply @ Poncho]
    • Hi Kammenos,
      i was able to rebuild your schematic (the first one) with success. But unfortunately i was not able to adapt this to a circuit by replacing the BC517 with a Darlingto Array (tried ULN2001A and ULN2803A). I connected the two open cables via 220Ohm with Pin1(i.e. Input) and the LED via 1,1kOhm with Pin 16 (i.e. Output). Both resistors were connected to Vcc (5Volts). But I was struggled with the emittor. Is it Pin8 (GND) or Pin9 (COM) which I have to connect with GND. Right now I am lost as I don't understand what I am doing wrong.
      Regards

      Poncho


  • At 3 May 2011, 14:17:55 user Kammenos wrote:   [reply @ Kammenos]
    • @Poncho i suggest you use 8 darlington transistors instead. regarding the ULN2803, i have not use it so you have to test it


  • At 3 May 2011, 6:24:07 user Poncho wrote:   [reply @ Poncho]
    • Hi Giorgos, thank you very much for this cool introduction and presentation.
      That is exactly what I've been looking for.
      However one problem still remains:
      I need 8 touch sensors like this, but would like to use a darlington array (e.g. ULN2803) Can someone explain how I should wire the first sensor to the darlington array? I understood that pin-9 is gnd and pin-1 is IN and pin-18 the corresponding OUT. However I do not know if I need some resistors to allow the input react on the current of the human body.

      Regards

      Poncho


  • At 12 February 2011, 13:10:49 user Kammenos wrote:   [reply @ Kammenos]
    • driven low will still mean current flows. The only way not to flow current is to let it float, which does not work for microcontroller inputs (as you saw). High and Low are same in digital electronics, with only difference that we talk about electron or hole movement. So, what you can do, is only decrease the current to minimum. Use a huge resistor as R3. How big? Well, you need to know the minimum current needed for the microcontroller. It is in its specifications. Usually a 22 Kohms resistor works, and can limit the current down to 0.2mA.


  • At 12 February 2011, 12:38:32 user Dave wrote:   [reply @ Dave]
    • @Kammenos - thanks for the tip. It works great! However, my only concern is now the circuit is driving HIGH all the time. I want to keep this running all the time and was hoping to minimize power draw. Is it possible to make it drive LOW and then HIGH only when touched?

      Dave


  • At 12 February 2011, 9:47:07 user Kammenos wrote:   [reply @ Kammenos]
    • Hi Dave. I think that the problem is that when the electrode is not touched, the input is floating. I suggest that you convert it into an inverting amplifier (the T2 i mean). Here is how to do it. R3 must be 1K5 or 2K2. I would use a 2K2. Then, the emitter of T2 (the one that goes to L1) should be driven directly to ground (as if you bridge L1-L2). Then, you connect the analog input of arduino in between the collector of T2 and R3. Keep in mind that now, the output works different. You get HIGH when input is NOT touched, and LOW when is touched. Please inform me if it works.


  • At 11 February 2011, 16:02:05 user Dave wrote:   [reply @ Dave]
    • Hi, glad I found this site. I am working on a DIY dimmable LED light for my desk and am using the Resistance Touch Momentary Button circuit you have above (the one without the 4013 that only turns the LED on when touched and off when not touched). I have the based of T2 (2n2222) going to an Arduino and reading it using AnalogRead(). However, I am having difficulties as it translates the voltage values into values between 0 and 1023. The problem is, if the circuit is powered and I dont touch the contacts, the values being returned seem to fluctuate and sometimes jump. For example, powering up - get the range of 470-480, but then for no reason, it will jump up to 530-540. This would be ok, as i can just set my Arduino to trigger at values above 550. However, the opposite is true as when I am triggering the dimming code, and my finger is on the contacts, it sometimes falls be low 550 (when most values are 680+).

      Sorry for all the detail - my question is this - can I add something to the output of T1 (BC517) that will help smooth this, or only trigger a reading when the voltage is above a limit. Note- I measured the voltage and during non-touch operation, it is about 0.04V, when touched it is ~2.5V. Problem is, the Arduino does not seem to see it this way (because I think its AnalogRead function normalizes the values.


  • At 2 February 2011, 13:22:41 user Fung wrote:   [reply @ Fung]
    • Temporary no because I have not been purchased it yet, but I have jotted it down, the BC517 in tape x100. So, I use 2 BC548 transistors instead.

      I believe that if BC517 is used, the problem can be solved.


  • At 1 February 2011, 17:54:29 user Kammenos wrote:   [reply @ Kammenos]
    • hmmmm, most unlikely. Do you have a darlington transistor for T1? If yes, what you can do is reduce R1 to 220 or 150 ohms. If still not working, add another darlington amplifier, but imo this is overkill. it should work with one darlington.


  • At 1 February 2011, 14:16:36 user Fung wrote:   [reply @ Fung]
    • When I test the resistance toggle touch switch circuit, I found that if the finger is too "dry", the 4013 gives no action. What modifications should I take if I want it to be more sensitive?


  • At 17 January 2011, 9:20:10 user Kammenos wrote:   [reply @ Kammenos]
    • Yes Fung, they do. My mistake. I correct it.


  • At 16 January 2011, 18:37:17 user Fung wrote:   [reply @ Fung]
    • For the resistance toggle touch switch circuit, do the 4013's pin 14 connect to Vcc (also the pin 7 to Vss)? In the schematic, they just connected to a electrolytic capacitor.



    delicious
    digg
    reddit this Reddit this
    Faves



     HOT in heaven!


    NEW in heaven!



    New Theory: AC electric motor working principle



     Contact     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS   

    Site design: Giorgos Lazaridis
    © Copyright 2008
    Please read the Terms of services and the Privacy policy