Jump to content

Custom hardware / simpit repository. For people who take KSP a little too far.


Mulbin

Recommended Posts

  • 3 weeks later...

The Arduino Mega can be used as a HID device but you have to flash a new bootloader. The Teensy has native HID support. The Teensy is also much faster, the Mega runs at 16mhz vs the newest Teensy the 3.6 which runs at 180mhz. Also the microcontroller in the Mega is only 8-bit the Teensy's is 32-bit. The Teensy is what mechanical keyboard builders use.

But the Mega has female headers. With the Teensy you have to purchase the headers separately and have solder them on. So the Mega out of the box is easier to use. on the flip side though you can soldered female headers or male headers so that you can plug the Teensy in to a breadboard.

For the I/O side of things, the Teensy has 25 Analog Inputs and 2 Analog Outputs so the Teensy can output 12 bit audio :o

The Mega has 16 analog inputs and 54 I/O pins total. The Teensy has 62 I/O Pins total but you can only use 42 on a breadboard.

 

As for price. The Teensy 3.6 is $30, a genuine Arduino Mega 2560 r3 is $38. But you can get clones for around $20.

 

Just some things to consider.

 

Edited by Krewmember
Link to comment
Share on other sites

@Krewmember I saw on your thread you had a RPM style controller for a Simpit. I found a Sony Trinitron PVM-8200T 8" CRT, has that project got anywhere where that would make it usable?

With your experience (I mean everybody, not just @Krewmember) what would be best. I was hoping to use it with a breadboard so that I could easily adjust the layouts and also support reusability. Is this a viable/good idea?

Link to comment
Share on other sites

2 hours ago, KerBlitz Kerman said:

@Krewmember I saw on your thread you had a RPM style controller for a Simpit. I found a Sony Trinitron PVM-8200T 8" CRT, has that project got anywhere where that would make it usable?

A RPM style multi-function display would look petty cool on that monitor. Sadly, it did not get any farther then the last image that I posted.

I was coding it in python and could not find a 3d library that would meet the requirements to render the navball :/

At the moment I'm experimenting with Unity 3d and the kRPC C# Library and got some pretty good results. As Unity 3d has a good UI system and is designed for 3d games and apps. I will see if I can get some gifs and images of the tests and post them here.

 

2 hours ago, KerBlitz Kerman said:

With your experience (I mean everybody, not just @Krewmember) what would be best. I was hoping to use it with a breadboard so that I could easily adjust the layouts and also support reusability. Is this a viable/good idea?

If you are going to use a breadboard I personally would get a Teensy. With male headers you can use it like a DIP package IC.

 

2 hours ago, KerBlitz Kerman said:

Also, does  the refresh rate make a difference for a simpit?

Refresh rate of what? I'm going to guess you mean monitor refresh rate. Yes, you will notice the difference between say a 60hz and 144hz monitor, with a higher refresh rate fast movements will be smoother and have less ghosting. But you have to make sure that your graphics card can support higher refresh rates and has the power to run a higher refresh rate monitor. Also 120hz and 144hz monitors are more expensive then 75hz or 60hz monitors. I think that in a simpit for kerbal monitor or projector resolution will make more of a difference. As for external monitors for things like a multi-function displays and instruments, you can not get data from kerbal fast enough for refresh rate to make a difference.

 

It's up to you to decide.

Edited by Krewmember
Link to comment
Share on other sites

On 28/02/2018 at 9:04 AM, KerBlitz Kerman said:

So thinking of building a simpit based on a usb keyboard and was wondering if you knew of a good controller for a usb keyboard? I was looking at a Teensy but you all probably know of good if not better chips for the job.

There's a few options:

  • A USB keyboard. :) You can go a long way by gutting a cheap keyboard and connecting your own switches and thing to the key pads.
  • A Leonardo class Arduino compatible. Either get a Leonardo board, or one of the clones like a Pro Micro from SparkFun. This is the bare minimum; these boards can easily emulate a USB HID device. Arduino Uno and Mega can not without some hard work.
  • Teensy. Much more powerful controllers - more inputs, faster clock speed. The most recent even have an FPU, they're great for doing complex floating point math with telemetry from the game. They're popular with the DIY mechanical keyboard crowd.
6 hours ago, KerBlitz Kerman said:

Also, does  the refresh rate make a difference for a simpit?

Not as much as you might think. My controller uses KSPSerialIO with an 80ms refresh, equivalent to 12.5fps. I've never noticed any latency between hitting an actuator and the game recognising it.

Link to comment
Share on other sites

