Jump to content

[Hardware, Plugin] Arduino based physical display + serial port io+ tutorial (24-11-19)


zitronen

Recommended Posts

Like many people here, I wanted to make an arduino physical display then quickly realized unity does not have the required serial IO name space. So the solution is to borrow someone else's code (http://sourceforge.net/projects/serialportnet/), which turns out is kind of incomplete but works. This plugin sends/receives data packets over the serial port, which should make it much easier for people wanting to build hardware for KSP but can't be bothered with making plugins as well.

Note: currently not fully working for windows 10 for some reason! You can receive data from KSP but not control anything.

Compatible with KSP 1.7 and later Versions 0.18.7 and older compatible with 1.2, versions 0.18.2 and older compatible with 1.1, 0.17.6 and older compatible with 1.0.5, 1.0, 0.90, versions 0.15 and older compatible with 0.23, 0.23.5, 0.24, 0.25

This plugin implements the following:

1. Packeting of serialized C# structure for efficient communications including checksums

2. Listing of available serial ports (only works on Windows PC, using registry hacks)

3. Automatic handshake and detection of display COM port at 38400 Baud

4. Bi-directional data transfer: control KSP from arduino [supported but not fully implemented yet, easy if you want to do it yourself] (added in 0.13)

5. Analogue axes control (added in 0.14)

Direct download link for the plugin: (V0.19.3b) - There may be newer versions posted in the thread, but this is the current recommended "stable" version.

https://drive.google.com/file/d/1eZOezBin0ysBdF0NLFIPLozm1iLWPxQa/view?usp=sharing

Also available on SpaceDock and CKAN

http://spacedock.info/mod/567/KSP Serial IO?ga=<Game+3102+'Kerbal+Space+Program'>

https://forum.kerbalspaceprogram.com/index.php?/topic/90246-the-comprehensive-kerbal-archive-network-ckan-package-manager-v1180-19-june-2016/ (Thanks hakan!)

Mac/linux version maintained by Marzubus:

Dead link

Source code for the plugin

https://github.com/zitron-git/KSPSerialIO

Source code for arduino - There may be newer versions posted in the thread, but this is the current recommended "stable" version.

https://drive.google.com/file/d/10qmZS4LY82eTYJHq9b3rJ87K4KY_Ferb/view?usp=sharing

Currently, these vessel parameters are sent to the serial port (updated 31-03-2019):

    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct VesselData
    {
        public byte id;              //1
        public float AP;             //2
        public float PE;             //3
        public float SemiMajorAxis;  //4
        public float SemiMinorAxis;  //5
        public float VVI;            //6
        public float e;              //7
        public float inc;            //8
        public float G;              //9
        public int TAp;              //10
        public int TPe;              //11
        public float TrueAnomaly;    //12
        public float Density;        //13
        public int period;           //14
        public float RAlt;           //15
        public float Alt;            //16
        public float Vsurf;          //17
        public float Lat;            //18
        public float Lon;            //19
        public float LiquidFuelTot;  //20
        public float LiquidFuel;     //21
        public float OxidizerTot;    //22
        public float Oxidizer;       //23
        public float EChargeTot;     //24
        public float ECharge;        //25
        public float MonoPropTot;    //26
        public float MonoProp;       //27
        public float IntakeAirTot;   //28
        public float IntakeAir;      //29
        public float SolidFuelTot;   //30
        public float SolidFuel;      //31
        public float XenonGasTot;    //32
        public float XenonGas;       //33
        public float LiquidFuelTotS; //34
        public float LiquidFuelS;    //35
        public float OxidizerTotS;   //36
        public float OxidizerS;      //37
        public UInt32 MissionTime;   //38
        public float deltaTime;      //39
        public float VOrbit;         //40
        public UInt32 MNTime;        //41
        public float MNDeltaV;       //42
        public float Pitch;          //43
        public float Roll;           //44
        public float Heading;        //45
        public UInt16 ActionGroups;  //46  status bit order:SAS, RCS, Light, Gear, Brakes, Abort, Custom01 - 10 
        public byte SOINumber;       //47  SOI Number (decimal format: sun-planet-moon e.g. 130 = kerbin, 131 = mun)
        public byte MaxOverHeat;     //48  Max part overheat (% percent)
        public float MachNumber;     //49
        public float IAS;            //50  Indicated Air Speed
        public byte CurrentStage;    //51  Current stage number
        public byte TotalStage;      //52  TotalNumber of stages
        public float TargetDist;     //53  Distance to targeted vessel (m)
        public float TargetV;        //54  Target vessel relative velocity (m/s)
        public byte NavballSASMode;  //55  Combined byte for navball target mode and SAS mode
                                     // First four bits indicate AutoPilot mode:
                                     // 0 SAS is off  //1 = Regular Stability Assist //2 = Prograde
                                     // 3 = RetroGrade //4 = Normal //5 = Antinormal //6 = Radial In
                                     // 7 = Radial Out //8 = Target //9 = Anti-Target //10 = Maneuver node
                                     // Last 4 bits set navball mode. (0=ignore,1=ORBIT,2=SURFACE,3=TARGET)
        public short ProgradePitch;  //56 Pitch   Of the Prograde Vector;  int_16 ***Changed: now fix point, actual angle = angle/50*** used to be (-0x8000(-360 degrees) to 0x7FFF(359.99ish degrees)); 
        public short ProgradeHeading;//57 Heading Of the Prograde Vector;  see above for range   (Prograde vector depends on navball mode, eg Surface/Orbit/Target)
        public short ManeuverPitch;  //58 Pitch   Of the Maneuver Vector;  see above for range;  (0 if no Maneuver node)
        public short ManeuverHeading;//59 Heading Of the Maneuver Vector;  see above for range;  (0 if no Maneuver node)
        public short TargetPitch;    //60 Pitch   Of the Target   Vector;  see above for range;  (0 if no Target)
        public short TargetHeading;  //61 Heading Of the Target   Vector;  see above for range;  (0 if no Target)
        public short NormalHeading;  //62 Normal Of the Prograde Vector;  see above for range;  (Pitch of the Heading Vector is always 0)
    }

 

