Kids' Basics: On/Off Touch Switch

Daniel Koch

Issue 41, December 2020

An easy to build DIY touch switch that you can connect to (almost) whatever you like!


Touch switches come in several forms. While the 1950s designs used large and impractical vacuum tube valves, by the 1980s transistors had made their way into consumer electronics and bedside and table lamps hit mainstream popularity. While they fell out of fashion, touch switches make a comeback every now and again, particularly in wall plate designs.

Outside the average house, though, touch switches are used in situations where a mechanical switch is for some reason unsuitable. Many shopping centre bathrooms feature sensor-based switches to turn the taps on and off touch-free. Touch switches can be used in equipment that must be sealed, where rubber covers eventually wear out. They find uses in commercial and industrial situations that most of us never see, but we're going to build a fun one that can be used around the home.

While commercial designs can control brightness or the like, ours is a bit simpler and is a straight on/off version. Anything more functional would be well beyond our rules for Kids' Basics complexity. We haven't designed a specific load to drive from this, either. We have instead used a relay module meant for Arduino, so that you can control whatever you like, as long as it's safe. The circuit is powered from 5V for the sake of the relay module, but the relay contacts can switch a different voltage. This means you can power the circuit from a USB plugpack or power bank.

If you have any of our previous builds lying around, you could use this project to switch on and off the Star Struck artwork, or last month's illuminated picture frame instead of the light sensor. For demonstration, we replaced the PIR sensor in the old lighthouse night light project. It isn't limited to lights, however. You can get creative!

The only rules for switching are that the voltage is safe. We'll describe later how to use the relay to switch different voltages, but make sure you do not use anything that is above around 50V AC or DC. This means NO MAINS! We really shouldn't have to say this, especially to people reading Kids' Basics, but mains can kill you very easily.

It's also illegal in Australia to wire anything into the mains, and that includes something you build yourself that has a power lead on it. Many people used to think you could make something mains powered in a case, for example, like an amplifier power supply, and use a power lead for connection to a power point. Recently, though, the authorities have made it very clear that this is not true. If it's mains, you need a license.

We encourage you to read all the way to the end of the article before you build. Not only will you have a better feel for the overall picture as you build, but we sometimes discuss options or alternatives that you will need to have decided on. In this case, we have two different touch plate options.

As always with Kids' Basics, we're building on a solderless breadboard. We avoid soldering to make Kids' Basics accessible to more people, but having an adult around can still be helpful. You won't need any particular skills besides being able to identify components at a basic level, and even then, we help as you go along. If, for example, you don't already know what a resistor is, you'll probably be able to work it out from the photos and description in each step.

We do provide a schematic or circuit diagram but this is just helpful if you already know how to read one. Don’t stress if you have never learned, but take the chance to compare the digital image of the breadboard layout (which we call a 'Fritzing' after the company that makes the software) to the schematic and see if you can work some things out. You can make this project from the Fritzing and photos alone. You might also like to check out our Breadboarding Basics from Issue 15.

One thing you really do need to know: The Integrated Circuit (IC) at the heart of this project is a CD4093. Any IC has a dot near pin 1 or a notch in the end where pin 1 is. Unfortunately, many ICs are now made with plastic cases (they were once ceramic) and there is often a dot at one end in the middle from the moulding process.

Most ICs today use the notch, which is much easier to see, but look closely at your whole IC first. Secondly, each manufacturer has their own codes. Some are 4093, some HEF4093, and ours was made by On Semiconductor who put an extra '1' before the part numbers, making it MC14093BCP. The letters following are extra information. Just make sure that when you buy your IC, keep it in its own labelled bag or envelope, otherwise, this could get confusing later.

The Build:

tools & materials
Wire Strippers
Side Cutters
Sticky Tape
Scraps of Cardboard

tools & materials

Parts Required:JaycarAltronicsCore Electronics
1 x Solderless BreadboardPB8820P1002CE05102
1 x Pack of Breadboard Wire LinksPB8850P1014ACE05631
2 x Plug-to-socket Jumper Leads*WC6027P1017PRT-12794
1 x 24kΩ Resistor*RR0605R7591COM-05092
1 x 47kΩ Resistor*RR0612R7598COM-05092
3 x 1MΩ Resistors*RR0644R7630COM-05092
1 x 100nF Capacitor%RM7125R3025BCE05188
2 x 470nF Capacitor%RM7165R3033BCE07453
1 x CD4093 Quad NAND GateZC4093Z4093CE07454
1 x 1N4148 or 1N914 Diode*ZR1100Z0101CE05129
1 x Relay ModuleXC4419Z6325CE05137
1 x Pack of Copper TapeNM2870T2980APRT-10561
1m Twin Core WireWB1702W2100CE06933

Parts Required:

* Quantity shown, may be sold in packs.

