Have a Question?

XBee Scent Generator

Table of Contents

  1. Introduction
  2. Assemble the Parts
  3. Configure the Radio
  4. Prepare the Air Freshener
  5. Wire up the Circuit
  6. Use it!

1) Introduction

What does information smell like? Now you can savor the bouquet of your data with an XBee Scent Generator. We show how to connect easily connect a battery-powered air freshener to the wireless web, using an XBee radio.

By pairing the XBee with a scent dispenser, you can create ambient alerts that notify a whole area without making any noise or needing anyone to look at them! This is a terrific way to present information that builds over time. Not meeting your corporate power-saving goals today? A whiff of pine can remind your co-workers to think green. Are sales spiking? Perhaps the smell of cinnamon warns your workforce that the website is getting slow. Or maybe surf's up at the beach and a brisk fragrance of ocean breeze pervading your home could change your afternoon plans. It's a whole new way to interact with information!

2) Assemble the Parts

To hook up an scent dispenser to an XBee for output you can smell, you'll need:

3) Configure the Radio

If you're not familiar with configuring radios using AT commands, review the steps in the Basic XBee 802.15.4 Chat tutorial, which walks you through configuring CoolTerm to program the radios.

  • Insert the XBee into the Explorer USB and connect it to your computer.
  • Launch CoolTerm and connect to the XBee.
  • Here are the commands we're going to use to configure the radio:
Function Command Parameter
Reset ATRE N/A (resets the radio to its factory settings)
PAN ID ATID 3001 (any address from 0 to FFFE will do)
MY Address ATMY 2
Pin 0 I/O configuration ATD0 5 (digital output, HIGH on startup)
I/O input address ATIA FFFF (address of any transmitting radio)
Write to memory ATWR N/A (save the settings to flash memory)
  • Here's what your terminal session might look like. The user input is in bold:
ATID 3001
ATD0 5

Note: Remember to issue the ATWR command when you're done so that the settings are saved in the radio's flash memory. If you don't issue this command, the radio will revert to its old settings when it loses power.

4) Prepare the Air Freshener

  • We'll be using the Glade Sense & Spray in this example. This device runs on two AA batteries. Hacking it for our purposes is very easy. There's a light sensor that triggers a spray every 20 minutes when it detects motion. We'll disable that feature because we want full remote control only. There's also a "boost" button that triggers additional sprays. We'll attach a couple wires to extend that switch outside the case, to where our XBee is. Let's do it!

  • Here's the Sense & Spray, out of its packaging. Notice the white button at the bottom.

  • This is the pushbutton activator that will "boost" spray when pressed. The button also has a hole that allows a photocell to detect rapid changes in lighting. We need to open the case to disable the photocell and attach a couple wires to the boost button.
  • Open the case by separating it at the top. Inside you'll see the scent canister and two AA batteries. Remove the back cover by popping out the white hinge pins at the top. You can do this pretty easily with your fingers.

  • Use a phillips screwdriver to remove the four screws on the back of the internal casing.
  • Lift off the back gearing and motor so that you can see the circuit board. Also remove the batteries at this time. Don't worry if the gearing falls off, we'll show you how to replace it later.
  • The circuit board is held on by two white clips that you can release with your fingertips. Pull up on the spring terminals for the batteries so that the whole assembly slides up and out as shown.
  • Use black tape to cover up the photocell so that it no longer responds to light/motion. You could also clip it out entirely if you're sure you never want to use it again.
  • Solder two wires to the back of the circuit board as shown. These will extend the connection for the tactile switch so you can operate it externally. The blue wire in this case is connected to the Ground side of the switch.
Replace the circuit board, sliding the battery spring terminals into their slots and popping the board back into its white retainer clips. Then replace the motor and gearbox assembly as shown.
  • Place the smaller of the two round gears on the spindle nearest the motor, with its inner gearing facing up as shown. The semi-circular cam gear should also be placed on its spindle as seen here.
  • Place the larger round gear on the center spindle with its inner gearing facing down, as shown. The activator lever can also be placed at this time. It interlocks with the cam gear's pin. That's what moves it up and down to so the motor can activate the sprayer!
  • Now simply reverse the initial steps. Screw the rear inner casing back on, threading the wires you soldered on at a convenient place between the halves of the casing.  Insert the AA batteries again. Then replace the outer cover by snapping the top white hinge pins back into the outer case and flipping it closed. Again, thread the wires between the outer casing halves in a place where they are not being pinched. (You could also drill a small hole in the backs of the inner and outer casing and run the wire out of that, but only if you want to be fancy.)

  • We made it easier to attach the other end of the scent dispenser wires to the breadboard by soldering some male headers onto it as shown. With batteries in the air freshener, it will fire any time you connect the two pins together. You're done with the hack and much closer to the sweet smell of success!

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.

5) Use it!

Now that you know how to set off scents with an XBee radio, take a look at our input tutorials for what can trigger the fragrance. Just be sure that the the transmitter's address is set as the receiver's I/O input address setting (ATIA). The video above shows a switch acting as a direct remote control. You can also hook up to the XBee Internet Gateway to send aromas from anywhere on the Internet.

There's no better way to get started with ambient output. Profits up? Database down? Plants dry? Basement wet? Checkout too slow? Kids driving too fast? From now on your nose will know!

Tags: 802.15.4