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

    Joined:
    Feb 9, 2019
    Messages:
    3
    Balance:
    22Coins
    Ratings:
    +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%)

    Print
    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.
    首先你需要准备的材料

    1,已经刷好固件的STM32F407开发板(上一篇有教程)

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


    我用的伺服套装
    3,25芯并口接头一个(一般买伺服套件会送)
    4,7芯屏蔽线一根(1米左右就够了,也就几块钱)
    5,Z11型免键涨套(25块)


    根据电机轴的大小选购
    6,M6x25内六角螺丝刀4个(连接涨套与打印件)
    7,M5x20内六角螺丝刀6个(连接快拆与打印件)
    8,M5x15内六角螺丝刀6个(连接方向盘与打印件)
    9,方向盘快拆(68块)


    10,赛车方向盘(150左右随便买个就好了)


    3D打印件一个(本次3D打印文件只适合这个教程内指定型号的涨套使用,其他型号的涨套方案不一定适用,打印可以找淘宝打印,填充率建议在35%-80%)


    打印件
    接下来就是如何将STM32通过CN2接口连接到伺服驱动器上,下边是接线图,如何接,接收那,图中都标示出来了

    [​IMG]
    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

    6到GND的线中间加个急停开关,防止电机失控时切断电机电源
    [​IMG]
    [​IMG]

    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.

    按线序接在25芯并口插头上
    Stm32线接好后先不要连接伺服驱动器,要先设置好伺服驱动(按键使用设置方式请看自带的说明书)主要固定参数设置(可以叫店家帮忙设置)
    Pn02设置为0(转矩模式)
    Pn03设置为0(外部使能)
    Pn53设置为58(Pn53代表Sigln2端口功能,18为《指令取反》功能,有的驱动指令取反不是18,具体请查驱动附带的说明书查看,)
    需要用到的浮动参数(驱动说明书有介绍,参数不一样请按说明书为准)
    编号取值范围名称
    Pn190 -1500〜1500mv模拟转矩指令更改调整Pn191 0-1模拟转矩指令方向Pn188 1〜 500ms模拟转矩指令平滑过滤时间Pn198 0〜4500转矩控制时限制速度作用
    Pn190:调整信号干扰造成的电机自转。这里要用2次
    1,驱动器接好编码器和电机后内部使能,此时电机自转根据电机转动方向,调整正负偏移量。
    2,此时接上CN2控制端(之前已经接好线),重新上电,观察 机转动方向,再次调整指令偏移此步骤最好外部使能,避免接错线造成电机乱转,尔手忙脚乱。
    Pn191:调整电机在接收正负指令信号的转动方向。
    ◢0:正电压正转(ccw),负电压反转(cw)◢1
    :负电压正转(ccw),正电压反转(cw)
    注:1,正常接法编码器A +接PA0编码器B +接PA12,若此时进入游戏方向盘转动方向与实际不符可调转正常接线,同时调整光合速率191设置,不可在MMOS上设置反转编码器,游戏上可以设置,但是会变为方向助力。
    Pn188:调整高频噪音
    设置值越大,输入模拟量响应速度越慢,有利于减小高频噪声干扰;设置越小,响应速度越快,但干扰噪声会变大
    Pn198限制电机扭转的转速,数值越大转速越快,设置速度120〜150比较合适(Ps:这个很重要,一定要限速,不然玩游戏时车辆一失控,电机转动能0.1秒内加速到2000转,贼TM恐怖,有一次我没固定好,电机直接飞到地上,头都给我吓掉囧)

    然后准备连接伺服驱动器与STM32:

    首先要先给电机伸出套,把涨套安在电机轴上,四个螺丝拧死,保障涨套和电机连接稳定,然后把四个螺丝替换来,,安上打印件,再继续拧上螺丝


    然后把快分开开,安装到打印件上


    然后把快拆的另一部分安装到方向盘上,由于方向盘不好建模就不画出来了


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

    [​IMG]


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

    Ads Master

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
  3. Chris Malcolm

    Chris Malcolm New Member

    Joined:
    Mar 9, 2019
    Messages:
    18
    Balance:
    159Coins
    Ratings:
    +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

    Joined:
    Jul 6, 2017
    Messages:
    598
    Occupation:
    Electronics Engineer
    Location:
    United States
    Balance:
    3,616Coins
    Ratings:
    +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

    Joined:
    Feb 9, 2019
    Messages:
    3
    Balance:
    22Coins
    Ratings:
    +2 / 0 / -0
    My Motion Simulator:
    DC motor, Motion platform, 4DOF, 6DOF