[chbot] The X-plane multiplex problem

Mark Atherton markaren1 at xtra.co.nz
Tue May 15 11:01:27 BST 2018


Hey Synco,

Any chance of a quick tutorial how X-Plane processes incoming UDP 
packets, and assigns associated bytes/bit-positions to each function.

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.

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.

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.

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...

Need to see if Paul has joined the group email (Andrew, please mail me 
Paul's email address off-list).

-Mark

PS can't help but think that someone may have been through all this 
already ...


On 15/05/2018 6:45 PM, Synco Reynders wrote:
> Hi Paul (from Oxford) + Guys,
>    From what I could gauge 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.
> So following is an outline of the building blocks I'd use for my solution:
>
> HARDWARE
> --------
>          Ethernet/UDP               i2c + power
> X-Plane <============> RaspberryPi <----+--> Panel1<--> PanelX...
>           |
>                                       +--> Panel2 <--> PanelX...
>                                       :
>
>
> * Each panel should be self-contained, and have a common connector 
> (think ethernet connector + cable is good idea)
> * They can be in a combination of daisy-chaining or 
> star-configuration, to suit panel layout.
>
> A search for "i2c" on TradeMe is probably a good starting point for 
> available I2C modules... eg.
> https://www.trademe.co.nz/electronics-photography/other-electronics/electronic-components/other/auction-1627424038.htm?rsqid=a42479ffc5a54d57a2f2d3102e0a888e
> https://www.trademe.co.nz/electronics-photography/other-electronics/electronic-components/other/auction-1628302081.htm?rsqid=a42479ffc5a54d57a2f2d3102e0a888e
> https://www.trademe.co.nz/electronics-photography/other-electronics/electronic-components/other/auction-1632177890.htm?rsqid=a42479ffc5a54d57a2f2d3102e0a888e
> https://www.trademe.co.nz/electronics-photography/other-electronics/electronic-components/other/auction-1628152427.htm?rsqid=a42479ffc5a54d57a2f2d3102e0a888e
>
>  * Plan what I2C module are needed and list the used addresses
>  * the RPI / linux has good I2C diagnostics. (apt install i2c-tools)
>  * https://github.com/ControlEverythingCom/Raspberry-Pi-I2C-Python
>  * 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
>  * Python to X-Plane via UDP (https://github.com/luizcantoni/x-pi)
>  * Here is the list of XPlane parameters that can be read/changed: 
> (suspect most are in sim/cockpit2/...)
> http://www.xsquawkbox.net/xpsdk/docs/DataRefs.html
>  * UDP protocol for reference 
> (http://www.nuclearprojects.com/xplane/xplaneref.html)
>
> Might make a mini instrument panel for myself, :-)
> Hope this helps,
> /s
>
>
> On 15 May 2018 at 16:09, Trevor Wignall <zl3adz at gmail.com 
> <mailto:zl3adz at gmail.com>> wrote:
>
>     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.
>
>     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
>     https://en.wikipedia.org/wiki/List_of_4000_series_integrated_circuits
>     <https://en.wikipedia.org/wiki/List_of_4000_series_integrated_circuits>
>     ). 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.
>
>     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.
>
>     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.
>
>     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.
>
>     But wait - there's less!
>
>     The same "Clock" and "Load" or "Strobe" lines can be used to drive
>     both 4094 and 4021 shift registers at the same time.
>
>     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.
>     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.
>
>     There are other approaches, but this will give an idea of what
>     sort of things can be done.
>
>     Cheers
>     Trevor
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ourshack.com/pipermail/chchrobotics/attachments/20180515/3338a360/attachment-0001.html>


More information about the Chchrobotics mailing list