The input packet from arduino is formated like this:

public struct ControlPacket
    {
        public byte id;
        public byte MainControls;                  //SAS RCS Lights Gear Brakes Precision Abort Stage 
        public byte Mode;                          //(Not implemented)
        public ushort ControlGroup;                //control groups 1-10 in 2 bytes
        public byte NavballSASMode;                //AutoPilot mode (See above for AutoPilot modes)(Ignored if the equal to zero or out of bounds (>10)) //Navball mode
        public byte AdditionalControlByte1;
        public short Pitch;                        //-1000 -> 1000
        public short Roll;                         //-1000 -> 1000
        public short Yaw;                          //-1000 -> 1000
        public short TX;                           //-1000 -> 1000
        public short TY;                           //-1000 -> 1000
        public short TZ;                           //-1000 -> 1000
        public short WheelSteer;                   //-1000 -> 1000
        public short Throttle;                     // 0 -> 1000
        public short WheelThrottle;                // 0 -> 1000
    };

 

Currently implemented controls:

 

  • SAS
  • RCS
  • Lights
  • Gear
  • Brakes
  • Abort
  • Stage
  • Action groups 1-10
  • SAS Modes
  • Pitch axis
  • Roll axis
  • Yaw axis
  • Translate X axis
  • Translate Y axis
  • Translate Z axis
  • Throttle
  • Wheel Throttle
  • Wheel Steer

 

Note: anything not mentioned here (like map view, precision) is not implemented yet.

Packet format:

The data packets are byte arrays with the following format:

Packet = [header][size][payload][checksum]
Header = [Header1=0xBE][Header2=0xEF]
size = [payload.length (0-255)]

 

Settings:

Settings file is located in the plugindata folder, currently these are the settings editable by the user:

 

 
    <double name="refresh">0.08</double>
    <string name="DefaultPort">COM1</string>
	<int name="BaudRate">38400</int>
    <int name="HandshakeDelay">2500</int>
	<int name="ThrottleEnable">2</int>
	<int name="PitchEnable">2</int>
	<int name="RollEnable">2</int>
	<int name="YawEnable">2</int>
	<int name="TXEnable">2</int>
	<int name="TYEnable">2</int>
	<int name="TZEnable">2</int>
	<int name="WheelSteerEnable">2</int>
	<int name="WheelThrottleEnable">2</int>
	<double name="SASTol">0.1</double>

 

