Jump to content

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


zitronen

Recommended Posts

Has anybody tried this plugin on a Linux installation? I'm sure I'm missing something obvious, but if I fire it up on Windows 7, 64 or 32 bit, modded or unmodded, then it works absolutely brilliantly with COM3.

On my Linux install, I just get no display found (which seems to indicate it cannot communicate with the Arduino). I'm not sure if it is because Windows looks for a COM port number, whereas Linux addresses the ports differently - on my box it is /dev/ttyS0 - I've tried putting that in the config file and it will not open it.

It's possible I'm missing something obvious as I'm fairly new to Arduino (though not hardware controls, in a previous role I built marine navigation simulators)

Link to comment
Share on other sites

@MrOnak

Thank you for your reply. I use kOS extensively, and have made many programs for it (creating nodes to circularize orbits based on orbital characteristics, four different ways to implement a node (thrust and time, fuel rate and time, mass, and orbital velocity), I'm working on implementing a more efficient surface-to-orbit curve from kerbin to space, etc, etc...) and I was hoping to bring some of that to bear on a completely new field to me, microcontrollers! I am most excited about this because I would like to work on code that can interact with "real" objects ( given the hardware, could I control a "real" rocket? ).

Ultimately, though, my question was: //edited to improve friendliness of this line.

Why is it when I tell the mod (through the config file in the mod folder) that I want the arduino to be able to control pitch, I can no longer control pitch from the keyboard?

Edited by postalbyke
Link to comment
Share on other sites

Has anybody tried this plugin on a Linux installation? I'm sure I'm missing something obvious, but if I fire it up on Windows 7, 64 or 32 bit, modded or unmodded, then it works absolutely brilliantly with COM3.

On my Linux install, I just get no display found (which seems to indicate it cannot communicate with the Arduino). I'm not sure if it is because Windows looks for a COM port number, whereas Linux addresses the ports differently - on my box it is /dev/ttyS0 - I've tried putting that in the config file and it will not open it.

It's possible I'm missing something obvious as I'm fairly new to Arduino (though not hardware controls, in a previous role I built marine navigation simulators)

Unfortunately the plugin uses windows specific serial port stuff so it will not work in linux. Some people have been working on a Mac version, but it's not easy: http://forum.kerbalspaceprogram.com/threads/68642-Arduino-Addon-for-Mac

@MrOnak

Thank you for your reply. I use kOS extensively, and have made many programs for it (creating nodes to circularize orbits based on orbital characteristics, four different ways to implement a node (thrust and time, fuel rate and time, mass, and orbital velocity), I'm working on implementing a more efficient surface-to-orbit curve from kerbin to space, etc, etc...) and I was hoping to bring some of that to bear on a completely new field to me, microcontrollers! I am most excited about this because I would like to work on code that can interact with "real" objects ( given the hardware, could I control a "real" rocket? ).

Ultimately, though, my question was: //edited to improve friendliness of this line.

Why is it when I tell the mod (through the config file in the mod folder) that I want the arduino to be able to control pitch, I can no longer control pitch from the keyboard?

Ok the problem is the values from arduino are overwriting the normal KSP inputs, that's why you can't control with your keyboard. A simple way around this is to add some buttons, pots, joysticks or whatever to your arduino input so you can flip a switch and toggle between arduino autopilot and arduino manual control.

Link to comment
Share on other sites

Unfortunately the plugin uses windows specific serial port stuff so it will not work in linux. Some people have been working on a Mac version, but it's not easy: http://forum.kerbalspaceprogram.com/threads/68642-Arduino-Addon-for-Mac

Thankyou for replying so quickly! That's not a problem, I'll keep it Windows for the time being and see if I can adapt it from the Mac version. If it was easy, it wouldn't be Rocket Science after all! :D

Link to comment
Share on other sites

Could it work with USB ports zitronen?

It does use USB, since no one has a serial port any more, most people use some kind of USB->serial adapter. Most arduino boards have one built in.

Edited by zitronen
Link to comment
Share on other sites

It does use USB, since no one has a serial port any more, most people use some kind of USB->serial adapter. Most arduino boards have one built in.

Hmm.... I doubt that I'll be of much use debugging this (no Linux with a Desktop here) but out of sheer curiosity, what exactly is the problem there? I assume it has to do with using the virtual com port from within KSP? Any more details?

Link to comment
Share on other sites

It has to do with Mono in Unity does not have the system.io stuff that is used in C#/Mono for accessing serial ports. Luckily I was able to use someone's windows based library, if you want to make it work on linux then a similar library is required. You can read the Mac thread for more details, I think most people have given up...

Link to comment
Share on other sites

Hello! :D

What an amazing mod! I bought my Arduino Mega 2560 about a week ago and have begun fiddling around with it and your code Zitronen. For some reason however, when I try to test the Demo8 code, the green LED and toggle switches function as expected, but the yellow and red LEDs will not turn on at all. I have not changed the code at all.

Is there a way to use the SerialIO mod in-game to output values of variables, to check if I am receiving the vessel data properly on my Mega? Any suggestions for how I can debug what is wrong?

Thanks very much!

Link to comment
Share on other sites

Thanks! I wanted something that almost looked professional, but still had that Kerbal humour :)

I'm still working on the flight data readout panel, at the moment it's a bunch of LCD / LED readouts and a bunch of wires all over the desk :)

