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:
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 11 hours agoasked 14 hours agoAdrian Maire31822 silver badges1717 bronze badges
- 1Note: I also tried other types of messages (rotate), without more success – Adrian Maire 14 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 14 hours ago
- 1I think the following document is more helpful: dropbox.com/sh/b3v81sb9nwir16q/AADXOwhdw7KLq5t5UM8ND3kwa/… Thank you – Adrian Maire 14 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 13 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 4 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
/ to continue, …
/ to continue, …
- 1Is there an answer to the OP’s question buried somewhere in there? – brhans 1 hour 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 1 hour ago Delete