Introduction: Through-Glass Doorbell
Link to video, as it doesn't show up everywhere: http://www.youtube.com/watch?v=K7FI8O0eBBI
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)
- External power supply
- TIP120 transistor
- 10MΩ resistor
- 2.2kΩ resistor
- 1N4001 rectifier
- 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!