1. You must be a registered member to be able to access this page and to download game plugins. Please register here. It´s for free.
  2. 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
  3. 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!
  4. 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
  5. 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
pOmmi

1DOF_nopots 1.0

1 DOF arduino code with no potentiometers needed

  1. pOmmi
    Hello everyone,

    Here is a 1 DOF arduino code that works without any potentiometers (for wipers motors).

    This code was developed in the following project : IKEA 1.5 DOF Ultra comfort

    The position is guessed/known by the code using internal increment time of the micropocessor of the arduino, mostly given by the baudrate (9600 in this example) and the complexity of the code.
    What I call "1 increment time" is the time that a void loop(){ ... } takes to execute in the arduino code.
    But you don't have to find it exactly. With one or two tests you can find a good value of the maximum range that fits with your system.
    In my case, what works with some few tests is 25000 increments time.
    So in the code : int incrMaxRange=25000; // max time increment range
    A litte schema below, for a better understanding :
    [​IMG]

    The main issue is the stress on the motors. If the engines have a big effort required during braking or acceleration, the target position of the motor won't be reached, and you will have a continuous gap.

    So in order to fix this issue, power of motors while braking is different from power of motors while you accelerate.
    Here are the two variables that you probably will have to change for your system :
    int PuissMotAccel=380; // motor pwm (power) from 0 to 1023 for accelerations / pulling back
    int PuissMotBreack=1023; // motor pwm (power) from 0 to 1023 for bracking / pushing

    SimTools Game Engine Interface Settings :
    [​IMG]

    PS1 : I'm not a progammer, and my code works but it should be horrible for a real progammer :) please forgive me ;)
    PS2 : Next step could be to build it as a 2 DOF...