LX-224HC servo Q&A

How to interface UART servo? (LX-224HV)

Ask QuestionAsked 4 days agoActive todayViewed 114 times1

I am trying to interface a RaspberryPi (2B) GPIO-UART to the this serial servo (Hiwonder LX-224HV), as a first step before to switch the Raspberry by an ARM MCU (STM32F407ZE on custom circuit).

The servo is supposed to follow a simple protocol, however, I am unable to manage any response from the servo (neither movement or UART response).

The documentation I found about the servo is limited (Note that this is another servo model, but according to vendor, their controller is compatible with both, consequently, I assume some compatibility):

Testing signal:

For testing purpose, I am sending the following message through command line:

#Some ports initialization here
echo "0" > /sys/class/gpio/gpio24/value # disable rx
echo "1" > /sys/class/gpio/gpio23/value # enable dx
echo -n -e "\x55\x55\xfe\x04\x0e\x01\xee" > /dev/ttyAMA0; sleep 0.001;
echo "0" > /sys/class/gpio/gpio23/value # enable dx
echo "1" > /sys/class/gpio/gpio24/value # disable rx

The message is made of:

  • 0x55 0x55: transmission start tag.
  • 0xFE: Id of the target servo, 254 means broadcast
  • 0x04: Length of the block, including this length to ending checksum
  • 0x0E: 14 is Read_ID, asking the servo for it ID.
  • 0x01: default Id (not used?)
  • 0xEE: Checksum ~(254+4+14+1) = ~(17) = 238

The circuit is set as follow:


simulate this circuit – Schematic created using CircuitLab

Note, I added a resistor to avoid burning any component in case of short-cut, It also allows to see variations in the signal if the servo tries to send any data.

The connection to the servo is done as follow:

  • 0-5V to signal, high impedance most of the time.
  • 12V to the VDD
  • 0V to the GND

The breadboard look like this:

enter image description here

The result signal:

The resulting signal at the signal pin of the servo-motor is as follow:

enter image description here

There is no significant signal after this, which I interpret as the servo not responding for any reason.

The question:

Is there any obvious missing element in this approach? or ultimately, how to interface with this servo?

