Software

Simchair MKIII I2C latest software on GitHub

Summary

Simchair MKIII uses the I2C bus for communication between the master controller and peripherals. That means that every controls piece contains a separate Arduino inside. Why is that necessary?

  • we can use a device-specific configuration: a lot of nice features are already there
  • we can use external I2C ADCs that provide MUCH more precision
  • we can have more than six analog axes and all the buttons we need
  • we can use filtering when it is necessary without slowing the master controller down
  •  we can extend our controller’s ports more than we’ll ever need
  • unified interface for everything, buttons or axes
  • Leonardo board allows us to use a nice Joystick library by MHeironimus, which simplifies things like ten times; no more pain with USB descriptors
  • easy flashing; need to change sensitivity setting for an aircraft? turn the AP on and flash the controller in flight!

Arduino Pro mini is used for all peripherals. It doesn’t have a USB port on it, so you will need a USB- UART converter to flash them. Why use a board with no USB?  They are small and cheap, and the converter costs literally nothing. I use a PL2303 based converter:

 

 

 

 

 

You can opt for using another Arduino board, like nano, everywhere except the B8 stick grip (probably not 412 head as well) at the moment. Basically, all you need to do is flash all the boards with their corresponding software and wire everything as written in manuals of the peripherals. Note that the master controller software is frequently updated, so remember to check GitHub for updates. Software for peripherals is only updated when there are some severe bugs in it, or some major upgrade is needed to adopt new functionality (I understand no one wants to disassemble stuff to upgrade it). With this in mind, you will only need to change something in peripherals’ software if you wired stuff differently.

Download

Download simchair_i2c repo from GitHub.

Libraries

At the moment, the master controller sketch uses two libraries:

You will need to install them to your IDE to compile the software.

Configuration

The sketch is split into multiple files for better readability and easier navigation. Every peripheral device has its own file, and all stuff you need to calibrate it is in there (if there are any, steps that are needed to be done for calibration are described in peripheral’s assembly manual). When you open one of the files with Arduino firmware, it opens the whole project, and all the files are opened as tabs. When you compile it, these files are concatenated in alphabetical order.

All configurable parameters are under “configuration” tab (a_configuration.ino file), it’s documented right there in comments. ( lines, starting with // )

Extra

To install Lua script that adds collective head switches support key bindings to X-Plane 11 controls menu, please look at this post.

16 Replies to “Software”

  1. Hi Alexey – have an understanding problem with master controller software as it is split into several *.ino files numbered with a to z. What do I have to do to get one sketch to transfer to the Leonardo?

    1. Hi Guido! Just open any of them. Arduino IDE will load all of them (as tabs) and merge into a single file (in alphabetical order, that’s why the letters are there) during compilation. The whole thing with splitting the config to multiple files is just for a better readability (there’s a quite lot of code now). Do not forget to install joystick library (https://github.com/MHeironimus/ArduinoJoystickLibrary) and ADS1x15 library (https://github.com/adafruit/Adafruit_ADS1X15).

      An important thing is to select Leonardo in boards menu and choose the right COM port. After that, just press “flash” button.

      It will show up as 3 joysticks, the gimbal will work as X and Y axes of the 1st one =)

      1. Hi Alexey! To get the tabs in Arduino IDE it was necessary for me to download all files into one directory. In my case I named the directory into “master_controller” and opened the same ino file. Is this the right approach? I get then a lot of error messages, unfortunately too many to send here in the comment. I use Arduino IDE 1.8.7. Possible to send to you by PN?
        When I downloaded only one ino as you wrote above the lines of the other inos are loaded but not seperately in tabs. Error messages are then the same when conmpiling. I am lost now!

        Guido

        1. Oops, I thought you have downloaded the whole git repo (actually, the best thing to do).

          Yup, you need all files from master_controller directory (https://github.com/hc625ma/simchair_i2c/tree/master/master_controller) to be in one dir together. Then you open any one of them, and IDE will load them all as tabs. You need to install joystick and ADS1x15 (links above) libraries before compilation (download them, unzip and copy their folders to your Arduino/libraries folder, look at “Manual installation” part of this manual if unfamiliar with this process: https://www.arduino.cc/en/Guide/Libraries)

          What do you mean by PN? You can write to me by email (my username at gmail.com), but it’s better here in comments so other guys who may have similar questions could find an answer easier =)

          Cheers!

          1. Hi Alexey – with downloading the complete git repo it works – was not clear for me in the beginning.
            Many thanks!

            Guido

  2. Hi Alexey – wanted to calibrate the padels following your instructions in master-controler:

    …… uncomment the following line under “g_helicopter_pedals” tab:

    //Serial.println(rudder); //uncomment to calibrate pedals…..

    Doing this nothing happens on serial port. I am not an Arduino specialist, but isn´t there a “Serial.begin(9600);” missing?

    1. Glad to hear that! Serial.begin is actually under the “main” tab, so no magic there =)

      I can think of only 2 possible reasons for it to not work: either smth is wrong with an i2c connection, or with the device address (if you forgot to connect ADDR and SDA pins).

  3. Hello,

    Can you please do an detailed script for dummy’s how to get the Leonardo board switch to a joystick with flashing the board ?

    Thanks

    Iam waiting for my Leonardo board from Ali

    1. Hi! Nothing complex here, just a few steps:

      1) download the Arduino IDE (https://bit.ly/2VkhkSi), install it
      2) download libraries:
      https://github.com/adafruit/Adafruit_ADS1X15
      https://github.com/MHeironimus/ArduinoJoystickLibrary

      unzip them and copy to Arduino/libraries folder (e.g. C:\Program Files (x86)\Arduino\libraries)

      3) download the simchair_i2c repo:
      https://github.com/hc625ma/simchair_i2c
      4) go to the master_controller folder and open one of the files contained there; All these files should open as tabs in Arduino IDE
      5) select “Arduino Leonardo” from board menu
      5) press “Compile” to check if everything’s fine; you can try the process up to this point without having a physical board
      6) press “flash”, connect and try your peripheral (replug the board after you connect stuff to it, as it will only auto-detect what’s connected on startup), make necessary adjustments in configuration.ino file if any (it’s more or less documented right there in the sketch in comments) and reflash the board again. It should be fine by default, but you may want to reverse some axes or change the default force trim behavior, or maybe reconfigure switches for the head.

      Try doing it without the board, if it compiles, it will flash without any issues. Please let me know how it went for you.

      Cheers and happy New Year!

  4. Hi Alexey – wanted to calibrate the cyclic. You wrote in manual:
    // uncomment next 3 lines for cyclic calibration
    // Serial.print(x);
    // Serial.print(” “);
    // Serial.println(y);

    Last line I do not find in “c_flight_stick_gimbal.ino” – I find only “Serial.println(ftcr);”
    Is this a typing error or do I make an error using the wrong master software?

    Guido

  5. Oops, just change ftcr to y =) Force trim center reset button was added very recently, so I guess I changed the value for debugging and forgot to put it back. Btw, it’s quite a useful feature, just need to solder a button between 5v and A2 pins of the ADC to use it.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.