Introduction: Through-Glass Doorbell

Link to video, as it doesn't show up everywhere:

How do you trigger a doorbell through a pane of glass? It's definitely not impossible, but it does require some Arduino magic. In this instructable we're going to outline how to use the Arduino to sense the change in capacitance of a piece of aluminium foil mounted on the other side of a glass pane. We're going to use that sensing ability to trigger a solenoid to ring a bell. Easy peasy!

Watch the video on top if you haven't already to understand what we'll be making!

Let's get started, here is what you'll need:



  • Arduino Uno
  • Aluminium foil (or tape)
  • Solenoid
  • Bell
  • External power supply
  • TIP120 transistor
  • 10MΩ resistor
  • 2.2kΩ resistor
  • 1N4001 rectifier
  • Wires



  • Soldering iron
  • Wire stripper

Step 1: Theory

What the Capacitive Sensing Library on the Arduino actually does is that it measures the time it takes between the send pin sending a signal to the receive pin receiving the signal. Normally, in a regular circuit, this happens pretty much instantly. Even when you add a high value resistor the signal travels pretty much instantly, but something magical happens when you touch the circuit. Because you are conductive, and have your own capacitance, it will take longer for the signal to reach from the send to the receive pin when you interfere with the circuit. Adding a piece of exposed wire, or aluminium foil, for you to touch gives you an easier way to access the circuit.

What is even more magical though is that with higher value resistors in the circuit the capacitive sensing increases in sensitivity, to the point where you don't actually need to touch the actual circuit. It's enough if you move your hand near it. What's even more magical is that it now works through non-conductive materials, like glass!

Before the penny drops, yes, it's similar to what smartphones and tablets do already, but on a way lower scale. The Capacitive Sensing Library can be used for some very crude position sensing as well to make interactive touch surfaces. Unfortunately, don't expect high fidelity from it.

Disclaimer: None of this is actual magic! The word "magic" is only used to emphasize how unintuitive this function is. In reality, it's a fascinating function, which you can spend many hours researching yourself.

Step 2: Circuit

The circuit is fairly simple, though with a couple of things which you need to be careful about.

First of all you will connect two wires to a piece of aluminium foil or tape. Aluminium foil can be very hard to solder, so you may want to use another method of attaching the wires securely. We used a small piece of copper tape which solders easily. Attach one wire to digital pin 4 and a high value resistor between digital pin 2 and the aluminium foil. The value will depend a bit on the sensitivity you want from the setup. In this case a 10MΩ resistor was used.

To ring the bell we need to actuate something which hits the bell to create the sound. For this we use a solenoid, and here is where things can get a bit hairy. Most solenoids on the market simply require more power than the Arduino can supply, or natively control. To get around this we're going to power both the Arduino and the solenoid through an external power supply and have the Arduino control a TIP120 transistor which in turn turns on and off the solenoid. To do this attach one end of a 2.2kΩ resistor to digital pin 12 and the other end to the base of the transistor. Attach the collector and emitter (the other two legs on the transistor) to the solenoid and to ground. Connect the positive lead of the external power supply to the other lead of the solenoid, and to Vin on the Arduino. Make sure your power supply is powerful enough to power the solenoid but not too powerful for the Arduino. It needs to be in excess of 6V, but cannot be higher than 12V!

Finally, add a 1N4001 rectifier between the leads on the solenoid to protect the Arduino from any power sneaker back through the wiring when the solenoid turns off.

Step 3: Code

I won't talk about the details about the code, you can download and go through the Arduino sketch if you're interested. Download it below!

The idea behind the sketch is to set up the capacitive sensing first, and make sure that it works as it should. You can easily do debugging using Serial.print to print out the values to the serial monitor and make sure it triggers as you want it to.

Once you have it triggering all you need to set up is a function to trigger the solenoid to ring the bell. This is very similar to blinking an LED, in that you're setting a digital pin to HIGH and LOW and controlling how long using a delay. The difference is that the digital pin is controlling a TIP120 transistor which in turn controls the solenoid. This is, as mentioned before, because the Arduino cannot itself give enough power to make the solenoid move.

There is also a 5000 millisecond (5 second) timer in the code, to prevent the bell from being rung more than once every five seconds.

Step 4: Final Result!

In the end, mount it where you see fit! Once mounted, you're probably going to find out that you need to adjust it again because the circumstances have changed.

Either way, enjoy your new doorbell!

Be sure to follow Switch & Lever here on instructables and on YouTube for more updates and projects!

Thank you!


MartynasB (author)2016-12-14

Is it possible to connect two of these using just three pins in the arduino?

flamingmat (author)2016-04-13

Hey could you describe how you use the "small piece of copper tape" you're using to attach the wires to the aluminium foil ?

joshua.brooks (author)2015-04-21

Quick intro to capacitive sensing. Well done! I'll have to start playing with this.

diy_bloke (author)2015-04-16

nice... unless you are married :-)


Not sure why marriage would make this not work. I'm lucky enough to have a wife who is really into things like these too.


then you are a lucky man. But most wives woulkd prefer a more 'tidy' doorbell :-)

Raitis (author)diy_bloke2015-04-18

It's not hard to make it more tidy either - just use some conductive glue or something else, apply it on a window through stencil, maybe even something more interesting than straight lines and hide the electronics somewhere. There you have a nice tidy conductive switch which rings the doorbell.

And keep in mind that attiny would probably be enough for this, so the controller part could really fit in a matchbox

diy_bloke (author)Raitis2015-04-18

indeed and please dont get me wrong, I am not critisizing your project at all. I think it is a fantastic idea

Raitis (author)diy_bloke2015-04-19

It's just that I like to see solutions instead of problems :)

diy_bloke (author)diy_bloke2015-04-18

dont get me wrong though. I think it is a great doorbell

Johenix (author)2015-04-17

Well, years ago they used similar sensors for burglar alarms. One safe wired to such an alarm rested against a ground floor back alley wall of the building. Every Saturday night about 11:15 the alarm would go off. When they watched the alley they found a man leaning against the wall, waiting for his girl friend to get off work next door at 11:30. The cure was to put a large grounded plate or screen between the safe and the wall.

You don't need solid metal foil, metal window screening will work just as well.

Switch and Lever (author)Johenix2015-04-18

Anything which is conductive will actually work, I've seen people using plants even.

starwriter34 (author)2015-04-16

Not bad might make one here soon.


If you do, be sure to post it here, would love to see it!

jcommisso (author)2015-04-16

Does this work through double layer glass?


If you mean through two layers of glass, with air inbetween, I doubt it. I mean, it would work in theory, but glass is an excellent electrical and capacitive insulator, meaning you would have to crank up the sensitivity of the system so high that I believe it would be more likely to be triggered by just moving air around the exposed foil than it would by you coming near it two glass layers away.