Difference between revisions of "ProjectNotes:KSPKontroller"

From Eleccelerator Wiki
Jump to: navigation, search
(Inspiration and Physical Design)
 
(3 intermediate revisions by one user not shown)
Line 2: Line 2:
  
 
=Inspiration and Physical Design=
 
=Inspiration and Physical Design=
 +
 +
[http://www.reddit.com/r/AskElectronics/comments/1k2t5e/help_w_project_ksp_controller_suite/ Original Reddit post]
  
 
[http://imgur.com/a/ZTnyh In-game screenshot album of the cockpit]
 
[http://imgur.com/a/ZTnyh In-game screenshot album of the cockpit]
Line 98: Line 100:
 
* Food, Oxygen, Water levels (visual and maybe numeric)
 
* Food, Oxygen, Water levels (visual and maybe numeric)
  
 +
=Part Choices=
 +
 +
==Imposed Limitations==
 +
 +
Frank has decided to put a few limits on capabilities:
 +
 +
* 8 analog inputs with 12 bit accuracy. (joysticks, throttle, potentiometer)
 +
 +
* 32 digital inputs (buttons, switches), 16 is ideal
 +
 +
* 32 digital outputs (ordinary LEDs), 16 is ideal
 +
 +
* 16 PWM outputs (LEDs that dim, analog panel dials), 8 is ideal
 +
 +
* 8 servos
 +
 +
* 1 colour display
 +
 +
* 1 monochrome display
  
 
==Microcontroller/Microprocessor==
 
==Microcontroller/Microprocessor==
Line 106: Line 127:
  
 
Raspberry Pi or any "single board computer" (BeagleBone, BeagleBoard, PandaBoard, GumStix, etc) is not recommended. Expensive, code gets complicated, communication gets complicated, latency adds up, plus a lot more problems.
 
Raspberry Pi or any "single board computer" (BeagleBone, BeagleBoard, PandaBoard, GumStix, etc) is not recommended. Expensive, code gets complicated, communication gets complicated, latency adds up, plus a lot more problems.
 +
 +
Most likely, Frank's first hardware prototype will use a STM32F405RG
  
 
==Panel==
 
==Panel==
Line 118: Line 141:
  
 
If you are super rich http://www.screenkeys.com/ or http://www.nkkswitches.com/SmartSwitch-ProgrammableSwitches/ or http://www.rjselectronics.com/?LCD_Switches:Q5 , RJS's Q5 keys are "Unit cost for 6 pieces is $34 each + $45 shipping", NKK's keys are somewhere over $60 each from Mouser. These keys will add a significant bit of complexity to the electronics and code but if it's an unlimited budget project, definitely worth the effort.
 
If you are super rich http://www.screenkeys.com/ or http://www.nkkswitches.com/SmartSwitch-ProgrammableSwitches/ or http://www.rjselectronics.com/?LCD_Switches:Q5 , RJS's Q5 keys are "Unit cost for 6 pieces is $34 each + $45 shipping", NKK's keys are somewhere over $60 each from Mouser. These keys will add a significant bit of complexity to the electronics and code but if it's an unlimited budget project, definitely worth the effort.
 +
 +
Frank has settled on a few [http://www.digikey.ca/product-detail/en/LP6OA2ASRG/EG4640-ND/1950616 E-Switch LP6 series] buttons
  
 
==Analog Dials==
 
==Analog Dials==
Line 134: Line 159:
  
 
Black and white graphic LCDs might be a substitute for real analog dials. [http://www.buy-display.com/default/graphic-lcd-display-module-1/160x64-graphic-lcd-display-module.html buy-display.com has some 160x64 displays] that might be suitable. LCDs offer a lot more flexibility, obviously.
 
Black and white graphic LCDs might be a substitute for real analog dials. [http://www.buy-display.com/default/graphic-lcd-display-module-1/160x64-graphic-lcd-display-module.html buy-display.com has some 160x64 displays] that might be suitable. LCDs offer a lot more flexibility, obviously.
 +
 +
After some mock up models, Frank has decided on the [http://www.buy-display.com/default/lcd-manufacturers.html this 3.0" 240x120 LCD]
  
 
==Toggle Switches==
 
==Toggle Switches==
Line 144: Line 171:
  
 
[http://www.digikey.ca/product-search/en?FV=fff40011%2Cfff80064%2C1140004%2C1140050%2C11400be%2C11400e1%2C114016f%2C1140190%2C11403c6%2C8280025%2C8280028%2C8280029%2C828002a&mnonly=0&newproducts=0&ColumnSort=1000011&page=1&stock=1&pbfree=0&rohs=0&quantity=&ptm=0&fid=0&pageSize=100 Illuminated (red or green or red/green) toggle switches on digikey.ca]
 
[http://www.digikey.ca/product-search/en?FV=fff40011%2Cfff80064%2C1140004%2C1140050%2C11400be%2C11400e1%2C114016f%2C1140190%2C11403c6%2C8280025%2C8280028%2C8280029%2C828002a&mnonly=0&newproducts=0&ColumnSort=1000011&page=1&stock=1&pbfree=0&rohs=0&quantity=&ptm=0&fid=0&pageSize=100 Illuminated (red or green or red/green) toggle switches on digikey.ca]
 +
 +
This is a possible pair: [http://www.digikey.ca/product-detail/en/GTB-2B18/CW204-ND/3190603 switch] and [http://www.digikey.ca/product-detail/en/GT-4R/CWI312-ND/3587645 cover]
  
 
==Joysticks==
 
==Joysticks==
Line 153: Line 182:
 
Sliding potentiometers are easy to find and will probably be mounted onto a perfboard, and perfboard mounted to the panel. Just make sure it has a nice knob. Motorized is optional but requires a H-bridge to be built.
 
Sliding potentiometers are easy to find and will probably be mounted onto a perfboard, and perfboard mounted to the panel. Just make sure it has a nice knob. Motorized is optional but requires a H-bridge to be built.
  
Video gaming flight controllers or joysticks are acceptable but they are expensive and bulky. Interfacing them will require a USB host interface, or taking them apart.
+
Video gaming flight controllers or joysticks are acceptable but they are expensive and bulky. The player should connect them directly into the computer so they are irrelevant.
  
 
==Nav Ball==
 
==Nav Ball==
  
 
[http://www.adafruit.com/products/335 2.8 inch TFT LCD with resistive touchscreen], holes make it easy to mount, fairly fast interface
 
[http://www.adafruit.com/products/335 2.8 inch TFT LCD with resistive touchscreen], holes make it easy to mount, fairly fast interface
 +
 +
==Throttle==
 +
 +
[http://www.digikey.ca/product-search/en?FV=fff40004%2Cfff80063%2Cb85c9a%2Cb85ca5%2Cb85ca8%2Cb85cbe%2Cb85ccf%2Cb87382%2Cb875d8%2Cb875dd%2Cb875df&mnonly=0&newproducts=0&ColumnSort=1000011&page=1&stock=1&pbfree=0&rohs=0&quantity=&ptm=0&fid=0&pageSize=100 largest sliding potentiometers on Digikey.ca]
  
 
==Crazy==
 
==Crazy==

Latest revision as of 11:04, 21 August 2013

Notes for the KSP Kontroller project

Contents

[edit] Inspiration and Physical Design

Original Reddit post

In-game screenshot album of the cockpit

[edit] Strategy

One-off DIY (meaning super expensive awesome looking components are allowed)? DIY kit-able (all components cheap and easy to get and work with)? Full product for sale (difficult components allowed but must be cheap)?

Frank is going to pick components for suitable a DIY kit. One LCD, zero to two analog dial meters, 6 illuminated square buttons for custom actions, 2 illuminated switches for SAS and RCS, 1 protected toggle switch for staging. Three small thumbsticks, one slide throttle.

[edit] Data Options

Before decided upon, a comprehensive list of potential components will be categorized as necessary, optional, or unnecessary. Following this list, each necessary or optional component will be revisited in its entirety, including its options for purchase, characteristics in design, fabrication, construction, implementation, and/or software-related characteristics.

  • SAS, RCS, Lights, Gear, and Brakes Toggle
  • SAS, RCS, Lights, Gear, and Brakes Indicator
  • Stage Push Button
  • Stage Enabler Toggle
  • Stage Enabler Indicator
  • Abort Push Button
  • Abort Enabler Toggle
  • Abort Enabler Indicator
  • Time Warp Slow Down and Speed Up
  • Orbital, External, and IVA View Selector Push Buttons
  • Staging and Docking Mode Pushbuttons
  • Zoom In, Zoom Out Push Buttons
  • View Rotation Stick
  • Custom Action Group 1-10 Push Buttons
  • Custom Action Group 1-10 Indicators
  • Autosave
  • Load


  • Hands-On Navigational Joystick
  • Throttle
  • Throttle Enabler Toggle
  • Throttle Enabler Indicator
  • Translational Docking Stick


  • Navigation Ball
  • Heading Indicator (numeric)
  • Velocity Display
  • Velocity Specifier (Surface, Orbit, Target)
  • Delta-V Display (numeric and visual)
  • Time to Delta-V (numeric)
  • Estimated Burn Time (numeric)
  • Vertical Speed (numeric and/or visual)
  • Barometric Altimeter (numeric)
  • Radar Altimeter (visual and maybe numeric)
  • G-Force (visual)
  • Extreme G-Force Indicator


  • Overheat Display (visual)
  • Lowest Stage Fuel Level (visual and maybe numeric)
  • Total Fuel Level (visual and maybe numeric)
  • Total Liquid Fuel, Oxidizer, Solid Fuel, and Electricity Level (visual and maybe numeric)
  • Low Food, Oxygen, and/or Water Indicator (life support will be implemented soon, I think)
  • Food, Oxygen, Water levels (visual and maybe numeric)

[edit] Part Choices

[edit] Imposed Limitations

Frank has decided to put a few limits on capabilities:

  • 8 analog inputs with 12 bit accuracy. (joysticks, throttle, potentiometer)
  • 32 digital inputs (buttons, switches), 16 is ideal
  • 32 digital outputs (ordinary LEDs), 16 is ideal
  • 16 PWM outputs (LEDs that dim, analog panel dials), 8 is ideal
  • 8 servos
  • 1 colour display
  • 1 monochrome display

[edit] Microcontroller/Microprocessor

STM32F4, actually probably overkill, but STM32F4 Discovery is a good place to get started, or Netduino 2 or Netduino Plus 2. I have both of these, plus my own custom boards. F2 or F1 would probably also work. L1 will also work but we don't need super low power features. LPC family from NXP is an option, start with the mbed.

8 bit AVR (must have native USB) might be too slow to keep up a good frame rate on the LCD for the nav ball. If it's fast enough, then great, if not, then upgrade. I'd say we try it out, since it makes it easy for people not as skilled with ARM.

Raspberry Pi or any "single board computer" (BeagleBone, BeagleBoard, PandaBoard, GumStix, etc) is not recommended. Expensive, code gets complicated, communication gets complicated, latency adds up, plus a lot more problems.

Most likely, Frank's first hardware prototype will use a STM32F405RG

[edit] Panel

Silver coloured laser cut acrylic. Easy to get from Ponoko. Will probably start off with clear acrylic and spray paint it silver, so the LCD and meters are still protected.

Carbon fiber, diamond steel sheets, plain aluminum sheets, all possible but harder and more expensive. Getting something water jet cut would be cool but expensive. I don't have many metal working tools at home.

[edit] Buttons

Digi-Key product results for green or red/green illuminated square buttons, through hole or panel mounted, sorted by price, text can be printed onto transparent stickers

If you are super rich http://www.screenkeys.com/ or http://www.nkkswitches.com/SmartSwitch-ProgrammableSwitches/ or http://www.rjselectronics.com/?LCD_Switches:Q5 , RJS's Q5 keys are "Unit cost for 6 pieces is $34 each + $45 shipping", NKK's keys are somewhere over $60 each from Mouser. These keys will add a significant bit of complexity to the electronics and code but if it's an unlimited budget project, definitely worth the effort.

Frank has settled on a few E-Switch LP6 series buttons

[edit] Analog Dials

http://www.amazon.com/Analog-Voltage-Panel-Meter-Voltmeter/dp/B00A4S9ZHW/ http://www.amazon.com/gp/product/B0051E8ONA/ , these are 0-5V, using a 3.3V microcontroller might require extra components, not a huge issue. 0-1V meters also exist

Current panel meters also exist, and a simple resistor value would be enough to make the voltage range issue go away. 0 to 10mA, or something around that would work. http://www.adafruit.com/products/252

Would probably replace the white voltage scale with a black scale. These can only be used for data that can be represented by a percentage (fuel, electric charge, atmosphere) because we can't dynamically change text on it.

Or a micro servo can be used. The panel meter's needle looks pretty thin, making them heavier might be risky.

I'm still trying to hunt some real instrument dials.

Sub-micro servos are tiny, HobbyKing example, might need a gear for a wider rotation, McMaster Carr has gears.

Black and white graphic LCDs might be a substitute for real analog dials. buy-display.com has some 160x64 displays that might be suitable. LCDs offer a lot more flexibility, obviously.

After some mock up models, Frank has decided on the this 3.0" 240x120 LCD

[edit] Toggle Switches

https://www.sparkfun.com/products/11310 might be good for "lift off" and "next stage"

RCS and SAS are on the push button panel inside the game, but illuminated toggle switches may be a better choice.

Illuminated (red or green or red/green) rocker switches on digikey.ca

Illuminated (red or green or red/green) toggle switches on digikey.ca

This is a possible pair: switch and cover

[edit] Joysticks

http://www.adafruit.com/products/512 are easy to mount into a panel

http://www.reallycooltoys.com/other-joystick-TX.html are expensive, but they have triple axis industrial joysticks

Sliding potentiometers are easy to find and will probably be mounted onto a perfboard, and perfboard mounted to the panel. Just make sure it has a nice knob. Motorized is optional but requires a H-bridge to be built.

Video gaming flight controllers or joysticks are acceptable but they are expensive and bulky. The player should connect them directly into the computer so they are irrelevant.

[edit] Nav Ball

2.8 inch TFT LCD with resistive touchscreen, holes make it easy to mount, fairly fast interface

[edit] Throttle

largest sliding potentiometers on Digikey.ca

[edit] Crazy

Got several grand to throw around?

http://www.aircraftspruce.com/categories/avionics_instruments/av/menus/in/index.html

http://gamesharkstore.ca/viewItem.asp?idProduct=4503&idCategory=450&scid=saiteksite

[edit] Software and Firmware

[edit] Strategy

The microcontroller can create two interfaces, one will be a generic HID joystick profile, and the second one will be custom HID or something else custom. The goal is to avoid COM port selection and avoid driver installation if possible.

A KSP plugin is required. Another way of doing it is probably making a "trainer" type thing but that's a lot more difficult. Stick with the official method of making plugins using C# and the Unity Engine API.

The plugin should be agnostic about the MCU's hardware, update all relevant data at a maximum rate of 15 or 20 times per second per variable.

Whatever MCU is chosen, LCD interface is the most important due to frame rate being critical. Joystick and throttle input is second priority. Everything else can use I2C connected chips (GPIO expanders, PWM/DAC outputs, ADC inputs) if we run out of pins.

Drawing the nav ball will be very hard. Having the computer draw it will take bandwidth, but having the MCU render it will be very processing intensive if a 3D look is required.

Use LUFA as the USB library for 8 bit AVR, and STM32 has their own USB library. mbed also has their own. If an additional USB host port is required, then use a MAX3421E or look for a MCU with 2 USB OTG ports (but this is much more difficult and eliminates AVR as a possibility).

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox