A: How to interface UART servo? (LX-224HV)
Question How can Rpi4B talk to duplex BUS UART servo LX-224HV? Answer Part B – Rpi4B UART to LX-224HV Simplex Serial Ciruit Design V0.1 Next step is to let Rpi to send commands to LX-224 and see if is replies back anything. The OP reports nothing comes back. So I will repeat his commands and …Adrian Maire13.2kHello @tlfong01, thanks you for your great research 🙂 Looking at your oscilloscope output, it does not resemble to any of the message that I have in the documentation. My initial conclusion is that the protocol explained is either wrong or has been significantly changed. It would be interesting to have more samples of communication to reverse-engineer the protocol. The on of your picture is probably about querying the temperature/voltage or position. tlfong013977Ah, I see. But I am not surprised, because I am using the Win10 Bus Servo Terminal GUI command to turn the motor non stop so I can easily us a scope to display something. There are other things that cause trouble: (1) I am using BusLink version 2.6, but I read the AliExpress and Amazon are selling old versions. So there might be outdated commands. The other thing is that I found HiWonder keeps saying that they cannot help users to develop software, because HiWonder is asking LeWanSoul to develop the LeWanSoul simplex uart servo protocol. So LeWanSoul might not the have motor turning commands.Ah, supper time, so see you late this evening or tomorrow. Cheers. Adrian MaireIn your circuit, I suggest you to add the pull-up resistor and also some 0.5k in-serie resistor between the bus and the servo. This will avoid any error to burn to quickly your devices. tlfong013977Ah that is a good advice I carelessly forgot . I usually use 330R or 470R series resistor to limit the motor current. I am also using a very small 220VAc to 12VDC 1A (yes, 1A only) PSU then step down to LM2596 12V to 5V to supply the LX-224. So I think LX-224 should at most take 1A or a bit more, hopefully no to fry anything. And also that is why I am using the less expensive servo, not the most expensive one, just in case, … Cheers Adrian MaireI created this room (chat.stackexchange.com/rooms/112557/lx-224hv-uart-interface‌​) so we don’t load this Q&A page too much with unrelated/unfinished content. At the end we can add the working result here just for future users. tlfong013977Thu 10:38Ah, a very good idea. Now I can be more casual thinking aloud, brainstorming crazy ideas that often later turned out wrong, because I am now trying out things in the area I have no experience at all. I only heard about the idea of “simplex” when playing with walkie talkie, and I never heard of the term UART/Bus Servo (As I confessed, all my life I have been playing only with toy PWM servos TowerPro MG995/6 and SG90) . 1 hour later… tlfong013977Thu 11:55update 2020sep03hkt1155Now I am assenbing a TXS0102 for experimenting with the LX-224HV simplex circuit. I actually have a couple of already assembled TXS/TXB01 02/03/06/08 in hand, but I want a semi permanent test bench version to keep a record.

As usual, comments are counter suggestions are always welcome, especially before I fry something. Ah, you remind me one good thing about chatting in the chat room is that I can easy insert pictures. 1 day later… Adrian Maire13.2kFri 17:02To be honest, it is also the first time for me playing with the UART servo. So experimenting too.Beautiful PCB! Is it a customized PCB that you designed/ordered?On my side, I still have to try reproduce the signal of your oscilloscope and see if the servo is going to answer or not. Also waiting for the little controller, but this will take some time. 5 hours later… tlfong013977Fri 22:24(1) HiWonder seems to have a 2020 cheaper model LX-20S. Did you see this when you ordered yours last time? This model has only one axis, but I think it is more affordable to fry, or for a project with many servos.The TXS0102 module is from a TaoBao shop. I remember that they delayed my small order of 20 pieces, because they need to make large quantities for Singapore. Singapore has a reputation of making high quality products (sometimes military grade). So I think they require good quality TXS0102 too. Before that I tried different cheap versions of TXS0102/04/06/08 but found them problematic. So this time I am wiring a new one on bread board to do a more rigorous test.I am thinking of testing LX-224 UART commands this weekend. I think I don’t need to use Rpi python. A lazy way is to use Win10 RealTerm terminal emulator to send and receive commands to LX-224. I hjave been searching for an updated version of LeWanSoul command list. But I could not find one. This might be bad news, becasue they might have abandoned the project during LX-16.Therefore not more updated command list. If my test this weekend is smooth, perhaps I can use python to create new commands such as turning 306 degrees. Ah bed time. See you over the weekend. Cheers. 18 hours later… Adrian Maire13.2kSat 16:26Hello 🙂
I have been making some tests and I have good news.Reading and testing about UART, it transmit 10bits for each (8bit) byte of data: First it transmit a “10” and then the data.
Also, it transmit first the less significant bits and after the most.
Example: x05 will be transmitted as 10-10100000With this in mind, the screenshot of your oscilloscope transmit following to the servo:
10-10101010 10-10101010 10-10000000 10-11000000 10-11011000 10-00000111
In numbers:
x55 x55 x01 x03 x1B xE0
Adding semantic:
0x55 0x55 (initial tag)
0x01: Servo ID (1)
0x03: Size of the data (by the doc, this includes from the size to the check-sum)
0x1B: Read Input voltage request
0xE0: checksum = ~(id+length+params) = ~(0x01+0x03+0x1B) = ~(0x1F) = 0xE0Then I tried to send those values through the RaspberryPi, and the oscilloscope give me the exact signal you shown.
However the servo is still not responding, so I am wondering the following issues:
– The servo has burn, due to any mistake during the test.
– The servo expect 12V signal (HV version). I expect the signal to be 5V even if the input voltage is 12V. Trying 12V bus imply burning the servo in case it expect 5V.
– Any other error in the electronic (?) 11 hours later… Adrian Maire13.2kyst 4:07When you have a moment, could I ask you try to connect higher voltage to the board?
1) Disconnect the servo (as it is not HV)
2) Connect a higher source to the board, e.g. 8V should not be a risk for the board
3) Send some signal (rotate or what-ever).
4) See if the signal is 5V or 8V? 19 hours later… tlfong013977yst 22:39Ah, the following three things you found out is very important, should save me a lot of time doing trials and errors: (1) Reading and testing about UART, it transmit 10bits for each (8bit) byte of data: (2) First it transmit a “10” and then the data.
(3) Also, it transmit first the less significant bits and after the most. But I don’t seem to find this protocol in the LewanSoul command user guide. I need to read the guide one more time and update my summary shown below。