I found many others servos with similar interface, so I believe this could help further users..uartgpioservoshareedit  follow  flagedited Aug 28 at 17:50asked Aug 28 at 15:19Adrian Maire32822 silver badges1717 bronze badges

  • 1Note: I also tried other types of messages (rotate), without more success – Adrian Maire Aug 28 at 15:20
  • AH, the datasheet looks detailed enough. Let me read it tomorrow and see if I can help. One weird thing is that the serial bus seems daisy chained, not the ordinary point to point, one bus for one device/servo type, (Of course not PWM controlled). Reference: (1) LC224-HC Servo: hiwonder.hk/products/…. See you tomorrow. Cheers. – tlfong01 Aug 28 at 15:24    
  • 1I think the following document is more helpful: dropbox.com/sh/b3v81sb9nwir16q/AADXOwhdw7KLq5t5UM8ND3kwa/… Thank you – Adrian Maire Aug 28 at 15:28
  • Ah yes, your drop box doc of course is more helpful. Earlier I have difficulty opening your drop box. This time is smooth. See you tomorrow. – tlfong01 Aug 28 at 15:30   
  • 1Multidrop serial on a bidirectional line is a quite normal thing; let’s please address the actual issue of the question not unfamiliarity with the concept. Some things to check would be that the baud rate is correctly set, that the device expects these voltage levels and this inversion sense (vs any of the RSxxx standards which would be opposite sense and possibly higher voltage), that the device address is correct, and that the transmit word is getting completely clocked out before the driver is disabled. Consider probing both sides of that series resistor… – Chris Stratton Aug 29 at 0:33
  • 1@Adrian Maire, Good morning. The docs in your drop boxed are very good and comprehensive. So I google and learned many more things I didn’t expect to know. Questions: (1) *Have you bought the LX-244 offline controller/tester? I am drafting a shopping list, including the offline controller. You might like to comment on my incomplete answer, or brainstorming me counter suggestions. Cheers. – tlfong01 Aug 29 at 4:20    
  • 1(1) I did not bought the controller/tester board initially because I did not expected this to be so difficult, however considering the current situation, I did bough one yesterday which should arrive in some 1-2months. (2) Yes, the baud-rate is set to the expected frequency (excepting any error from my part). (3) the device address should be correct, as I am using broadcast. (4) The word is getting completely clocked out before the driver is disabled: Checked. (5) Voltages and levels: you see the wave from the oscilloscope, but I can’t ensure anything more. – Adrian Maire Aug 29 at 10:49
  • Ah, just now I searched your drop boxes with many goodies and found the LeWaSoul Bus tutorial with a circuit on using HC126, and I then understand why it is there and what is it used for. Previously I wrongly thought that it was your design and so did not pay any any attention to it. I have not read the complete LeWanSoul thing but I guess the HC126 is for implementing Simplex protocol. where UART can only go one direction, either send or receive at one time, but not send and receive at the same time. Now the HC126 is used to control the send or receive operation. / to continue, … – tlfong01 Aug 30 at 7:08   
  • So I guess the following is what is going on: (1) Rpi set send mode, then say “AT” to LX-244HV servo, with its ID. (To make things simple, let us assume that there is only one servo). (2) Then Rpi set to receive mode, and wait servo to reply. (2) So when testing, you need to set send or receive mode by disabling and enabling the correct HC126 channels“. (3) One more complication is that I think the circuit is for 5V Arduino. /to continue, … – tlfong01 Aug 30 at 7:17   
  • So if you are using Rpi, you need to Shift 3V3 logic signal to 5V. Only if you have wired this level shifter first, then later you can set send of receive mode. Comments and counter suggestions welcome.Cheers. – tlfong01 Aug 30 at 7:17   
  • 1The 74HC126 does the job for the 3.3V to 5V conversion, and the resistor divider for the reception (100k & 68K). Also enTx and EnRx enable and disable the gates. – Adrian Maire Aug 30 at 7:35 
  • Thank your for pointing out my careless mistake. I did quickly read the datasheet and make sure you can only set HC126 Vcc to 5V, hoping HC126 are 5V tolerant, but that is risky because of latching up danger. I once thought about using HC03 and CD4040, or 2 x TSX0102 each with enable/disable. I must confess that I did not read your bash commands carefully, so you do set send before sending “AT”, then set recv mode before receiving “OK”? Any way, my toys not yet arrived. When they arrive, I will first use the Win10 tool to play with LX-244, then try my python “say Hello” program. Cheers. – tlfong01 Aug 30 at 9:00   
  • Ah, I missed this part “the resistor divider for the reception 100k & 68K”. So I have no more worries. Ah, one more thing, if you still have your Arduino lying around, you can just run the Arduino demo programs. Ah, supper time. See you Monday or Tuesday. – tlfong01 2 days ago   
  • And a short question. Have you tried (1) put LX-224 aside, just test the HC126 wiring, (2) Enable both buffers, and see if sending out a test byte, say “0x55” will loop back, eg. scope read the reach back? – tlfong01 2 days ago   
  • 1I cannot loop-back, as the driver is either enabled for reading, or for writing (not both at the same time). However with the oscilloscope, I can detect any signal in both directions, even if colliding (and prior to the driver gate) (result in the image). I see no signal from the servo unfortunately, it is probably just ignoring fully my input. I will make further tries when the controller will arrive. – Adrian Maire yesterday 
  • Thank you for your reply, pointing out my ignorance on the half duplex circuit using HC126. I agree that if you use a scope to look at the input terminal of the servo, of course you are pretty sure that the servo is getting the serial string 0x55 etc. I also agree that if you don’t see clashing signals after the input to server, there is little chance that the servo is returning anything. / to continue … – tlfong01 yesterday   
  • I might try my dual TSX0102 up shifter to see if I can do the loop back. Perhaps I am wrong to think that enabling both HC126 can then loop back, but perhaps it it sort of short circuiting TxD to RxD. But perhaps TSX0102/04 is different, because their input/output are open drain, therefore can be connect together, but only 80% sure. / to continue, … – tlfong01 yesterday   
  • Now 2 pieces of bad news. (1) My toys, including the offline servo checker, arrived yesterday. I thought I could easily check if a servo work, moving it and monitoring it temperature, over/under voltage etc. But to my surprise, I could not do that, because that is for ANOTHER BOARD called controller or something. (2) The 15 yuan board I said is a must buy perhaps joke to your and me, because I found two chips on board: HC126 and CH430. But I don’t need them, because I am using my own TSX0102 and UART/TTL. There are also many misleading or wrong info in my deleted answer. / to continue, … – tlfong01 yesterday    
  • My old answer mentioned about another half duplex uart servo, but I mixed up with the Korean servo Dynamexal which is very expensive, and I did not have a chance to play with it. Now this LX-224 is perhaps a good chance for poor hobbyists like me to have a taste of the future servos. Just thinking aloud, sorry for the typos. Cheers. – tlfong01 yesterday    
  • Good News! I installed BusLinker V2.4 in Chinese Win 10 and tried it with LX-824HV and it worked immediately. No need to do any adjustment. Ch340 serial driver is auto detected. By just clicking I could select port, open/close motor, select servo mode, adjust position. Then display window shows position, voltage, and temperature. I don’t need online controller now. This offline tester is more than enough for me. Installation of BusLinker take two minutes, and the complete test takes another three minutes. I finished everything in only 5 minutes! Cheers. i.imgur.com/xlTD9Cg.jpeg. – tlfong01 18 hours ago    
  • 1Good! Could you record the bus with any simple operation? (e.g. move or request ID) – Adrian Maire 18 hours ago 
  • Ah, “Moving servo to a particular position” is a bit hard to repeat using python, and might take me 30 minutes. “Setting servo to motor mode and turning continuously is dead easy – just click, click,click, and drag and drop, all done in 15 seconds. That is why I said earlier that the 15 yuan (US$2) offline test board is a must buy. 🙂 Cheers. PS – It would be nice if you can read my scope screen capture and verify if bus linker is indeed sending a motor turn command, and servo is replying something like: “OK, OK, so I am turning”. – tlfong01 4 hours ago    
  • So I will wait for you to check out my scope displays. In the mean time I am moving on to design the rpi-level-shifter-and_simplex_uart. Basically I am doing the following (1) Shift 3v3 logical signal to 5V0. (2) designing enable/disable signals for the UART directional control buffer, what you are using HX126 for. Now I am thinking of using TSX0102 to replacing HC126. – tlfong01 1 hour ago   
  • I have drafted v0.1 of the TSX0104 based simplex UART cct to replace the HC126. One thing I am not sure is whether to use two diodes to direct the signal to/from LX-224 too TSX0102 outputs before shorting together, or let the TSX0102’s no sensor auto direction sense control to auto do all things in one go. Comments and counter suggestions welcome. – tlfong01 5 mins ago   
  • One brainstorming idea is this. When Rpi sends a text string, the sent string will immediately loop back, but Rpi can just ignore this loopback string. After waiting for some time for the LX-224 to settle down and send back the reply string, then Rpi will at this time reads the message. At this time, Rpi is not sending anything, so the sent back LX-224 string will not clutter with anything. – tlfong01 just now   Edit   

