Uncategorized

lx-224hv chat record

Then 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.2kSun

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… tlfong013973Sun 22:39

Ah, 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。

user image

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.

user image

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 MaireSun 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…

tlfong013973Mon 13: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”?

user image

  2 hours later… 

Adrian Maire13.2kMon 14: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… tlfong013973Mon 16:13

Ah, 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.

user image

user image

user image

user image

user image

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. 

Adrian Maire13.2k

Mon 16:54I am currently at work, so I will translate the screenshots later.

Thank you very much for testing 8V and 10V and confirming that the UART signal is always 5V. With this, I can discard the issue of voltage and try others ideas.

Considering the “10”: it is nothing about the servo itself, but about UART protocol in general. Reading a bit more about the subject:

UART send a “0” before each bytes and a “1” after each byte (so we see the “10” between them).

This is used to synchronize clocks in the serial communication. you don’t need to add them to the string, it is automatically done by the UA…(see full text)  6 hours later…

 tlfong013973Mon 23:06(removed)Now I have set up and tested the following hardware and software to prepare testing sending commands to servo to request temperature.

(1) Set up PC Win10 USB to UART adapter baud rate 115200bd.

(2) Setup Win10 RealTerm and test loopback (hex) numbers

(3) Setup TXS0104 3V3 to 5V0 logical level shifter.

(4) Test loop back with 5V0 TxD shorted to RxD

user image

user image

user image

user image

Test plan tomorrow.

Tomorrow will test the real thing:

(1) Short 5V0 TxD to RxD

(2) Connect shorted TxD/RxD to signal terminal of LX-824HV

(3) Send command request for temperature

(4) If all goes well, LX-824HC should return temperature.

Bed time, call it a day, carry on tomorrow.  13 hours later… tlfong013973

Tue 12:44

You said the following: “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.

(1) 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.

(2) Any other error in the electronic (?)

(1) If you once used 12V UART signal, it is very likely the servo is fried.

(2) You did not mention where did you buy the servo. If it is from eBay or other not that reliable shops, then you might get a fake model, or “damaged and returned to shop” thing.

I noticed that there are many shops in CN selling LX-224HV, to newbies and schools.

It is likely that those newbies do not know how to properly handle the HV toy and fired it and return it. Some bad guys might just sell the damaged toys on eBay.

That is one of the reasons I posted detailed info of the toy I ordered.

I found that in CN there are a couple of flagship or big authorized or seemingly authorized shop.

One of the big shops has the following note in their ad: “We Accept Returned Goods“, that means they accept used toys, usually paying a low fee, to any used toys, damaged or good, without asking any question.

Then they may resell it to bad eBay guys, …  

3 hours later… 

Adrian Maire13.2kTue 16:04

If you onace used 12V UART signal, it is very likely the servo is fried.
I did not, that is why I asked you to test the signal voltage first. 🙂

You did not mention where did you buy the servo.

Here, we have not that many choices where to buy them. I got it on Alibaba, and usually what I get there works fine. Any way, I should receive the controller soon, so I will let you know if it works with it.

Also, eBay is not that evil: you can be cheated (ofc), but usually (and if you are a bit careful) you get correct stuff. I had never issues with eBay in my case.

Yesterday, I wrote a small C++ code to send the UART signal and activate/deactivate writing mode. (using WiringPi lib). It works mostly, but I have issues synchronizing UART and the “writing” pin, because UART is buffered: I activate “writing” then send the signal to UART, and finally deactivate “writing”, but that way the UART signal finish after the “writing” is disabled.

I tried with some timers, but in the micro-seconds, those don’t work reliably. I am thinking how to implement that by hardware.(see full text)  

1 day later…

 tlfong013973yst 22:31(1)

I agree eBay is not always evil, but I think eBay’s quality control is not as good as Amazon or AliExpress.

Actually I was once a member of AliBaBa, but I later opened an account in AliPay and TaoBao, which belongs to Alibaba.

(2) I think I understand what your C++ code is trying to do, but I think it is tedious.