% We used MKTs but you could use greencaps. Ceramics at the larger value will be hard to find but would work if you have them.

In addition to these parts and materials, you'll need a way to power your build. Because there are a few ways to do this, we've discussed it at the end of the build. You might light to scout around for an old USB cable though, one that no one is using anymore. Try to find a cheap charging cable rather than a general purpose USB cable. There are some other options at the end too, so read on.

Step 1:

Place the breadboard in front of you with the outer red (+) rail away from you and the outer blue (-) rail closest to you. Install the CD4093 IC with its dot or notch facing your left. Also, add the wire links which join the matching supply rails.

Step 2:

Add the wire links which surround the IC. Count carefully to place them correctly, and note that the one to the left across the gap in the board is spaced one row away from the end of the IC.

Step 3:

Install the three 1MΩ resistors (brown-black-black-yellow- -brown). Place resistors so that their colour codes read top to bottom or left to right. While a resistor does not care which way current goes through it, keeping them this way makes reading the codes later on much easier.

Step 4:

Place a 47kΩ resistor (yellow-purple-black-red- -brown) and two horizontal wire links. These are blue and green in the photo. Add a diode with its striped end the lower red (+) rail and the other end to pin 1 of the IC.

Step 5:

Install a 470nF capacitor (marked 0.47 or 474 with a letter and three more numbers following) between the upper blue (-) rail and pin 13 of the IC. Add another between the lower blue (-) rail and pin 2. Also, add a wire link to join the lower blue (-) rail to pin 7 of the IC.

Step 6:

Install a 100nF capacitor (marked 100n or 104 with a letter and three more numbers following) between the upper blue (-) rail and pin 12 of the IC. Also, add a wire link to join the upper red (+) rail to pin 14 of the IC.

Step 7:

Insert three plug-to-socket jumper wires, one in the upper red (+) rail, one in the upper blue (-) rail, and one at the end of the wire link from pin 10 of the IC. Also, install a 100μF capacitor with its negative striped leg in the upper blue (-) rail and the other leg in the upper red (+) rail.

Step 8:

Install the relay module on the sockets of the jumper leads. Pin order varies between manufacturers, but the wire from the red (+) rail goes to +, V, or V+; the wire from the blue (-) rail goes to -, G or GND; and the wire from the wire link goes to the input, marked S or SIG.

Step 9:

Insert a 24kΩ resistor (red-yellow-black-red- -brown) across the gap in the middle of the board in line with the relay signal connection. Install a wire link between the resistor and the lower blue (-) rail. We could have added this to the upper rails but things are getting crowded there.

Step 10:

Cut six or eight pieces of copper tape, slightly less than the length of the cardboard. Carefully stick them down so they are close to each other but not touching. Look carefully at the pattern in the image. Cut a length of twin-core wire, bare about 1cm of one end, and about 5cm of the other.

Step 11:

Insert the short ends into the breadboard as shown. The strands will need to be twisted firmly. Use a short wire link in the same holes to keep the stranded wire in place. One wire goes to the upper red (+) rail, the other to the 47kΩ resistor.

Step 12:

Tape the longer ends over the groups of three copper tape ends. This means one wire touches every second piece of tape. Be careful not to cover any of the copper tape where all the pieces are, keep it to where there is only every second piece.

