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 two wires that you soldered onto the air freshener switch into the breadboard. The one attached to the Ground side of the switch (the blue wire in this case) gets connected to the ground rail on the breadboard. The other wire should be connected to the XBee’s AD0, physical pin 20 in the upper right of the radio. If you hook the wires up in reverse by accident, it won’t work but you won’t hurt anything, so just flip them around the other way.
- 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 Scent & Spray air freshener may fire one time when you insert the batteries, but after that it will be triggered remotely.
- Above is a breadboard layout and a diagram of the circuit for your reference. Here’s how it works electrically:
- The tactile switch on the air freshener, when pressed, connects a trigger to ground, firing off a sequence that runs the sprayer.
- We have tied the two devices grounds together so they are electrically the same with the blue wire.
- The wire that we soldered to the trigger side of the switch is connected to pin AD0 of the XBee, and that pin has been set HIGH to start with.
- When we remotely bring that pin LOW, it is connected to ground, triggering the air freshener as if we had physically pressed its “boost” button.
- It will continue firing off scent until we remotely bring XBee pin AD0 HIGH again to stop it.
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 relay to join the trigger to ground. Also, different brands of battery-powered air fresheners will require different connections, but many will be similarly easy to connect to an XBee.





