matthieuvigne / STS_servos

Arduino library for Feetech's STS smart servo
MIT License
17 stars 8 forks source link

servo connection #4

Open goguelnikov opened 6 months ago

goguelnikov commented 6 months ago

Hello, Thank you for this work! do you have any newer version? I'll be trying to use these servos too. how do you connect them actually? Are you using a serial port and a serial adapter? best

matthieuvigne commented 6 months ago

Hi,

The version you see on Github is the current one. To be honest I'm not actively developing this any further (this was mostly a prototype project for me as I mostly use Raspberry Pi nowadays), but if you encounter any issue I'll be happy to investigate and fix them.

There is indeed one catch in connecting these servos to an Ardunio (or any microcontroller): communication is half-duplex, there is only one data line that needs to toggle between input and output. You'll need to handle that either by hardware or software. Personally, I used the converter board from feetech directly: https://www.feetechrc.com/FE-URT1-C001.html ; you could also use the shield from Dynamixel: https://emanual.robotis.com/docs/en/parts/interface/dynamixel_shield/ - or really any half-duplex to full-duplex converter. If you are looking for something plug and play, I would recommend taking this solution. If you are into electronics, you could also design your own - there are many designs based on a tri-state buffer (such as the one proposed by Dynamixel for the AX 12: https://emanual.robotis.com/docs/en/dxl/ax/ax-12a/ ; Feetech also has a design in the datasheet of their servo which doesn't require a direction pin). Note that Feetech's servos are quite similar to Dynamixel (using an almost identical protocol), so all you can find on google about this servo can work for Feetech's as well. There is also the simple solution of simply putting a diode between RX and TX - this works, but has the drawback that any signal you send is also read back by the Arduino (because RX and TX are connected). You'd then seen to flush the serial buffer after each package (and hope for the flush to occur before the reply) - it wouldn't be supported as is by the library.

One last option is to do this through software serial - basically have code switch the line direction. See for instance the SingleWireSerial library: https://www.arduino.cc/reference/en/libraries/singlewireserial/ This solution however is much slower than a hardware-based approach, and I've never tested it with these servos.

goguelnikov commented 6 months ago

thank you for your answer! I have the same controller. my goal is to make a GUI to control a robot arm with 6 feetech servos. do you think there are other PC environement containing libraries for these servos? like python or something else? best, Romain

matthieuvigne commented 6 months ago

I've never tried it personally but in python there is an official package from Feetech directly: https://pypi.org/project/feetech-servo-sdk/