I am also considering the test command strings I should try use first. I found you use of the broadcast address 0xfe a bit confusing. I need to think again to see 0xfe is a good address to test. I am studying the following to get to know more.

I think the simplest commands I might try first is 0x26, 0x27, and 0x28, (1) Read Temperature, (2) Read Vcc, and (3) Read Position (I can move the servo by hand and see if Position changes).For your suggestion on testing the offline tester board, let me make some comments first.(1) The BusLinker V2.4 is for old version LX-16A, so it says Vin = 6V ~ 8.4V, so there should be no problem if I set Vin to 8V and send a rotate commend. I will do that later, but as you have guessed, the logic output should be 5V. Anyway, I will try that and let you know if your guess if correct.You said my screen capture is “x55 x55 x01 x03 x1B xE0”. I need to read the command table to see what this means, but I will also try to use my terminal emulator Win10 RealTerm, or RpiCuteCom, or Rpi python to send this string, and also your decoded command “10-10101010 10-10101010 10-10000000 10-11000000 10-11011000 10-00000111” and see what happens. I will also try read temperature, Vin, and Pos as I suggested earlier.Ah, bed time. Call it a day. See you tomorrow. Cheers.You said perhaps the following: “The servo expect 12V signal (HV version)”. I think this is very unlikely, but I will, as you suggest, try Vin = 8V and see what happens. Anyway, will carry on tomorrow. Cheers. Adrian Maireyst 23:35I need to read the command table to see what this means,
I did that already, just read my previous comment, it explains each bytes 🙂 14 hours later… tlfong01397713:10Yes, I saw that you explained each byes of my bus link rotate motor screen capture. But I don’t understand why my “Rotate Motor” string becomes your “Read Voltage Input Request”?

2 hours later… Adrian Maire13.2k14:53>But I don’t understand why my “Rotate Motor” string becomes your “Read Voltage Input Request”?
IMO, When you use the software (Hiwonder windows UI), it request periodically temperature/voltage/position to the servo, to display them in the screen. The “rotate” directive is probably sent before.Te more clear: I think that out of the many communications that happens between the servo and Hiwonder software, you made zoom on the one which request voltage input. 1 hour later… tlfong01397716:13Ah, yes, actually that is what I have just done before I saw your message. (1) I did also suspect the Bus Servo Terminal does repeatedly request Vin, Temp, Pos. In other words, there is no need to rotate the motor in order to display waveform on the scope. (2) So this time I set to servo mode, and adjust position to around 735 and watching the scope.(3) I found scope shows repeated waveforms every 350 ms, roughly in two parts. (4) I always find it difficult to read the bits and bytes, perhaps you can help out and translate the bits into bytes.





Notes – (a) I did try to change Vin from 6V to 8V and found no change in the amplitude of the 5V UART waveform, so I guess Vin is solely for powering the motor, and has nothing to do with the UART stuff. (b) I also guess, the BusLinker is for LX-16A which is not HV and only work to 7.2V. But the servo LX-824HV should work to 11.1V, so I increase Vin to 10.0V and found every body happy to work as usual, for at least about 15 minutes without any smoke coming out.Now about the 10bit command string. I guess the initial “10-” before the “0x55 0x55” string is just to “wake up” the servo, and is not part of the command string, which only starts with 0x55, 0x55. So If I am going to use a terminal emulator, or later a python program, I can forget the “10-” part and just start a commend with 0x55, 0x55. I have not yet decided not to do next. Comments and suggestions welcome.Please also feel free to ask me to try other things you like. Ah, jogging time. See you late this evening or tomorrow. Cheers.Â
.END
Categories: Uncategorized