(3) I read the BusLink doc saying that its UART connector can be used by MCU to talk to servo, but I am not sure if you must use Win10 and install driver for that.

(4) I found Win10 RealTerm hard to handle, and I need to reset every now and then.

Now I have decided to switch to Rpi4B CutCom which is simpler than RealTerm, and CuteCom is easier to convert to Thonny python.

But I have only 50% confidence that my TXS0102/04 can replace the BusLink. Will take me a couple more days to find out. Cheers. 

tlfong01yst 22:51

Just now I googled and find a python library for BusLink Terminal on Python. In other words no more using Windows.

If your HC126 adapter is almost identical to BusLink Terminal, perhaps you can also try this python LeWanSoul LX-16A library. For now I will still carry on my TXS0104 setup.

Adrian Maire13.2k

Hi tlfong01 🙂
I finally got the controller board from Aliexpress, so I could try the different servos. As a note, the HV version is also moving with 5V (much easier to avoid frying the servo).

I managed to do the C++ code, but unfortunately, I can’t manage to reliably disable TX on time. The problem is that the OS timers and scheduling is on the 10ms range, while this communication happens in the 0.1ms.. This makes impossible to control enTX and TX by software on any modern OS.

user image

If you test it, you will see that the enTX will be disabled after last bit of the UART, but with significant Jiter

What to do now?

1) I will try to use the 5V TX RX GND of the board to control the servo from the RPI.

2) Revert-engineer the board if possible.

Depending on result… we will see.  

14 hours later… 

tlfong01397312:46

Well, if wiringPi and wiringSerial’s operation delay is of the order of 10ms, it is too slow for your HC126 enTxD circuit.

As I see, there are at least two more alternatives:

(1) Use level shifter to shift Rpi’s TxD, RxD to 5V and use the plain HC126 cct or BusLink Terminal Board to talk to servo,

(2) My suggested TXS0102/04 level shifting and auto direction control two-in-one solution.

WARNING – I have not yet tested it. I think I have only 50% chance winning. 🙂

BTW, I have skimmed the following: maximkulkin Enable standalone mode for terminal app (lewansoul_lx16a_terminal.py, 695 lines) – Maxim Kulkin (maximkulkin), GitHub 2019feb27


github.com/maximkulkin/…

The python library by Maxim Kulkin is well documented, but I am not interested to over simplify the 625 lines long python code to start my preliminary testing. I will just first try it in CuteCom, and then use Thonny python to test the very basic commands, (1) Read Position, (2) Read Temperature, and (3) Read Vin.  

2 hours later… 

Adrian Maire13.2k15:11Hello,

So yesterday I did some more tries with the board. And I managed to control the servo from the RaspberryPI GPIO through the board.

user image

To summarize:

– The raspberryPi Tx and Rx are converted from 3.3V to 5V, and then connected to the 5V/Tx/Rx/GND pins on the board.

– I implemented some additional logic in C++ to make it rotate and request Vin.

Both: moving the servo and requesting Vin works.(I will push the c++ code as soon as possible)

What now?

1) Your python approach is interesting, I am excited to see if it’s going to work.

2) On my side, I will reverse-engineer the board, to see if I can skip it. But probably your suggestion of TXS0102/04 is a good approach. 

tlfong01397315:32

Oh my goodness. (2) This is a milestone. “I implemented some additional logic in C++ to make it rotate and request Vin”

(2) Your idea of “reverse-engineer the board, to see if I can skip it.” is good. I have no idea of how difficult it is. I have the feeling that it might be very difficult, as the BuskLink Terminal App is a bit complicated, as Maxim Kulkin’s terminal + UI python code. Anyway, good luck.

Now I have read the “LewanSoul Bus Servo Communication Protocol”. It is only 11 pages long, implying not too many commands to deal with. As said earlier, I will only test the read temp, vin, and pos commands.

I have summarized the protocol guide, and upload here, in case you are interested to see what I am doing.

user image

user image

Adrian Maire

