# Getting Started with XBee (ZigBee)

I’m using the XBee S2C module from Amazon:

<figure><img src="/files/G2SZOktbJpbL3oDEnVBm" alt=""><figcaption></figcaption></figure>

## 1. Wiring <a href="#efa0" id="efa0"></a>

First, we need to wire up the XBee. Originally, I was going to use an Arduino UNO to do the USB-TTL conversion. However, I had no luck with it. Not sure about the reason. Maybe because I’m using a non-official clone, which has a different onboard USB-TTL chip?

Then I realized that I can just use a plain USB-TTL converter to establish the link between the XBee module with the computer. I’m using the Rath RA-LINK module, originally designed for the GD32VF series MCU. We will just use the serial converter function of this debugger.

<figure><img src="/files/puOWd1r4b5bgVfApz4nk" alt=""><figcaption></figcaption></figure>

An additional benefit of this setup is that both end are using the 2.0mm pitch Dupont connector. (Viva la metric unit!)

Here is the wiring diagram:

<figure><img src="/files/hgzrtfTrGccPOgwyYMhS" alt=""><figcaption></figcaption></figure>

## 2. Download XCTU

Download XCTU from [here](https://hub.digi.com/support/products/xctu/?path=/support/asset/xctu-v-659-windows-x86x64/).

<figure><img src="/files/i1MQWInYHV49Pg9dvw2c" alt=""><figcaption></figcaption></figure>

Insert the USB debugger into the computer and click this button.

<img src="/files/QWXurhx1YkB6kKcvdKcI" alt="" data-size="line">

In the pop-up menu, we will select the corresponding COM port.

<figure><img src="/files/YOKlB1rugugZLLffaEXg" alt=""><figcaption></figcaption></figure>

It will automatically search for the device.

<figure><img src="/files/6pkB4jiR10ACD050Lbla" alt=""><figcaption></figcaption></figure>

And then display its settings

<figure><img src="/files/KgspSJfSi6mnFeNdkGx8" alt=""><figcaption></figcaption></figure>

We will make this first device the station (coordinator), and thus we modify the following fields:

**ID** (Pan ID): 2333

**CE** (Coordinator Enable): Enabled \[1]

**DL** (Destination Address Low): FFFF

**NI** (Node Identifier): XBee-Station

**BD** (Baud Rate): 115200 \[7]

And update the configuration by clicking this button

<img src="/files/EGzTO2AjFGAs0sts3ed9" alt="" data-size="line">

Then the station node is configured successfully.

Next, we perform the same thing for the car node, but this time with the following settings:

**ID** (Pan ID): 2333

**JV** (Channel Verification): Enabled \[1]

**DL** (Destination Address Low): 0

**NI** (Node Identifier): XBee-Car

**BD** (Baud Rate): 115200 \[7]

Now we are ready to test the connections.

Press this button to switch to the terminal window

<img src="/files/hjZtDQdVApReeawvbV5P" alt="" data-size="line">

And click this button to open the serial port

<img src="/files/2NgtpGrZ2ybWw7h0dZX1" alt="" data-size="line">

Now when we type in one terminal, we can see the contents appear in another terminal, indicating that the connection is established

<figure><img src="/files/Bo1jHbJVYq6HmBULjyyB" alt=""><figcaption></figcaption></figure>

P.S. if the wrong configuration is entered in XBee parameters, XCTU will try to perform a revert on the chip

<figure><img src="/files/4XGyudGrraf0m0eOGhQ4" alt=""><figcaption></figcaption></figure>

## 3. STM32 Code <a href="#f1b8" id="f1b8"></a>

Because XBee uses simple TX and RX to transmit data, we can simply program the STM32 to transmit and listen to data on the [USART port](/notes/stm32/connectivity/uart.md).

\\


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tk233.gitbook.io/notes/tools/windows/getting-started-with-xbee-zigbee.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
