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 AASD-15A in Torque mode. Any way to reduce the noise?

Discussion in 'Motor actuators and drivers' started by Trigen, Dec 11, 2023.

  1. Trigen

    Trigen Active Member

    Joined:
    Nov 25, 2018
    Messages:
    484
    Balance:
    2,872Coins
    Ratings:
    +178 / 1 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino
    Hi guys!

    I've made a very simple sketch to run my ST60 motor in torque mode for my sway and im using a Cytron 30C something as its the only one i got on hand at the momemt but the noise is way to high. Any way to reduce this? I've tried some smoothing settings and changing PWM (borrowed some code) but dosent seem to do anything.

    Here's a short vid. https://youtube.com/shorts/4zTE-Jn3J4U

    Code:
    /*******************************************************************************
     * THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTY AND SUPPORT
     * IS APPLICABLE TO THIS SOFTWARE IN ANY FORM. CYTRON TECHNOLOGIES SHALL NOT,
     * IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR CONSEQUENTIAL
     * DAMAGES, FOR ANY REASON WHATSOEVER.
     ********************************************************************************
     * DESCRIPTION:
     *
     * This example shows how to drive a motor using the PWM and DIR pins.
     * This example only shows how to drive a single motor for simplicity.
     * For dual channel motor driver, both channel work the same way.
     *
     *
     * CONNECTIONS:
     *
     * Arduino D3  - Motor Driver PWM Input
     * Arduino D4  - Motor Driver DIR Input
     * Arduino GND - Motor Driver GND
     *
     *
     * AUTHOR   : Kong Wai Weng
     * COMPANY  : Cytron Technologies Sdn Bhd
     * WEBSITE  : www.cytron.io
     * EMAIL    : support@cytron.io
     *
     *******************************************************************************/
    
     #include "CytronMotorDriver.h"
    
    
    // Configure the motor driver.
    CytronMD motor(PWM_DIR, 3, 4);  // PWM = Pin 3, DIR = Pin 4.
    
    // pwmMode - sets the PWM frequency, valid options as follows:
    // pwmMode = 0 will use 980Hz PWM, default mode which will work with all fan types, will cause coil whine if using a MM.
    // pwmMode = 1 will use 4kHz PWM, might reduce coil whine for blowers, use heatsinks on the MM - check MM temp at a low fan speed.
    // pwmMode = 2 will use 8kHz PWM, might be OK for blowers with active cooling on the MM - check MM temp at a low fan speed.
    // pwmMode = 3 will use 31kHz PWM, use with caution - not for blowers with MM as it will cause very high temps. Check MM temp at a low fan speed.
    // server fans - should be able to use pwmMode = 2 or 3. If you are using the PWM control on the server fan, leave this at default 0.
    // if you have blowers with a monster moto, try pwmMode = 1 or 2 and check whether your monster moto temp at low speeds.
    int pwmMode = 1; // value of 0, 1, 2 or 3 - modes 2 and 3 will overheat a Monster Moto if used with blowers
    
    
    // The setup routine runs once when you press reset.
    void setup() {
      Serial.begin(500000);
       motor.setSpeed(0);
    
    
        // disable timer0's interrupt handler - this will disable Arduino's time keeping functions such as delay()
      TIMSK0 &= B11111110;
    
      if (pwmMode == 1)
        {
        // Set pins 5 & 6 to Phase-correct PWM of 3.9 kHz (prescale factor of 8)
        TCCR0A = _BV(COM0A1) | _BV(COM0B1) | _BV(WGM00); // phase-correct PWM
        TCCR0B = _BV(CS01); // prescaler of 8, gives frequency 61kHz/8/2 = 3.9kHz
        }
      else if (pwmMode == 2)
        {
        // Set pins 5 & 6 to Fast PWM of 7.8 kHz (prescale factor of 8)
        TCCR0A = _BV(COM0A1) | _BV(COM0B1) | _BV(WGM01) | _BV(WGM00); // fast PWM
        TCCR0B = _BV(CS01); // prescaler of 8, gives frequency 61kHz/8 = 7.8kHz
        }
      else if (pwmMode == 3)
        {
        // Set pins 5 & 6 to Phase-correct PWM of 31.25 kHz (prescale factor of 1)
        TCCR0A = _BV(COM0A1) | _BV(COM0B1) | _BV(WGM00); // phase-correct PWM
        TCCR0B = _BV(CS00); // prescaler of 1, gives frequency 61kHz/1/2 = 31.25kHz
        }
      else
        {
        // Set pins 5 & 6 to Fast PWM of 980Hz (prescale factor of 64)
        TCCR0A = _BV(COM0A1) | _BV(COM0B1) | _BV(WGM01) | _BV(WGM00); // fast PWM
        TCCR0B = _BV(CS01) | _BV(CS00); // prescaler of 64, gives frequency 61kHz/64 = 980Hz
        }
    }
    
    
    // The loop routine runs over and over again forever.
    void loop() {
       // put your main code here, to run repeatedly:
    
     // motor.setSpeed(0);
       
       while (Serial.available()> 0)
       {
          unsigned int Speed = Serial.read()  ; // Dont need -48, Mover compensates // divide by 4 to get 8 bit
    
         if (Speed > 128){
            Speed = map(Speed, 128, 255, 0, 255);
           // Serial.println (Speed);
            motor.setSpeed(Speed);
           
         }
    
        else if (Speed < 126){
            Speed = map(Speed, 0, 126, -255, 0);
           
            motor.setSpeed(Speed);
           
         }
         else {
         //   motorOff ();
            motor.setSpeed(0);
         
            }
             
       }
           
    
    
    
      // motor.setSpeed(128);  // Run forward at 50% speed.
      // delay(10000);
     
      // motor.setSpeed(255);  // Run forward at full speed.
      // delay(10000);
    
      // motor.setSpeed(0);    // Stop.
      // delay(10000);
    
      // motor.setSpeed(-128);  // Run backward at 50% speed.
      // delay(10000);
     
      // motor.setSpeed(-255);  // Run backward at full speed.
      // delay(10000);
    
      // motor.setSpeed(0);    // Stop.
      // delay(1000);
    }
    
    
  2. cfischer

    cfischer Active Member Gold Contributor

    Joined:
    Sep 7, 2015
    Messages:
    372
    Location:
    Colorado
    Balance:
    2,688Coins
    Ratings:
    +259 / 1 / -0
    google Low-Pass Filter a PWM Signal into an Analog Voltage
    • Like Like x 1