add a commentstart a bounty

2 Answers



How can Rpi4B talk to duplex BUS UART servo LX-224HV?


Part B – Rpi4B UART to LX-224HV Simplex Serial Ciruit Design V0.1

lx-224 simplex cct design

Part A – LX224HX Troubleshooting Using BusLink V2.4

I am using the HiWonder Bus Linker V2.4 to display the send receive signals when the LX-224 UART/Bus servo is set to motor mode and move continuously at about 700 rpm.

lx224 motor test 2

motor signal 1

motor signal 2

motor signal 3


/ to continue, …


Appendix A – The OP’s test setup

The OP's test setup

Appendix B – HiWonder LX-224 BusServoController setup

lx-224 controller

Appendix C – HiWonder LX-224 BusLink V2.4 Setup

enter image description here

Appendix D – TSX0104 Level Shifter for implementing LX224 Simplex UART/BUS Servo Bidirectional Control

tsx0102 1

/ to continue, …

Not yet completed answer. Stay tuned, …shareeditdeleteflagedited 5 mins agoanswered 4 hours agotlfong0154544 silver badges66 bronze badgesadd a comment-2This post is hidden. It was flagged as spam or offensive content and deleted 3 days ago by Community.Locked. This answer is not currently accepting new interactions. Learn more.


