Home/Support/Support Forum/XBee3 access TX serial with MicroPython for Simplified Serial use
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

XBee3 access TX serial with MicroPython for Simplified Serial use

0 votes
Good morning everyone!

I have a motor driver that i want to directly control with a simple XBee3 (XB3-24Z8PT-J).
Until now I would have use an intermediate cpu like an Arduino, but now we have MicroPython!

The motor driver needs to receive TTL level single-byte serial commands of 8 bits and it is a one direction only interface (no RX needed on the XBee, just TX).

I want to receive lets say a transmit packet with a json payload and depending on the content of the json send the correct command to the motor driver. 9600 Baud rate is enough.

I do not need to monitor anything on a console, so I can use [AP] = [1, 2, 4]. (I do not want to use transparent mode)

Any idea how to achieve that?
asked Jun 4 in Python by Antoine New to the Community (9 points)

Please log in or register to answer this question.

2 Answers

+1 vote
Antoine,

If you want the Micro Python on the remote end, then you would use AP 4 which uses Micro Python mode. From there, you would want to use the Micro Python Serial port for the data to come out of.

There are examples in the PyCharm IDE that Digi has created that should allow you to see how to perform the functions you desire.
https://www.digi.com/support/productdetail?pid=5674&type=documentation

Digi Support
answered Jun 4 by mvut Veteran of the Digi Community (12,786 points)
Correct me if I am wrong but the example you are referencing to are for "cellular" XBees which have indeed a second UART port accessible through MicroPython.

However I do not have a cellular XBee3 and I do not plan to buy one.

I only need transmission of 8bits of data at a time following TTL level 8N1 - 9600 baudrate.

For now I will try to bit bang these 10bits and see if it works!
Bit banging did not work as it takes around 5ms for a normal GPIO (GPIO4) to switch from one state to the other. Are there any fast pins I could use for bit banging from MicroPython?
No, these are the only ones that would use UART data in and out from Micro Python application to an external device.
Alright! I hope Digi will implement UART for the XBee3 soon! It would be a life changer!
Thanks again mvut!
0 votes
I finally managed to find a solution.

In MicroPython using this:

"
from sys import stdout

stdout.buffer.write(b'\xFF')
"
I then matched the UART baudrate of the XBee3 with XCTU to the speed on the remote motor driver.
answered Jun 24 by Antoine New to the Community (9 points)
...