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 Now a Download Plan!
  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. 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

News Open source force feed back

Discussion in 'DIY peripherals' started by Hoantv, Oct 2, 2019.

  1. OZHEAT

    OZHEAT Active Member

    Joined:
    Oct 26, 2015
    Messages:
    212
    Location:
    Australia
    Balance:
    2,384Coins
    Ratings:
    +101 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor
    I meant the DI in the servo drive which are actually 12-24v optocouplers and analog pins are+/-10v
    I realise the stm32f4 analog pins do not use optocouplers and is a 3v3 device but this isn't the servo drive your aasd servo drive is.
  2. Thanos

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

    Joined:
    Jul 6, 2017
    Messages:
    842
    Occupation:
    Electronics Engineer
    Location:
    United States
    Balance:
    4,100Coins
    Ratings:
    +731 / 6 / -0
    My Motion Simulator:
    AC motor, Motion platform, 4DOF, 6DOF
    Word salad... I don't understand why its so difficult for you to see that these servo drives work fine with 3.3v signals, digital or analog.
  3. Hoantv

    Hoantv Active Member

    Joined:
    Jul 19, 2019
    Messages:
    106
    Balance:
    867Coins
    Ratings:
    +63 / 1 / -0
    My Motion Simulator:
    AC motor, Arduino
    Yes, but it is aasd. Others still used 2 inputs to rotate right and left like Delta, Teco.
  4. Hoantv

    Hoantv Active Member

    Joined:
    Jul 19, 2019
    Messages:
    106
    Balance:
    867Coins
    Ratings:
    +63 / 1 / -0
    My Motion Simulator:
    AC motor, Arduino
    That is good idea about naming mode. But there are some driver need +- analog signal. I havent’t yet found the better solution for this, only separate the analog to 2 output. And find the ic convert +3.3 to -3.3v.
    The firmware,
    i uploaded to my github too.
    https://github.com/hoantv/CarSimulatorFirmware
    I am willing to listen all feedbacks, suggessions from all people to make the firmware better :). If you have, that will be great.
    • Like Like x 1
  5. Hoantv

    Hoantv Active Member

    Joined:
    Jul 19, 2019
    Messages:
    106
    Balance:
    867Coins
    Ratings:
    +63 / 1 / -0
    My Motion Simulator:
    AC motor, Arduino
    The signal control servo is 0-10v not. So if you use 3.3v, just scale torque to 300% in AC driver. That will be ok.

    Is there any device could convert 3.3v to -3.3v with trigger enable?
    That can help me only create 1 DAC pin.
  6. fzxj520

    fzxj520 Member

    Joined:
    May 14, 2015
    Messages:
    151
    Location:
    SimTools is a generic Motion Simulator
    Balance:
    1,155Coins
    Ratings:
    +74 / 1 / -0
    My Motion Simulator:
    2DOF
    Hello I also hope to join the test, I do not know if it is possible now?
    Is there the same output as mmos (PWM 0.50.100 and PWM 100.50.0), suitable for a driver with only one input pin.
  7. Hoantv

    Hoantv Active Member

    Joined:
    Jul 19, 2019
    Messages:
    106
    Balance:
    867Coins
    Ratings:
    +63 / 1 / -0
    My Motion Simulator:
    AC motor, Arduino
    I made PWM 0.50.100, but it is not tesed yet. Because i dont have a driver for test.
    go to my discord to discuss for detail, i dont check web frequently https://discord.gg/NDk4pYd
  8. fzxj520

    fzxj520 Member

    Joined:
    May 14, 2015
    Messages:
    151
    Location:
    SimTools is a generic Motion Simulator
    Balance:
    1,155Coins
    Ratings:
    +74 / 1 / -0
    My Motion Simulator:
    2DOF
    Thank you
    I don't see a setting with reverse output. Whether a reversed PWM output (PWM 100.50.0) should be added.
    Next I will test
    11.jpg
    Last edited: Jun 26, 2020
  9. fzxj520

    fzxj520 Member

    Joined:
    May 14, 2015
    Messages:
    151
    Location:
    SimTools is a generic Motion Simulator
    Balance:
    1,155Coins
    Ratings:
    +74 / 1 / -0
    My Motion Simulator:
    2DOF
    I tested it but it doesn't work, only when I save the wheel Base Setup, the motor will start to rotate continuously in one direction.

    I turned the steering wheel to the limit on both sides and compared the output voltage of the pwm pin
    Use mmos pin output voltage 00.01V-1.6V-3.1V
    Use CarSimulation pin output voltage about 0.1V
  10. OZHEAT

    OZHEAT Active Member

    Joined:
    Oct 26, 2015
    Messages:
    212
    Location:
    Australia
    Balance:
    2,384Coins
    Ratings:
    +101 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor
    @Thanos
    good intelligent answer, especially from a EE and product developer.
  11. OZHEAT

    OZHEAT Active Member

    Joined:
    Oct 26, 2015
    Messages:
    212
    Location:
    Australia
    Balance:
    2,384Coins
    Ratings:
    +101 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor
    @Hoantv
    Thanks for making the firmware available.
    If you want a bipolar output of +-3v or +-10v you will require a bipolar power supply.

    The easiest mode that I can envisage is similar to PWM 0-50-100 mode but instead of pwm use one DAC output instead. That would make it assuming using 12 bit DAC, a value of 1 would be full level left, 2048 would be stopped or freewheeling and 4096 would be full level right.

    At the moment I think you are using both DAC outputs to individually go left or right which I can't get around my head at the moment to utilise this mode to get +-3v or 10v, i'm sure it can be done but it just complicates things.

    If you can implement an additional mode which uses DAC 0-50-100 output on a single DAC output and maybe constant 50% or value 2048 on the second DAC output. I can prototype a converter for you. BTW the converter will also work with PWM 0-50-100 aswell it would just require an additional low pass filter.

    As I said previously I am busy till the end of this month but I will order a few components and will take a few days to arrive but will go relatively fast from there.

    I am not looking to use my Delta 2Kw servo as a DD wheel as in most known brands in the automation industry
    do not allow 240vac single phase input and must use 240vac three phase input. I got around this by using a rotary phase generator which is essentially a 3 phase motor run off single phase with capacitors to generate the phase shift to the other 2 phases. The only drawback of this is that I have to put up with an additional 2-3Kw motor continuously running which I don't want to do. I will pull out and setup the motors to test if you want but once you get +_3v or +-10v it will work with any servo motor driver with torque/speed mode.
  12. Thanos

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

    Joined:
    Jul 6, 2017
    Messages:
    842
    Occupation:
    Electronics Engineer
    Location:
    United States
    Balance:
    4,100Coins
    Ratings:
    +731 / 6 / -0
    My Motion Simulator:
    AC motor, Motion platform, 4DOF, 6DOF
    Just to remind you, I'm not developing FFB... just basic improvements on existing MMOS firmware that exists since 2014... just added a plug and play db25 for AASD-30A servos and a real 12bit DAC for clean signal.
  13. Hoantv

    Hoantv Active Member

    Joined:
    Jul 19, 2019
    Messages:
    106
    Balance:
    867Coins
    Ratings:
    +63 / 1 / -0
    My Motion Simulator:
    AC motor, Arduino
    Ok, i will debug it.
  14. Hoantv

    Hoantv Active Member

    Joined:
    Jul 19, 2019
    Messages:
    106
    Balance:
    867Coins
    Ratings:
    +63 / 1 / -0
    My Motion Simulator:
    AC motor, Arduino
    @OZHEAT
    This is a driver for Mige with bissc encoder ( i have ordered, maybe next 2 week i will receive it).
    It uses +- 10v to control torque and speed, output stm32 DAC is + 3.3V. So It is need to convert
    3v to +- 3.3V or +-10V here. To do that, i have to make 2 output DAC:
    - with pwm+-: pa4 is to make + 3.3/10v, Pa5 for -3.3
    In my old servo, i used pwm+-. And used PE9, PE11 with opto and bipolar to create +-10v based on torque -> it worked. But i dont know, which can replace optocouplers in case input is analog (there are some opams can do this but i still haven’t investigated deeply)
    - with pulse dir: pa4 is to make analog control (pe9), pa5 is only 0 or 3.3v (~ dir of pe11). My idea here is to make: i made a circuit which is reponsible for:
    + when pa5= 0 (low level) output = pa4
    + when pa5 = 3.3 (high level) -> output = -pa4
    I add pa5 without using pe11 because i think i add option use DAC or use PWM, so if using DAC, pe11 is not dir pin anymore.
    - About DAC is 0..50.100 i think it is no problem.
    Currently, i made pwm 0..50..100 like that
    + turn left: pwmValue = map (torque, -10000,0, 0, period/2)
    + turn righ: pwmValue= map(torque,0,10000,period/2, period)
    Setpwm(pe9, pwmValue)
    So it is the same with DAC, i added it to pwm0..50..100 like other mode.

    BD25F200-FD74-4F5C-891F-3C963FE3B7C4.jpeg
    • Optimistic Optimistic x 1
  15. OZHEAT

    OZHEAT Active Member

    Joined:
    Oct 26, 2015
    Messages:
    212
    Location:
    Australia
    Balance:
    2,384Coins
    Ratings:
    +101 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor
    @Hoantv
    I just got the parts from fanell that I ordered waiting at my door.

    I might have to rethink about how to go ahead if you want to use optocouplers for electrical isolation but you also got to isolate any other signals aswell such as the encoder and 3v 5v power.
    I don't really think you need the electrical isolation between the seervo drive and the stm32 as the servo drive already isolates signals although analog Ain isn't.

    It really complicates things by separating the CW and CCW torque values as neutral(no force) would be the problem and therefore need a bigger dead zone to mitigate jitter, it may work but the stm32's DACs are not rail to rail DACs. You cannot get a zero value or 3v3, there will be some offset, I will have to measure the voltages when the DAC is set to 0 and 4096 values.

    The easiest way I can think of is by using a few opamps in 0-50-100% mode with the second dac at a constant 50% so I can use that as the reference voltage. That way even if the power fluctuates because of the reference 50% it should be stable which would result in lot less jitter and dead zone.

    +-3v +-5v or +-10v shouldn't be a problem as it just the amplication of the 3v signal. You also go to realise that the stm's dac is 3v3 and 12 bits which equates to ‭0.0008056640625‬v (0.08mV)per division, I highly doubt any servo drive could even come close to detecting such a small voltage, in the different servo drives I have looked at I haven't been able to see parameter settings for torque besides -300% ~ +300% in 1 % increasements.
    Even if the value would be 12bits a servo drive @30A would be unable to measure 30A and still differentiate 10mA increasements.

    Anyway now I got some time now during the night I will make up the circuit and do some tests.
    LOL I might even have to try doing some programming to try control the DACs, I don't really try programming as I was traumatised as a child with assembly language and machine code.
    • Funny Funny x 1
  16. sedesa tatasa

    sedesa tatasa New Member

    Joined:
    Jun 16, 2018
    Messages:
    26
    Balance:
    232Coins
    Ratings:
    +9 / 0 / -0
    @Hoantv
    The speed limit of industrial servos is noisy.
    If your software has speed limit, it's a solution.

    The problem of your servo not having a ground may be solved
    by inserting 5000Ω between the line receiver gnd and the servo driver gnd.

    Is there no smoothing like mmos?
  17. Hoantv

    Hoantv Active Member

    Joined:
    Jul 19, 2019
    Messages:
    106
    Balance:
    867Coins
    Ratings:
    +63 / 1 / -0
    My Motion Simulator:
    AC motor, Arduino
    @OZHEAT

    I used 2nd servo drive, maybe the isolate feature of it has problem. I will try connect directly with new servo drive.
    Can we set offset value in servo?
    I don't understand the operation principle, could you send me a reference?
    The problem is not the amplitudes. I need create negative voltage from output of DAC.
    If you have free time, try some test and find the best way to control servo motor with DAC output of stm32. That will be great :)!
  18. Hoantv

    Hoantv Active Member

    Joined:
    Jul 19, 2019
    Messages:
    106
    Balance:
    867Coins
    Ratings:
    +63 / 1 / -0
    My Motion Simulator:
    AC motor, Arduino
    The firmware can not limit servo, but in the servo driver, there is a parameter to limit servo driver.
    I will try connect R5k between STM32 and servo drive in new servo, maybe next 20 days :(, shipping too long)
  19. OZHEAT

    OZHEAT Active Member

    Joined:
    Oct 26, 2015
    Messages:
    212
    Location:
    Australia
    Balance:
    2,384Coins
    Ratings:
    +101 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor
    @Hoantv
    I'm unsure about what you understand so I will explain as there is no references that I know of that I want you to do, only reference is my head.

    First off, 0-50-100% mode.
    I think you kinda understand what this means.
    I'm gonna to just explain in simple terms and assume a perfect output but in reality the dac in the stm32 isn't perfect being it can't go rail to rail.
    There is an offset but for this explanation just say 0%=0v 100%=3v 50%=1.5v if we just say we have minimum steps of 1%. ie. we are using 49 steps per direction
    @50% it is like you are commanding the servo drive to just sit there and do nothing.
    @0% commands full power CCW. @49% that is the smallest value in CCW.
    @100% commands full power CW @51% smallest in the CW direction.

    In my mind this is the simplest way to get a bipolar signal(+ve - gnd - -ve) to the servo drive from an single ended stm32 signal (+ve - gnd) is to use an opamp in differential configuration.
    download.png this is just a pic taken from google.
    As you want a bipolar signal to the servo drive you will require a bipolar power supply to the opamp be it +-3v +-5v +-10v (in reality most opamps aren't rail to rail so for +-10 the supply will need to be ~ +-11 or 12v).
    In simplest terms your stm32 dac output would go to V1 and V2 could be derived by using a equal voltage divider on the 3v power from the stm32 giving 1.5v on v2.
    ddd.png
    This would work but you could get a better reference voltage in V2 if you simply use the second stm32 dac channel to output value 2048 which should be exactly half. fff.png
    Resistor Rf determines voltage multiplier so if R1=R2=Rg=Rf the Vout would be double giving +-3v.
    Or if Rf=R1*2 Vout=+-6v Rf=R1*3 Vout=+-9v.

    I would use another opamp in voltage follower config on Vout then to the servo drive so you don't load the first opamp(differential).



    Long post but I hope you get the idea.
    I haven't been using your firmware to test the circuit as your 0-50-100 is split in to 2 dac pins and the 0-50-100 using PE9 pwm has some maths errors in it and only outputs 0v - 0.275v - 0.55v(using low pass filter).
    I have been using mmos & wheelcheck to test using the voltage divider but wheelcheck only has limited output modes.
    LOL I have actually spent 10x more time trying to write code to test the second circuit config but it does work albeit only as a voltage sweep and a few leds for range indicators, working on using a pot on an analog pin to vary dac output but that might take a while. Hopefully you will get the 0-50-100 mode working so I don't need to try programming.
  20. Hoantv

    Hoantv Active Member

    Joined:
    Jul 19, 2019
    Messages:
    106
    Balance:
    867Coins
    Ratings:
    +63 / 1 / -0
    My Motion Simulator:
    AC motor, Arduino
    Ah ha. Your idea is same as like me.
    In my idea:
    I connect pa4 to vin+ , gnd to vin-, out put is 0-> +3(assume all resistor is same value)
    And pa5 to vin-, gnd to vin+ -> out is -3v -> 0v.
    But as you said, can not get 0 or 3.3 v. So need a reference votage instead of 0v -> use dac output as v-ref.
    So, i will do like that:
    - set dac output is 0..50..100 like pwm (0..49 cw, 51..100 ccw, 50 no rotation) on pa4
    - make V-ref: set pa5 with dac value 2048
    - connect like that
    + pa4 to vin+ opam
    + pa5 to vin- opam
    Now output is -3.3 to 3.3 (rf = 2r1)
    - connect output to both +- 10 voltage in
    Is it correct?
    If it correct but i dont know is it good when connecting -3.3 to +10v in or 3.3v to -10v.
    Maybe i still separate to 2 opam. Using Dac 0v instead of ground as V-ref
    Last edited: Jul 4, 2020