<div dir="ltr">In response to Marks comment about this must have all been done before this Stuff article explains how Pacific Simulators started out with three guys in a garage...<div><div><br><div><a href="https://www.stuff.co.nz/the-press/news/99416941/going-so-far-you-come-home-again">https://www.stuff.co.nz/the-press/news/99416941/going-so-far-you-come-home-again</a><br></div></div><div><br></div><div>We might be able to persuade one of them to come along for a chat and describe how all the interfacing is done. I used to work with Stuart Whelan at Tait and he came along to the robotics group back in the days when were involved with youngsters at Science Alive.</div><div><br></div><div>Richard</div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 15, 2018 at 10:01 PM, Mark Atherton <span dir="ltr"><<a href="mailto:markaren1@xtra.co.nz" target="_blank">markaren1@xtra.co.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div class="m_1590007228355287675moz-cite-prefix">Hey Synco,<br>
      <br>
      Any chance of a quick tutorial how X-Plane processes incoming UDP
      packets, and assigns associated bytes/bit-positions to each
      function.<br>
      <br>
      Getting some kind of spec. from Paul (or help write one) would be
      very useful to determine cable loom lengths, number of inputs,
      types etc. For each control: Push Button, On/Off, Rotary (number
      of positions) ,or Potentiometer (and resolution), and max scan
      time.<br>
      <br>
      He may have been using a 4 position switch with 4 wires, when it
      may actually be an encoded 2-bit problem. Not sure if full size,
      low cost rotary binary outputs switches are readily available -
      hex coded switches are obviously too small...  There was mention
      of an R-2R ladder on the switch and an ADC - this seems a bit over
      the top (?). How about using a 1 of 4 rotary switch, and a small
      diode matrix (4 diodes + 4 pull down resistors) to encode to
      binary - there are obviously larger bit-savings with 8 and 10
      positions switches.<br>
      <br>
      Not personally a fan of carrying I2C any great distance due to
      noise immunity issues (or lack thereof), but screened twin cable
      (and associated unwanted capacitance) with low clock rate (10kHz
      ?) and careful grounding may be OK though.<br>
      <br>
      R-PI seems over the top to convert bits into UDP, but I guess they
      are readily available, well supported, and low cost, so why the
      hell not...<br>
      <br>
      Need to see if Paul has joined the group email (Andrew, please
      mail me Paul's email address off-list).<br>
      <br>
      -Mark<br>
      <br>
      PS can't help but think that someone may have been through all
      this already ...<br>
      <br>
      <br>
      On 15/05/2018 6:45 PM, Synco Reynders wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">
        <div>Hi Paul <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">(from
            Oxford) </span>+ Guys,</div>
        <div>   From what I could gauge <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Paul
            was after a simple solution that he could understand, build
            and maintain. So my idea would be to point him in the
            direction of what to buy and how to wire it up, rather then
            designing a custom PCB design.</span></div>
        <div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">So
            following is an outline of the building blocks I'd use for
            my solution:</span></div>
        <div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br>
          </span></div>
        <div><span style="color:rgb(34,34,34);font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><font face="monospace, monospace">HARDWARE</font></span></div>
        <div><span style="color:rgb(34,34,34);font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><font face="monospace, monospace">--------</font></span></div>
        <div><span style="color:rgb(34,34,34);font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><font face="monospace, monospace">               </font></span></div>
        <div><span style="color:rgb(34,34,34);font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><font face="monospace, monospace">         E<span style="color:rgb(34,34,34);font-family:monospace,monospace;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">thernet/UDP 
                              i2c + power</span></font></span></div>
        <div><span style="color:rgb(34,34,34);font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><font face="monospace, monospace">X-Plane <============>
              RaspberryPi <----+--> Panel1<span style="color:rgb(34,34,34);font-family:monospace,monospace;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span> </span><-->
                PanelX...</span></font></span></div>
        <div><span style="color:rgb(34,34,34);font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><font face="monospace, monospace">                             
                        |</font></span></div>
        <div><span style="color:rgb(34,34,34);font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><font face="monospace, monospace"><span style="color:rgb(34,34,34);font-family:monospace,monospace;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> 
                                                      +--> Panel2
                <--> PanelX...</span></font></span></div>
        <div><span style="color:rgb(34,34,34);font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><font face="monospace, monospace"><span style="color:rgb(34,34,34);font-family:monospace,monospace;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> 
                                                      :</span></font></span></div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>* Each panel should be self-contained, and have a common
          connector (think ethernet connector + cable is good idea)</div>
        <div>* They can be in a combination of daisy-chaining or
          star-configuration, to suit panel layout.</div>
        <div><br>
        </div>
        <div>A search for "i2c" on TradeMe is probably a good starting
          point for available I2C modules... eg.</div>
        <div><a href="https://www.trademe.co.nz/electronics-photography/other-electronics/electronic-components/other/auction-1627424038.htm?rsqid=a42479ffc5a54d57a2f2d3102e0a888e" target="_blank">https://www.trademe.co.nz/<wbr>electronics-photography/other-<wbr>electronics/electronic-<wbr>components/other/auction-<wbr>1627424038.htm?rsqid=<wbr>a42479ffc5a54d57a2f2d3102e0a88<wbr>8e</a><br>
        </div>
        <div><a href="https://www.trademe.co.nz/electronics-photography/other-electronics/electronic-components/other/auction-1628302081.htm?rsqid=a42479ffc5a54d57a2f2d3102e0a888e" target="_blank">https://www.trademe.co.nz/<wbr>electronics-photography/other-<wbr>electronics/electronic-<wbr>components/other/auction-<wbr>1628302081.htm?rsqid=<wbr>a42479ffc5a54d57a2f2d3102e0a88<wbr>8e</a><br>
        </div>
        <div><a href="https://www.trademe.co.nz/electronics-photography/other-electronics/electronic-components/other/auction-1632177890.htm?rsqid=a42479ffc5a54d57a2f2d3102e0a888e" target="_blank">https://www.trademe.co.nz/<wbr>electronics-photography/other-<wbr>electronics/electronic-<wbr>components/other/auction-<wbr>1632177890.htm?rsqid=<wbr>a42479ffc5a54d57a2f2d3102e0a88<wbr>8e</a><br>
        </div>
        <div><a href="https://www.trademe.co.nz/electronics-photography/other-electronics/electronic-components/other/auction-1628152427.htm?rsqid=a42479ffc5a54d57a2f2d3102e0a888e" target="_blank">https://www.trademe.co.nz/<wbr>electronics-photography/other-<wbr>electronics/electronic-<wbr>components/other/auction-<wbr>1628152427.htm?rsqid=<wbr>a42479ffc5a54d57a2f2d3102e0a88<wbr>8e</a><br>
        </div>
        <div><br>
        </div>
        <div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> *
            Plan what I2C module are needed and list the used addresses</span><br>
        </div>
        <div> * the RPI / linux has good I2C diagnostics. (apt install
          i2c-tools)<br>
        </div>
        <div>
          <div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">
            <div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"> * <a href="https://github.com/ControlEverythingCom/Raspberry-Pi-I2C-Python" target="_blank">https://github.com/<wbr>ControlEverythingCom/<wbr>Raspberry-Pi-I2C-Python</a></div>
             * Run Python on the RPI to do the polling of the I2C
            modules (switches and output lamps etc) and sending the
            associated UDP packet to X-Plane</div>
        </div>
        <div>
          <div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"> *
            Python to X-Plane via UDP (<a href="https://github.com/luizcantoni/x-pi" target="_blank">https://github.com/<wbr>luizcantoni/x-pi</a>)</div>
           * Here is the list of XPlane parameters that can be
          read/changed: (suspect most are in sim/cockpit2/...)<br>
        </div>
        <div><a href="http://www.xsquawkbox.net/xpsdk/docs/DataRefs.html" target="_blank">http://www.xsquawkbox.net/<wbr>xpsdk/docs/DataRefs.html</a></div>
        <div> * UDP protocol for reference (<a href="http://www.nuclearprojects.com/xplane/xplaneref.html" target="_blank">http://www.nuclearprojects.<wbr>com/xplane/xplaneref.html</a>)<br>
        </div>
        <div><br>
        </div>
        <div>Might make a mini instrument panel for myself, :-)</div>
        <div>Hope this helps,</div>
        <div>/s</div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On 15 May 2018 at 16:09, Trevor Wignall
          <span dir="ltr"><<a href="mailto:zl3adz@gmail.com" target="_blank">zl3adz@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Paul from Oxford expressed interest in ways
              of connecting multiple inputs (switches and
              potentiometers) to the likes of an Arduino, rather than
              having to use multiple Arduinos. 
              <div><br>
              </div>
              <div>This is actually a common and easily solved problem.
                In fact there are multiple solutions, using different
                approaches with different advantages or disadvantages,
                using multiplexers, I2C and serial expanders. There are
                a number of useful integrated circuits (ICs) which could
                be useful, including members of the 4000 series of CMOS
                ICs (refer to <a href="https://en.wikipedia.org/wiki/List_of_4000_series_integrated_circuits" target="_blank">https://en.wikipedia.org/wi<wbr>ki/List_of_4000_series_integra<wbr>ted_circuits</a>
                ). Common ICs include the 4051 multiplexer (also known
                as a one of eight selector), the 4094 serial to parallel
                shift register, and the 4021 parallel to serial shift
                register. All three of these ICs will run off 5Volts and
                are cheap, readily obtainable, 16 pin devices.
                <div><br>
                </div>
                <div>The 4051 is useful for allowing up to 8 digital or
                  analog signals to be scanned using just one digital or
                  analog input of the Arduino, with 3 digital output
                  lines from the Arduino being used to select which of
                  the 8 inputs to read. It can also be used to select
                  one of up to 8 output lines to drive - more on this
                  later. The same three address lines can be used to
                  drive multiple 4051 selectors.</div>
                <div><br>
                </div>
                <div>The 4021 is useful for allowing up to 8 digital
                  signals to be read in turn using just one digital
                  input of the Arduino, but requires only two output
                  lines from the Arduino - a "Clock" line and a "Strobe"
                  or "Load" or "Reset" line, which is used to restart
                  the scan process. Multiple 4021s can be wired in
                  series so the same two output and one input lines can
                  be used to scan 16, 24, 32,... digital signals. </div>
                <div><br>
                </div>
                <div>The 4094 is used to drive up to 8 digital outputs
                  (such as indicator LEDs) using three digital outputs
                  from the Arduino - a "Data" line, a "Clock" line and a
                  "Strobe" or "Load" line. Again multiple 4094s can be
                  wired in series so the same three outputs can be used
                  to drive 16, 24, 32,... digital outputs.</div>
                <div><br>
                </div>
                <div>But wait - there's less!</div>
                <div><br>
                </div>
                <div>The same "Clock" and "Load" or "Strobe" lines can
                  be used to drive both 4094 and 4021 shift registers at
                  the same time.</div>
                <div><br>
                </div>
                <div>A final trick - multiple switches can be scanned by
                  wiring them into a matrix such as an 8x8 array or an
                  8x16 array. If two switches on the same row or column
                  can be closed at the same time, diodes can be used to
                  allow the sense of each switch to be determines
                  without "Phantom keys". There is no reason an 8x16
                  array cannot be scanned using a 4094 to drive a 4051
                  which selects one of 8 rows, and a pair of 4021s to
                  read up to 16 switches on that row - or the 12
                  individual switches of a 12 position rotary switch.</div>
                <div>And the same outputs of the 4094 can be used to
                  drive the address inputs of a second 4051 which can
                  scan 8 analog inputs. The remaining 5 outputs of the
                  4094 can be used to drive indicator LEDs and a second
                  4094 can be added to drive another 8 LEDs if necessary
                  All of this can be achieved with about 5 ports of the
                  Arduino - an analog input, a digital input and three
                  digital outputs including a Clock and a Strobe which
                  can also be used to drive other circuitry.</div>
              </div>
              <div><br>
              </div>
              <div>There are other approaches, but this will give an
                idea of what sort of things can be done.</div>
              <div><br>
              </div>
              <div>Cheers</div>
              <span class="m_1590007228355287675HOEnZb"><font color="#888888">
                  <div>Trevor</div>
                </font></span></div>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <br>
  </div>

<br>______________________________<wbr>_________________<br>
Chchrobotics mailing list <a href="mailto:Chchrobotics@lists.ourshack.com">Chchrobotics@lists.ourshack.<wbr>com</a><br>
<a href="https://lists.ourshack.com/mailman/listinfo/chchrobotics" rel="noreferrer" target="_blank">https://lists.ourshack.com/<wbr>mailman/listinfo/chchrobotics</a><br>
Mail Archives: <a href="http://lists.ourshack.com/pipermail/chchrobotics/" rel="noreferrer" target="_blank">http://lists.ourshack.com/<wbr>pipermail/chchrobotics/</a><br>
Meetings usually 3rd Monday each month. See <a href="http://kiwibots.org" rel="noreferrer" target="_blank">http://kiwibots.org</a> for venue, directions and dates.<br>
When replying, please edit your Subject line to reflect new subjects.<br></blockquote></div><br></div>