1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  3. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  4. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

Question FlyPT Mover -> USB -> Rs485 -> Servo Controller?

Discussion in 'Motor actuators and drivers' started by Lutzi1112, Feb 9, 2023.

  1. Lutzi1112

    Lutzi1112 New Member

    Joined:
    Feb 9, 2023
    Messages:
    3
    Balance:
    48Coins
    Ratings:
    +0 / 0 / -0
    Hi,

    im quite new here and hope this is the correct place to ask this.

    Has anyone tried using a USB to RS485 Converter (like this waveshare.com/wiki/USB_TO_RS485) to directly control a Servo Controller?

    Currently making vague Plans for my first Rig and kind of wondering if i could just leave out the motion control board like a Motion4Sim or similar.

    Would there be any safety concerns in doing so?

    Any input appreciated, thank you.
  2. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,157
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,628Coins
    Ratings:
    +10,909 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
  3. wingert

    wingert Active Member

    Joined:
    Aug 10, 2020
    Messages:
    112
    Balance:
    642Coins
    Ratings:
    +89 / 0 / -0
    My Motion Simulator:
    4DOF
    it depends on your motor controller. If you want use the AASD series, afaik no, as this hardware uses separated step and direction pulses no serial structure e.g. start and stop bits.
  4. bobo

    bobo Member

    Joined:
    Dec 6, 2022
    Messages:
    31
    Balance:
    274Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    6DOF
    You seem to lack one thing, that is, the control board.

    You can't control the servo driver directly with a computer.

    You need to use a single chip computer, write a program,

    and then output pwm or 4856 to control the servo motor
  5. Lutzi1112

    Lutzi1112 New Member

    Joined:
    Feb 9, 2023
    Messages:
    3
    Balance:
    48Coins
    Ratings:
    +0 / 0 / -0
    Ohh ok so the RS485 Port on those is just for configuration, no commands to drive it? Exclusively step and direction?

    The lack of a control board is exactly what I am curious about, because FlyPT Mover can output a serial string to control the Rig.

    So I thought if I could figure out the RS485/ Modbus Protocol of the driver, depending on which one supports it, I could leave out said control board and communicate directly from the usb/RS485 adapter with the servo drivers.

    According to this Manual setting the driver to FN002 for trial operation I could at least Jog the servo by setting pn177 via RS485 or am i mistaken? (Page 30)

    And then on page 65 it states "◢ Pn120=12,Pn121=5000。Example: the encoder 2500 line, to go travel 12.5 turn, is set Pn120 = 12, Pn121 = 5000."

    Wouldn't that mean setting pn 120 and 121 enables us to drive the servo via RS485? If everything else is configured and the enable pin is pulled high etc.?

    Or am I missing anything obvious?

    (Attached is the AASD driver manual I found and base my assumptions on)

    Attached Files:

  6. wingert

    wingert Active Member

    Joined:
    Aug 10, 2020
    Messages:
    112
    Balance:
    642Coins
    Ratings:
    +89 / 0 / -0
    My Motion Simulator:
    4DOF
    the manual is not a clearly explanation so I would interpret modbus only for configuration ?
  7. Lutzi1112

    Lutzi1112 New Member

    Joined:
    Feb 9, 2023
    Messages:
    3
    Balance:
    48Coins
    Ratings:
    +0 / 0 / -0
    Ok,

    I've got a little something deciphered and clobbered together.
    Sorry if it's a little unclear or messy, i spent the entire night and Morning on this.

    THIS IS ALL UNTESTED, im just going after the manual and trying to piece everything together.

    In FlyPT we need to make sure, that Axis1a is only outputting one Byte so in the Rig Settings we need to Set Position Bit output to 8.
    And I believe the Pose limits need to be below 10000, but honestly no clue about that part.

    FlyPTMover Serial Output for one Axis using RS485 for AASD would look something like this.

    :<0><1><0><6><0><121><Axis1a><13><10>


    : or <58> declares the Start.

    0 1 | is the Drive Number it could go up to 31 as far as i understand.

    0 6 | is the command. 0 6 writes a single register (in another part of the manual it is statet to read a single register as well, so idk whats true) there is more like writing multiple registers (0 16), or reading multiple registers (0 3).

    0 121 | is the Register we are writing to, 121 is Postion control in steps from -9999 - 9999, if we wanted to move the motor more than 9999 we would need to also write data to 120 which is also position control, but in that case 1 would mean 10000 Steps, so be carefull there.

    Axis1a | our Data, as in the steps we want to drive the Servo.

    13 | CR Carriage Return

    10 | LF Linefeed


    What we are missing is the 2 LRC Bytes before CR.
    The Servos use a Longitudinal Redundancy Check, it works something like this: Sum up all Bytes you are sending except Start, CR and LF. Subtract that number from 256. Now with that new number we determine the corresponding ASCII Character. We split that in half (for Example 80 turns into 8 and 0) now we find the corresponding Byte Values for those ASCII Characters (in this case simply 8 and 0) and insert those into our string before CR. In my Opinion an incredibly convoluted Protocol, not very fun to think about.
    No idea if it is possible to do in FlyPt, I couldnt figure it out, so I wrote a little Python script to insert the LRC into the string and send it out over Serial. Only for testing purposes and one Axis so far.
    Should i upload the file or put it on github or something? Its as untested as everything else in this post.

    Axis1a is 127 in this Test String.
    So if we were to Adjust Pn064 - Pn071 accordingly for proper communication with our USB to Rs485 Adapter and Pc as described in our manual and Enabled the Servo (for safety reasons I think doing the enabling and disabling only via Serial is not the best idea, but apparently also possible), we could send the String :<0><1><0><6><0><121><127><8><0><13><10> (including the :) and our Servo number one would (hopefully) turn to middle position.



    Again this is all NOT!!! TESTED!!!, as my drives haven't arrived yet, take all of the above with a grain of Salt until its proven to be true.
    If someone is willing to test it for me that would be great :)

    The signal Path would be: FlyPT overUDP -> Python script for the CRC over Serial-> USB to Rs485 Adapter -> Motordriver