Have a Question?

802.15.4 Analog Input with a Potentiometer

Table of Contents

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


1) Introduction

When it comes to analog input, it doesn't get any easier than a basic potentiometer. Nicknamed "pots," these components are essentially variable resistors, which let us, with a twist of their shaft, alter the amount of voltage that goes through their center pin. If you've ever adjusted a volume dial or a picture control dial on an older television set, chances are, you were using a pot.

XBee radios have two analog inputs and therefore can be connected directly to up to two potentiometers. With a little bit of configuration, the radios can transmit the level of the input voltage to the PWM output pins on the receiving radio.

2) Assemble the Parts

Potentiometer Input Parts
To hook up a potentiometer to an XBee, you'll need:

  • XBee 802.15.4 Radio
  • 2K potentiometer
  • Breadboard
  • Jumper cables
  • XBee Breakout Board - for your circuit.
  • XBee Explorer USB - for programming your radio.
  • A DC power source, 2.8 - 3.3V - We'll be using two C batteries in a battery holder from Radio Shack.

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 1
Destination address high ATDH 0 (indicates a 16-bit address)
Destination address low ATDL 2 (the address of the receiving radio)
Pin 0 I/O Configuration ATD0 2 (analog input)
Sample Rate ATIR 14 (20 ms, 14 in hexadecimal = 20 in decimal)
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:
+++
OK
ATRE
OK
ATID 3001
OK
ATMY 1
OK
ATDH 0
OK
ATDL 2
OK
ATD0 2
OK
ATIR 14
OK
ATID
3001
ATMY
1
ATDH
0
ATDL
2
ATD0
2
ATIR
14
ATWR
OK

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) Wire up the Circuit

  • Place the XBee adapter into the breadboard and wire up the power buses to each other.

  • Connect the VCC terminal of the XBee adapter to the positive rail and the ground terminal to the negative rail.

  • Connect the VREF terminal of the XBee adapter to the positive rail. This will give the XBee a reference for what voltage an analog sensor is working with.

  • The middle pin of the potentiometer gets connected to I/O pin 0, which is physical pin 20, on the top right side of the XBee. One of the outside pins of the potentiometer gets connected to the positive rail. The remaining potentiometer pin gets connected to the negative rail. Refer to the diagram above for the proper wiring.

  • When you insert the potentiometer, it will look like this.

  • Insert the XBee into the adapter.

  • And finally, connect the battery pack.

5) Use it!


Now that you know how to connect a potentiometer to the analog input of an XBee radio, take a look at our output tutorials for what you can control. 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 wireless potentiometer connected to a wireless LED.

Tags: 802.15.4