How come my LX-224HV doesn’t move?

/ to continue ,…


mars cat 1

1. Introduction

Let me introduce myself. I am an electronic hobbyist, already spent 100+ hours playing with toy servos.

All my hobbyist life I only played TowerPro MG995, SG90, and almost nothing else. I do once try to learn LX14 when an OP asked for help. I tried to help by learning together, but not too soon he mysteriously disappeared.

So this is my second chance to learn an UART Servo. All the servos I have been playing so far use PWM signals to control. But LX-224 servo seems using a special kind of UART protocol, so I am not sure if I can handle it, though I am very familiar with Rpi4B UART.

My long term plan is to use Rpi4B Thonny python and Cotrex M0. The OP likes to use Cortex M4, and open source C.

2. Warning UART servo newbies

For newbies like me, who only knows PWM servos, or doesn’t know any servo at all, this project is for advanced servo users only. Any newbie following this post building servo hardware or software are warned that No guarantee no nothing won’t melt down or blow up.

To those faint of heart, but brave enough newbies reading on, it is a good idea just sit back and watch how we buy, learn, play and fry servos.

I still remember vividly the first time I learnt to play the servo TowerPro MG995, way back in 2009, I was so excited that my hands started excitedly trembling when switching on, but then I unexpectedly saw my servo was also frantically trembling, but didn’t move. Long story short, I fried two new servos, …

Don’t ask me how many more servos I fried afterwards, but not too longer later I fried enough servos to have became a ninja and decided writing an advice the stupid newbies frying servos day after day. And unlike those genius geeks speaking Greek to newbies, Me IQ 97 can write newbie understandable language and so very soon my published SG90 Servo Newbie Guide climbed up to the Top of the Pops, and go translated into Spainish and many other languages,

My best selling SG90 PWM servo newbie guide was written in 2008. Now 2020, 12 years later, I hope to do it again, this time on the LX-224 UART servo.

3. Buying a UART servo

I live in HK, and ShenZhen, the World’s Factory, is just over the border, one hour away by train. So I can usually get EE toys day return, say in 6 hours. But now everything is miserably locking down, so I am locking down at home, writing friendly locking down rubbish to pass my gloomy locking down Sunday. Anyway I can still buy online from TaoBao, sort of AliExpress, but usually cheaper, except I must wait 24 long hours for express delivery by SF-Express (34 Yuen (US$ 8) min delivery charge for max 3Kg)

4. Which LX-224HV UART Servo to buy

Usually I will first window shopping LadyAda, SparkFun for the real thing, but most expensive high quality, and then browse Amazon, AliExpress, and finally TaoBao, for the cheapest fake versions for poor hobbyists like me.

So I browsed the TaoBao catalog, but found something I don’t understand.

(a) Only a year ago, I thought I should learn the new thing UART servo, and I remember the OP then was play LX-14, and I was jealous because I was only play cheap toy servos like MG995 and SG90, and my bad friends were LOL at me. But now I know LX-224 should stop them laughing me, and instead respect me more than I deserve. But them I still could not sleep well, because there a new model LX-824. Shall I buy future LOL proof, the most trendy LX-824.

So I think I should watch some videos before I leap, …

