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

Can not make the engine spin

Discussion in 'DIY Motion Simulator Projects' started by phonghornet, Oct 11, 2018.

?

what is your date of birth

  1. 21

    0 vote(s)
    0.0%
  2. i dont now

    0 vote(s)
    0.0%
  3. i dont now

    0 vote(s)
    0.0%
Multiple votes are allowed.
  1. phonghornet

    phonghornet New Member

    Joined:
    Aug 19, 2018
    Messages:
    27
    Balance:
    190Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino, 4DOF, 6DOF
    hello everyone i am new
    I use smc3 v0.6 code (I do not edit anything to upload to my uno arduino and diagram under the attached photo template.
    I can not make the engine spin.
    I do not know where I was wrong.
    Please help everyone.

    Attached Files:

  2. phonghornet

    phonghornet New Member

    Joined:
    Aug 19, 2018
    Messages:
    27
    Balance:
    190Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino, 4DOF, 6DOF
    completely original code
    //****************************************************************************************************************
    // SMC3.ini is basic Motor PID driver designed for motion simulators with upto 3 motors (written for UNO R3)
    //
    //****************************************************************************************************************

    // Set to MODE1 for use with a typical H-Bride that requires PWM and 1 or 2 direction inputs
    // Set to MODE2 for a 43A "Chinese" IBT-2 H-Bridge from e-bay or equiv

    #define MODE2


    // COMMAND SET:
    //
    // [] Drive all motors to defined stop positions and hold there
    // [Axx],[Bxx],[Cxx] Send position updates for Motor 1,2,3 where xx is the binary position limitted to range 0-1024
    // [Dxx],[Exx],[Fxx] Send the Kp parameter for motor 1,2,3 where xx is the Kp value multiplied by 100
    // [Gxx],[Hxx],[Ixx] Send the Ki parameter for motor 1,2,3 where xx is the Ki value multiplied by 100
    // [Jxx],[Kxx],[Lxx] Send the Kd parameter for motor 1,2,3 where xx is the Kd value multiplied by 100
    // [Mxx],[Nxx],[Oxx] Send the Ks parameter for motor 1,2,3 where xx is the Ks value
    // [Pxy],[Qxy],[Rxy] Send the PWMmin and PWMmax values x is the PWMmin and y is PWMmax each being in range 0-255
    // [Sxy],[Txy],[Uxy] Send the Motor Min/Max Limits (x) and Input Min/Max Limits (y) (Note same value used for Min and Max)
    // [Vxy],[Wxy],[Xxy] Send the Feedback dead zone (x) and the PWM reverse duty (y) for each motor
    // [rdx] Read a value from the controller where x is the code for the parameter to read
    // [ena] Enable all motors
    // [sav] Save parameters to non-volatile memory
    // [ver] Send the SMC3 software version
    //

    // Arduino UNO Pinouts Used
    //
    // 9 - Motor 1 PWM
    // 10 - Motor 2 PWM
    // 11 - Motor 3 PWM
    // 2 - Motor 1 H-Bridge ENA
    // 3 - Motor 1 H-Bridge ENB
    // 4 - Motor 2 H-Bridge ENA
    // 5 - Motor 2 H-Bridge ENB
    // 6 - Motor 3 H-Bridge ENA
    // 7 - Motor 3 H-Bridge ENB
    // A0 - Motor 1 Feedback
    // A1 - Motor 2 Feedback
    // A2 - Motor 3 Feedback




    // BOF preprocessor bug prevention - leave me at the top of the arduino-code
    #if 1
    __asm volatile ("nop");
    #endif

    #include <EEPROM.h>
    #include <SoftwareSerial.h>

    // defines for setting and clearing register bits
    #ifndef cbi
    #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
    #endif
    #ifndef sbi
    #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
    #endif

    #define COM0 0 // hardware Serial Port
    #define COM1 1 // Software Serial Port
    #define START_BYTE '[' // Start Byte for serial commands
    #define END_BYTE ']' // End Byte for serial commands
    #define PROCESS_PERIOD_uS 250 // 244 -> 4096 per second approx
    #define TIMER_UPPER_LIMIT 4294966000 // Used to check for timer wraparound
    #define TIMER_LOWER_LIMIT 1000 // Used to check for timer wraparound


    unsigned long TimesUp=0; // Counter used to see if it's time to calculate next PID update

    int Feedback1 = 512;
    int Feedback2 = 512;
    int Feedback3 = 512;
    int Target1 = 512;
    int Target2 = 512;
    int Target3 = 512;

    unsigned int RxByte[2]={0}; // Current byte received from each of the two comm ports
    int BufferEnd[2]={-1}; // Rx Buffer end index for each of the two comm ports
    unsigned int RxBuffer[5][2]={0}; // 5 byte Rx Command Buffer for each of the two comm ports
    unsigned long LoopCount = 0; // unsigned 32bit, 0 to 4,294,967,295 to count times round loop
    unsigned long LastCount = 0; // loop counter the last time it was read so can calc delta
    byte errorcount = 0; // serial receive error detected by checksum

    //
    //
    // +----+ +------+
    // +-|PWR |--------------| USB |-----+
    // | | | | | |
    // | +----+ +------+ o|
    // | o|
    // | o|AREF
    // | o|GND
    // NC|o o|13 TTL (software) Serial
    // IOREF|o +----+ o|12 TTL (software) Serial
    // RESET|o | | o|11~ PWM Motor 3
    // 3.3V|o | | o|10~ PWM Motor 2
    // 5V|o | | Arduino o|9~ PWM Motor 1
    // GND|o | | UNO o|8
    // GND|o | | |
    // VIN|o | | o|7 Motor 3 ENB
    // | | | o|6~ Motor 3 ENA
    // Motor 1 Pot A0|o | | o|5~ Motor 2 ENB
    // Motor 2 Pot A1|o | | o|4 Motor 2 ENA
    // Motor 3 Pot A2|o | | o|3~ Motor 1 ENB
    // A3|o | | o|2 Motor 1 ENA
    // A4|o | | o|1
    // A5|o +-/\-+ o|0
    // +-\ /---------+
    // \--------------------/
    //
    //
  3. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,198
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,868Coins
    Ratings:
    +10,921 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    I don't use SMC3 but it should be set to Mode 1 for MMs.

    It would also help if you posted pictures of all your settings.
  4. phonghornet

    phonghornet New Member

    Joined:
    Aug 19, 2018
    Messages:
    27
    Balance:
    190Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino, 4DOF, 6DOF
    I want to build 3dof following model.
    But programming arduino for me is very difficult.

    Attached Files:

  5. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,198
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,868Coins
    Ratings:
    +10,921 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
  6. phonghornet

    phonghornet New Member

    Joined:
    Aug 19, 2018
    Messages:
    27
    Balance:
    190Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino, 4DOF, 6DOF
    Thank you.NOORBEAST
    may be to add time for reading instruction.