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 Simtools with Relay

Discussion in 'DIY Motion Simulator Projects' started by Sebastian Fernandes, Aug 19, 2023.

  1. Sebastian Fernandes

    Sebastian Fernandes New Member

    Joined:
    Jun 24, 2023
    Messages:
    4
    Balance:
    - 10Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    Motion platform
    Greetings,
    I would be interested in making a very very simple low budget motion for my home for the kids. My idea of making this rig is as follows.
    I would want the Arduino board to work the same as its working for the motors in the famous project which is already on this website, the only changes I would be interested in making is, there will no motors attached with this project. I would be using an Air-Compressor, Solonide, and relays to push up and down four bellows.
    These four bellows will be located under a platform and on the platform would be my seat. The Arduino will be sending the commands to the relays to activate and when the relay is activated, the solonoide will activate making the air from the compressor to release and thus making the belows go up and so the platform along with the seat will go up. So I need 4 relays to be operated by arduino using Simtools.
    Kindly help me with your suggestions and will try this out as this is going to be in a very low budget.

    Thanks and regards,

    Sebastian Alexo Fernandes
  2. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,862
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    147,009Coins
    Ratings:
    +10,845 / 53 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
  3. Sebastian Fernandes

    Sebastian Fernandes New Member

    Joined:
    Jun 24, 2023
    Messages:
    4
    Balance:
    - 10Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    Motion platform
    Yes something similar to the above project, but would be using Bellows instead of Pistons. Could you please help me with the code as I m very new to all this stuff and Im trying get into it.
  4. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,862
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    147,009Coins
    Ratings:
    +10,845 / 53 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Best to post pictures of what hardware you plan using, and what design you have, so we all have a clear idea in mind of what you intend.
  5. Sebastian Fernandes

    Sebastian Fernandes New Member

    Joined:
    Jun 24, 2023
    Messages:
    4
    Balance:
    - 10Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    Motion platform
    This an Uno
    and a 4 channel 5v relay module

    and Have uploaded this sm3 code on UNO and want the relays to activate in simtools

    Below is the code of sm3 in short form


    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 MODE1   
    
    // Uncomment the following line to reverse the direction of Motor 1.
    
    //#define REVERSE_MOTOR1
    
    // Uncomment ONE of the following lines to enable analogue input AN5 as a scaler for the motion values.
    
    // #define ENABLE_POT_SCALING
    // #define ENABLE_NON_LINEAR_POT_SCALING
    
    // Uncomment the following line to enable the second software serial port.
    // NOTE: This is currently not working - leave commented out until fixed!!!
    
    // #define SECOND_SERIAL
    
    //    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
    //    A5 - Motion scaler pot input
    
    
    
    // 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

    Attached Files:

  6. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,862
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    147,009Coins
    Ratings:
    +10,845 / 53 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
  7. Sebastian Fernandes

    Sebastian Fernandes New Member

    Joined:
    Jun 24, 2023
    Messages:
    4
    Balance:
    - 10Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    Motion platform
    Yes this is what it should be like, I was trying to find this type of content on this website but was not able to, But still I am look for the arduino code for the same
  8. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,862
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    147,009Coins
    Ratings:
    +10,845 / 53 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Sorry but @Sijmen is the only member I am aware of who has used that hardware, and modified code for it.