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. Benu

    Benu Member

    Joined:
    Mar 19, 2018
    Messages:
    128
    Location:
    Germany
    Balance:
    1,295Coins
    Ratings:
    +41 / 2 / -0
    Well, I never tested the BLDC output from the MMos board myself. But the creator of the MMos firmware stated in his thread at virtualracing.org that he implemented BLDC support but never tested it himself. I also found no reference of someone else giving it a try.
  2. Benu

    Benu Member

    Joined:
    Mar 19, 2018
    Messages:
    128
    Location:
    Germany
    Balance:
    1,295Coins
    Ratings:
    +41 / 2 / -0
    That is interesting! How is your progress? Does the motor react to the FFB input correctly?

    Ok, got it.
    I never tried two IBT2 for that. So I cannot provide any trustable/proofed schematics, sorry.
  3. BiT0

    BiT0 Member

    Joined:
    Mar 13, 2019
    Messages:
    37
    Balance:
    227Coins
    Ratings:
    +6 / 0 / -0
    Progress is slow due few time available because of work and family.
    Positive on HW side: the IFX shield is easy to work with, had no problem with the toolchain.
    Still lot of issues on my code. The motor reacts to FFB but can not say it does...correctly. Lot of spikes. Guess I have to rework the lookup tables but had no time. Let's hope in holidays...

    The wheel project will remain on the IFX, expecially now that I hope to mix the BLDC control code with the AIW you provided (thank you!).

    I was looking at the IBT as a cheaper solution for another later project involving multiple motors. I was looking at the ODrive for that. I like that project very much but was too much for a single motor. But with 2 the 2x IFX cost is not much low.
    The 2xIBT would be a very cheap solution.
    • Like Like x 1
  4. Benu

    Benu Member

    Joined:
    Mar 19, 2018
    Messages:
    128
    Location:
    Germany
    Balance:
    1,295Coins
    Ratings:
    +41 / 2 / -0
    Do you use shielded and grounded wires for the control and encoder signals? Maybe some interference causes the spikes.

    I think the AIW source came from fernando igor, not me.
  5. BiT0

    BiT0 Member

    Joined:
    Mar 13, 2019
    Messages:
    37
    Balance:
    227Coins
    Ratings:
    +6 / 0 / -0
    Yep all shielded and grounded. I really think problem is my sw. Wll sort it out.

    I know the code is from Fernando. But you posted the git link. I was not able to found it myself
    • Like Like x 1
  6. RSP

    RSP New Member

    Joined:
    Apr 26, 2019
    Messages:
    19
    Balance:
    131Coins
    Ratings:
    +6 / 0 / -0
    My Motion Simulator:
    DC motor
    The IFX007T it's a good solution and easy to install because put the board on Arduino and the current output is very high.
  7. BiT0

    BiT0 Member

    Joined:
    Mar 13, 2019
    Messages:
    37
    Balance:
    227Coins
    Ratings:
    +6 / 0 / -0
    Yes it is a very nice board. Another interesting one from same source is the TLE9879, you can stack up to 4 on a single Arduino. Would be a very nice solution for multiple motor control. Sadly it is not fine for hoverboard motors because of the max 10A rating. Indeed this spec is reported in the product homepage but I did not find any in the tech docs. Still think Odrive is te better solution for multiple BLDC motors. Like maybe in a motion platform...
    • Like Like x 1
  8. wannabeaflyer2

    wannabeaflyer2 Well-Known Member

    Joined:
    Jun 12, 2015
    Messages:
    724
    Location:
    london uk
    Balance:
    8,286Coins
    Ratings:
    +950 / 7 / -0
    My Motion Simulator:
    2DOF, Arduino, Motion platform, 6DOF
    Hi Guys just wanted to say thanks for the feedback on connecting BTS's to drive Brushless motor , some more bits to order again now before Play time Cheers Some very good info to go check out -)
  9. johnmiller85

    johnmiller85 New Member

    Joined:
    Jun 24, 2019
    Messages:
    4
    Balance:
    92Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    DC motor, AC motor
    I am working a new hoverboard project.
  10. RSP

    RSP New Member

    Joined:
    Apr 26, 2019
    Messages:
    19
    Balance:
    131Coins
    Ratings:
    +6 / 0 / -0
    My Motion Simulator:
    DC motor
  11. Benu

    Benu Member

    Joined:
    Mar 19, 2018
    Messages:
    128
    Location:
    Germany
    Balance:
    1,295Coins
    Ratings:
    +41 / 2 / -0
    I didn't notice these boards yet. Good find!

    The SPIN3204 will not be suitable, I guess. Although the databrief states FOC drivability, I did not see anything in the manuals.

    But the SPIN3201 seems to be a worthwhile candidate. The 3201 is designed for FOC drive and has three shunt current sensing. The other specs are almost identical. Even over-current protection is in a range suitable for our needs (20A/65A/140A).

    This board could be a good alternative to the F303RE/IHM08M1 combo.
    • Like Like x 1
    Last edited: Jul 13, 2019
  12. BiT0

    BiT0 Member

    Joined:
    Mar 13, 2019
    Messages:
    37
    Balance:
    227Coins
    Ratings:
    +6 / 0 / -0
    Wish to share a resource.
    It may be of interest expecially for @danove_b since he is working with tables like me. BLDC Lookup table calculator.
    It is a spreadsheet in open office format to crete lookup tables for both SPWM and SVPWM.
    Original credit to Barryjam. Interesting reading (and code).
  13. BiT0

    BiT0 Member

    Joined:
    Mar 13, 2019
    Messages:
    37
    Balance:
    227Coins
    Ratings:
    +6 / 0 / -0
    Hey @danove_b had another look at the code you posted on page 2 and have a question.

    I am reworking my own code in the sinusoidal function moltiplication.
    I am not sure what you did there in the logic you applied for values of the sinusoidal function ><127.
    Beside this are you sure abouth your math? I mean I think there is a fault: your argument to the function is a float between -1 and 1, that is 0 is supposed to be 50% torque. But when the argument is 0 your algorythm will always ouput 127
  14. danove_b

    danove_b Active Member

    Joined:
    Nov 11, 2017
    Messages:
    209
    Location:
    Sweden
    Balance:
    1,792Coins
    Ratings:
    +79 / 3 / -0
    That part is correct, but I did some more adjustment to the code when I did my tests. 127 should give about 6 volts and be considered as the zero level. 255 will give 12 volt and 0 will give 0 volt. So with zero torque demand we will put out 6 volt on all three phases.
  15. BiT0

    BiT0 Member

    Joined:
    Mar 13, 2019
    Messages:
    37
    Balance:
    227Coins
    Ratings:
    +6 / 0 / -0
    Hi danove_b. OK about volt/torque. So for you the 0 as argument equals to ... zero. LOL
    I missunderstood the range to your CalcTorque and thought you were going from -1 to 1, with 0 being half.
    Is that to reverse?

    I've found other code on the net, as a modification of the one from barryjam I linked above.
    Like this or from the same author in a different repo this

    Here on the same array concept he is doing in first case
    Code:
    // get number from the sin table, change amplitude from max
      pwm_a = (pwmSin[(position + currentStepA) % 360]) * (power / 255.0);
      pwm_b = (pwmSin[(position + currentStepB) % 360]) * (power / 255.0);
      pwm_c = (pwmSin[(position + currentStepC) % 360]) * (power / 255.0);
    
    and in the second

    Code:
    // fetch pwm from sinus table
      posStep = MotorPos & 0xff;
      pwm_a = pwmSinMotor[(uint8_t)posStep];
      pwm_b = pwmSinMotor[(uint8_t)(posStep + 85)];
      pwm_c = pwmSinMotor[(uint8_t)(posStep + 170)];
     
      // apply power factor
      pwm_a = maxPWM * pwm_a;
      pwm_a = pwm_a >> 8;
      pwm_a += 128;
    
      pwm_b = maxPWM * pwm_b;
      pwm_b = pwm_b >> 8;
      pwm_b += 128;
     
      pwm_c = maxPWM * pwm_c;
      pwm_c = pwm_c >> 8;
      pwm_c += 128;
  16. danove_b

    danove_b Active Member

    Joined:
    Nov 11, 2017
    Messages:
    209
    Location:
    Sweden
    Balance:
    1,792Coins
    Ratings:
    +79 / 3 / -0


    I can send you my test code tonight.
    • Friendly Friendly x 1
  17. BiT0

    BiT0 Member

    Joined:
    Mar 13, 2019
    Messages:
    37
    Balance:
    227Coins
    Ratings:
    +6 / 0 / -0
    Oh that would be kind of you. I am collecting lots of info and studying a lot because with my own code I still got a lot of spikes.
    What do you think of the math used by that guy in the code I posted above?
  18. danove_b

    danove_b Active Member

    Joined:
    Nov 11, 2017
    Messages:
    209
    Location:
    Sweden
    Balance:
    1,792Coins
    Ratings:
    +79 / 3 / -0
    Attached my simple test code. In this code I have used the inbuilt hall elements in the motor for the commutation. Of course this will be replaced with the encoder, but I didn't have that at this time. This was the first time I did something similar. Was mostly reversed engineering... As you can see I change the commutation with 140 degree to change the direction. I have no explanation why it worked best with that value. I was expecting 120 or a multiple of that.
    I used a potentiometer connected to a AD in to simulate the torque values. The enable signal enables the drivers. (I disable it when there is no torque, which make the motor easy to turn by your hands) I don't know if this should be there or not in the final application.

    My own comments are sometime in the Swedish language... I kind of mix...

    Attached Files:

  19. danove_b

    danove_b Active Member

    Joined:
    Nov 11, 2017
    Messages:
    209
    Location:
    Sweden
    Balance:
    1,792Coins
    Ratings:
    +79 / 3 / -0
    I also played with some sine generator in Excel. You can check the values by changing the torque factor (0-1) in R1C8

    Attached Files:

  20. BiT0

    BiT0 Member

    Joined:
    Mar 13, 2019
    Messages:
    37
    Balance:
    227Coins
    Ratings:
    +6 / 0 / -0
    Hi @danove_b, sorry for late answer. Lot of family troubles are taking me away from this project atm.
    Thank you for sharing your code. Very kind by you.
    Indeed it is very close to mine because I too started from the same original code you posted early.
    The only differences are in the torque scaling math that is much simpler and based upon the code I found here Arduino_BrushlessServ and in the commutation at 120.

    I may be wrong but in your code since the sine arrey element you select is choosen by the angle you pass to SetTorque() and that angle comes from math with two constants applied to the hall reading, which returns 6 possible values, indeed only 12 (6+/6-) possible values may be sent to SetTorque(). That is of the whole array you use always the same 12 elements upon the Commute().
    Other than that my code differs in the mmos interface which I am still dealing with (frequency and smoothing function which I am not convinced of). I am thinking to switch to the mode1 of PWM output from mmos but as said not time at the moment.

    Also as soon as I'll be back to the project I want to try an open loop method, with no sensor at all (used for the HID input but not to drive the motor).