1. 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 Download Package Now!
  2. 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
  3. 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 here. Do not following these rules will lead to permanent exclusion from this website: Read the forum rules.

USB servo motor direct drive DIY

Discussion in 'Direct Drive Wheels' started by 卡尔黄森, Jan 2, 2020.

  1. 卡尔黄森

    卡尔黄森 New Member

    Feb 9, 2019
    +2 / 0 / -0
    My Motion Simulator:
    DC motor, Motion platform, 4DOF, 6DOF
    Google-translated from Chinese:

    First you need to prepare the materials

    1. The STM32F407 development board with the firmware already brushed (the previous one has a tutorial)
    2. Servo motor kit (including motor and driver, I use Yichuan Yifeng's servo kit, the motor is 80st-03520, polycarbonate 3.5NM, I think it is enough, the servo kit costs 850 yuan, and there are conditions to recommend Buy 130st-10010 set, polycarbonate is big enough, but the price is also expensive)

    I use the servo package
    3. 25 core parallel port connector (usually bought by servo kit)
    4. 7-core shielded wire (about 1 meter is enough, and only a few dollars)
    5. Z11 type keyless riser (25 pieces)

    Choose according to the size of the motor shaft
    6. 4 M6x25 Allen screwdrivers (connecting the expansion sleeve and the print)
    7. 6 M5x20 Allen screwdrivers (connecting quick release and printing parts)
    8. 6 M5x15 Allen screwdrivers (connecting the steering wheel and prints)
    9. Quick release of steering wheel (68 pieces)

    10. racing steering wheel (just buy it around 150)

    One 3D print (This 3D print file is only suitable for the expansion sets of the specified models in this tutorial. Other types of expansion sets are not necessarily applicable. Printing can be found on Taobao. The filling rate is recommended to be 35% -80%)

    The next step is how to connect the STM32 to the servo driver through the CN2 interface. Below is the wiring diagram. How to connect and receive it is marked in the figure.


    2,伺服电机套件(包含电机和驱动,我用的是一川亿丰的伺服套件,电机是80st- 03520,聚碳酸酯3.5NM我觉得够用了,伺服套装花费850块,有条件的建议买130st-10010套装,聚碳酸酯够大,但是价钱也贵)






    Add an emergency stop switch in the middle of the line from 6 to GND to prevent the motor from being cut off when the motor is out of control


    Connected to 25-pin parallel port plug in line order
    Do not connect the servo driver after the Stm32 cable is connected. You must set the servo driver first (please see the instruction manual for the key usage setting method). The main fixed parameter settings (you can ask the store to help set)
    Pn02 is set to 0 (torque mode)
    Pn03 is set to 0 (external enable)
    Pn53 is set to 58 (Pn53 stands for Sigln2 port function, 18 is the "instruction negation" function, and some drive instruction negation is not 18, please refer to the manual attached to the driver for details.)
    Floating parameters that need to be used (the driver's manual has instructions, the parameters are different, please refer to the manual)
    Number value range name
    Pn190 -1500 ~ 1500mv Analog torque command change adjustment Pn191 0-1 Analog torque command direction Pn188 1 ~ 500ms Analog torque command smooth filter time Pn198 0 ~ 4500 Limit speed effect during torque control
    Pn190: Adjust the motor rotation caused by signal interference. I will use it twice
    1. The driver is internally enabled after the encoder and the motor are connected. At this time, the motor rotation adjusts the positive and negative offset according to the direction of motor rotation.
    2. At this time, connect to the CN2 control terminal (the wire has been connected before), power on again, observe the direction of rotation of the machine, and adjust the command offset again. This step is best externally enabled to avoid the wrong rotation of the motor. .
    Pn191: Adjust the rotation direction of the motor when receiving positive and negative command signals.
    ◢0: positive voltage forward (ccw), negative voltage reverse (cw) ◢1
    : Positive voltage reverse (ccw), positive voltage reverse (cw)
    Note: 1. Normally connected encoder A + connected to PA0 encoder B + connected to PA12. At this time, if the direction of rotation of the steering wheel in the game does not match the actual situation, the normal wiring can be adjusted. At the same time, the photosynthetic rate 191 can be adjusted, and the inversion cannot be set on MMOS. The encoder can be set in the game, but it will become a direction aid.
    Pn188: Adjust high frequency noise
    The larger the setting value, the slower the response speed of the input analog, which is beneficial to reduce the high-frequency noise interference; the smaller the setting, the faster the response speed, but the interference noise will become larger.
    Pn198 limits the rotation speed of the motor. The larger the value is, the faster the speed is. It is more appropriate to set a speed of 120 ~ 150. Turn, thief TM is terrible, once I did not fix it, the motor flew directly to the ground, my head scared me 囧)

    Then prepare to connect the servo drive with the STM32:

    First, extend the sleeve for the motor, install the expansion sleeve on the motor shaft, and screw the four screws to ensure the connection between the expansion sleeve and the motor is stable. Then replace the four screws, install the print, and then continue to screw Screws

    Quickly separate it and install it on the print

    Then install the other part of the quick release to the steering wheel. Because the steering wheel is not good for modeling, it will not be drawn.

    Assembly diagram
    After installing the plate, the next step is the commissioning phase
    1. Connect the encoder cable and 3 power cables of the driver and motor.
    2. Set the main parameters (pn02 pn03 pn53)
    3. Do not connect any wires to CN2. At this time, turn on the power of the servo driver. Adjust the driver to be internally enabled and the motor to rotate. Adjust the Pn190 parameters until the motor is stationary. Adjust the driver to external enable to prepare for the next step.
    4. Connect the driver to the STM32 development board, power on the driver, and connect the STM to the computer. (The firmware has been flashed in the previous period) The flashing firmware tutorial moves to the previous tutorial.
    5. Set the MMOS host computer: Open MMOS, click Install to enter the settings, change the settings to the following, after the save is successful, the lower left icon turns red, and then re-plug the STM32 line data. Go to the center position, click the button on the software, and then click Save in the bottom right corner
    Next, make the final adjustments, unplug the drive, unplug the STM32 data cable , Re-plug the STM data cable and driver power, perform motor debugging 1, and adjust the limit strength to the minimum. As shown in Figure 2, turn on the enable and observe whether the machine has been rotating left and right all the time. If not, go to step Pn191 to set. 3. After adjusting the motor to swing left and right, adjust Pn190. After the motor worker is stationary, Collins rotates the shaft by hand to see if the left and right positions are limited. The limit is successful, the game is tested, DIY is successful 4, and there is still a problem with the setting of Pn191. In step 3, if the motor worker rotates in the same direction after rotating to a certain angle in the left and right, this problem still needs to set the Pn191 analog command torque direction. This completes the direct drive inverter DIY. If you feel that the motor is louder, you can adjust Pn188.

    Pn190 -1500〜1500mv模拟转矩指令更改调整Pn191 0-1模拟转矩指令方向Pn188 1〜 500ms模拟转矩指令平滑过滤时间Pn198 0〜4500转矩控制时限制速度作用
    2,此时接上CN2控制端(之前已经接好线),重新上电,观察 机转动方向,再次调整指令偏移此步骤最好外部使能,避免接错线造成电机乱转,尔手忙脚乱。
    注:1,正常接法编码器A +接PA0编码器B +接PA12,若此时进入游戏方向盘转动方向与实际不符可调转正常接线,同时调整光合速率191设置,不可在MMOS上设置反转编码器,游戏上可以设置,但是会变为方向助力。





    2.设置好主要参数(pn02 pn03 pn53)
    5.设置MMOS上位机:打开MMOS,点击安装进入设置,将设置改成如下,保存成功后左下图标变红,然后重新插拔STM32线数据重新插拔数据线后将软件设置成以下设置,方向盘转到中心位置,点击软件上的按钮,然后点击右下角的保存 [COLOR =#212121] [FONT = -apple-system-font]接下来进行最后的调整拔下驱动器的电源,拔下STM32数据线,重新插上STM数据线和驱动器电源,进行电机调试1,调整限位力度至最小。如图2所示,接通使能,观察 机是否一直左右旋转。如若不是,亲移步Pn191设置。3,调整至电机一直左右摇摆后,调整Pn190,至电机工静止后柯林斯用手旋转轴,看看左右是否有限位,可调整方向盘度数多次测试。限位成功,上游戏测试,DIY成功4,还有一种情况还是Pn191设置问题。在步骤3如果中左右旋转到一定角度后电机工就会朝着同一方向旋转,这个问题还是要设置Pn191模拟指令转矩方向。到此直驱变频器DIY完成。后续要是感觉电机响声大可以调整Pn188。


    • Like Like x 2
    Last edited by a moderator: Jan 3, 2020
  2. Ads Master

    Ads Master

    +0 / 0 / -0
  3. Chris Malcolm

    Chris Malcolm New Member

    Mar 9, 2019
    +7 / 0 / -0
    Wow. I have no idea if I could make it work but thanks for posting. I'd love to try and build that in the future.
  4. Thanos

    Thanos Building the Future one AC Servo at a time... or 6

    Jul 6, 2017
    Electronics Engineer
    United States
    +503 / 4 / -0
    My Motion Simulator:
    AC motor, Motion platform, 4DOF, 6DOF
    Nice! I have a spare AASD-15A drive and servomotor that I might convert to use for FFB steering wheel like that. I did similar in the past with Clearpath motor but doesn't have that much torque!!! Thanks for sharing!
  5. 卡尔黄森

    卡尔黄森 New Member

    Feb 9, 2019
    +2 / 0 / -0
    My Motion Simulator:
    DC motor, Motion platform, 4DOF, 6DOF