Results 1 to 8 of 8
  1. #1
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Mar 2017
    Location
    Denmark
    Posts
    7
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Could it work? (Cockpit project with I2C data transfer)

    Hi
    Iīm quite new to this cockpit-building topic so please bear with me.
    Me and some other guys have a free-time group about aviation in which we discuss aviation stuff, make presentations for each other and also build projects. We have worked on a Arduino-BT controlled blimp for quite some time and now it seems like this project is about to be finished.
    So we had an idea to build Supermarine Spitfire cockpit compatible with FSX.

    It is mainly my responsibility to take care of electronics as others are more into mechanical stuff. We have wood workshop, laser cutter and 3D printers available so I hope no major problems will happen in this field.

    I have done some basic research and divided the cockpit into segments/individual gauges. Iīm not so worried about inputs for the game but what concerns me are outputs from the game. I would like to use two Arduino MEGA - one for outputs, second for inputs. The one which handles outputs would only take data from link2fs and send them down the I2C to appropriate sub-arduino (Arduino Pro Mini). To reduce data-transfer I would like this only to happen when data received from game is different from data previously send out.
    These sub-arduinos would then take the values, processed them and send outputs to servos, steppers, LED, etc.

    Is this concept feasible? Especially will the speed be sufficient? I havenīt managed to write any code which would be able to transfer more than one game extraction to sub-arduino without major lag.

    Thanks so much for help
    Jiri Kaspar, AeroVIA, Horsens, Denmark
    Attached Images Attached Images

  2. #2
    75+ Posting Member
    Join Date
    Jun 2016
    Location
    127.0.0.1
    Posts
    117
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Could it work? (Cockpit project with I2C data transfer)

    Hi there and good luck with your project.

    You can calculate your data rate quite easily using simple assumptions, like bus speed, number of connections, updates per second, data length.

    But my gut feeling is that you focus on the wrong direction. As far as I remember (and that may be totally incorrect so please check this out first), Link2FS uses a rather verbose text protocol over a serial connection. This will be providing far less bandwidth than any (normal) i2c implementation so it will be the limiting factor.

    On the hardware level, i2c is designed for short distances. If you plan to connect several arduinos with long cables (where "long" here is as short as in the range of decimeters - 10ths of centimeters), you will increase the capacitance of the bus so much that the signal will not have enough time to switch from an open to a driven state, meaning no data will ever be transmitted. You can decrease the speed of the bus to counteract this but that can be played with up to a certain extent before it doesn't make any sense. There are some other techiniques to help but you'll be doing hacks to fix something that was never designed for this use.

  3. Thanks Bombos3 thanked for this post
    Likes Bombos3 liked this post
  4. #3
    150+ Forum Groupie


    BushPilotWannabe's Avatar
    Join Date
    Jan 2014
    Location
    Alberta, Canada
    Posts
    176
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Could it work? (Cockpit project with I2C data transfer)

    Servo. Model airplane or aircraft instruments?

    Major lag. How long is unacceptable? One byte servo identifier, one low byte, and one high byte should be just over 2 milliseconds with one byte reply.

    Arduino boards do not multitask. Run several smaller boards and two or more copies of Link2FS to compensate.

    Nothing comes out of FSX, and in turn by Link2FS, unless it is an update. Optional Link2FS refresh at fixed intervals excepted. Aircraft attitude, altitude and engine output can be controlled to some measure by selecting the format of data downloaded to the Arduino. 000, 0000. 00000, 00000. , 00000.00, etc. Is altitude accurate to 10 feet acceptable?

    Group one fast changing servo with several slow changing servos.

    FSX has prioritized its input and output. Send two swap frequency commands 20 milliseconds apart and the second request will probably fail. Watch the VR flap indicator hesitate as it moves from full up to full down.

    My only I2C UNO to Pro Mini cable is a piece of old USB cable 600mm long bonded at the UNO end. No problem from nearby monitors or computer keyboard.

    Have fun.

    Hugh
    ---CYXD ----- TWR --- GND ------ Closed
    ILS-- NDB -- 119.1 -- 121.9 ---- 11/2013

  5. Thanks Bombos3 thanked for this post
    Likes Bombos3 liked this post
  6. #4
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Mar 2017
    Location
    Denmark
    Posts
    7
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Could it work? (Cockpit project with I2C data transfer)

    Hi
    Thank you for your replies. They really helped me to move a bit further in the process. Now I see I2C is not the best idea and I will only (if at all) implement it on some sub-systems with short distance and low data transfer.

    This simulator is "only" supposed to be a stationary cockpit - no large servos for movement, all the stuff in the graphics above is related to instruments.
    I honestly like your idea of having several instances of link2fs running simultaneously. At this point I only have FS2004 and appropriate link2fs installed on this machine and it doesnīt work (no data coming to second l2fs). Is it different from FSX version then?

    Overall it seems like ideal solution for me as I could easily make simple and clean code for all major instruments and run them on separate small boards connected straight to PC. However is this going to be possible with Arduino Pro Mini as they donīt have native USB communication support? I could hard wire USB to TTL converter to them at some extra cost (still about 50% of Arduino Pro Micro though) but I have no previous experience with this kind of setup. Especially Iīm curious if I would have to manually adjust COM ports every time I restart the computer?

    It also makes me curious what is the right way of designing this project/cockpit/simulator. I can imagine to connect some of the things (servos, LED, inputs) to one or two Arduino MEGA cards but still there is always going to be need to drive small stepper motors. I did a bit of research on this and it appears to me these should be ideally driven by separate card each. This of course raises need for multiple small Arduino in addition to MEGA cards.

    Have a nice day
    Thank you for help

  7. #5
    150+ Forum Groupie


    BushPilotWannabe's Avatar
    Join Date
    Jan 2014
    Location
    Alberta, Canada
    Posts
    176
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Could it work? (Cockpit project with I2C data transfer)

    Strange entities these, Windows, USB, FSX, Link2FS, and Arduino. Until now I have used the second install of Link2FS to test SimConnect and FSUIPC codes before adding them to first (main) installation. I did spend about 5 minutes after installing the second Link2FS proving the concept.

    Today, the entities would not play nicely together. Dropped USB channels including the VGA_monitor/keyboard&mouse switcher. Unplug and test. Go back to the first Link2FS and change the USB channel number matched to the board moved to the second Link2FS, even though the Link2FS card was not "connected". Unplug and connect the USB cables, then restart both Link2FS. Restart FSX. One board (navcom1) worked OK, the other (panel switches and magnetos usiing Pro Mini and I2C) eventually ran but two switches moved at same time eventually changed FSX - ten second pause, switch 1, ten second pause, switch 2.

    After ten minutes of this, both cards clicked in. Saved everything but the FSX flight and restarted the computer. Both boards up and running. Now what will happen when I go back to running the one Link2FS and both cards?

    Your project. Where are you converting the downloads from Link2FS to device instructions? How often are the downloads? How long are the packets moved by 12C to the Pro Mini. If you are using rebuilt flight instruments, we who will never do this, would appreciate a rundown of what is involved.

    Hugh
    ---CYXD ----- TWR --- GND ------ Closed
    ILS-- NDB -- 119.1 -- 121.9 ---- 11/2013

  8. #6
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Mar 2017
    Location
    Denmark
    Posts
    7
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Could it work? (Cockpit project with I2C data transfer)

    BushPilotWannabe:
    I did give it (2 simultaneously running link2fs) a try again and it worked. Anyway Iīm still concerned about the convenience of connecting the Arduinos this way. Although there are obvious benefits - simple, clean code for each AD but there are also some concerns - will usb to tll converter communicate directly with link2fs, will I have to adjust com ports on every start up?

    In my project I initially had idea of having two mega cards - one handling inputs, other outputs. I intended them to take raw data from link2fs and send this raw data to individual AD on I2C. For instance Mega would ask for
    But after all this hassle I see that maybe I should use 1 MEGA for inputs, and several Pro Micros to handle outputs. Some of these micros would then have Pro Mini connected to them via I2C to drive steppers. There wouldnīt be much traffic and also distance would be very short. I donīt want to rebuild instruments, all will be designed and made on our own (3D printers, laser cutter, ..).

    Does anyone have a nice master device I2C code which works well with link2fs?

  9. #7
    150+ Forum Groupie


    BushPilotWannabe's Avatar
    Join Date
    Jan 2014
    Location
    Alberta, Canada
    Posts
    176
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Could it work? (Cockpit project with I2C data transfer)

    Funny you should ask that. If you have the patience try http://www.mycockpit.org/forums/show...591&highlight= The project is too long and too many builder variables to publish as one sketch unless incorporated into a 'do it yourself, this way' Instructible. A stepper motor module for the flap indicator is finished short of getting the 60mm linear stepper actuator to run quietly. There is no response to the thread. May have to do a YouTube.

    One UNO or Mega acts like a switcher to change Jim's string code to a byte or integer, then forwarded to a Pro Mini on 60ms schedule. The Pro Mini then processes the code and runs the attached devices. At 16 MHz the Pro Mini has the same computing power as a MEGA, just fewer pins and less onboard memory. A $2 USB to serial programming adapter can be moved from one deputy board to another and is removed altogether once the project is complete. The frequency of the downloaded packets from Link2FS would limit the number of Pro Minis on the I2C buss. One UNO switcher running multiple deputy boards with scheduled two way communication can be used for the slow inputs (flaps, oil pressure, fuel, etc) and monitor all switches by return packet.

    If communication is one way, transmission of rapid downloads can be passed as part of the void Question() or void Equals() functions. No scheduling required. The current scheduled no data response from deputy board in a two way communication will be removed with the next post. The main board does not require an 'I'm here' confirmation, it only tells the programmer that most of the deputy board sketch is working.

    Hugh
    ---CYXD ----- TWR --- GND ------ Closed
    ILS-- NDB -- 119.1 -- 121.9 ---- 11/2013

  10. #8
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Mar 2017
    Location
    Denmark
    Posts
    7
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Could it work? (Cockpit project with I2C data transfer)

    Thank you for the link. I went through it and even though I understood the concept I donīt feel like I should go this deep into the topic. I will be more then happy if I will manage to achieve functional one-way I2C.
    At this point all of the electronics needed to build 6 main instruments is on the way from China. Hopefully it is not gonna be too affected by 11/11 and work will begin soon. I donīt have much else to discuss at this point but surely I will come later.

    Again - thanks a lot for help