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

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:
    +4 / 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 2
  2. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,897
    Location:
    London
    Balance:
    11,610Coins
    Ratings:
    +458 / 9 / -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
  3. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,161
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,162Coins
    Ratings:
    +5,036 / 16 / -0
    I second the smc3 Arduino code.
    yobuddy
    • Like Like x 1
  4. genius613

    genius613 New Member

    Joined:
    Apr 25, 2018
    Messages:
    7
    Location:
    Florida
    Balance:
    187Coins
    Ratings:
    +4 / 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.
  5. Gadget999

    Gadget999 Well-Known Member

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

    genius613 New Member

    Joined:
    Apr 25, 2018
    Messages:
    7
    Location:
    Florida
    Balance:
    187Coins
    Ratings:
    +4 / 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
    • Funny Funny x 1
  7. 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
  8. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,535
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    145,034Coins
    Ratings:
    +10,776 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    • Agree Agree x 1
  9. genius613

    genius613 New Member

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

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,897
    Location:
    London
    Balance:
    11,610Coins
    Ratings:
    +458 / 9 / -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
  11. bruce stephen

    bruce stephen Hammer doesnt fix it, must be electrical

    Joined:
    Jun 7, 2015
    Messages:
    1,286
    Occupation:
    general contractor
    Location:
    michigan
    Balance:
    9,110Coins
    Ratings:
    +1,238 / 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
  12. genius613

    genius613 New Member

    Joined:
    Apr 25, 2018
    Messages:
    7
    Location:
    Florida
    Balance:
    187Coins
    Ratings:
    +4 / 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.
  13. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,535
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    145,034Coins
    Ratings:
    +10,776 / 52 / -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
  14. genius613

    genius613 New Member

    Joined:
    Apr 25, 2018
    Messages:
    7
    Location:
    Florida
    Balance:
    187Coins
    Ratings:
    +4 / 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.
  15. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,535
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    145,034Coins
    Ratings:
    +10,776 / 52 / -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
  16. genius613

    genius613 New Member

    Joined:
    Apr 25, 2018
    Messages:
    7
    Location:
    Florida
    Balance:
    187Coins
    Ratings:
    +4 / 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.
  17. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,535
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    145,034Coins
    Ratings:
    +10,776 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    • Like Like x 1
  18. Boris Furtak

    Boris Furtak Member Gold Contributor

    Joined:
    Oct 11, 2021
    Messages:
    57
    Balance:
    160Coins
    Ratings:
    +10 / 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
  19. Rodeo5150

    Rodeo5150 ROOKIE BUT LEARNING FAST Gold Contributor

    Joined:
    Mar 21, 2019
    Messages:
    210
    Location:
    Antioch, CA, United States
    Balance:
    1,233Coins
    Ratings:
    +51 / 0 / -0
    My Motion Simulator:
    Arduino, 6DOF
    Dude the potentiometers are to read the position of your Motors not the frame that's where you're running into a problem you're not trying to get feedback from your frame you trying to get feedback from your Motors so the code knows when to stop and start your Motors
  20. early_m

    early_m Active Member

    Joined:
    Jul 28, 2016
    Messages:
    318
    Location:
    Chelmsford
    Balance:
    824Coins
    Ratings:
    +341 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform
    I would advise you to consider these comments and you'll get results quicker. Members here have been doing this for years, with all different types of hardware and know what they're talking about. Good luck with your project.