Okay, I have a cousin (who is WAY older then me, don't know how that it is he is technically a cousin) who flies a PA-32R, I'll see if he knows of old avionics shops where you can get one with a CRT. Especially an old navball if that is possible.

I think also that if people, say @zitronen and somebody who could help design a UI interface that RPM/ASET styled multipurpose interfaces but that would run on say a Pi, arduino, or a programmable microcontroller. this would run on say a CRT with Extra Immersion guaranteed. Using a USB keyboard HID you would have the buttons.

Link to comment
Share on other sites

I must apologize for my wording,

21 hours ago, Krewmember said:

Refresh rate of what? I'm going to guess you mean monitor refresh rate.

I meant the board processor refresh

On 2/28/2018 at 1:10 PM, Krewmember said:

The Teensy is also much faster, the Mega runs at 16mhz vs the newest Teensy the 3.6 which runs at 180mhz.

 

Link to comment
Share on other sites

So is there such a thing as an DPST switch that when release springs back to off?

Because I thought I'd get a four way D-Pad then set that as up, down, left and right controls (RCS) and one of the possibly nonexistent DPST switches that spring to center as forward, backwards.

Edited by KerBlitz Kerman
Link to comment
Share on other sites

40 minutes ago, KerBlitz Kerman said:

So is there such a thing as an DPST switch that when release springs back to off?

Sure. Key word to search for is a momentary toggle switch, centre return. But if you're planning on using it as forwards/reverse, don't you want a DPDT? Something like https://www.amazon.com/Heavy-Handle-Momentary-Toggle-Switch/dp/B000LFVFA8

Link to comment
Share on other sites

3 minutes ago, stibbons said:

Sure. Key word to search for is a momentary toggle switch, centre return. But if you're planning on using it as forwards/reverse, don't you want a DPDT? Something like https://www.amazon.com/Heavy-Handle-Momentary-Toggle-Switch/dp/B000LFVFA8

Sorry, my mistake, I meant SPDT

Link to comment
Share on other sites

I've just started my own controller, starting simple with a throttle slider.

Album XHRqb will appear when post is submitted

...but I'm not having any luck getting the Joystick library working. That's an Arduino Pro Micro and I'm using OS X. I've already tested this setup with different code, and between smoothing code and a capacitor, the slider generates a really smooth input, jittering by only 1.

...but then it doesn't report anything as a throttle.

Is there a particular library you folks are using that's easier to understand than this one (the examples are needlessly baroque on this one; I have to strip out all sorts of stuff just to get to the basics of "adjust throttle".)

Edited by Joshua A.C. Newman
Trying to get the image to load.
Link to comment
Share on other sites

On ‎1‎/‎03‎/‎2018 at 8:33 PM, Freshmeat said:

You can assign 32 buttons to one HID controller. I think the problem is a lot worse for people who use off the shelf controllers, we can design around the limitation.

Anyone know how to get KSP to listen for a Joystick button input in the API? This will be for some custom code to listen to a button array from a Teensy 2.0++.  I can't use the keymapping/joystick Options screen as what I want to do isn't available in that screen.

Wondering if anyone could point me to a github library that I might be able to study (if one exists that is).   I've worked out Keyboard bindings by following a brake toggle example I found on Github, but I fast ran out of options with the mod key while also avoiding any existing key mappings. I have quite a few rotary switches (each with 4 to 7 options) as well as a button panel.

EDIT: Nevermind - found this repo by pbatard I'll study when I get home. If anyone knows of any other methods - I'd still love to hear about any further references.

Edited by wile1411
Link to comment
Share on other sites

@wile1411 If you cannot access the function through the options screen, you might be able to do it with KSPSerialIO, or kRPC which is more powerful but somewhat more cumbersome. What do you want to do?

@KerBlitz Kerman The joystick I mentioned operates like the switch stibbons pointed to. I am not certain what you are asking about the mac.

Link to comment
Share on other sites

20 minutes ago, Freshmeat said:

@wile1411 If you cannot access the function through the options screen, you might be able to do it with KSPSerialIO, or kRPC which is more powerful but somewhat more cumbersome. What do you want to do?

There's two - I wanted buttons on the joystick to lock the brakes and another to lock staging. I know the API commands for those,  I just don't know how to get it programmed into a mod so KSP will listen to for the Joystick button press.

Link to comment
Share on other sites

3 minutes ago, wile1411 said:

how to get it programmed into a mod

The part you are missing is how to listen for joystick inputs in a mod. That would be dependent on your Operating System. That part has little to do with KSP, you can search the internet for code examples for your OS. I think the programming language for KSP mods is C# (somebody correct me if I'm wrong).

Link to comment
Share on other sites

1 hour ago, hugopeeters said:

The part you are missing is how to listen for joystick inputs in a mod. That would be dependent on your Operating System. That part has little to do with KSP, you can search the internet for code examples for your OS. I think the programming language for KSP mods is C# (somebody correct me if I'm wrong).

I am very ignorant on this matter, so pls forgive the question. What would the external part to the listener be? A separate program that API can listen to?

I initially thought that if KSP already had the ability to bind specific keys from the keyboard and also has joystick support, there would be someway to bind the joystick button in a similar manner to get the API to listen for a joystick button that would execute a piece of code when pressed.

Having said that, I do know that 'logical' things sometimes doesn't exist in KSP even though it seems like it should. If I'm on windows I was hoping the mod I referenced earlier might help. Do you know any other way?

FYI Here's my code I'm looking to modify - I've borrowed and modded slightly from a github by ericBG for the "parking break" when pressing the 'n' key. I want to rebind that to a joystick button.  The code in its current form isn't exactly user friendly if you want to customise it later, but it's short and sweet and works enough for me in a DLL I'm using that does a variety of functions.

using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using UnityEngine;

namespace ParkingBreak
{
    [KSPAddon(KSPAddon.Startup.Flight, false)]
    public class BreakToggle : MonoBehaviour
    {
        private string _keybind;
        public void Start()
        {
            if (_keybind == null) _keybind = "n";
        }
        public void Awake()
        {
            if (_keybind == null) _keybind = "n";
        }
        private void Update()
        {
            if (GameSettings.MODIFIER_KEY.GetKey() && Input.GetKeyDown(_keybind))
            {
                FlightGlobals.ActiveVessel.ActionGroups.SetGroup(KSPActionGroup.Brakes, true);
            }
        }
    }
}

 

Edited by wile1411
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...