Giter Club home page Giter Club logo

dhc2-beaver-sim's Introduction

A little pandemic project to build a DHC-2 Beaver cockpit in the basement.

This repo contains the software used for the integration, with miscellaneous other notes.

The panel instruments are displayed with [g3py]hhttps://github.com/patricksurry/g3py) running on a Raspberry Pi 4. The Pi also monitors various physical inputs via an Arduino Mega connected by USB.

The Arduino Mega runs the sketch in controlpanel/controlpanel.ino and manages a switch panel with up to 32 digital pins, along with a collection of (push-button) rotary encoders on the instrument panel. The encoders are managed by a GPIO breakout board like this one MCP23017. Each encoder requires three pins so a 16-pin breakout hosts up to five encoders, and can be daisy chained (up to 8 boards I believe). The Arduino tracks encoder changes via interrupt, and provides accumulated change along with current switch state on demand via the serial protocol.

The logical mapping of switches from the Arduino pins is configured in switchmap.py, and serialmonitor.py runs a very simple polling routine which checks for state changes on a regular basis.

Raspberry Pi setup

TODO: this will also forward the input actions to FS2020 via python-simconnect.

Tool to disable mouse pointer unless moving

sudo apt-get install unclutter

Wait for the network before launching startup script:

sudo raspi-config # System -> Network -> Wait for network at boot

Create /etc/xdg/lxsession/LXDE-pi/autostart (or ~/.config/lxsession/LXDE-pi/autostart; see https://forums.raspberrypi.com/viewtopic.php?t=294014) to start the browser and arduino monitoring at startup, it should contain just:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@bash /home/pi/dhc2-beaver-sim/startup.sh

On restart, logs will be found in:

 ~/.cache/lxsession/LXDE-pi/run.log

Some tweaking might be necessary for the browser settings, for example improved framerate; enable hardware acceleration; notes on kiosk setup. The current settings can be found in the startup.sh script. It's also fiddly to get the browser to display on two screens, e.g. the display is always set to 0, wwith the indow position giving the offset from one screen to the second.

setup rpi screens resolution and orientation (via gui display configuration or cli):

in my case I want orientation > left

click top-left > preferences > screen configuration

or via sudo raspi-config # advanced options > resolution > ...

$ tvservice -l
2 attached device(s), display ID's are :
Display Number 2, type HDMI 0
Display Number 7, type HDMI 1

$ tvservice -s -v 2
state 0x6 [DVI CUSTOM RGB full 4:3], 1024x768 @ 75.00Hz, progressive

$ tvservice -m DMT -v 2
Group DMT has 6 modes:
           mode 4: 640x480 @ 60Hz 4:3, clock:25MHz progressive
           mode 6: 640x480 @ 75Hz 4:3, clock:31MHz progressive
           mode 9: 800x600 @ 60Hz 4:3, clock:40MHz progressive
           mode 11: 800x600 @ 75Hz 4:3, clock:49MHz progressive
  (prefer) mode 16: 1024x768 @ 60Hz 4:3, clock:65MHz progressive
           mode 18: 1024x768 @ 75Hz 4:3, clock:78MHz progressive

$ tvservice -s -v 7
state 0xa [HDMI CUSTOM RGB full 4:3], 1024x768 @ 75.00Hz, progressive

$ tvservice -m DMT -v 7
Group DMT has 11 modes:
           mode 4: 640x480 @ 60Hz 4:3, clock:25MHz progressive
           mode 5: 640x480 @ 72Hz 4:3, clock:31MHz progressive
           mode 6: 640x480 @ 75Hz 4:3, clock:31MHz progressive
           mode 8: 800x600 @ 56Hz 4:3, clock:36MHz progressive
           mode 9: 800x600 @ 60Hz 4:3, clock:40MHz progressive
           mode 10: 800x600 @ 72Hz 4:3, clock:50MHz progressive
           mode 11: 800x600 @ 75Hz 4:3, clock:49MHz progressive
           mode 16: 1024x768 @ 60Hz 4:3, clock:65MHz progressive
           mode 17: 1024x768 @ 70Hz 4:3, clock:75MHz progressive
           mode 18: 1024x768 @ 75Hz 4:3, clock:78MHz progressive
           mode 85: 1280x720 @ 60Hz 16:9, clock:74MHz progressive

Finding specific LCD panels.

Viewable area, outline area often constrained

Find common sizes (diagonal) via something like https://www.panelook.com/modelsearch.php?op=size

Figure out a size and aspect ratio that suits your needs (e.g. https://en.wikipedia.org/wiki/Display_size)

Either find a used monitor with the right size to disassemble, or get a bare LCD panel on ebay, along with a matching controller board.

19" monitor for main instrument panel - LG Flatron E1911TX, jumped power switch with a secondary push button

center panel: LP156WH4-TLP2 + controller https://www.ebay.ca/itm/163835481523

Useful links (YMMV)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.