refresh: how quickly the plugin sends out data, default once every 0.08 seconds (80ms)

DefaultPort: this is the port the plugin will check first

BaudRate: serial port baud rate

HandshakeDelay: we need to wait for the arduino to restart every time we open the port, by default we wait 2500ms. Try increase if you have connection problems.

ThrottleEnable: enable control of throttle axis from arduino

PitchEnable: enable value of pitch axis

RollEnable: enable value of roll axis

YawEnable: enable value of yaw axis

TXEnable: enable value of translation X axis

TYEnable: enable value of translation Y axis

TZEnable: enable value of translation Z axis

SASTol: The SAS will override your controls when you turn it on, this value allows you to override SAS if you move the roll pitch yaw control over a certain limit (10% travel by default)

Enable value settings for axes:

0: The internal value (supplied by KSP) is always used.

1: The external value (read from serial packet) is always used.

2: If the internal value is not zero use it, otherwise use the external value. (Now default!!!)

3: If the external value is not zero use it, otherwise use the internal value.

Using this plugin, you can make something like this:

IMG_8886s.jpg

 

 

More pictures:

https://sites.google.com/site/zitronfiles/IMG_8888s.jpg

https://sites.google.com/site/zitronfiles/IMG_8889s.jpg

If anyone is interested in buying a display or the PCB + parts to build the display yourself, send me a PM. I have some bits left over to make a few more.

It take too much effort to make and sell these, but send me a PM if you have difficulty finding parts.

Schematics and BOM below!

Schematic and BOM for the display: (V1)

https://sites.google.com/site/zitronfiles/Schematics_V1.pdf

https://sites.google.com/site/zitronfiles/BOM_V1.pdf

Tutorial for arduino

1. Simple Warning LEDs

Connect 3 LEDs and 3 1k resistors to pins 5 (green), 6 (yellow), and 7 (red)

IMG_8897.JPG