That's pretty neat! I'll probably borrow the idea having status LEDs for the switches for my own :D

You might want to check Mulbin's simpit thread and list your project there as well by the way: http://forum.kerbalspaceprogram.com/threads/66763-Custom-hardware-simpit-repository-For-people-who-take-KSP-a-little-too-far

Link to comment
Share on other sites

Thanks! Glad you like it :)

I posted a while back with an overview of the 'flight computer', and a code snippet for how I worked out which celestial body the craft is orbiting; I've finialised that code, and it's a lot more foolproof :)

http://forum.kerbalspaceprogram.com/threads/66393-Hardware-Plugin-Arduino-based-physical-display-serial-port-io-tutorial-%2808-Oct%29?p=1381446#post1381446

And by all means, borrow away! :D

Link to comment
Share on other sites

Thankyou! :D

Yep, mass-wiring's a pain. I used a lot of pre-fabbed wires with female single headers, and just cut one end off. My main ground bus is uninsulated tinned copper, because it was just easier to solder up. Plus, it makes it look dodgy as :P

I do a bit at a time, make that bit work, and that motivated me to do more wiring :) I gotta get some PCBs made up for the mass 7-segment board though, and that takes time (to get it right) and money.

I do not expect to get my panel complete fast, but once it's done, it'll look amazing :D

Plus I plan on making a clone of my panel for a close friend, so PCBs make it nice looking and less work - the perfect combination! :D

Link to comment
Share on other sites

Hello!

Sorry, was hoping you guys could help me. I started experimenting with your mod about a week back Zitronen, but my Yellow and Red LED will not light up using the demo code. I have double checked my wiring - everything looks ok. Am using 510ohm resistors for all 3 LEDs.

Is there a way to use the SerialIO mod in-game to output values of variables, to check if I am receiving the vessel data properly on my Mega? Any suggestions for how I can debug what is wrong?

Thanks very much!

Link to comment
Share on other sites

Hello!

Sorry, was hoping you guys could help me. I started experimenting with your mod about a week back Zitronen, but my Yellow and Red LED will not light up using the demo code. I have double checked my wiring - everything looks ok. Am using 510ohm resistors for all 3 LEDs.

Is there a way to use the SerialIO mod in-game to output values of variables, to check if I am receiving the vessel data properly on my Mega? Any suggestions for how I can debug what is wrong?

Thanks very much!

Easy test: Swap the wires.

If your green LED works fine then swap the connection of the green LED to the Arduino with that of the Yellow one and see if now the Yellow one does the job of the green one. If it doesn't: Circuit problem.

Rinse and repeat with the red one :)

Link to comment
Share on other sites

You can post the debug log from KSP. Also just to make sure that the LEDs only light up when you have high G and low fuel, so just make sure your rocket is terrible enough to trigger them!

Cannot attach a text file so, please find it in the link:

https://docs.google.com/document/d/1yiMviKQciQfKYPvU8PS2ErbLG8Me0rM-KWYXqEktEjw/edit?usp=sharing

Link to comment
Share on other sites

Easy test: Swap the wires.

If your green LED works fine then swap the connection of the green LED to the Arduino with that of the Yellow one and see if now the Yellow one does the job of the green one. If it doesn't: Circuit problem.

Rinse and repeat with the red one :)

Tried what you suggested - red and yellow LEDs turn on as expected when I connect the wire from the green LED (pin 5) to the red and yellow LED.

Link to comment
Share on other sites

Tried what you suggested - red and yellow LEDs turn on as expected when I connect the wire from the green LED (pin 5) to the red and yellow LED.

Alright then, that pretty much means that your circuit is fine. So either your craft is "too good" to trigger the yellow/red LEDs or its something software-related. If I have time I'll check the log you posted tomorrow... too tired right now.

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