Hey, everyone! In this Instructable, I will show you how to control devices such as lamps and fans, by using knocks and touch! These are just other ways to activate household appliances, instead of using conventional switches. This project is handy for those wanting to make their homes "smarter" and geek-ish, and can also act as an add on in a home automation project!

Here's a video demonstrating the knock switch and the relay along with an LED Lamp, just so you know that it's actually working...

Step 1: About the Project...

I have used a toggle circuit based on the popular 555 IC, which receives an input from a piezo element via two transistors. As a result, there is no need of an Arduino or micro controller, making the project cheap; under 2$. I have modified the circuit I originally got from BuildCircuit.com, and added a relay, so it can handle 100-240V appliances.

When idle, the circuit consumes about 20-30mA (0.2W), and upto 120mA when switching on the relay ( excluding the LED lamp, if used). The circuit is small, and can be powered by a battery or adapter.

Step 2: Materials Required...



  • 5 - 7 V Relay
  • Piezo element
  • Jumper wire
  • BC547 transistors
  • IN4007 diode
  • Resistors: 100K, 10K, 330ohms
  • Capacitors: 1 uF
  • PCB
  • Berg sockets
  • Female header (optional)


  • An Adapter
  • LED lamp (optional)
  • Battery(optional)
  • CFL/Fan/ any other appliance...

Step 3: The Circuit...

The circuit is based on a toggle switch circuit I saw on BuildCircuit.com. With a few modifications, this can be turned into a knock or touch switch. The circuit for the touch switch and the knock switch are the same, just that the touch switch uses foil contacts and the knock switch uses a piezo element.

Update: I have now included a fritzing diagram on a breadboard, so you can test the circuit with ease.

Step 4: Soldering the Circuit on a PCB...

I used a general purpose PCB, but you may etch your circuit if you want. Soldering is not too difficult, though you may need some experience. I used berg sockets for the 555 IC, and male headers for two transistors (for the reason, see the pics above). Of course, their optional, but novices are advised to follow my idea.

Note: You may have noticed that I used 12K resistors instead of 10K ones, but it doesn't matter, as long as both have the same value.

The DIY Layout Editor is an awesome tool for designing ciruits on PCBs. I recommend you download it.

Step 5: Cut the PCB and Smooth the Edges...

The title and pictures are self explanatory. You may have noticed that I soldered 1 transistor directly, as I didn't have to make many solder tracks around it. Even then I used a paper clip as a heat sink to avoid damaging the transistor...

Use a saw if you have one. I dont have those types of tools around...

Step 6: Add Components...

Well, just pop on the 555 and the transistors as shown in the picture above. Skip this step if you've directly soldered the components on the PCB.

Step 7: Preparing the Knock and Touch Sensors...

The piezo element acts as a knock sensor. Solder jumper wires to it as shown in the above picture. The touch sensor is simple to make.

  1. Start by cutting out a pice of paper of about 8 x 4 cm .
  2. Cut out two strips of aluminium foil, and stick it on the paper as shown on the picture.
  3. Stick a jumper wire to each strip with insulation tape

Step 8: Preparing the Relay...

Wait, what is a relay?

A relay is an electrically operated switch. Usually relays use an electromagnet to mechanically operate an isolated switch. It's main function is to use a small voltage to switch on/off a high voltage or high current separately. It's handy for controlling mains appliances with small circuits or micro controllers.

For more information see this helpful instructable- How Electronic Switches Work For Noobs: Relays and Transistors

Better use the 5 pin relays, to avoid confusion.

My relay just wouldn't fit on a breadboard or a PCB, so I had to solder wires to its pins directly. For the pinout, see the picture above. The pinout May vary with different relays, so be sure to check out the datasheet. Note that I connected thick copper wires for the pins dealing with mains voltage.

Step 9: Connecting the Knock Sensor...

Put one terminal of the knock sensor to the base of the first transistor, or insert it in the female header if you followed my PCB layout ( that is why I used the header, so that I can take the sensor out later. You may solder it directly, but it will be permanent).

The other terminal is connected to ground, and I have another header for this to go in. Basically this header is connected to ground.

Step 10: Connecting the Touch Sensor...

See the pictures and their tags for information.

The collector of transistor 1 was connected to +9v, and the emitter to base of transistor 2. So take out transistor 1(T1) and

  1. Insert one of the touch sensor's terminal to where T1's collector was, i.e to +ve.
  2. Insert the other terminal to where T1's emitter was, i.e the base of transistor 2.
  3. Done...

Step 11: Connecting the Relay to the Circuit...

Here are the connections...

  1. One pin of the relays's coil's inputs to the ground header pin.
  2. The other coil's input pin to the output wire of our circuit.
  3. An IN4007 connected between the relays input pins, with the anode (+) connected to ground and cathode (-) to the output wire ( not the other way round !).

Step 12: Connecting the LED Lamp...

The LED lamp consists of 18 white super bright LEDs, powered by a 5v 200mA wall adapter. The relay will control this lamp. Connect the + wire to the relays red COM wire, and the LED's anode(+) to the NO ( normally open pin, the one on which I soldered a thick black ). The LEDs' cathode (-) is connected to the adapter's ground, or - wire.

Step 13: Final Touches and Completion

Well, your knock or touch switch is ready! Power it up by clipping in the battery and turning on the adapter. Get it together and stick it in one place. If you are a little experienced, you can connect a CFL or fan to the relay. However, the relay must then be isolated, otherwise you'll end up getting a nasty shock, or destroying the circuit on the PCB.

For the touch switch, use your fingers to cover both strips of foil at once to activate the switch.
Here's the video of the knock switch again. If you liked my Instructable, please go ahead and comment!!!

There is a diode on the breadbord and parts list but not on the circuit pls reply soon
<p>Cool :D</p>
<p>Awesome .... I'm going to make it!</p>
Nice This Rocks! I'm gonna use this at our house. Thanks a lot.
<p>Thanks for the positive comment :D</p>

About This Instructable




Bio: Linux n00b, hacker
More by DangerousTim:ESP8266 Desktop Clock (WiFi Synchronised!) Linkit ONE GPS Tutorial Linkit ONE Setup Guide 
Add instructable to: