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

SONXUN SX8847

Discussion in 'Motor actuators and drivers' started by Ceresoli, May 21, 2014.

  1. Ceresoli

    Ceresoli ceretz

    Joined:
    Mar 3, 2014
    Messages:
    30
    Occupation:
    Cinema Projectionist and car mechanic
    Location:
    Piemont, Italy
    Balance:
    469Coins
    Ratings:
    +28 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    Hi all, I have two 240w dc motor driver for my flight simulator. Does anyone know them?
    They are produced by SONXUN, SX8847 models.
    I'm trying to connect to my Arduino Mega 2560 with two optical encoders, two limit switches and a proxy for the central location of the engines.
    All for a cab game TAITO TOP LANDING converted to FSX!
    An old 2DOF.
    I will post pictures soon

    Regards
    ceretz

    Attached Files:

  2. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,400Coins
    Ratings:
    +1,683 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    @Ceresoli is there a data sheet available , a link with more information then we can inform you on how to use them.
    http://forum.arduino.cc/index.php?PHPSESSID=me43bkmpcav26repgknmej1ch4&topic=134411.15
    Looking here I found a code to drive them so to wire are run them he has :

    //Functions used on h bridge pcbs.
    int oneen = 8; // enable
    int onedir = 9; // direction
    int onepwm = 10; // pulse width modulation
    int onedi = 2; // disable
    //also connect GND and VCC obviously

    Looks like we need to drive the enable pin high in order to enable the driver and then set a direction high will go one way and low will turn it the other way, then we drive the pwm pin inorder to set a speed to travel in the direction we want, lastly you can then disable the driver via another pin ( like if a safety switch).
    Looks feasible and I believe @RufusDufus code could run these drivers.

    Hope that gets you started
    • Informative Informative x 1
  3. Ceresoli

    Ceresoli ceretz

    Joined:
    Mar 3, 2014
    Messages:
    30
    Occupation:
    Cinema Projectionist and car mechanic
    Location:
    Piemont, Italy
    Balance:
    469Coins
    Ratings:
    +28 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    Thank you for reply!
    I had already looked at the link you have posted.
    I also found this, which also explains how to use the SPI register http://forum.arduino.cc/index.php/topic,171010.0.html
    I can not find the code @RufusDufus . Could you give me the link? So I can compare with other material at my disposal and can then share my experiences. I would be really grateful!
    Sorry for my english :p
  4. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,400Coins
    Ratings:
    +1,683 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
  5. Ceresoli

    Ceresoli ceretz

    Joined:
    Mar 3, 2014
    Messages:
    30
    Occupation:
    Cinema Projectionist and car mechanic
    Location:
    Piemont, Italy
    Balance:
    469Coins
    Ratings:
    +28 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    Hi,
    This in my Arduino's code for test only two SX8847 Without other I/O
    I use it witw an Arduino Mega 2560 R3.
    /*
    Two SONXUN SX8847 Test with Arduino Mega 2560 R3
    */

    //Functions used on h bridge pcbs.
    int oneen = 12; // enable MOTOR 1
    int onedir = 11; // direction MOTOR 1
    int onepwm = 10; // pulse width MOTOR modulation 1
    int onedi = 9; // disable MOTOR 1
    int twoen = 8; // enable MOTOR 2
    int twodir = 7; // direction MOTOR 2
    int twopwm = 6; // pulse width modulation MOTOR 2
    int twodi = 5; // disable MOTOR 2

    // the setup routine runs once when you press reset:
    void setup()
    {
    // initialize the digital pins.
    pinMode(onedir, OUTPUT);
    pinMode(onepwm, OUTPUT);
    pinMode(oneen, OUTPUT);
    pinMode(onedi, OUTPUT);
    pinMode(twodir, OUTPUT);
    pinMode(twopwm, OUTPUT);
    pinMode(twoen, OUTPUT);
    pinMode(twodi, OUTPUT);
    }

    // the loop routine runs over and over again forever:
    void loop() {
    //turn all low
    digitalWrite(oneen, LOW); // part 1, h bridge activation 1
    digitalWrite(onedi, LOW); // part no disable 1
    digitalWrite(onedir, LOW); // high turns forwards, low is reverse 1
    digitalWrite(onepwm, LOW); // high runs motor (if h bridge is on) 1
    digitalWrite(twoen, LOW); // part 1, h bridge activation 2
    digitalWrite(twodi, LOW); // part no disable 2
    digitalWrite(twodir, LOW); // high turns forwards, low is reverse 2
    digitalWrite(twopwm, LOW); // high runs motor (if h bridge is on) 2
    delay(1000);
    // onedir high, onepwm low, works clockwise
    digitalWrite(oneen, HIGH); // part 1, h bridge enable 1
    digitalWrite(onedi, LOW); // part 2, h bridge no disable 1
    digitalWrite(onedir, LOW); // high turns anticlockwise, low is clockwise 1
    digitalWrite(onepwm, HIGH); // high runs motor (if h bridge is activen) 1
    digitalWrite(twoen, HIGH); // part 1, h bridge enable 2
    digitalWrite(twodi, LOW); // part 2, h bridge no disable 2
    digitalWrite(twodir, LOW); // high turns anticlockwise, low is clockwise 2
    digitalWrite(twopwm, HIGH); // high runs motor (if h bridge is activen) 2
    delay(4000);

    //turn all low (motor off)
    digitalWrite(oneen, LOW);
    digitalWrite(onedi, LOW);
    digitalWrite(onedir, LOW);
    digitalWrite(onepwm, LOW);
    digitalWrite(twoen, LOW);
    digitalWrite(twodi, LOW);
    digitalWrite(twodir, LOW);
    digitalWrite(twopwm, LOW);
    delay(1000);
    //onedir high, onepwm high, works anticlockwise
    digitalWrite(oneen, HIGH); // part 1, h bridge activation 1
    digitalWrite(onedi, LOW); // part 2, h bridge no disable 1
    digitalWrite(onedir, HIGH); // high turns anticlockwise, low is clockwise 1
    digitalWrite(onepwm, HIGH); // high runs motor (if h bridge is on) 1
    digitalWrite(twoen, HIGH); // part 1, h bridge activation 2
    digitalWrite(twodi, LOW); // part 2, h bridge no disable 2
    digitalWrite(twodir, HIGH); // high turns anticlockwise, low is clockwise 2
    digitalWrite(twopwm, HIGH); // high runs motor (if h bridge is on) 2
    delay(4000); // wait for 1 second

    //turn all low (motor off)
    digitalWrite(oneen, LOW); // part 1, h bridge activation 1
    digitalWrite(onedi, LOW); // part no disable 1
    digitalWrite(onedir, LOW); // high turns forwards, low is reverse 1
    digitalWrite(onepwm, LOW); // high runs motor (if h bridge is on) 1
    digitalWrite(twoen, LOW); // part 1, h bridge activation
    digitalWrite(twodi, LOW); // part no disable
    digitalWrite(twodir, LOW); // high turns forwards, low is reverse
    digitalWrite(twopwm, LOW); // high runs motor (if h bridge is on)
    delay(1000);
    }
    Motors waits for one second, goes clockwise for 4 seconds, waits for one second,
    anticlockwise for 4 seconds, waits for 1 second, repeats.
    The setup routine runs once when you press reset

    Attached Files:

  6. Ceresoli

    Ceresoli ceretz

    Joined:
    Mar 3, 2014
    Messages:
    30
    Occupation:
    Cinema Projectionist and car mechanic
    Location:
    Piemont, Italy
    Balance:
    469Coins
    Ratings:
    +28 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino

    This is the first test of two sx8847 with Arduino Mega and one LCD.
    • Like Like x 3
    Last edited: Jun 14, 2014
  7. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,400Coins
    Ratings:
    +1,683 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
  8. Ceresoli

    Ceresoli ceretz

    Joined:
    Mar 3, 2014
    Messages:
    30
    Occupation:
    Cinema Projectionist and car mechanic
    Location:
    Piemont, Italy
    Balance:
    469Coins
    Ratings:
    +28 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    linked, sorry! i have edited the message :D:popcorn
    • Winner Winner x 1
  9. Ceresoli

    Ceresoli ceretz

    Joined:
    Mar 3, 2014
    Messages:
    30
    Occupation:
    Cinema Projectionist and car mechanic
    Location:
    Piemont, Italy
    Balance:
    469Coins
    Ratings:
    +28 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    I have update arduino with an LCD. This is the first test.
    I'm work to study the SPI register of SX8847, becouse there are some helpful function and communication sended to arduino from this driver!
    The information are very helpful if the are some problem during motor control.
    My idea is to have an LCD monitor 20x4 for parameter visualization like motor position, sx8847 problem (temp. warning, no load, undervoltage, ecc.) and state of various switch for security.
    Very long work......:mad::mad:
  10. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,400Coins
    Ratings:
    +1,683 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    All coming along nicely, Well done keep us informed or any questions ask away.
    • Like Like x 1
  11. Ceresoli

    Ceresoli ceretz

    Joined:
    Mar 3, 2014
    Messages:
    30
    Occupation:
    Cinema Projectionist and car mechanic
    Location:
    Piemont, Italy
    Balance:
    469Coins
    Ratings:
    +28 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    Hello, sorry for my absence, but I became a father of the little Carol
    :grin

    I attach the datasheet of the integrated heart of sx8847 and the arduino's library found around the internet.
    I hope can be useful, while I continue studying and compiling the sketch for the motor management:rolleyes:

    Attached Files:

    • Winner Winner x 1
  12. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,557
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    145,160Coins
    Ratings:
    +10,780 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Congratulations @Ceresoli :cheers

    Thanks for this update of your developing project.
  13. Ceresoli

    Ceresoli ceretz

    Joined:
    Mar 3, 2014
    Messages:
    30
    Occupation:
    Cinema Projectionist and car mechanic
    Location:
    Piemont, Italy
    Balance:
    469Coins
    Ratings:
    +28 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    With a little help of arduino's community i have compiled this.
    Example with explication for SX8847 SPI Access, program and serial monitoring
    The second step is adding a LCD for diagnostic (visualize SX8847 Poblem and motor position) and complete the sketch with some security switch, 2pot and the infrared photocells that block the simulator in case of unauthorized acces in mition simulator area .

    Attached Files:

    • Like Like x 1