# How can I make a half-duplex UART to TTL converter for communicating to a servo with a HC04 and a HC126?

I have been trying to configure this circuit for some amount of time.

I am using a HC04 chip and a HC126 chip.

The HC04 is an inverter chip. The HC126 is a buffer gate. I found that for the servo connection, I can set up the schematic like so:

The Linux SBC I am using handles GPIO pins with 3.3V. I have a GPIO pin in use, a UART (TX/RX) connected, and those three pins are tied to a logic level shifter.

I am also using a Micro AnyVolt. This is being used to handle the 12V of the battery supply to the Dynamixel Servo for powering the servo and all while stepping down the voltage to the HC04 and HC126.

I have all my unused pins tied to GND. Direction_Port on this schematic a GPIO Pin on my SBC.

My questions are these:

• How can I make this schematic work or should I take another route for UART communication from my SBC to a Half-Duplex TTL line on my Servo?
• and...
• Is this schematic a good schematic to use to handle these chips for use with a GPIO and UART from a SBC to TTL line on the Servo of choice?

I have a normal servo with three pins: http://www.robotis.us/ax-12a/

One pin is GND, one pin is 5v logic, and the other pin is a Half-Duplex TTL (TX/RX) Data Pin.

So, I am expecting to see the Dynamixel SDK on my Linux SBC (BBB) with 3.3v Logic to send and receive specific communications. The Micro AnyVolt handles the 5v logic to the Dynamixel from the 12v supply. The Micro AnyVolt also handles the powering of the HC04/126.

This link provides the Python3 example I am trying to run from the command line.

I was able to compile the source in Python3 and C so far. Anyway, w/ Dynamixel Servos, there are two types of protocols, i.e. 1 and 2. With my AX-12A Servo, I use the protocol 1 structured sections.

...

I have changed the port to "/dev/ttyS2" onboard my BBB.

The logic level shifter handles my 3.3v to 5v conversion. I think this may get closer to what is going on for your ideas to become added here. Also, Direction_Port goes to a GPIO, TX_Data goes to RX, and RX_Data goes to TX on the SBC.

The software states that I successfully change the baudrate and successfully open the port. The issues lie here:

[TxRxResult] There is no status packet!


This basically means that the Dynamixel is not sending out the required feedback. I think I need a separate program to run the GPIO HIGH/LOW but I am not sure exactly how to perform this action within their SDK.

Anyway...let me try one more thing. The TTL and GND connections to the Dynamixel Servo (AX-12A) might need to be swapped. I have not had any correct info. regarding the connection at the servo and the below schematic. I will test and get back to you.

Here is a simplistic edit:

Okay...I have to admit something. I should have asked this question in software engineering because of the DynamixelSDK that I came across and now that I know it is mostly software related, and taken back a bit, I should have not posted this effort or concern under my account. I apologize to anyone who read over it and wanted to supply support. Anyway, thank you for your guidance and help.

• You forgot to ask a question. – brhans Jul 20 '20 at 11:45
• Sorry. I added the questions instead of leaving the question on the header of the article. – De Funct Jul 20 '20 at 12:11
• The schematic looks ok. The problem is likely somewhere you don't mention or describe in detail. What's the specific problem anyway? Can you better the describe what you expect to happen and what happens instead? – Codo Jul 20 '20 at 13:45
• I'm not sure, but reading between the lines it seems as though it "isn't working" right now. So far as I can see, you've not provided any details about the servo, itself. My crystal ball is broken, so I'm stuck at this time. Maybe someone else has a working one, though, and they can help out. – jonk Jul 20 '20 at 14:48
• Sure...let me try to better describe the idea and how it is not working on my end. – De Funct Jul 20 '20 at 19:25