Projects / XBee point-to-point link

XBee point-to-point link

Intermediate2 hGuided buildReviewed

Build it step by step

0 of 8 done
  1. NANO

    Install XCTU

    From Digi's site.

  2. NANOCP2102

    Add module 1 through its adapter

    Read its settings.

  3. NANO

    Set ID, BD and the firmware

    As in the notes.

  4. NANO

    Repeat for module 2

    Same network ID.

  5. NANO

    Wire module 1 to the Nano

    With the voltage divider.

  6. NANO

    Upload sender.ino

    Power the Nano.

  7. NANO

    Open the XCTU console on module 2

    Watch pot= lines.

  8. NANO

    Run a range test

    XCTU's range test tool.

In short

How do you build an XBee point-to-point link?

Two XBee modules replace a serial cable over a few hundred metres, sending a sensor reading from an Arduino Nano to a PC. You need XBee 3 module × 2, USB to TTL serial adapter (CP2102) × 2, Arduino Nano, Potentiometer 10 kΩ, Resistor 1 kΩ × 3, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 8 steps and about 120 minutes.

Level
Intermediate
Time
About 120 min
Parts
7

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
XBee pin 1 (VCC)3.3 V only, from a 3.3 V supply that can give 250 mANever connect 5 V to an XBee
XBee pin 10 (GND)Ground, shared with the adapter or NanoCommon ground
XBee pin 2 (DOUT)Nano D10 (SoftwareSerial RX)Data from the XBee, 3.3 V is fine for the Nano
XBee pin 3 (DIN)Nano D11 through a 1 k and 2 k divider to GND (2 k is two 1 k in series)Data to the XBee, 3.3 V logic
Potentiometer middleNano A0, ends to 5V and GNDTest sensor
Second XBee on the CP2102 adapterAdapter 3.3 V, GND, TX to XBee DIN, RX to XBee DOUTThe PC end of the link

Code

An XBee 3 is a small radio module that behaves like a long wireless serial cable. Anything the Nano prints into one module comes out of the other module's serial port, so any code you write for a wired serial link works unchanged. You configure each module once on a PC with the free XCTU program from Digi: both get the same network ID, the same baud rate (9600) and transparent mode. For a plain point-to-point link, leave the destination at broadcast. Use the DigiMesh firmware so you can add a third module as a relay or a second sender later. IMPORTANT electrical points: XBee modules run at 3.3 V only and 5 V will destroy them, so the Nano's 5 V transmit line goes through a divider (1 k then 2 k to ground) before the XBee's DIN pin, while the XBee's output is 3.3 V, which the Nano reads as a high without trouble. Many cheap USB adapters cannot supply the 250 mA an XBee can need while transmitting, which shows up as resets; use an adapter or a regulator designed for it. Range is a few hundred metres in open air and far less through walls, so test at different distances and note the signal strength reported in XCTU's range test. Keep the baud rate low to be safe. Setup: Arduino IDE, board "Arduino Nano" (try the Old Bootloader option if the upload fails). Install XCTU on the PC.

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

// ===== File 1: sender.ino for the Arduino Nano =====
#include <SoftwareSerial.h>

SoftwareSerial xbee(10, 11);          // RX, TX (TX goes through the 1 k and 2 k divider to the XBee)

void setup() {
  xbee.begin(9600);                   // must match the XBee BD setting (default is 9600)
}

void loop() {
  int v = analogRead(A0);
  xbee.print("pot=");
  xbee.println(v);
  delay(1000);
}

/*
# ===== File 2: XCTU settings, the same on both modules except the destination address =====
# Open XCTU on the PC, add each module through its USB adapter, and set:
#   Firmware: Digi XBee3 DigiMesh 2.4 (a mesh firmware, so you can add nodes later)
#   ID  (Network ID)    = 2345      same on every module in your network, pick your own number
#   CE / role           = default
#   DH and DL           = leave at 0 and FFFF to broadcast to all, or set to the other module's SH and SL
#   BD  (Baud rate)     = 9600      matches the Nano
#   AP (API mode)       = 0         transparent serial, behaves like a wire
# Then open XCTU's Console on the PC module: the pot= lines should appear.
*/

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Turn the potentiometerValues change on the PC console
Walk 20 m awayLink keeps working
Put a wall in betweenSignal drops, link may stay
Change the ID on one moduleLink breaks
Set it backLink returns

If it does not work

No data

Network ID or baud rate mismatch; check both in XCTU.

Garbage characters

Baud rates differ.

Module resets while sending

Power supply cannot give 250 mA.

Module hot or dead

5 V was connected; fit the divider and the 3.3 V supply.

Short range

Antenna orientation and obstacles.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the XBee point-to-point link?

XBee 3 module × 2, USB to TTL serial adapter (CP2102) × 2, Arduino Nano, Potentiometer 10 kΩ, Resistor 1 kΩ × 3, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).

How long does the XBee point-to-point link take to build?

About 120 minutes for a intermediate maker, in 8 steps.

How do I know the XBee point-to-point link works?

Turn the potentiometer: Values change on the PC console. Walk 20 m away: Link keeps working. Put a wall in between: Signal drops, link may stay.

No data: what should I check?

Network ID or baud rate mismatch; check both in XCTU.

Garbage characters: what should I check?

Baud rates differ.

Module resets while sending: what should I check?

Power supply cannot give 250 mA.

Module hot or dead: what should I check?

5 V was connected; fit the divider and the 3.3 V supply.