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

MMOS controller with cheap servo drive and motor

Discussion in 'Direct Drive Wheels' started by sikjar, May 22, 2017.

  1. Carlo_Labati

    Carlo_Labati New Member

    Joined:
    Jan 10, 2018
    Messages:
    18
    Location:
    italy
    Balance:
    213Coins
    Ratings:
    +3 / 0 / -0
    Wath NM Torque for this motors ?
  2. Ultrawipf

    Ultrawipf New Member

    Joined:
    Jan 12, 2019
    Messages:
    12
    Balance:
    123Coins
    Ratings:
    +17 / 0 / -0
    Okay little update on stepper drive wheels.
    I might have an idea how we could build one better and probably even cheaper than with these old drivers that don't even work for that application.

    Its a shame that mmos is closed source. It would make the project so much easier if it wasn't.
    I plan on making a similiar standalone controller -open source- with a more modern stepper driver that can drive inexpensive high power steppers instead of hard to get servos with super expensive drivers.

    The biggest problem is currently to get any kind of documentation on usb hid descriptors with force feedback. Tell me if anyone has more info about that subject.

    Attached Files:

    • Like Like x 1
  3. OZHEAT

    OZHEAT Active Member

    Joined:
    Oct 26, 2015
    Messages:
    208
    Location:
    Australia
    Balance:
    2,459Coins
    Ratings:
    +106 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor
    @Ultrawipf
    I have always had my reservations regarding using stepper motor as a steering wheel, you will not get rid of the cogging from the motor although a large steering wheel will minimize the feeling.

    As for MMos, I believe the project was started with good intentions but pretty much stopped developing it when he got an industrial drive controller(granite) and partly rewrote the program to cater for the drive and left it like that.
    Yes he did develop the ffb effects more but he did drop any ideas on directly driving motors from mmos.
    Granite servo drives are NOT the only servo drives that you can use with MMOS, in fact most can be used.
    So you do not need to limit yourself to an expensive "Granite servo drive", a second hand or new industrial servo motor and drive can be used instead.
  4. Ultrawipf

    Ultrawipf New Member

    Joined:
    Jan 12, 2019
    Messages:
    12
    Balance:
    123Coins
    Ratings:
    +17 / 0 / -0
    This is probably true that steppers are not the best choice. But afaik the simxperience accuforce uses a "hybrid stepper drive" too which is also just a stepper with a closed loop drive. Maybe they have some advanced regulation to make it smoother.
    If they can do it i am sure there could be demand for an open version.

    If it does not work out at all there might be some other options.
    The choice of motor and how it is driven can also greatly reduce the cogging feeling of a stepper so it does not always feel like you are grinding phantom gears.
    My test setup currently only features a nema23 which feels pretty smooth when freerunning with something wheel sized but a nema42 would be the ultimate goal and that could become a bit rougher.

    Maybe someone with an accuforce can confirm how it feels.
  5. Ultrawipf

    Ultrawipf New Member

    Joined:
    Jan 12, 2019
    Messages:
    12
    Balance:
    123Coins
    Ratings:
    +17 / 0 / -0
    I am currently working an a foc control loop for steppers.
    The good news is the driver has a lot of power and allows voltage and current mode regulation and has a fast step clock input and a constant torque foc driver was done before with the powerstep01 by some researchers.
    The slightly bad news is that modulating the power by sending spi commands is not perfectly timed and enabling highZ mode for freerunning also is probably too slow in the main control loop. But i am working on a solution.

    The challenge i am facing right now is dealing with aligning the encoder and motor phase perfectly at startup either by measuring an offset or aligning it while homing.

    Here is little video showing constant torque being applied in current mode with FOC: https://streamable.com/fwrur
    This is at 0.4A at 15V with a nema23 3Nm motor as my test setup. Of course when it works completely i will test it on bigger motors.

    I gues it is at least something that shows the idea might be possible ;)
    Cogging is way less than i feared and i hope it will not get too much worse with bigger motors. Keep in mind a real steering wheel would be a lot larger and would reduce the feeling further.

    More progress will come. Might have to make a new thread or document elsewhere when it gets more advanced so i don't hijack this topic.
  6. Ultrawipf

    Ultrawipf New Member

    Joined:
    Jan 12, 2019
    Messages:
    12
    Balance:
    123Coins
    Ratings:
    +17 / 0 / -0
    As i don't want to spam this thread further until some real discussion about it can happen, the project is now active and will be documented here: https://hackaday.io/project/163904-ohsc-hybrid-stepper-motor-controller

    Current stage: HID Input is working (16bit steering, 12bit for adc channels and 16 buttons), foc and basic position control is working. Force Feedback via USB Physical Interface has to be implemented yet.

    Which effects are normally used by the usual games? Constant torque and "spring to position" can be implemented easily and would make sense but virtually no documentation about this topic is available.

    This would be my next stage before designing a pcb and making the final prototype for further development.
    It is also planned to implement a general purpose stepper interface as servo alternative for other tasks.
    I am almost certain that the final interface will be based on an stm32f4 microcontroller and the powerstep01 stepper driver as this combination seems to make sense and currently works well enough. The encoder must have sub-microstep resolution for the foc part to work. 8-10k pulses seem work fine.

    A new more powerful nema34 motor and a better steering wheel will be used later to test the full capabilities.

    Small teaser with "steering action": https://streamable.com/qjpzb

    I hope we can make this happen as an alternative to expensive servos. :grin
    • Like Like x 1
  7. HUANGJIN

    HUANGJIN New Member

    Joined:
    Feb 9, 2019
    Messages:
    25
    Occupation:
    machinery manufacturing company
    Location:
    China
    Balance:
    198Coins
    Ratings:
    +13 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, SimforceGT, Motion platform, 4DOF, 6DOF
    非常完美的力反馈
  8. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,140
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,535Coins
    Ratings:
    +10,902 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    • Like Like x 1
  9. Ultrawipf

    Ultrawipf New Member

    Joined:
    Jan 12, 2019
    Messages:
    12
    Balance:
    123Coins
    Ratings:
    +17 / 0 / -0
    One update here to say that i have succeeded in making a basic FFB stepper direct drive wheel.
    The torque resolution must still be improved with a different motor driver and of course all the usability features are still missing.
    But FFB is working, most motor features are implemented, gamepad polling runs at 1khz and 16 bit and it feels very direct.

    With a different motor driver circuit it will get more expensive but it should still be way under most other options and even with hardware less than a higher quality consumer wheel.
    Compared with a thrustmaster TX it comes close but the effects are still very noisy because of the 7 bit current control in the stepper driver.

    Source will be published once it is cleaned up and the next hardware is planned so anyone could use it as a reference for future ffb projects as i was a bit shocked to see almost no examples on how to make a usb PID device... That was a lot of work.

    Here is a short video of the current status:

    All updates will be posted on hackaday.io: https://hackaday.io/project/163904-ohsc-hybrid-stepper-motor-controller

    But i also want to see if the community is interested in the project and if i should make a new thread.
    • Like Like x 1
  10. wannabeaflyer2

    wannabeaflyer2 Well-Known Member

    Joined:
    Jun 12, 2015
    Messages:
    724
    Location:
    london uk
    Balance:
    8,309Coins
    Ratings:
    +953 / 7 / -0
    My Motion Simulator:
    2DOF, Arduino, Motion platform, 6DOF
    Hi @Ultrawipf thanks for posting this update , all knowledge is good, and always great to see another possible option for the guys with lets say, " restricted Monetary means for what will be a great addition to the sim fraternity. keep at it in the end we all benefit by learning something new or another way of looking at an design challenge :)
  11. llluis

    llluis Active Member Gold Contributor

    Joined:
    Mar 30, 2017
    Messages:
    164
    Location:
    Quebec
    Balance:
    1,630Coins
    Ratings:
    +103 / 1 / -0
    My Motion Simulator:
    6DOF
    I have a working unit from RufusDufus ("Son of OSW") on a Nema34 13Nm (5A) and a full sized wheel and can do comparative tests if needed.
    (encoder is a 2000ppr (8000cpr)).
    Controller is the standard STM32F4 running MMos. Did you write another firmware to replace the MMos?
  12. Ultrawipf

    Ultrawipf New Member

    Joined:
    Jan 12, 2019
    Messages:
    12
    Balance:
    123Coins
    Ratings:
    +17 / 0 / -0
    I am using 10k and 8192cpr encoders without issues.
    Yes the firmware is completely new for this as mmos did not have the speed and features needed and was not open source.
    If mmos was open source... well. that would have been easy to adapt.
    My firmware is currently running on a STM32F103RC because the F4 support only 4 usb endpoints and this is not enough to open a bidirectional HID and CDC device at the same time but the F1 family allows 8 endpoints.
    I first used the F411 but then you would have to configure it via HID or external uart controllers and i don't want that. I will write a simple config gui that will send commands via COM/CDC and you should also be able to send these commands via any terminal instead of custom HID reports like mmos does. A bit easier this way and maybe someone does not want to build a wheel but something else entirely. Then only the HID part has to be removed and it will be a universal motor controller.
  13. Luis Miguel

    Luis Miguel New Member

    Joined:
    Jun 10, 2019
    Messages:
    1
    Balance:
    96Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    Arduino
    Hello, I have the same components you have. HBS86H, the NEMA 34 8.5 Nm, I am using an Arduino UNO and a 60V Power Supply.

    How do you wire from the Arduino to the driver?

    For me this seems to work, except whem I change the steps per revolutions. This just work for some of them.
    Pul + to 5V
    pUL - to Pin 2
    Dir + to 5V
    Dir - to Pin 3

    When I asked in other forums I was told to wire in a different way, but didn't work for me?

    I was told to connect:
    Pul+ to Pin 2
    Dir + to Pin 3
    GND to Pul -and Dir -

    But this connection doesn't work for me.

    Thank you.
  14. BiT0

    BiT0 Member

    Joined:
    Mar 13, 2019
    Messages:
    37
    Balance:
    227Coins
    Ratings:
    +6 / 0 / -0
    I do not completly understend the math in the OP code.
    Logic is clear and the smoothing function with the summed pulses too.
    But why does it assume a max 55 torque value from MMOS?
    The PWM pulse lenght is the force coming from MMOS and in his guide the PWM freq in MMOS is set to 5.6Khz. To me that do not match to a max duty cycle of 55.
    Anybody can clarify to me?
  15. Ben Xie

    Ben Xie New Member

    Joined:
    Nov 26, 2019
    Messages:
    7
    Balance:
    70Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    Arduino, 6DOF
    Wait so all you need is an arduino, STM32f4, and motor/driver? I might try this, at least a small scale version :)
  16. Ben Xie

    Ben Xie New Member

    Joined:
    Nov 26, 2019
    Messages:
    7
    Balance:
    70Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    Arduino, 6DOF
    So how exactly does this control torque? Does the HBS86H have that feature?
  17. Ultrawipf

    Ultrawipf New Member

    Joined:
    Jan 12, 2019
    Messages:
    12
    Balance:
    123Coins
    Ratings:
    +17 / 0 / -0
    Since the last time i posted here my project had some major changes.
    It evolved into the Open FFBoard and a new and much more capable motor driver was developed and the project shifted to a universal FFB interface direction with support for different setups, motor drivers and applications.
    The motor driver supports 3 phase servos, 2 phase steppers and DC motors and can even be stacked for multiple axes.
    The software will be modular and allow for many different setups.

    There is a prototype with functioning FFB again:


    DSC01074.JPG
    • Like Like x 2
    • Winner Winner x 2
    • Creative Creative x 1
    Last edited: Feb 16, 2020
  18. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,140
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,535Coins
    Ratings:
    +10,902 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Added Open FFBoard to the FAQs: https://www.xsimulator.net/community/faq/steering-wheels.65/
    • Like Like x 1
  19. vicborder

    vicborder Vicborder

    Joined:
    Nov 6, 2019
    Messages:
    37
    Balance:
    - 529Coins
    Ratings:
    +7 / 0 / -0
    My Motion Simulator:
    2DOF
    Hello greetings, I am a newbie I have found this code, more or less it works just farte the part to adjust the torque from 0 to 100%, someone has any idea

    #include <Stepper.h>
    int current_position = 0;
    const char direction_pin = 4; conect to stm32 pe11 to driver dir
    const char step_pin = 5;
    const char pot_pin = 0; //analog input 1 conect to stm32 pe9 pwm
    #define Limit01 7
    #define Limit02 8
    void setup()
    {
    pinMode(Limit01, INPUT);
    pinMode(Limit02, INPUT);
    pinMode(direction_pin, OUTPUT);
    pinMode(step_pin, OUTPUT);
    pinMode(pot_pin, INPUT);
    }

    void loop()
    {
    int readvalue = analogRead(pot_pin);
    readvalue = map(readvalue,0,1023,0,1151);
    if (readvalue > current_position+20)
    {
    step_motor_forward();
    current_position += 1;
    }
    else if (readvalue < current_position-20)
    {
    step_motor_back();
    current_position -= 1;
    }
    }//end of loop

    void step_motor_forward()
    {
    if (digitalRead(Limit02)) {}

    else {
    digitalWrite(direction_pin, LOW);
    digitalWrite(step_pin, HIGH);
    digitalWrite(step_pin, LOW);
    }
    }

    void step_motor_back()
    {
    if (digitalRead(Limit01)) {}

    else {
    digitalWrite(direction_pin, LOW);
    digitalWrite(step_pin, LOW);
    digitalWrite(step_pin, HIGH);
    }
    }
    Last edited: Feb 22, 2020
  20. paytufo

    paytufo New Member

    Joined:
    Apr 6, 2018
    Messages:
    4
    Location:
    Spain
    Balance:
    155Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    How can I get the board that RufusDufus did?