(I don't have any red LEDs so using blue instead)

Load the arduino code below. Start KSP and build a simple ship. The green led will turn on at launch, yellow led will turn on when G > 5 or fuel < 10%, and red led will turn on when G > 9 or fuel < 5%. These warnings can of course be customized in the arduino code. Since version 0.15 the warnings are for current stage fuel, not total.

2. Simple input example

Connect switches between pins 8 (SAS) and 9 (RCS) and ground (PIN --> Switch --> Ground). By default the input states are sent from the arduino at 40Hz

3. Action groups

Action groups are similar to normal inputs. If you set your controls to "toggle" in KSP, you can actually use a switch to turn an action group on and off. In the arduino code you can simply write: ControlGroups(10, HIGH); to turn on control group 10.

4. Axes

By default, the demo code uses the analogue input 0 to drive the throttle. Connect a pot to an analog input pin 0 and that's it (see arduino.cc/en/Tutorial/ReadAnalogVoltage). You will need to go to settings file and set ThrottleEnable to 1, by default throttle is not enabled (same with all other axes). Once throttle is enabled you will lose the ability to control it with keyboard.

Source code for arduino - There may be newer versions posted in the thread, but this is the current recommended "stable" version.

** Use link at start of this post for latest version, plugin data structure needs to match the arduino code or it may not work

1. Warning LED demo: https://sites.google.com/site/zitronfiles/KSPIODemo.zip

2. Input demo: https://sites.google.com/site/zitronfiles/KSPIODemo2.zip

3. Action groups: https://sites.google.com/site/zitronfiles/KSPIODemo3.zip

4. Input Axes: https://sites.google.com/site/zitronfiles/KSPIODemo16.zip

Forks and other projects using the plugin

@DrMarcel made a TCP version with an android client so you can finally have a Navball:

@KingLuxor made a super useful debugging tool, saves you opening/closing KSP, launching to orbit to test your controller/display

@madlemur has a updated version of this tool at https://github.com/madlemur/KSPSerialIODebugTool/releases

 

@Daid is forking the plugin code to make a Kerbal control panel with many buttons and switches, allowing you to fly your rocket without a keyboard

http://forum.kerbalspaceprogram.com/threads/105251-Yet-another-Kerbal-Control-Panel

@MrOnak has ported the Arduino code to AVR C, so you can use generic AVR micro controllers and not stuck with Arduino IDE

https://github.com/MrOnak/avr_KSPIO

@cm2227 is working on a version that will include mechjeb functionality for his display

http://forum.kerbalspaceprogram.com/threads/77921-Custom-Control-and-Display

Several people are working on a Mac version

http://forum.kerbalspaceprogram.com/threads/68642-Arduino-Addon-for-Mac

Working version by Marzubus:

https://github.com/unixunion/KSPSerialIO/tree/master/release/0.17.0/

@Mulbin has created a thread listing many example projects (not all using this plugin)

http://forum.kerbalspaceprogram.com/threads/66763-Custom-hardware-simpit-repository-For-people-who-take-KSP-a-little-too-far

Known Issues

1. Seems to have trouble detecting COM ports with high numbers, check and make sure you port number is less than 10, will fix later (now fixed in version 0.19.2)

2. If you are getting the handshake reply but not getting any data, it usually means you found the right COM port, everything is working but there is something wrong with the packet. This is typically caused by plugin and arduino code version miss match, try re-downloading the plugin and demo arduino code, you might have missed an update.

3. If you are having intermittent connection drops, it may be caused by the Arduino serial buffer getting filled up. You can try increasing the size of the rx buffer in HardwareSerial.h in your Arduino install.

License

CC BY, attribution appreciated.

Special Thanks

BlackNecro

 

Updates

1. 25-01-2014 Added a simple tutorial for arduino

2. 31-01-2014 Added schematics and BOM, updated plugin to 0.11

3. 04-02-2014 Found new bug, updated packet description

4. 08-02-2014 Updated plugin to 0.12, added user settings with some help from blacknecro, now you can define a default port which the plugin will try first

5. 25-02-2014 Updated plugin to 0.13, added support for inputs, added input demo, added description of input packet format

6. 11-03-2014 Updated plugin to 0.13.4, added action groups, lights, gear, brakes, abort, and stage

7. 15-03-2014 Updated plugin to 0.13.5, added output for current and total resources, and altitude above sea level

8. 29-03-2014 Updated plugin to 0.14.1, added analogue throttle control, updated packet structure

9. 09-04-2014 Updated plugin to 0.14.3, added pitch, roll, yaw, and x, y, z, translation axes controls, fixed a problem with some arduino bootloaders.

10. 04-05-2014 Updated plugin to 0.15.1 added Mission time, delta time, liquid fuel + oxidizer total and available for current stage, added orbital velocity, time to next node and delta V for next node

11. 16-08-2014 Updated plugin to 0.15.3 added roll, pitch, heading output, changed handshake so it is possible to connect multiple arduinos/devices (possible but still requires some work)

12. 08-09-2014 Oops, there were some problems with the latest version. I accidentally uploaded the debug code for 0.15.3 and demo8, so it didn't work. If you have recently downloaded the plugin and arduino code, you need to re-download them again. Sorry about that.

13. 08-10-2014 Tested to work with 0.25

14. 29-11-2014 Hopefully fixed a bug with axes controls when changing vessels (thanks AmeliaEatyaheart).

15. 14-12-2014 Changed to use time.unscaledTime so that the data refresh rate is constant during physical time warp: https://github.com/zitron-git/KSPSerialIO/issues/2

16. 17-12-2014 V0.16.0 Compatibility fix for KSP 0.90: changed stuff related to active vessel SAS

17. 17-12-2014 V0.16.1 Compatibility fix for KSP 0.90: fixed issue with patched conics null reference in career mode

18. 09-03-2015 V0.17.1 Added sending back of control statuses in a single uint16: SAS, RCS, Light, Gear, Brakes, Abort, Custom01 - 10, added simple function in arduino for reading the statuses, SAS and RCS controls are now synced when switching vessel (Freshmeat request), added return value for input() function in arduino code (MrOnak post #705), merged the controls code from Stibbons which works really well

Integrated new axes WheelSteer and WheelThrottle using code from Stibbons, now you can drive your rovers from your control panel, new config file settings for enabling/disabling axes from Stibbons.

19. 06-06-2015 V0.17.3 Added SOI name output in decimal format: sun-planet-moon (http://forum.kerbalspaceprogram.com/threads/66393-Hardware-Plugin-Arduino-based-physical-display-serial-port-io-tutorial-%2809-Mar%29?p=1922639&viewfull=1#post1922639), added max overheat percent (Sputnix request), Mach number, and indicated air speed.

20. 26-07-2015 V0.17.4 Added current and total stage numbers. Fixes to over heat.

21. 14-01-2016 V0.17.6 Option to disable handshake for windows 10 compatibility. Changes to axis input for KSP 1.0.5.

22. 21-04-2016 V0.18.1 Compatibility with KSP 1.1, including null reference fix from stibbons

23. 22-04-2016 V0.18.2 Fixed staging problem and stage numbers

24. 12-10-2016 V0.18.3 Compatibility with KSP 1.2

25. 17-10-2016 V0.18.4 Changed MNDeltaV from node delta V required to deltaV remaining (thanks @JeffSergeant), Added float TargetDist: Distance to targeted vessel (m), Added float TargetV: Target vessel relative velocity (m/s)

26. 22-10-2016 V0.18.4a Fixed a null reference bug when targeting a planet

27. 19-11-2016 V0.18.5 Added SAS mode input and output (thanks @c4ooo), see page 68 for details

28. 03-12-2016 V0.18.6 Added navball mode input and output (again thanks to @c4ooo, hero of the republic), Added easy to use functions to set and read SAS and navball modes, see page 70 for details

29. 23-04-2017 V0.18.7 Fixed broken axis control hooks reported by @AmeliaEatyaheart and @Freshmeat

30. 10-06-2017 V0.19.0 Fixed broken axis/SAS control issues reported by @Freshmeat and @#Pseudo,  Rebuilt against KSP 1.3 (previous version seem to work still, so this is just in case something changed)

31. 31-03-2019 V0.19.1 Added pro-grade, maneuver, and target pitch and heading angles, as well as normal vector, thanks to @c4ooo Recompiled against KSP version 1.6.1, seems to work OK

32. 24-11-2019 V0.19.2 Fixed very old bug of auto detections and connection with high number (>10) COM ports, thanks to detective work from @Jimbofarrar Recompiled against KSP version 1.7.3

33. 08-11-2020 v0.19.3b You no longer have to disable SAS to update vessel controls, so the annoy issue of having to disable SAS to move an axis is gone (the whole business with SASTol no longer an issue, it now doesn't do anything). Now the axis control behaves like normal joystick input. I didn't do anything apart from remove the check and doing some testing. Thanks to @c4ooo for letting me know. Also recompiled against 1.10.1

Edited by zitronen
Link to comment
Share on other sites

probibly use one of those usb<->ttl bridge chips like was used on older arduinos (you can get breakout boards for this chip from sparkfun, see link). newer arduinos just have a usb cdc serial port integrated into the bootloader (may be able to do the same on a pic). never used pic myself, mostly an avr guy. if i change to something its gonna be arm.

https://www.sparkfun.com/products/718

i got a 240x320 color tft screen with a spi interface (currently connected to a leonardo running a modded version of hackvision asteroids). might play around with having an orbiter-esque orbit gauge one of these days. *googles ellipse drawing algorithm*

Edited by Nuke
Link to comment
Share on other sites

There are others who are also in the works of making physical displays, but this display is simple yet handy!

However, how can i use it while i have no serial port? (while there are serial port adapters, how will the Arduino co-op with that?)

Link to comment
Share on other sites

its pretty much virtual serial over usb. arduino handles all that for you. on the pc side this interface is exposed as a virtual com port, and on the arduino side with the serial library. this plugin looks like its designed to handle the pc side for you.

from the looks of it you just need to receive the data packet, and use the data to draw your displays, these could be 7 segment displays, character lcds, graphic lcds, physical gauges, servos etc. this looks pretty versatile.

Edited by Nuke
Link to comment
Share on other sites

Update: I have made a simple tutorial for arduino and uploaded some simple arduino code to drive a couple LEDs as warning lights, check the first post.

How is the data bus that is sent via serial to the arduino?

I want to make this reading using PIC!

ps: Sorry my english

All you need to do is buy an arduino or any of the arduino clone boards. If you use a PIC you will need to buy your own USB to serial board e.g. FTDI, like the one Nuke mentioned. I wouldn't get it from sparkfun though, everything they sell is more expensive.

How much does the thing cost?

pre-assembled or only the parts.

Looks like it will be around £60 + shipping, the PCB is £10, LCD £10, the LED drivers and 4x3 7 seg LEDs another £20, plus the ATMEGA328, crystal, encoder and so on it all adds up very quickly! I don't want to get into business selling these though, my goal is to make it easier for people to build their own.

Edited by zitronen
Link to comment
Share on other sites

sparkfun is a little expensive. i usually go check ebay first to see if i cant get something for less. im up to my eyeballs in prototyping stuffs so i dont need to buy anything, i just need to allocate time to playing around with this.

Link to comment
Share on other sites

my goal is to make it easier for people to build their own.

Man this is awesome. I have my arduino sitting here collecting dust, my plans were to do exactly what you've done. I'm bogged down in my other mod projects but when I'm done those I'm going to look at this closely. From what you've said I was going to follow nearly the same path you have.

Great stuff!

Link to comment
Share on other sites

OK to send a single byte is easy, but once you need to send more data and parse it and also receive from serial it suddenly becomes more complex. Basically, you can just add the serialport.dll in my plugin to your references, and use something like this:



using OpenNETCF.IO.Ports;

...

[KSPAddon(KSPAddon.Startup.Flight, false)]
public class KSPSerialIO : MonoBehaviour
{
void Start()
{
public SerialPort Port;
byte HelloByte= 0xBE;

Port = new SerialPort("COMx", 38400, Parity.None, 8, StopBits.One);
Port.Open();

Port.Write(HelloByte, 0, 1);

Port.Close();
}
}

Have not tested it, so there are probably some errors.

Edited by zitronen
Link to comment
Share on other sites

Did you see the pictures in the first post? I'm not using an arduino board, I'm making my own PCB: https://sites.google.com/site/zitronfiles/IMG_8888s.jpg

I bought an arduino many years ago back when they were still using ATMEGA8s to get started, and have since been making my own. But why is arduino terrible, it is just GCC C compiler with some libraries? I mean if you want to you can write in assembly in the IDE and access ports and registers directly so what's so different? You can also make your own on a bread board for $4. It is far easier for people who don't have any knowledge about micro controllers to get started, if you want to use AVR studio or MPLab it's up to you.

Link to comment
Share on other sites

So let me get this straight (I have very limited knowledge of this stuff)... you just drop the KSPSerialIO folder into... gamedata? And then KSP will send all these values to the serial? Just like that??

I have my first Arduino on the way (it was cheap) and will be learning to use it over the next few months in preparation for constructing my second KSP dashboard panel.

The first panel is nearing completion - http://forum.kerbalspaceprogram.com/threads/66742-Custom-hardware-control-switch-panel-simpit-WIP

The plan is to eventually install the panels in a cockpit enclosure, probably next year once I have all the panels made (total of 6 panels - switchboards, dial panels, flight computer etc).

Link to comment
Share on other sites

So let me get this straight (I have very limited knowledge of this stuff)... you just drop the KSPSerialIO folder into... gamedata? And then KSP will send all these values to the serial? Just like that??

Yep, that's it if it works properly. If you use my arduino example code, it should automatically detect the COM port. I really need more people to test it since I only know it works on my computer.

Link to comment
Share on other sites

What did you use to make the PCB's?k

Trigger Au thank you for your plugin tutorials! I use the free version of DipTrace for PCB design, if you want a PCB I have 3 left over. All the other parts can be found on Farnell/Mouser/Digikey except the LCD which I got from Ebay. I also have a fully assembled display made from left over parts. If anyone wants my spare parts just send me a pm.

Link to comment
Share on other sites

Yep, that's it if it works properly. If you use my arduino example code, it should automatically detect the COM port. I really need more people to test it since I only know it works on my computer.

Awesome!!! By the way I've linked your thread here... trying to get a central resource going for hardware builders. http://forum.kerbalspaceprogram.com/threads/66763-Custom-hardware-simpit-repository-For-people-who-take-KSP-a-little-too-far?p=920499#post920499

My first Arduino should arrive tomorrow so I have a lot of learning to do! I'll be making a dial panel soon to add to my first panel (and eventually an enclosure).

This one is just inputs so just uses joypad parts and an off the peg pulse generator to make the toggle switches convert to keystrokes.

zuxv4oA.jpg

Link to comment
Share on other sites

i got this:

IMG_0300_zpsd40ee52d.jpg

etched the board myself, never finished the firmware though. its a 2313 so i dont have much flash, my code doesnt fit so i need to refactor all the things. its not the display code its the serial/i2c inteface that needs to be reduced. it needs to connect to an arduino over i2c for the pc interface.

and this would make a pretty good gauge display:

IMG_0311_zps82d5cbe1.jpg

this screen cost me $9 on ebay and has a very easy to use arduino library. catch is its a 3.3v screen so you need a bunch of resistor dividers or zener diods or n-channel mosfets to drop the signal level. its not as fast as a parallel display but its fast enough to draw a basic gauge on it (or asteroids).

Edited by Nuke
Link to comment
Share on other sites

Trigger Au thank you for your plugin tutorials! I use the free version of DipTrace for PCB design, if you want a PCB I have 3 left over. All the other parts can be found on Farnell/Mouser/Digikey except the LCD which I got from Ebay. I also have a fully assembled display made from left over parts. If anyone wants my spare parts just send me a pm.

Is very tempting zitronen, some of the work done already. I think I need to finish some current projects first though :( . Cant wait to see the schematic and other parts and I might get in touch a bit later

Link to comment
Share on other sites

Zitronen - Is your cutom board specifically to control the LCD seen in the video? Or is it suitable for controlling analogue dials instead? My build will be based on Mercury/Gemini... although I may include an Apollo-esque computer too.

Link to comment
Share on other sites

depends on the gauge and how good you are on driving it. you might need a dac to drive one of those galvanometric gauges. you can fake it with a servo, which is rather easy and doesn't need a driver circuit (though an isolated power supply for the servos is nice). want something more robust? maybe try a stepper motor or a regular old dc motor with a rotory encoder or perhaps a hall sensor. motor driver ics are pretty cheap. there are led displays, 7 segment displays and bar graph displays and drivers ics for them. of course there are a lot of lcd modules, character, graphic, color, etc. basically go nuts.

Link to comment
Share on other sites

Update 2: Added BOM and schematics for my PCB, see first post.

Awesome!!! By the way I've linked your thread here... trying to get a central resource going for hardware builders. http://forum.kerbalspaceprogram.com/threads/66763-Custom-hardware-simpit-repository-For-people-who-take-KSP-a-little-too-far?p=920499#post920499

My first Arduino should arrive tomorrow so I have a lot of learning to do! I'll be making a dial panel soon to add to my first panel (and eventually an enclosure).

This one is just inputs so just uses joypad parts and an off the peg pulse generator to make the toggle switches convert to keystrokes.

http://i.imgur.com/zuxv4oA.jpg

Good idea with the thread, I hope they will make a sub forum soon. I will try to see what I can do to have external controls sent to KSP this weekend. I hope I will be able to get a simple SAS switch or something working in a couple of days.

Is very tempting zitronen, some of the work done already. I think I need to finish some current projects first though :( . Cant wait to see the schematic and other parts and I might get in touch a bit later

Schematics and BOM now in the first post!

Zitronen - Is your cutom board specifically to control the LCD seen in the video? Or is it suitable for controlling analogue dials instead? My build will be based on Mercury/Gemini... although I may include an Apollo-esque computer too.

My PCB was specifically designed for the LCD, 4 x 3 digit 7 seg displays, indicators and rotary encoder. I guess you can use it without the LCD and only use the 7 segs, but I think for your build you don't have much choice but to make custom stuff.

depends on the gauge and how good you are on driving it. you might need a dac to drive one of those galvanometric gauges. you can fake it with a servo, which is rather easy and doesn't need a driver circuit (though an isolated power supply for the servos is nice). want something more robust? maybe try a stepper motor or a regular old dc motor with a rotory encoder or perhaps a hall sensor. motor driver ics are pretty cheap. there are led displays, 7 segment displays and bar graph displays and drivers ics for them. of course there are a lot of lcd modules, character, graphic, color, etc. basically go nuts.

You can control a voltage/current gauge with a simple RC filter and PWM. If you get like a 1mA current gauge you can drive it directly through a 5V micro pin with PWM with a 5K series resistor.

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