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

DD-Wheel with Hoverboard Motor

Discussion in 'Direct Drive Wheels' started by Benu, Jan 21, 2019.

  1. fzxj520

    fzxj520 Active Member

    Joined:
    May 14, 2015
    Messages:
    176
    Location:
    SimTools is a generic Motion Simulator
    Balance:
    1,341Coins
    Ratings:
    +87 / 1 / -0
    My Motion Simulator:
    2DOF
    I try to answer
    1. I think the Z phase of the mmos board can be disconnected (the Z phase function of mmos is to save the position of the midpoint of the steering wheel)
    2. The Z phase of the ESC board is necessary, in fact, the Z phase function of the ESC has been changed. The Z phase interface of ESC controls the braking resistor to turn on, and the braking resistor consumes the back EMF of the motor.
  2. danove_b

    danove_b Active Member

    Joined:
    Nov 11, 2017
    Messages:
    209
    Location:
    Sweden
    Balance:
    1,792Coins
    Ratings:
    +79 / 3 / -0
    I also have a kind of working ffb solution with vJoy that is based on the feeder example. As all sims I have tested so far sends a raw signal either with periodic or Constant, I haven't bother implement the other effects. With rfactor1, something is missing though. I'm not sure if you are the person behind the latest driver also (2.2.0), but if so, have you find anything missing in the previous version(s) (2.19) that you have corrected in 2.2.0? I know for example the example functions that use the function TwosCompByte2Int return weird values, so i have replaced that with my own code.
  3. Chris_Beeves

    Chris_Beeves Active Member Gold Contributor

    Joined:
    May 31, 2019
    Messages:
    330
    Balance:
    1,897Coins
    Ratings:
    +229 / 2 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 4DOF
    The z output on the esc is simply programmed to go high if the voltage exceeds a set value and go low if it goes under another set value. :thumbs

    None of the controllers I know of has this function implemented, but I guess it’s a pretty simple task if you can measure the voltage.
  4. Sieben

    Sieben Active Member

    Joined:
    Nov 6, 2018
    Messages:
    391
    Balance:
    2,216Coins
    Ratings:
    +115 / 2 / -0
    That's exactly what i meant asking the encoder's z". Thanks!)
  5. danove_b

    danove_b Active Member

    Joined:
    Nov 11, 2017
    Messages:
    209
    Location:
    Sweden
    Balance:
    1,792Coins
    Ratings:
    +79 / 3 / -0
    Hard to say where it come from, but I tuned down the PID parameters a bit just to make it a little bit less nervous.

    /*
    #define PID_TORQUE_KP_DEFAULT 2040
    #define PID_TORQUE_KI_DEFAULT 3944
    #define PID_TORQUE_KD_DEFAULT 100
    */
    #define PID_TORQUE_KP_DEFAULT 128
    #define PID_TORQUE_KI_DEFAULT 500
    #define PID_TORQUE_KD_DEFAULT 100
  6. njz3

    njz3 New Member

    Joined:
    May 15, 2020
    Messages:
    5
    Balance:
    58Coins
    Ratings:
    +0 / 0 / -0
    Hi Danove,
    Yes I am the one that fixed vJoy's driver for a FFB issue related to simultaneous effect, as this one was a strong limitation of vJoy up to now. I also added 16 analog axes instead of 8 and fix other small issues still related to FFB (same as you did).
    The 2.1.9 version did not allow to have more than 1 effect at a time, while the new version allow to create up to 100 effects and play them.
    The installer and driver has been signed by Justin Shafer as he owns a certificate (which is expensive).
    You can grab the signed installer for vJoy 2.2.0 from my github. Do you want the new SDK ?

    My feeder in C# is a good example to start your own feeder. I put as many comments as I could to help other people. It actually is very simple : everything related to FFB (even PID servoing) is made on the PC side, while a simple 'IO board' is used as an IO extender for the PC. Communication is text serial-based protocol with 1byte command, so you can probably easily plug it to your own embedded platform. The example Arduino code is portable enough.
    Current Arduino code allows you to output an analog PWM signal, a digital PWM, or a 2xPWM to directly plug a L6203 H bridge (warning: there is no current or torque servoing in this case, this is only a open-loop torque control, with a PID in position).
    The goal was actually to directly pilote a PMSM or BLDC torque controller sending torque commands and retrieving IOs as fast as possible. Current servoloop period is 5ms+5ms, but you can lower it down to 2ms. Depending on your motor driver and mechanical setup, you may not notice any difference with 5ms or even 10ms. At least with my arcade racing cabinet, 100Hz (5ms+5ms) is fine.
    Let me know if you want to give it a try,
    Benjamin
  7. danove_b

    danove_b Active Member

    Joined:
    Nov 11, 2017
    Messages:
    209
    Location:
    Sweden
    Balance:
    1,792Coins
    Ratings:
    +79 / 3 / -0
    Thanks for the info. I'm very glad that someone has continued to work on this excellent piece of software.
    I've have already your code. The driver installation, SDK and updated feeder example was all there. I did a fast test, but I didn't get the inputs to work with my current feeder code. Didn't put so much time in it though. Maybe I forgot to change the SDK files, don't remember. I didn't notice that you had expanded with more analog axles, so I was probably using the wrong struct. My solution is very similar to yours, I just send the torque setpoint to the ESC card by USB/Serial, and it returns back the encoder value. Then I have separate task for reading pedal inputs from an Arduino Pro, and a separate task that receives the buttons from the wheel by UPD packets. The time for send and receive a packet to the ESC is around 2 ms. I have the code for the wheel end-stop in the feeder application,which oscillate if I go up to 10 ms , so the update frequency do matter. Also, rfactor2 have 400 Hz ffb.
  8. njz3

    njz3 New Member

    Joined:
    May 15, 2020
    Messages:
    5
    Balance:
    58Coins
    Ratings:
    +0 / 0 / -0
    Ok, that makes sense if your application feeds at 400Hz to also perform the USB communication @500Hz, but I think in this case you will encouter a limit with Windows itself and its USB drivers (the OS schedules its process as it wants, or needs, so delay of a few ms are very common at this scale).

    Regarding your oscillations: from control theory, we know that PID gains depends on the sampling period. So if you change the period, you must re-tune your PID accordingly. Also, from my experience, only a PropDeriate (PD) corrector is needed for spring effect, the integrator (the source of instability) is not used at all. All other HID effects does not need servoing, so except from spring, you should not see oscillations when playing with an effect editor like fedit.
    One other source of oscillations is the game itself that can use torque (constant force) commands to perform spring effect (I have seen that with Daytona 1/2 on emulators). In this case, you have no control over it and sadly, as you do, it is required to be as fast as possible.
    Benjamin
  9. njz3

    njz3 New Member

    Joined:
    May 15, 2020
    Messages:
    5
    Balance:
    58Coins
    Ratings:
    +0 / 0 / -0
    Oh, I forgot to tell you about your issue. The new version 2.2.0 uses different structures in memory, so yes you need to update the SDK and recompile your code.
    Also, if you have a previous vJoy installation, you need to reset the configuration and do it again with vJoy Configure (I needed to change the HID descriptor to add stuff like effect delay), please read the FAQ:
    https://github.com/njz3/vJoyIOFeederWithFFB/blob/master/FAQ.md
  10. Sieben

    Sieben Active Member

    Joined:
    Nov 6, 2018
    Messages:
    391
    Balance:
    2,216Coins
    Ratings:
    +115 / 2 / -0

    May be can be useful. Has a codes etc.
    • Like Like x 1
  11. fzxj520

    fzxj520 Active Member

    Joined:
    May 14, 2015
    Messages:
    176
    Location:
    SimTools is a generic Motion Simulator
    Balance:
    1,341Coins
    Ratings:
    +87 / 1 / -0
    My Motion Simulator:
    2DOF
    SMC3Utils has the same parameters, kp ki kd adjustment is also very simple.
    But in the face of STMCWB I was at a loss.
    Is it possible to modify KP KI KD through chick to open monitor in STMCWB program?
  12. Sieben

    Sieben Active Member

    Joined:
    Nov 6, 2018
    Messages:
    391
    Balance:
    2,216Coins
    Ratings:
    +115 / 2 / -0
    Doesn't anybody try to swap the phase of the bldc with its halls to control the rotation changes? With native bldc motor controller.
  13. Granberget

    Granberget New Member

    Joined:
    May 6, 2020
    Messages:
    6
    Balance:
    58Coins
    Ratings:
    +2 / 1 / -0
    My Motion Simulator:
    Arduino
    Great work on the vJoyIOFeeder... I've looked at it a bit, and it looks really promising and useful. Beautiful GUI!

    I also looked at your IOBoard example. It's probably better and more advanced than anything I'd write myself, but it's a bit complex for my coding level... Do you possibly have a "bare minimum example"?
    For instance just X-axis from a potentiometer and torque as a clearly stated int.
    That way I think it would be easier to understand the basic principle and start to build an IO board adapted to my own setup.
  14. njz3

    njz3 New Member

    Joined:
    May 15, 2020
    Messages:
    5
    Balance:
    58Coins
    Ratings:
    +0 / 0 / -0
    Thanks for your kind words.
    Sadly, the code is now becoming a bit large and complex because I added more and more stuff. Removing extra stuff is possible, but I would prefer to not have two branches of code to maintain.
    If you are not confortable with modifying the code, I recommand to use the software as it is.
    If you have a potentiometer feedback for the wheel and podels, then you can use an Arduino Leonardo straight out of the box using the current code with no modification. Look to the § where I explain the schematics for a PWM+Dir mode.
    I put some information for installation here (in french, but google translate works fine): https://www.gamoover.net/Forums/index.php?topic=42477.0
    After you wire the wheel/pedals inputs and PWM outputs to your motor driver, configure vJoy with your analog axes and buttons, then run the feeder and configure it. After enabling the "manager" you should see your inputs working (analog values). Select the PWM centered mode, or PWM+Dir mode, or even dual PWM (for H Bridge like a L6203 ), commit to the eeprom and restart everything.
  15. Benu

    Benu Member

    Joined:
    Mar 19, 2018
    Messages:
    128
    Location:
    Germany
    Balance:
    1,295Coins
    Ratings:
    +41 / 2 / -0
    There is a gentle sizzling sound even if the motor is not moving.
    I made some changes to the firmware to reduce that noise. I you like I can send you the current version with your motor parameters.
  16. fzxj520

    fzxj520 Active Member

    Joined:
    May 14, 2015
    Messages:
    176
    Location:
    SimTools is a generic Motion Simulator
    Balance:
    1,341Coins
    Ratings:
    +87 / 1 / -0
    My Motion Simulator:
    2DOF
    Grateful:)
    In addition, I also found that sometimes when the 24V power supply is connected, the ESC will not power the motor. At this time, it is necessary to completely disconnect the 24V power supply and turn on the 24v power supply again before the ESC will supply power to the motor.
    Last edited: May 27, 2020
  17. marccohn

    marccohn New Member

    Joined:
    May 5, 2020
    Messages:
    26
    Balance:
    301Coins
    Ratings:
    +9 / 0 / -0
    My Motion Simulator:
    Arduino
    New Working Solution

    After learning a lot about PWM and burning up my ODrive board I have a new/simplified FFB Solution that I have been driving with in iRacing for the past few days. I am now using the original hoverboard control board.

    As this is my first FFB wheel, I have nothing to compare it to, but I am very pleased with the results. I can definitely feel forces build in a corner and loss of traction through the wheel, which is the most important. Also can feel vibration when braking, or driving over rumble strips. Can't turn it all the way up unless i want to work up a sweat while driving.

    Here is a diagram
    upload_2020-5-27_13-30-8.png

    Notes:
    -- Gave up on power supply and used the 36V battery. Extra voltage provide plenty of power. No more need for braking resistor circuit, lasts about 6 hours on a charge, so if you run the battery out, you have been racing too much.
    -- Hoverboard control board is running hacked firmware based on FOC motor control. https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC I have used this firmware on a different project and it is solid and bug free.
    -- Converting PWM signals to analog signals with an RC filter feels like cheating but it works. Might slow response time down slightly, but simplifies project and can't really feel a slow response.
    -- All in cost less then $50 (Encoder $16, Used Hoverboard $20, Leonardo board $12)

    Its not perfect:
    -- The wheel does need some mechanical friction to keep from oscillating. Might be a function of slow response time. EMC Friction adjustment has no effect. Trying to tune out on the hoverboard controller firmware. Stay tuned.
    -- "Coggy-ness" - you can feel when the rotor moves from one magnet field to the next in high force low velocity motions. FOC should minimize this, but still feel it. Probably less than perfect commutation. I assume hoverboard controller uses a standard commutation table because there is never a commutation cycle at start up sequence.

    I will work out some of these issues and share details soon.

    Attached Files:

    • Like Like x 2
    • Agree Agree x 1
    • Winner Winner x 1
  18. Sieben

    Sieben Active Member

    Joined:
    Nov 6, 2018
    Messages:
    391
    Balance:
    2,216Coins
    Ratings:
    +115 / 2 / -0
    marccohn? that's cool. Do you have any video on its work etc?
  19. Feisty

    Feisty New Member

    Joined:
    Mar 29, 2020
    Messages:
    21
    Balance:
    169Coins
    Ratings:
    +11 / 0 / -0
    My Motion Simulator:
    AC motor
    I had that issue too but found that adding a capacitor to the input of the controller helped, I havent worked out the ideal size tho. I think its due to an inrush current or something being higher than the controller can deal with which immediately triggers the over current protection
  20. Benu

    Benu Member

    Joined:
    Mar 19, 2018
    Messages:
    128
    Location:
    Germany
    Balance:
    1,295Coins
    Ratings:
    +41 / 2 / -0
    As @Feisty mentioned, this might be due to high current/voltage level at startup. This could trigger the firmwares over-current protection.
    I am not sure what causes this, as the firmware starts with zero force level.

    1. Are you sure there is correct input on the PWM wires to the ESC at startup?
    2. Is it possible your power supply overshoots output voltage/current at startup?
    3. In what sequence do you power on, connect and start the MMOS/Arduino force feedback board and the ESC?
    4. Have you tried just resetting the ESC with the on board reset button (right besides the blue potentiometer)? This will restart the firmware.