# xbee3: how to send data received from serial via ble

**URL:** <https://forums.digi.com/t/xbee3-how-to-send-data-received-from-serial-via-ble/22492>\
**Category:** XBee - Zigbee\
**Tags:** micropython, bluetooth, serial-communication, xctu, xbee3\
**Created:** [June 18, 2021, 8:13am UTC](https://forums.digi.com/t/xbee3-how-to-send-data-received-from-serial-via-ble/22492 "2021-06-18T08:13:34Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![manos](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@manos](https://forums.digi.com/u/manos)\
**Post date:** [June 18, 2021, 8:13am UTC](https://forums.digi.com/t/xbee3-how-to-send-data-received-from-serial-via-ble/22492/1 "2021-06-18T08:13:34Z")

</div>

Hey all,

My goal is to transfer all data received in the Rx pin of the serial of the xbee3 via ble to an other ble device.

Could someone point me to some documentation or/and example of how to do this?

Also, can this be achieved only with micropython (any helpful link on that?) or can it be done with simple xctu setting configurations?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![mvut](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/mvut/32/31_2.png) [@mvut](https://forums.digi.com/u/mvut)\
**Post date:** [June 21, 2021, 7:56am UTC](https://forums.digi.com/t/xbee3-how-to-send-data-received-from-serial-via-ble/22492/2 "2021-06-21T07:56:17Z")

</div>

You need to use API mode on the XBee 3 modules.

As for an example, I would use the XCTU Mobile app as it will allow you to do what you want.

---

<div class="post-metadata">

**Author:** ![manos](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@manos](https://forums.digi.com/u/manos)\
**Post date:** [June 21, 2021, 9:51am UTC](https://forums.digi.com/t/xbee3-how-to-send-data-received-from-serial-via-ble/22492/3 "2021-06-21T09:51:28Z")

</div>

Hi and thanks for your response.

Unfortunately, despite following the suggested principle (the usage of api mode), i have not managed to succeed.  
In detail, i have set the xbee in API mode 1 (or 2) and enabled the BLE (BT=1).  
Then, i sent in the serial of the xbee3, bytes which form an API frame (In example, i sent the following sequential bytes:  
0x7E, 0x00, 0x07, 0x2D, 0x00, 0x01, 0x74, 0x65, 0x73, 0x74, 0x11, which based on the API frame generator it should correspond to the message “test”, with frame type 0x2d (user relay frame) and for API mode 1). Then, i connected to the xbee3 through the XCTU Mobile app(although my final target is to send to another xbee3. By the way is that possible or xbee3’s can only be ble servers?). Then nothing happened (unfortunately).

Do i miss some extra configuration from the BLE settings of the xbee3 or am i doing something wrong with the data-api frame i am sending?

Any help or suggestion is more then welcomed.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![mvut](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/mvut/32/31_2.png) [@mvut](https://forums.digi.com/u/mvut)\
**Post date:** [June 21, 2021, 10:05am UTC](https://forums.digi.com/t/xbee3-how-to-send-data-received-from-serial-via-ble/22492/4 "2021-06-21T10:05:00Z")

</div>

In the XCTU Mobile app, you need to discover the XBee first. Then once added, go to the Frames Relay Console found under the triple dot menu in the upper right. They send your data back and forth. Your frame worked for me and this worked for me as well.

---

<div class="post-metadata">

**Author:** ![manos](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@manos](https://forums.digi.com/u/manos)\
**Post date:** [June 22, 2021, 9:52am UTC](https://forums.digi.com/t/xbee3-how-to-send-data-received-from-serial-via-ble/22492/5 "2021-06-22T09:52:41Z")

</div>

Hey,

glad that my api frame worked in your test, but in mine setup nothing happened…I connect to the XBee, provide the password, open relay console and tried to send a frame…it just doesn’t work…

Could you please provide me with the xctu settings you have configured, if that’s not a problem for you?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![mvut](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/mvut/32/31_2.png) [@mvut](https://forums.digi.com/u/mvut)\
**Post date:** [June 22, 2021, 10:02am UTC](https://forums.digi.com/t/xbee3-how-to-send-data-received-from-serial-via-ble/22492/6 "2021-06-22T10:02:08Z")

</div>

Other than API mode being enabled, I have firmware version 100B installed, BT Enabled, and BI set.

I also have the XCTU set for the terminal emulator on the same COM port and open.

---

<div class="post-metadata">

**Author:** ![manos](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@manos](https://forums.digi.com/u/manos)\
**Post date:** [June 30, 2021, 9:10am UTC](https://forums.digi.com/t/xbee3-how-to-send-data-received-from-serial-via-ble/22492/7 "2021-06-30T09:10:04Z")

</div>

Hey,

my bad, I was creating the wrong api frame (wrong frame type). Fixing that enabled me to send with ble! Thanks for your input.

May I ask though, can I also transmit to an other XBee3 via BLE? Or XBee3 can not act as a BLE client?  
In the latter case, can I then transmit to an other ble device? And if so, is there any guide/example or could you please provide me some guidelines?

PS: shall I post this in a new post or is it ok?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![mvut](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/mvut/32/31_2.png) [@mvut](https://forums.digi.com/u/mvut)\
**Post date:** [June 30, 2021, 9:21am UTC](https://forums.digi.com/t/xbee3-how-to-send-data-received-from-serial-via-ble/22492/8 "2021-06-30T09:21:28Z")

</div>

No, you can connect two XBee 3 modules via BLE and communicate.

---

<div class="post-metadata">

**Author:** ![manos](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@manos](https://forums.digi.com/u/manos)\
**Post date:** [July 7, 2021, 9:01am UTC](https://forums.digi.com/t/xbee3-how-to-send-data-received-from-serial-via-ble/22492/9 "2021-07-07T09:01:42Z")

</div>

Hey,

thanks for your reply!  
So, how exactly do i do this?  
All I need to do is to set BT, BI and set for API Frames (which I send through serial) and it is good to go?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![mvut](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/mvut/32/31_2.png) [@mvut](https://forums.digi.com/u/mvut)\
**Post date:** [July 7, 2021, 9:10am UTC](https://forums.digi.com/t/xbee3-how-to-send-data-received-from-serial-via-ble/22492/10 "2021-07-07T09:10:23Z")

</div>

That is correct.

---

<div class="post-metadata">

**Author:** ![manos](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@manos](https://forums.digi.com/u/manos)\
**Post date:** [July 20, 2021, 10:13am UTC](https://forums.digi.com/t/xbee3-how-to-send-data-received-from-serial-via-ble/22492/11 "2021-07-20T10:13:09Z")

</div>

Hi again,

Unfortunately, I just keep failing…  
I have sent the frame:  
7E 00 07 2D 00 01 54 45 53 54 91  
which never reaches the other xbee…Instead all I get is the following transmit status message (in the xbee which transmits): 7E 00 03 89 00 7D F9  
(Interface not accepting frames)

Do you have any ideas or suggestions?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![mvut](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/mvut/32/31_2.png) [@mvut](https://forums.digi.com/u/mvut)\
**Post date:** [July 21, 2021, 11:41am UTC](https://forums.digi.com/t/xbee3-how-to-send-data-received-from-serial-via-ble/22492/12 "2021-07-21T11:41:00Z")

</div>

That sounds like you don’t have both BLE interface options enabled and connected.

---

<div class="post-metadata">

**Author:** ![manos](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@manos](https://forums.digi.com/u/manos)\
**Post date:** [July 22, 2021, 12:35pm UTC](https://forums.digi.com/t/xbee3-how-to-send-data-received-from-serial-via-ble/22492/13 "2021-07-22T12:35:19Z")

</div>

Hey,

thanks for your reply!  
So, what do you suggest?  
I have already enabled BLE with BT option (both enabled).  
How do I get them connected?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![mvut](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/mvut/32/31_2.png) [@mvut](https://forums.digi.com/u/mvut)\
**Post date:** [July 23, 2021, 10:46am UTC](https://forums.digi.com/t/xbee3-how-to-send-data-received-from-serial-via-ble/22492/14 "2021-07-23T10:46:08Z")

</div>

[https://www.digi.com/resources/documentation/digidocs/90002350/default.htm#Reference/r\_frame\_0x2C\_example.htm?Highlight=BLE%20Scan](https://www.digi.com/resources/documentation/digidocs/90002350/default.htm#Reference/r_frame_0x2C_example.htm?Highlight=BLE%20Scan)

[https://www.digi.com/resources/documentation/digidocs/90002219/default.htm#container/cont\_digi.ble.htm?TocPath=digi.ble%2520module%257C\_\_\_\_\_0](https://www.digi.com/resources/documentation/digidocs/90002219/default.htm#container/cont_digi.ble.htm?TocPath=digi.ble%2520module%257C _____ 0)

[https://github.com/digidotcom/xbee-micropython/tree/master/samples/bluetooth/xbee\_connect](https://github.com/digidotcom/xbee-micropython/tree/master/samples/bluetooth/xbee_connect)

---

<div class="post-metadata">

**Author:** ![manos](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@manos](https://forums.digi.com/u/manos)\
**Post date:** [July 26, 2021, 9:20am UTC](https://forums.digi.com/t/xbee3-how-to-send-data-received-from-serial-via-ble/22492/15 "2021-07-26T09:20:18Z")

</div>

Thank you! Thanks for all the resources given.

I am going to check them thoroughly. Untill then I would like to mention though that it seems like you refer to xbee3 cellular…Hopefully, it’s the same for the xbee3.  
Also, considering that only one link is not strictly about micropython and it specificallly regards how to unlock API, does it mean that in order to send api frames, I firstly have to unlock the api?  
But how do I make the first steps like scan for advertisements, turn on indications and connect to gatt server via xctu?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![mvut](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/mvut/32/31_2.png) [@mvut](https://forums.digi.com/u/mvut)\
**Post date:** [July 26, 2021, 9:24am UTC](https://forums.digi.com/t/xbee3-how-to-send-data-received-from-serial-via-ble/22492/16 "2021-07-26T09:24:07Z")

</div>

For what you want to do, it is done in the Micro Python code instead. I referenced the API options so you can see how some of that would be done outside of Micro Python.
