4) Wire up the Circuit
- Place the XBee adapter into the breadboard and wire up the power buses to each other. Next, connect the VCC terminal of the XBee adapter to the positive rail and the ground terminal to the negative rail.
- We made it easier to attach the battery holder to the breadboard by soldering some male headers onto its positive and negative wiring leads.
- Connect the battery pack directly to the ground and power rails.
- Insert the relay into the breadboard, making sure that it’s oriented so that each pin goes into a different row. This reed relay goes crosswise to the trough but other brands might go lengthwise. There will be two coil pins and two switch pins. One wire can attach a coil pin to ground. The other wire should connect the other coil wire to the XBee’s AD0, physical pin 20 in the upper right of the radio. For this type of relay, the polarity through the coil doesn’t matter.
- Here’s the second wire from the coil attached to the XBee’s physical pin 20 (AD0).
- Insert the wires from the cymbal monkey into the breadboard. Connect one wire to one of the relay’s switch pins.
- …and connect the other wire to the remaining relay switch pin.
- And finally, insert the XBee into the breakout board and load the batteries into the battery pack. If there’s a switch on the battery pack be sure to switch it to the on position. The Cymbal Monkey is now ready for wireless action!
- Above is a breadboard layout and a diagram of the circuit for your reference. Here’s how it works electrically:
- When pin AD0 on the XBee goes high, it triggers the coil on the relay to close the reed switch.
- The reed switch then brings two contacts together that connect the cymbal monkey’s wires to each other, completing the circuit that sends battery power to its mechanism.
- You could use this type of circuit to apply power to almost any simple battery-0perated device, creating a wireless method for turning it on and off.
Note: We’ve kept this example as simple as possible. The same effect could also be accomplished with a more sophisticated circuit, using a transistor or MOSFET to regulate the flow of power. Also, different kinds of devices will require different connections, but many will be similarly easy to connect to an XBee in this way. Don’t be afraid to try something new!