Project: Bluetooth Doorbell
Now you can take what you learned about XBees and apply it to a slightly more robust project: a wireless doorbell. Figure 4.7 shows the doorbell button, and Figure 4.8 shows the buzzer unit that is tucked away on a shelf inside.
FIGURE 4.7 The doorbell awaits visitors!
FIGURE 4.8 The buzzer unit sits discreetly on a shelf.
Sure, you might say, they make these already! You can buy a wireless doorbell in any hardware store. However, this one you make yourself! Even better, as you get more confident with Arduino, you can modify it to make it uniquely yours. For instance, what if your Arduino triggers a music player instead of a buzzer to let you know that someone has pressed the button?
The button you use in the button unit, shown in Figure 4.9, is kind of intriguing because it has six connectors: two sets of positive and negative terminals that close when the button is pressed—so you could have two circuits, both of which trip when the button is activated. The last two leads—the white lugs in the photo—are for powering the LED. Be sure to attach a resistor on the power lead so you don’t fry your LED inadvertently. I use a 330-ohm resistor in this project.
FIGURE 4.9 The button you use in the project has six connectors.
Switch Connectors (Two Located on Other Side, Too)
Instructions for Wiring Up the Doorbell
The project consists of two Arduinos equipped with XBee modules and breakout boards. One Arduino has a button, and the other has a buzzer to sound out to let you know someone is at your door. Let’s get started!
Let’s begin with the button unit (see Figure 4.10), which consists of the following components:
FIGURE 4.10 The button unit before the acrylic is added.
Now, assemble these parts together as shown in Figure 4.11, and you can follow along with these steps:
FIGURE 4.11 The button unit consists primarily of a button, an Arduino, and the wireless module.
- Plug in the XBee and its breakout board to a mini breadboard.
- Plug the XBee’s 5V to the 5V on the Arduino, its TX into RX, its RX into TX, and its GND pin to any free GND on the Arduino.
- Connect one of the button’s leads to pin 8 and the other to GND. (I use the breadboard to accommodate the GND leads coming from the button.)
- Solder a 330-ohm resistor and a jumper to the button’s LED’s power terminal, and connect the other end to the 3V3 port of the Arduino. The other terminal of the LED goes to GND.
Next, connect the components that make up the buzzer unit, seen in Figure 4.12. These consist of the following:
FIGURE 4.12 The buzzer unit waiting to be closed up. The outer holes are for wall mounting.
XBee wireless module
Next, use Figure 4.13 as a guide for connecting the various parts:
FIGURE 4.13 The buzzer unit consists of an Arduino, XBee, and buzzer.
- Plug in the XBee and its breakout board into a mini breadboard.
- Plug in the XBee’s 5V to the 5V on the Arduino, its TX into RX, its RX into TX, and its GND pin to any free GND on the Arduino.
- Connect the buzzer’s leads to the breadboard as well, as shown in Figure 4.13. You can connect them directly to the Arduino if you want—if you go this route, connect the red wire to pin 8 and the black wire to any free GND.
- To power the buzzer unit, use an Arduino-compatible wall wart or a 9V battery pack.
Building the Doorbell Enclosures
You next need to build the two enclosures for this project. The outside enclosure (see Figure 4.14) is designed to resist the elements—I hesitate to call it “weatherproof”—whereas the inside enclosure is designed to look good.
FIGURE 4.14 The outside enclosure is made out of bent acrylic on a wooden back.
Button Unit Enclosure
The button unit is the module that is on the outside of the door—press the button to make the buzzer buzz! To make an enclosure, all you need is a box with a hole for the button, but I’ll show you how you can make one of your own. The one I made consists of a sheet of acrylic that I bent by heating it up, and then laying the flexible acrylic over a metal pipe to form a half-circle. I added the acrylic to a wooden back (refer to Figure 4.11) to finish the enclosure. Here are the steps:
- Laser-cut the top, bottom, and back out of quarter-inch medium-density fiberboard (MDF). If you don’t have access to a laser cutter, you can create a box out of pieces of wood, repurpose another container as an enclosure, or buy a commercial project enclosure.
- Laser-cut the front from 5mm acrylic. (If you want the design files I used to output the wooden backing as well as the acrylic front, you can find them at https://github.com/n1/Arduino-For-Beginners.)
- Glue the top and bottom wood pieces to the back wood piece. You might want to paint the wood!
If you aren’t using a laser cutter, you’ll need to drill mounting holes in the acrylic. You might want to mock it up using a sheet of paper first.
- Bend the acrylic front plate as described in the next section, “Bending Acrylic.”
- Attach the acrylic plate to the front so that the button can be pressed through the hole in the plastic.
- Install the unit outside your door of choice, and eagerly await your first visitor!
For the outside button unit enclosure, you heat-bend acrylic (see Figure 4.15) to form a casing. This task is easy to learn because you don’t really need anything unusual or uncommon.
FIGURE 4.15 Bending acrylic is easy and gives a nice effect!
Acrylic (also known as Plexiglas) is also easy to heat and re-form. After it gets to the right temperature—not too hot or cool—the acrylic starts to bow and flex. When it gets a little hotter, it softens. That’s when you bend it how you want it, and let it cool into an awesome new shape!
You need three things to get started:
- The acrylic to be bent—I suggest 1/8 inch, though you might have luck with the thicker stuff.
- A form—This is the surface over which the hot acrylic will cool and harden. You want this close to the actual curve you want the plastic to hold. The easiest form of all is the edge of a table. I used a rounded form—a pipe—to form the acrylic face seen in Figure 4.7. If you go this route, you’ll need to find a form that matches the curve of the shape you’re looking for.
A source of heat—Heat guns (see Figure 4.16) and propane torches are common tools, though you can purchase commercial acrylic-heating strips (TAP Plastics has one for $80, P/N 169). Finally, you could heat up the plastic in an oven. This last technique is not for the faint of heart and you should definitely monitor the plastic closely so it doesn’t bubble or scorch.
FIGURE 4.16 Using a heat gun to soften acrylic.
Although you could conceivably use any heat-resistant surface to form your acrylic—or even build your own out of pieces of wood—in some respects, using the edge of the table is an easy choice because it bends the plastic perfectly, using gravity and the table’s surface to make a fairly perfect 90-degree bend. To bend plastic using the “edge of the table” technique, follow these steps:
As shown in Figure 4.17, position the acrylic so the edge of the table is right where you want the plastic to bend. You’ll definitely want to weigh it down so it doesn’t move.
FIGURE 4.17 As the acrylic heats up, it starts to bend.
When it gets hot enough, gravity starts pulling the soft acrylic down, as shown in Figure 4.17.
- Position the acrylic how you want it to look—and work quickly because after it cools, it becomes just as brittle as it was before. Don’t try to re-bend it without applying more heat!
Buzzer Unit Enclosure
The buzzer unit doesn’t use plastic, because who wants plastic in their home? Instead, you can use a simple arrangement of wooden panels separated by bolts. I laser-cut two pieces of wood, one bigger than the other. (I ended up hand-drilling four additional holes, as shown in Figure 4.18, after changing my mind on how to proceed.)
FIGURE 4.18 I used laser-cut wood for the buzzer unit’s enclosure.
To connect the two pieces I used brass bolts, #10-24 and 2.5" long, with brass washers and nuts. This enclosure is considerably easier to do than the other enclosure and it looks great!