Yes, this doc has became my favorite nightstand book too 😛BTW: what software do you use to highlight PDF? it seems very convenient 

tlfong0115:50Ah,

what do you mean by “favorite night stand”?

I was about to curse that the guide seemed to be written by a nerd/geek in a hurry.

Geeks usually have high IQ like the uni profs and so their ordinary IQ students find the prof’s lecture hard to follow. 

Adrian Maire

Ohh! It’s an expression here, to indicate that I have it close to me all the time and I spend lot of time on it. (Not really that I like it especially)

 tlfong01

Ah, I used to highlight my lengthy reports to my very busy ex boss, who only has time to play golf, no time to read my rubbish. So if he is very busy, he will just read the pink sentences, and so not busy, the green stuff, and so so, read the blue stuff. 

Adrian Maire

Pink/Green/Blue: convenient.I am going back to work. I wish you a good after-noon and luck with your researches 🙂 

tlfong013973

And I used to use these tools/procedures to convert pdf and actually all documents that can display in Windows (Yes, I am a Windows guy).

(1) Display anything on the Windows screen,

(2) Crop/Capture the interesting portion of screen into a JPG file,

(3) Use the very powerful PhotoShop to edit the jpg image,

(4) use the PhotoShop “TRANSPARENT” thing (I am using Chinese Windows, so I don’t know the “thing” in English! :)) to highlight what you want.

Ah, I missed my afternoon tea! See you later.  2 hours later… tlfong0117:37

Progress Report 2020sep10hkt1737 

tlfong01397317:48

I feel jealous that the other guy next Continent is making great progress today. So to catch up, I abandoned the Rpi CuteCom I am setting up, and went back to the not so stable Win Real Term to test the read temperature LeWanSoul command with my LX-224HV.

I have already done the following before the test this time.

(1) Use BusLink board to test servo can rotate, move to position, read temp, pos, and vin.

(2) Adrian helped to decode the read Vin request as

0x55, 0x55, 0x01, 0x03, 0x1b, 0xe0.

(3) I tested Win10 RealTerm UART loopback, with TxD shorted to RxD, at logical level 3V3 (UART adapter jumper set to 3V3),

(4) I ten tested Win10 RealTerm UART loopback at logical level 5V0, using TXS0104 to do level shift up,

(5) Next is the fun part:

(a) I power servo with 5V,

(b) set RealTerm input string to readVin,

(c) send readVin without connecting the signal (TxD shorted to RxD) to servo. RealTemp output displayed the readVin string and nothing else.

(d) send request again, this time, RealTerm displayed more numbers (from servo, I guess).

(e) I repeated send without signal connected, and then connected to servo). The RealTerm output is displayed below.

user image

Now I need someone kindly to decode the seemingly reply from the servo, hopefully something like a Vin value of 5V. Ah, I am missing the locking down supper, will come back later this evening, … 

Adrian Maire13.2k18:09

user image

tlfong01Thanks a lot. So I will do my always dodgy calculation after supper. Cheers. 

Adrian Maire13.2k

x55 x55: start communication frame
x01: ID from the servo replying
x05: length of the message, including this byte and following
x1B: command: 27 is response to VIN_READ
x4E and x14: value of voltage.
x7C checksum.

continuing

x14=20, x4E=78: 5198 

tlfong01

Ha, so the value is 0x4E14. I will ask the online hex to decimal converter for help. 

Adrian Maire13.2k

4E is lower bits and 14 higher, so you have to reverse them: x14 x4E14=20, 4E=78, so 20*256+78 = 5198

There is no description of what does that mean, but considering other parameters, it seems like mV, thus 5.198V tlfong01

Ah, yes I first tried 4e14 returning some rubbish, then 144e gives 5198. I hope it means 5.198V.

tks bye Adrian Maire18:27

>JPG

Ohh! I though you had some tool to directly highlight the PDF. Like with Okular PDF-reader  The last message was posted 3 hours ago.

END

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 )

Google photo

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

Twitter picture

You are commenting using your Twitter 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.