Now all that is needed is to connect power and a load. We designed the project to run from a USB supply, so you could use the power supply wire from last month's Kids' Basics. If not, you can cut the end off an old phone charger (please ask first and make sure it's old!) and twist wires to the wires inside. The challenge is that not all the internal wires in these power supplies are colour coded.

You could also cut up an old USB cable or cheap phone charger cable from a dollar shop. More of these are colour coded, and often the cheap charging cables only have the power wires in them, not the data wires for the USB. Have a look at the photo as a guide. Of course, there are lots of other 5V power options too, including dedicated breadboard power supplies, and power banks.

As for loads, we discussed earlier that this can be whatever you want, as long as it's a safe voltage. Don't go cutting up any mains supplies. Our title image is our old Lighthouse Night Light project with the Arduino and breadboard removed and the LEDs connected to the touch switch and its power supply! The dedicated power supplies often come with breadboard kits, but can be purchased alone too. They plug into the power rails of the breadboard and are powered by a 12V plug pack. You might have to change where the power wires for the relay connect to the breadboard to make one fit.

The other thing to keep in mind is whether or not someone else wants or is using the thing you want to use as a load. Don't cut up your adults' Christmas lights and put them around your room! Unless you've asked first, of course.

What's Going On?

Inside the CD4093 IC are four separate arrangements of internal components called 'gates' which have two inputs and an output. While other arrangements like amplifiers and comparators that we have used before have two inputs and an output, gates work a bit differently. There are four types, OR, NOR, AND, and NAND. The CD4093 has four NAND gates.

In an OR gate, one input OR the other needs to be high for the output to be high. In a NOR gate, the output is high when neither output is high (both low). Either, or; neither, nor.

In an AND gate, inputs 1 AND 2 have to be high for the output to be high. In a NAND gate, which we don't have an easy phrase to remember, if both inputs are low, then the output is high. If one input is high and the other low, the output is high. If both are high, the output is low.

While we showed the build schematic with the Kids' Basics standard of using the IC outline in the schematic, and traditional schematic shows the individual gates as separate items (or amplifiers, or buffers, or whatever is in the IC). We have the circuit diagram again here in the traditional manner, but know when you read it that all four of those gates are in one IC. The gates are labelled IC1a, b, c, d, or whatever, based on the pin order or internal layout of the IC.


The contacts are independent and not powered by the circuit unless you link it. The relay has a common, normally open, and normally closed contact. The common is shared between both. It is connected like a switch to the normally closed contact until the relay is powered. Then, the magnetic coil pulls the contact to the normally open position, closing the connection between there and common, and opening the connection between common and normally closed. So, you can switch any other voltage within safe limits, by connecting power to common, load to normally open, and the ground connection straight to the load's ground.

When power is first applied, IC1a's second input and IC1d's first input, which are tied together and fed by the touch plate, re low because of the 1MΩ resistor to GND. Their other inputs are also low, but we'll see why shortly. This means both outputs are high. The output of IC1a goes to an input of IC1b, and the output of IC1d goes to an input of IC1c. The other inputs of IC1b and IC1c are fed by each other's outputs. This cross-connection is called a flip-flop. The 24kΩ resistor to ground connected to IC1b's other gate keeps that input low, so the output stays high. This output goes to the remaining input if IC1c, which, having two high inputs, stays low.

Besides the IC's power connections, no current is flowing to the inputs until the touch plate is touched. When this happens, a tiny amount of current flows across your skin. Because every second piece of tape is wired to the voltage supply rail, and every other via the 47kΩ resistor to the 100nF capacitor, this begins charging. You'll notice there is a 1MΩ resistor in parallel but there is still plenty of current to charge the capacitor. As it charges above half the supply voltage, the connected inputs of gates IC1a and IC1d go high.

Meanwhile, because IC1b's output is high, current flows from here via the 1MΩ resistor to the 470nF capacitor in pin 13, the remaining gate of IC1d. This has been happening since power was applied, so as soon as the current from the touch plate charges the 100nF capacitor and sends pins 1 and 12 high, which includes IC1d's other input, the two high inputs cause IC1d's output to go low. As soon as it does, IC1c no longer has two high inputs, so its output goes high. This is where our relay signal is connected to, which now turns on.

With IC1c's output now high, the input of IC1b now has a high signal, which causes it's output to go low. Remember, IC1a was feeding IC1b's other input a high signal. Current also flows via another 1MΩ resistor to the other 470nF capacitor connected to IC1a's other gate, pin 1, which charges up and brings this input high. It allows the 470nF capacitor on pin 13 to discharge via its 1MΩ resistor and the low IC1b output, which is now sinking current.

At this point, the capacitor at IC1d is discharged, and the capacitor on IC1a is charged. It is now ready for current to arrive from the touch plate. When it does, or if the finger has never been removed from the touch plate, IC1a will now have two high inputs high and its output will go low. When this happens, IC1b's output will go high again, repeating the process. This is why, if you keep your finger on the touch plate, the relay output oscillates on and off. The 1MΩ resistor parallel to the 100nF capacitor and in series with the 47kΩ resistor from the touch plate allows the 100nF capacitor to discharge between touches and also helps keep the pin1/pin12 junction from floating around. If you apply power with your finger on the touch plate, the time until the relay first clicks is noticeably longer than the time between clicks when you leave it there.

The human body has induced current in it in most situations, and the 1N4148 diode ensures that pin 1 cannot be pulled above the supply voltage the touch plate receives such voltage from the body touching it.


The copper tape is one way of making a touch plate, but it is not the only way. All that is needed is some way to create lots of current paths close together that can be bridged by the skin. We explored with a paperclip version too. It was far less reliable because the paperclips don't like to stay still under the tape. It's very hard to flatten them out enough. Hot melt glue might help but at this point we chose the copper tape. You might well come up with a better idea.

The circuit here is not new, as many of our simple circuits aren't. We made lots of changes though. The biggest was increasing the capacitor values a lot so that the finger did not have to be pulled off the plate so quickly. Play with values but keep to non-polarised capacitors.

One experiment you could try is to make a two-way switch by making a second touch plate on a longer wire and connecting it in parallel with the existing one. That way, you could turn a string of fairy lights off and on from each end of a garden path, for example. These lights are usually below 36V but make very sure before you cut into anything, and never do so with the power applied!