(b) The other thing I don’t understand is that I saw in the TaoBao catalog something like a PWM server tester (which can adjust by hand to PWM 0.5 ms to 1.5 ms signal. I was wondering the thing I don’t know is a similar tester, but output UART signals, instead of PWM?

Anyway, LX-224 YouTube watching first!

(c) I found the above YT disappointedly less then 2 minutes short, but does answer me the question about the test thing. It is called an “Offline Tester” and can control a couple of servos together, and also connected to PS3 controller. I watched one more video showing RGB LED showing status. This is good idea to show off to my jealous bad friends “my colours”

One more thing is that I learned from the YTs the LX-824 model looks ugly, compared to the LX-224 with a trendy bright metallic read casing. YT is indeed my friend. Also the HiWonder YTs are dated 2020jun, so it should take a long while before outdated, and my bad friends resumed LOL at me again.

Anyway, I think the 20 yuan offline tester is a must buy.

I googled further the LX-244’s manufacturer Lobot and found the Lobot servo catalog I found that there are more UART servos that I don’t know that I don’t know, including a 60 kg torque, also models smaller than LX-244.

So I have almost made up my mind what to buy. One more thing or good news I forgot to say, is that I read the Arduino code and found the function read position, implying that we can do feedback control. I am at the same time playing with stepping and BLDC motor which can also do speed and position reading, but the position reading is only by counting steps, or encoder A/B signals, which is not as reliable as UART LX-224, which is similar to PWM motor which you know the position by the PWM signal you sent.

5. LX-244 UART Servo Product Sheet and Pictures

lx224 1

  1. LX-224 Testing Plan

I looked at the OP’s test config and found it a bit low (hardware wise, not quality wise) level, perhaps to make it easy to switch to little ARM Cortex. Anyway, lazy will only test the UART AT command part, using the OP’s serial commands (the green bubble in Appendix A below).

7. LX-224 Tmall Order Status

I ordered and paid for LX-224 and the offline tester around Saturday 1:15pm, and the goods has already collected by SfExpress around 2:30 pm. I hope my toys would arrive tomorrow Sunday evening, to collect any time Monday. In the mean locking time, I would pass the time by reading boringly friendly datasheets and user manuals.

8. LX-224 BusLinker TTL/USB Debug/Test Board

R8.1 HiWonder LX-224HV 20KG Bus Servo (with Tutorial Video) – ¥20

R8.2 BusLinker Serial Bus Servo TTL/USB Debugging Board for LX-16A LX-15D LX-824 LX-224 LX-824HV LX-224HV LX-1501 Servo – AliEXpress US$4

Now I am looking at the feather sheet of the LX-244 BusLinker debug boad.


/ to continue, …


(1) How to interface LX-224HV UART Servo? – Adrian Maire, SE EE 2020aug29

(2) LX-224HV / 824HV Three Terminal Bus High Voltage Servo Catalog – TaoBao

(3) LX-224HV Tester ¥20 – TaoBao

(4) LX-224 Hiwonder HV/LX-824 HV Three Connectors High Voltage Bus Servo – YouTube, 2020jun19 83views

(5) LX-224 / LX824 2019 Hiwonder Lobot LX-824HV LX-224HV 11.1V BUS servo – US$17 ~ US$21

(6) LX15D Hiwonder Intelligent Serial Bus Servo with RGB Indicator for Displaying Robot Status – 2020jun19 138views

(7) LX-15D Bus Servo User Manual

(8.1) LX-15/224/824 Bus Servo Controller Doc

(8.2) LX-15/224/824 Arduino Docs

(8.3) LX-15/224/824 Windows PC Docs

(9) LoBot Rpi Robot Kit and Servo Catalog

(10) BusLinker Serial Bus Servo TTL/USB Debugging Board for LX-16A LX-15D LX-824 LX-224 LX-824HV LX-224HV LX-1501 Servo – AliEXpress US$4

(11) STM32F405xx STM32F407xx Arm Cortex-M4 32b MCU+FPU, 210DMIPS, up to 1MB Flash/192+4KB RAM, USB OTG HS/FS, Ethernet, 17 TIMs, 3 ADCs, 15 comm. interfaces & camera

(12) ST STM32F405xx STM32F407xx Arm Cortex-M4 32b MCU+FPU, 210DMIPS, up to 1MB Flash/192+4KB RAM, USB OTG HS/FS, Ethernet, 17 TIMs, 3 ADCs, 15 comm. interfaces & camera https://www.st.com/resource/en/datasheet/stm32f407ze.pdf

(12) NXP LPC1110/11/12/13/14/15 32-bit ARM Cortex-M0 microcontroller; up to 64 kB flash and 8 kB SRAM – 2014mar26

(13) Dynamixel AX12 and the Raspberry Pi

(14) TowerPro SG90 PWM Servo Arduino C++ Demo Program for Absolute Newbies – tlfong01 2008


Appendix A – The OP’s LX-224HV UART Servo Hardware and Software Testing Setup

op test 1


  1. The OP’s test config seems a bit low level, perhaps as the OP pointed out making it easy to later implement/switch to ARM MCU (STM32F407ZE on custom circuit).
  2. I think it is easier for lazy me to test everything in Rpi on board or even USB UART level, using Rpi4B buster Thonny python 3.7.3. I can even forget python, just use Win10 RealTerm/puTTY, Rpi CuteCom to direct just say hello to LX-224, then later use python to make long chats.

Appendix B – LX-224 Tmall Order Status – last update 2020aug28hkt1649

lx=224 order

Appendix C – Rpi 3V3 to 5V Logic Level Shifter for LX-244HV

level shifter 1
rpi logic level shifter

/ to continue, …

This is not the end of answer, but only the beginning. Stay tuned.shareeditflagedited Aug 30 at 1:52answered Aug 29 at 2:29tlfong0154544 silver badges66 bronze badges

  • 2Is there an answer to the OP’s question buried somewhere in there? – brhans Aug 29 at 3:42
  • Ah, this is just an introduction. My answers are usually over the SE word limit, ie 30k words, with at least 20 pictures. Ah, my apologies to the misleading note “End of Answer” of my incomplete answer. Sorry for the misleading comment. I will delete/modify that immediately. Cheers – tlfong01 Aug 29 at 4:01   
  • 1Happy to hear that you are involved in trying this :-). I agree that my testing setup with command line is bad-quality. I plan to switch to C/C++ implementation as soon as I get an answer from the servo, because I don’t want to fight too many problems at the same time. I am also waiting for the board, but it will take 20-30 days to arrive here, so let me know if you discover something before me. Thanks for your great response. – Adrian Maire Aug 29 at 11:06
  • Ah, I never thought that your CLI commands are bad quality. I think if you are fluent in linux bash and also script writing, using a few CLI commands to just say Hello is most efficient. But of course, when later you want to do more complicated things, then C/C++ is more human time efficient than script commands. Before playing with Rpi python, I used Arduino C++. I once used MS Studio C/C++/C# and found them very good, better that Rpi C/python. But at that time MS studio full version is not free. So I gave up and switched to Rpi. I am only a hobbyist programmer. So python suits me best. – tlfong01 Aug 29 at 13:20   
  • 1I read my comments again and realized why you think me saying that your code is “low quality”. As explained above, I am saying that your using hardware, like HC126 etc, and reading the results using a scope is indeed in bits and bytes level. I am using python to talk in text strings “Hello”, “AT”, “OK” etc, so it is like the high level language C comparing to low level assembly language or even machine.Of course this misunderstanding is not important, but I am glad you pointed out the cause of misunderstanding. Cheers. – tlfong01 Aug 29 at 13:46   
  • Another misunderstanding is this: You read that you will finally switch to Cortex with a part number. I did not pay attention to the part number and thought you mean Cortex M0, because I have been playing with Cotrex M0 (lpc1114, last time I used C, actually). So I thought your Cortex is also M0. But was very surprised to later found that Your Cortex is M4, and me only M0. That is a huge difference, like comparing a Porsche 911 with a BMX Bike! – tlfong01 Aug 29 at 14:00   
  • Also I totally agree with you saying that “I found many others servos with similar interface, so I believe this could help further users“. So it would be a good idea to make sure that there are as little as possible ambiguities in our Q&A, so not to confuse and scary away UART servo newbies. – tlfong01 Aug 29 at 14:07   
  • 2″I once used MS Studio C/C++/C# and found them very good, better that Rpi C/python. But at that time MS studio full version is not free”. You don’t need (and even don’t want) MSVC, you just need g++ and cmake. Any IDE works, I especially like QtCreator and KDevelop (all of them open-source, cross-platform and free). – Adrian Maire Aug 29 at 18:08
  • 1-1 This is yet another example of your despicable habit of posting chatty non-answers! You really need to familiarize yourself with the rules – Chris Stratton Aug 30 at 1:37 
  • Thank you for your advice on EE SE Q&A rules. Perhaps I should delete ALL the comments, chats, and cartoons, AFTER I finish my answer. Cheers. – tlfong01 Aug 30 at 1:56    
  • This is spam it only exists to promote a product or service – Voltage Spike Aug 30 at 2:28

comments disabled on deleted / locked posts / reviewsAdd Another Answer


Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.