How to interface UART servo? (LX-224HV)
Ask QuestionAsked todayActive todayViewed 46 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):
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:
The result signal:
The resulting signal at the signal pin of the servo-motor is as follow:
There is no significant signal after this, which I interpret as the servo not responding for any reason.
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 16 hours agoasked 18 hours agoAdrian Maire32822 silver badges1717 bronze badges
- 1Note: I also tried other types of messages (rotate), without more success – Adrian Maire 18 hours ago
- 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 18 hours ago
- 1I think the following document is more helpful: dropbox.com/sh/b3v81sb9nwir16q/AADXOwhdw7KLq5t5UM8ND3kwa/… Thank you – Adrian Maire 18 hours ago
- 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 18 hours ago
- Multidrop 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 9 hours ago
- @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 5 hours ago
How come my LX-224HV doesn’t move?
/ to continue ,…
Let me first introduce myself. I am an electronic hobbyist and I have about 100+ hours of playing with toy servo.
All my hobbyist life I only play TowerPro 95/96, 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 somehow he disappeared..
So this is my second chance to learn an UART. All the servos I have been playing with use PWM signals. But LX servo seems to use a special kind of UART, so I am not sure if I can handle it, though I am very familiar with Rpi4B ecial kind of UART, so I am not sure if I can handle it, though I am very familiar with Rpi4B Thonny python UART. I am glad that the OP is also using, hopefully we can learn together.
2. Warning UART servo newbies
For newbies like me, who only knows PWM servos (or no servos, PWM or otherwise), this Q&A your are reading is on another kind of servo UART servo. Right now two newbies (or just me) are just friendly hobbyists.
So be warned: No guarantee no nothing won’t melt down or blow up.
To those faint of heart, but brave enough to read on, the best thing is set back, and watch how we buy, learn and fry servos. I already remind myself that the first time I learnt PWM servo TowerPro MG995, my hands started trembling and saw the servo is also trembling and didn’t move. Long story short, I fried two new servos, …
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
- LX-224 Testing Plan
I looked at the OP’s test config and found it a bit low 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
Appendix A – The OP’s LX-224HV UART Servo Hardware and Software Testing Setup
- 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).
- 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
/ to continue, …
This is not the end of answer, but only the beginning. Stay tuned.shareeditdeleteflagedited 2 mins agoanswered 7 hours agotlfong0162244 silver badges66 bronze badges
- 1Is there an answer to the OP’s question buried somewhere in there? – brhans 6 hours ago
- 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 6 hours ago
Leave a Reply