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

Question 2DOF Racecar Simulator using Arduino and Linear Actuators

Discussion in 'DIY Motion Simulator Building Q&A / FAQ' started by genius613, Apr 25, 2018.

  1. genius613

    genius613 New Member

    Joined:
    Apr 25, 2018
    Messages:
    7
    Location:
    Florida
    Balance:
    187Coins
    Ratings:
    +2 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Hi there,

    So I'm a mechanical engineering student and for my senior design project, my group is making a racecar simulator. We are using potentiometers for steering, gas and clutch and a load cell for the brake. These are sent to an Arduino Leonardo which is configured to appear to the computer as a game controller. We are also using the Asseto Corsa game for the simulation. So far, that side of the project works fine.

    Then, the plan is to have SimTools read the data from Asseto Corsa and send the information to an Arduino Uno. The Uno controls two linear actuators (Firgelli Auto Deluxe Rod Actuator 6" variety) which are built in to rotate the simulator in the pitch and roll directions. The idea is that the pitch simulates the longitudinal acceleration (surge) and the roll simulates the lateral acceleration (sway). This is the side of the project that is giving us trouble. We need some help getting SimTools to communicate with the Uno and then coding the Uno to get it to perform properly. I should also mention that we plan to use a gyro for feedback on the position of the actuators.

    The project is due next week so time is of the essence. Any help will be most appreciated.
    • Like Like x 1
  2. Ads Master

    Ads Master

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
  3. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,416
    Location:
    London
    Balance:
    9,246Coins
    Ratings:
    +321 / 8 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF
    a week is not much time for completing a project !

    i suggest you use the smc3 arduino code that has already been written
    • Like Like x 1
  4. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    3,967
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    37,345Coins
    Ratings:
    +4,115 / 11 / -0
    I second the smc3 Arduino code.
    yobuddy
    • Like Like x 1
  5. genius613

    genius613 New Member

    Joined:
    Apr 25, 2018
    Messages:
    7
    Location:
    Florida
    Balance:
    187Coins
    Ratings:
    +2 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    We are planning on doing that. However, we're not entirely sure how to edit that code to make it work for our setup. For example, we only have two motors instead of three. Also, our motor controllers have a DIR pin, PWM pin and GND pin; as opposed to SMC3 which seems to have another DIR pin instead of ground.

    Additionally, what feedback does SMC3 use? Our actuators do not have internal feedback. We are using a gyro for that.

    Also super confused as to how to tune the PID system in the code.

    AND, perhaps most importantly, we're not clear on how we're supposed to set up SimTools to send the information that we want to the right place.
  6. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,416
    Location:
    London
    Balance:
    9,246Coins
    Ratings:
    +321 / 8 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF
    program an arduino with the smc3 code and get learning
  7. genius613

    genius613 New Member

    Joined:
    Apr 25, 2018
    Messages:
    7
    Location:
    Florida
    Balance:
    187Coins
    Ratings:
    +2 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    wow people on here are so helpful

    I'm really glad I posted in this forum.
    • Like Like x 1
  8. frankrizzo2

    frankrizzo2 Member

    Joined:
    Sep 11, 2013
    Messages:
    54
    Location:
    Minot, ND
    Balance:
    603Coins
    Ratings:
    +29 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    I don't know a ton about PID tuning but there is a guide on here in the how to section of the forums. As far as programming the arduino and editing code it would be best to watch a few youtube videos on simple programming and editing arduino code. It will take some time but will be worth the time to learn as it will apply to other hobbies and projects. I've been following these forums religiously for the last 6 years and I still learn something everytime I log onto the site. There are a ton of different aspects in this hobby...there is engineering, electronic programming, computer science, pid tuning, profile tuning and lots of trial and error. Just do as much reading and research as you can and the answers will come to you. Hope this helps. Good luck with your project.
    • Agree Agree x 1
  9. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    17,324
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    125,068Coins
    Ratings:
    +9,800 / 47 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    • Agree Agree x 1
  10. genius613

    genius613 New Member

    Joined:
    Apr 25, 2018
    Messages:
    7
    Location:
    Florida
    Balance:
    187Coins
    Ratings:
    +2 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
  11. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,416
    Location:
    London
    Balance:
    9,246Coins
    Ratings:
    +321 / 8 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF
    you dont need to edit the smc3 code - its a fully working project and will interface with simtools

    it works with different types of h bridge
    • Agree Agree x 1
  12. bruce stephen

    bruce stephen Hammer doesnt fix it, must be electrical

    Joined:
    Jun 7, 2015
    Messages:
    1,293
    Occupation:
    general contractor
    Location:
    michigan
    Balance:
    9,092Coins
    Ratings:
    +1,233 / 9 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform, 6DOF
    Smc3 is the easiest solution for code here on this site. It uses feedback from potentiometers. I dont believe gyro is a viable solution for this application as simtools deals with motor position, not tracked g Forces. Read through the post linked by @noorbeast regarding smc3. Most people here cannot or are not willing to learn how to use new code. Most have tried or are using smc3 so your chances of solid support are better. But ill be honest you will get more out of this site if you approach it by reading first then asking questions.
    • Agree Agree x 2
    • Like Like x 1
  13. genius613

    genius613 New Member

    Joined:
    Apr 25, 2018
    Messages:
    7
    Location:
    Florida
    Balance:
    187Coins
    Ratings:
    +2 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    I have read through that post. I have tried SMC3. It does not work for me. I do not have potentiometers. Unlike other people, I AM willing to learn how to use new code, but I just need someone to help me. PLEASE PLEASE stop telling me to use SMC3. It's getting very frustrating.
  14. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    17,324
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    125,068Coins
    Ratings:
    +9,800 / 47 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    People are trying to help you. If you give a bit more information, post some pictures of hardware and settings, then likely members can help you out.

    You say you tried SMC3 but without potentiometers, if that is the case what are you using for feedback in place of potentiometers? Something has to provide positional feedback: https://www.xsimulator.net/communit...on-simulation-control-basics-how-it-works.38/

    If these are the actuators you are using then they are likely too slow for anything other than very gentle flight motion simulation, at 3"/sec (around 75mm/sec): https://www.firgelliauto.com/products/deluxe-rod-actuator#ptab-specifications

    Generally 150mm+ is the general consensus as the minimum speed needed for good motion simulation: https://www.xsimulator.net/community/faq/speed-needed-for-good-motion.218/
    • Like Like x 1
    • Agree Agree x 1
  15. genius613

    genius613 New Member

    Joined:
    Apr 25, 2018
    Messages:
    7
    Location:
    Florida
    Balance:
    187Coins
    Ratings:
    +2 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    IMG_0220.JPG IMG_0221.JPG IMG_0222.JPG

    Here are some pictures as requested.

    Car frame can rotate about pitch and roll axes. It has shaft connected to bearings. This is meant to simulate surge and sway.

    Motor driver is made by Cytron. Can control one motor. Has 1 DIR pin, PWM pin and GND pin. IMPORTANT: motor has no potentiometer/feedback. Feedback is given by gyroscope which measures angle of rotation of the car about each axis.

    Pedals: gas and clutch contain potentiometers. Brake has load cell. Steering wheel also has potentiometer.

    If motors are too slow, well then they're too slow. Project is due next week. No time to change that.
  16. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    17,324
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    125,068Coins
    Ratings:
    +9,800 / 47 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    I would suggest you are going to need to find a way to interface a gyroscope, and even then may have to deal with things like drift, or go out and buy a couple of pots or Hall sensors, make mount brackets for them and just hook them up...I would suggest the latter is far easier and will definitely work, the former is a shot in the dark and not likely to happen by next week.
    • Agree Agree x 1
    Last edited: Apr 28, 2018
  17. genius613

    genius613 New Member

    Joined:
    Apr 25, 2018
    Messages:
    7
    Location:
    Florida
    Balance:
    187Coins
    Ratings:
    +2 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Honestly, my biggest problem right now is that SimTools does not seem to speak to the Arduino. I need to know how to configure SimTools and the specific code in Arduino that will read the data. The rest I'm confident I can take care of.
  18. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    17,324
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    125,068Coins
    Ratings:
    +9,800 / 47 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    • Like Like x 1
  19. Boris Furtak

    Boris Furtak Member Gold Contributor

    Joined:
    Oct 11, 2021
    Messages:
    44
    Balance:
    252Coins
    Ratings:
    +7 / 0 / -0
    Than
    Thank you Noorbeast I think this info going to help me aswell cause I need to change to pots ...my absolute encoder aren't meant for this setup ... I'm considering your hall sensor setup but cause I have linear actuator I'll need to modify the back casing of my gearboxes and try find clean feed back from that