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

Issues while communicating to Arduino

Discussion in 'DIY Motion Simulator Building Q&A / FAQ' started by Tintin Boulsard, Feb 7, 2024.

  1. Tintin Boulsard

    Tintin Boulsard Member

    Joined:
    Dec 23, 2022
    Messages:
    40
    Location:
    France
    Balance:
    152Coins
    Ratings:
    +17 / 0 / -0
    My Motion Simulator:
    3DOF, Arduino
    upload_2024-2-22_16-3-30.png
  2. early_m

    early_m Active Member

    Joined:
    Jul 28, 2016
    Messages:
    318
    Location:
    Chelmsford
    Balance:
    814Coins
    Ratings:
    +345 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform
    Excellent! Thanks so much for your hard work. I look forward to testing these and will let you know if I have any issues
  3. Tintin Boulsard

    Tintin Boulsard Member

    Joined:
    Dec 23, 2022
    Messages:
    40
    Location:
    France
    Balance:
    152Coins
    Ratings:
    +17 / 0 / -0
    My Motion Simulator:
    3DOF, Arduino
    Hi @early_m,
    Did you test the codes? Any issue with them?

    Best regards,
    Tintin Boulsard
  4. early_m

    early_m Active Member

    Joined:
    Jul 28, 2016
    Messages:
    318
    Location:
    Chelmsford
    Balance:
    814Coins
    Ratings:
    +345 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform
    Not tested yet as I've been away - will keep you updated
    • Like Like x 1
    • Informative Informative x 1
  5. early_m

    early_m Active Member

    Joined:
    Jul 28, 2016
    Messages:
    318
    Location:
    Chelmsford
    Balance:
    814Coins
    Ratings:
    +345 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform
    Lebois code testing:

    Generally I have found it to be very stable and reliable. However, while testing in interface settings it seems slow to move to long adjustments. For example, if I place it on 100 and click the X to take it back to 0, it takes about 0.5-0.75 seconds. I've tried reducing the specified value in the code, past the recommend 6 to 3. Functionality is ok, but the speed remains the same and perhaps too slow. This is all at 51200 micro steps. Lowering the mocrosteps speeds up the motion and increases the range, but also comes with larger steps.

    However, in real world game testing (and for my purposes) the motors just about kept up with the output when viewed in virtual output.

    Tintin code testing:

    Using this code as supplied initially gave issues in interface setup testing. The motor randomly jumped around and was uncontrollable. I found that increasing the ms from 10 to 20 solved the issue. I then had the issue that the motors would randomly move during fast chamges. Changing the range to 1600 fixed this. This gives about half a rotation in each direction (360 degrees total). This is using 3200 microsteps and I found the motors are much quicker and responsive, hitting their targets faster (at the expense of larger steps). I tried other microsteps setting without success.
    • Informative Informative x 1
  6. early_m

    early_m Active Member

    Joined:
    Jul 28, 2016
    Messages:
    318
    Location:
    Chelmsford
    Balance:
    814Coins
    Ratings:
    +345 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform
    I've done some more testing and the main issue Ive found with steppers is they are easily moveable if they are powered down. When powered back up the middle position is not always the same, so I would imagine an initial homing procedure would be required to center the axis, similar to what many 3d printers do with limit switches.

    The big question, is this possible to implement in either of the codes we're testing here? If not, I can't see how steppers are ever going to be a viable option
    • Informative Informative x 1
  7. early_m

    early_m Active Member

    Joined:
    Jul 28, 2016
    Messages:
    318
    Location:
    Chelmsford
    Balance:
    814Coins
    Ratings:
    +345 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform
    I'm reading up about limit switches and homing - is very doable so will order some switches and start experimenting.

    I would imagine this is required for linear actuator that don't use a Thanos board?
  8. Tintin Boulsard

    Tintin Boulsard Member

    Joined:
    Dec 23, 2022
    Messages:
    40
    Location:
    France
    Balance:
    152Coins
    Ratings:
    +17 / 0 / -0
    My Motion Simulator:
    3DOF, Arduino
    Hi,
    Sorry for my late answer, I was really busy last week and didn't have the time to reply you.
    Lebois' code is made for linear actuators, with 3200 micro steps. It doesn't correspond to your purposes... For me, this code works well but I have to reduce the speed either the motor drivers fail : something like a too high difference between motor position and input. I'll buy better quality stuff...

    With my code (original by aeorobbie), the motors are really faster and more responsive as you said. 5 ms is not enough, 10 or more is much better.
    Switches are highly recommended because when start up Simtools and output test, you'll notice that once it goes back to middle position, the position is not the same. This is due to the output format (0-255 in our case). The half of 255 is not 127 but 127,5. The problem is that the code "thinks" that the middle is 127,5 but Simtools sends 127 when you put it back to home position. With a small range, such as 1600, the difference can be clearly seen. This issue can be solved by either using a higher output format or using switches, like on a 3D printer. In both case, you have to modify the code. I'll try modifying the code for a higher input format, and then do some researches on how to wire and code for the switches. I will keep you updated.

    Lastly, @yobuddy replied on the thread I opened a few weeks ago. Maybe this will work? I don't think so because we sometimes have no issues in specific cases such as Lebois' code.

    Best regards,
    Tintin Boulsard
    • Like Like x 1
  9. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    5,261
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,990Coins
    Ratings:
    +5,076 / 18 / -0
    Hi @Tintin Boulsard,
    Hope you are doing well buddy,
    The problem here is there is no 127.5 for 8 bit output. ( as bit output is integer math)
    Please see the Appendix C: Bit Resolution Chart in the v3 manual for more info.
    I have not fully read the thread to see exactly what your doing, but buzz me if you need help, and I will see if I can help.
    Take care,
    yobuddy
    • Friendly Friendly x 1
  10. early_m

    early_m Active Member

    Joined:
    Jul 28, 2016
    Messages:
    318
    Location:
    Chelmsford
    Balance:
    814Coins
    Ratings:
    +345 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform
    For now, your code is enough to allow me to test what I need to do, which is to see if stepper motors are a viable option for my design
  11. Tintin Boulsard

    Tintin Boulsard Member

    Joined:
    Dec 23, 2022
    Messages:
    40
    Location:
    France
    Balance:
    152Coins
    Ratings:
    +17 / 0 / -0
    My Motion Simulator:
    3DOF, Arduino
    Hi @yobuddy,
    Thank you very much for your reply. I'll check the manual... I said the problem was because of 127.5 because when I send 127 through the Serial Monitor or click on Output Test in Simtools, I can hear and see the motor moving of one or two steps, as if the middle / home position wasn't 127, but 127.5 for exemple. It was quite logical for me...
    Actually, I'm taking a break from the project, that's why I'm not really active these weeks...

    Best regards,
    Tintin Boulsard
    • Informative Informative x 1