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 Can I use ESC with SMC3 Arduino 3DOF?

Discussion in 'DIY Motion Simulator Building Q&A / FAQ' started by Boldq8, Apr 24, 2017.

  1. Boldq8

    Boldq8 New Member

    Joined:
    May 15, 2015
    Messages:
    5
    Balance:
    106Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, AC motor, Arduino, Motion platform
    Hi everyone,

    I have ESC (Speed Controller Dc Motor)
    IFIrobotics victor 885
    [​IMG]
    http://www.robotcombat.com/products/images/IFI-883-885-Manual.pdf

    I would to use ESC instead of H-Bridge with Arduino and SMC3 code

    The ESC have 3 wires PWM only, Not like H-Bridge have PWM and ENA - ENB

    Is there anyone who tried the edit on the code?
    Do I need to edit the code?
    How to wire connections?

    So if there is a solution please help
  2. delcarlo

    delcarlo Member

    Joined:
    Mar 28, 2017
    Messages:
    34
    Location:
    Australia
    Balance:
    439Coins
    Ratings:
    +36 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor
    that looks to be a dc speed controller for an RC car/plane.. the PWM signal is a single wire, with the other two being 5v and ground. (white signal, red 5v and black ground)

    standard PWM for RC servos are single wire (no direction) with the direction information contained in the signal 'high' time pulse (0.9-2.1ms, with 1.5ms being centered) with a variable low time. I'm not sure how 'mode 2' works on smc3, but wiring would be the same.
  3. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,643Coins
    Ratings:
    +1,009 / 8 / -1
    In theory it should work. You will still need feedback pots on motors to the arduino SMC3. I also assume that the ESC is capable of driving the Motor you plan to use. A lot of RC ESCs these days are for Brushless DC RC motors - I guess this one is just a DC Motor driver as it only has the two wires to motor.

    You would need a few changes in the SMC3 code, first change all the SetOutputsMotor1 (2 and 3) as below:
    Code:
    void SetOutputsMotor1()
    {
        #define ZERO_SPEED_OFFSET 127
        if((Feedback1 > InputClipMax1) && (PWMrev1 != 0))
        {
            PWMout1 = PWMrev1;
            MyPWMWrite(PWMpin1, ZERO_SPEED_OFFSET-(PWMout1/2));
        }
        else if((Feedback1<InputClipMin1) && (PWMrev1 != 0))
        {
            PWMout1 = PWMrev1;
            MyPWMWrite(PWMpin1, (PWMout1/2)+ZERO_SPEED_OFFSET);
        } 
        else if((Target1 > (Feedback1 + DeadZone1)) || (Target1 < (Feedback1 - DeadZone1)))
        {
            if (PWMout1 >= 0) 
            {                                   
                // Drive Motor Forward
                PWMout1+=PWMoffset1;
                if(PWMout1 > (PWMmax1+LiftFactor1)){PWMout1=PWMmax1+LiftFactor1;}
                MyPWMWrite(PWMpin1, (PWMout1/2)+ZERO_SPEED_OFFSET);
            } 
            else
            {                                             
                // Drive Motor Backwards
                PWMout1 = abs(PWMout1);
                PWMout1+=PWMoffset1;
                if(PWMout1 > PWMmax1){PWMout1=PWMmax1;}
                MyPWMWrite(PWMpin1, ZERO_SPEED_OFFSET-(PWMout1/2));
            }
        }
        else
        {
            PWMout1=0;
            MyPWMWrite(PWMpin1, ZERO_SPEED_OFFSET);
        }
    }
    
    And then you will need to change the PWM frequency to something like 330Hz or there abouts. Actually I think the default Arduino PWM freq is 360Hz so maybe if you just comment out the code to set the freq it will be right?

    This is all untested and not properly researched - I'm just going from memory. You would have to try.

    As I always suggest, first try a small dc motor so you don't fry the ESC if it is wrong.
    • Informative Informative x 1
    • Friendly Friendly x 1
  4. Boldq8

    Boldq8 New Member

    Joined:
    May 15, 2015
    Messages:
    5
    Balance:
    106Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, AC motor, Arduino, Motion platform
    @delcarlo Thanks for your reply and help

    @RufusDufus Thanks for your reply and help, I did the whole thing but it does not work!