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 Arduino Code Ultrasonic PWM

Discussion in 'SimTools compatible interfaces' started by TomKlash, May 16, 2020.

  1. TomKlash

    TomKlash Member

    Joined:
    Nov 21, 2012
    Messages:
    50
    Location:
    FRANCE
    Balance:
    425Coins
    Ratings:
    +10 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, SCN5, Arduino
    Hi,

    I am creating this subject because I would need the help of people who know how to code ARDUINO. I use a code which allows to control the motors of my SIMU via MotoMonsterShield cards the famous VNH2SP30. The code was written by RacingMat then updated by it to pass the PWM from 580 Hz to 20KHz in order to avoid the unpleasant engine noise on these low frequencies.

    However, this reference code is written to drive 2 motors and I use 3 for my SIMU.

    For the classic code I was able to transpose it to go from 2 to 3 engines.
    By cons concerning the code "ultrasonic" I am not able it requires knowledge that I do not have (my field being the mechanical design).

    Obviously it is necessary to intervene on the Timer of the Arduino and following the pins which one wishes to pass to 20KHz it is necessary to modify the timer 0, 1 or 2 ...


    If someone can help me it would be very nice of him, and I would not hesitate to return the favor in my area of competence obviously.


    I post here the origin of the information and the Arduino codes.

    Forum Links:

    https://forum.arduino.cc/index.php?topic=135847.30
    https://pobot.org/Modifier-la-frequence-d-un-PWM.html


    http://www.racingfr.com/forum/…php?showtopic=47537&st=15
    https://www.xsimulator.net/com…nic-pwm-with-arduino.102/

    The codes :

    Basic code 2 engines: https://drive.google.com/open?…_yZX1rz-lY-PTmK5LeYIxeRnb
    Code for 3 engines: https://drive.google.com/open?…C2jUUlreRaaVPRkoOlxYMsuVR

    Code for 2 PWM 20KHz motors: https://drive.google.com/open?…PofxcrGqS7KObC2sSQScYjRmf
    Last edited: Jun 6, 2020