Jump to content

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


zitronen

Recommended Posts

Ok!

So I started Small, and I tried to run the code that you have a demo for, because the demo seems to be receive.

When I load up everything I see my Arduino trying to talk (tx) light to my computer and the Green LED lights momentarily.

I never see the Rx light up at all.

I'm using a Mega 2560 R3.  I am using V13 of the demo & 17.6 of the Serial IO Mod.

Log basically scans the COM7 (Port where my arduino is) says i can't see it then keeps going.

MY arduino define tally knowst to transmit when i get to the flight screen and my the Rx light flashes 1 time when the computer looks for COM 7 in the serial ports.

Not entirely sure what to try here to receive data.

Link to comment
Share on other sites

 

Followed your advice and started small with the demo.

When I'm testing the demo do I need to upload each "tab" when I open the demo individually or does clicking upload on the main "demo" tab work. 

Running the Demo:

I'm seeing the LEDs initiate. I'm seeing my Tx light go crazy and my Rx blinks once when it scans over the COM7 port (where my arduino mega is) but it always returns "no KSP display" in the log and eventually the tx light and green light goes out. 

I had to go in the COM port setting in Windows and match the baud rate to the setting config. 

I also went into the config and turned off all the "transmit" settings, because of your advice that that function doesn't work on wind. 10. 

Many advice to get my receive working? 

Thanks!

Link to comment
Share on other sites

My project has been on the backburner. I had everything working great.

I try making things work today and I'm getting this:

KSPSerialIO: Found 3 serial ports
 
(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

KSPSerialIO: trying default port COM5
 
(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

KSPSerialIO: KSP Display not found
 
(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

KSPSerialIO: trying port \Device\VCP0 - COM12
 
(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

Error opening serial port COM12: CreateFile Failed: 2
 
(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

KSPSerialIO: trying port \Device\VCP1 - COM5
 
(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

Error opening serial port COM5: Access to the requested resource is not authorized.

It's very strange. I don't remember ever seeing this before. I did transfer my license to another computer for a bit and transfer back. But I don't see why it should be doing this.

Any ideas for what would be causing "Access to the requested resource is not authorized", and "CreateFile Failed: 2"?

Edited by Keith Young
Link to comment
Share on other sites

for those interested i finally posted my HID Joystick library to github

https://github.com/LordNuke/ArduinoLibs

im running this in 1.6.7 which has support for hid based libraries now. this made it very easy to make it a self contained package where before it was a dirty hack in my arduino core. glad that its a library proper now.

so its pretty basic, supports 8 16-bit axes, 32 buttons, and a pair of 8-way hat switches. so far i tested it on the arduino leo and it appears to be working.

Link to comment
Share on other sites

On 03/03/2016 at 1:17 AM, Keith Young said:

My project has been on the backburner. I had everything working great.

I try making things work today and I'm getting this:

KSPSerialIO: Found 3 serial ports
 
(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

KSPSerialIO: trying default port COM5
 
(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

KSPSerialIO: KSP Display not found
 
(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

KSPSerialIO: trying port \Device\VCP0 - COM12
 
(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

Error opening serial port COM12: CreateFile Failed: 2
 
(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

KSPSerialIO: trying port \Device\VCP1 - COM5
 
(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

Error opening serial port COM5: Access to the requested resource is not authorized.

It's very strange. I don't remember ever seeing this before. I did transfer my license to another computer for a bit and transfer back. But I don't see why it should be doing this.

Any ideas for what would be causing "Access to the requested resource is not authorized", and "CreateFile Failed: 2"?

What COM port is your arduino plugged in? "Access not authorized" usually means the port is already being used, for example, if you are connected to it through arduino IDE. "create failed" usually means it does not exist. The library has some issues with COM port > 10, you can change the number is that's the issue.

15 hours ago, Nuke said:

for those interested i finally posted my HID Joystick library to github

https://github.com/LordNuke/ArduinoLibs

im running this in 1.6.7 which has support for hid based libraries now. this made it very easy to make it a self contained package where before it was a dirty hack in my arduino core. glad that its a library proper now.

so its pretty basic, supports 8 16-bit axes, 32 buttons, and a pair of 8-way hat switches. so far i tested it on the arduino leo and it appears to be working.

Cool thanks, would be good for people on win 10.

Link to comment
Share on other sites

2 hours ago, zitronen said:

What COM port is your arduino plugged in? "Access not authorized" usually means the port is already being used, for example, if you are connected to it through arduino IDE. "create failed" usually means it does not exist. The library has some issues with COM port > 10, you can change the number is that's the issue.

Cool thanks, would be good for people on win 10.

it should work on any platform that supports the arduino ide. im not sure what arduinos it supports. definately not any of the 328p micros, anything based on a 32u4 will work. it compiled for the due but i haven't tested it yet (its got a mess of wires connected to it for another project). i also got a brand new stm32 board in my desk but i haven't even soldered on the headers yet, but il try and see if it compiles (it doesnt look like the stm32 package works for this version of arduino, id have to go back to 1.6.5, which doesnt support my library).

update on the due, no workie. nope it works, you just need to #include "HID.h" at the top of the file and you have to use the native port.

Edited by Nuke
Link to comment
Share on other sites

hello, I see on your first message that your plugin does not support Windows 10, is it still relevant?
I can not run the demo program, with LED, is because of Windows 10?
thank you,
Sorry for my bad english, I used Google Translate.

Link to comment
Share on other sites

Hey guys again. Went back to my project and added joystick this time. But I cant get them to work for some reason. Arduino read values of pots, aslo code is processed (CPacket.Pitch and rest of them change its values if i move a stick) but game doesnt respont at all.  I also forced game to use external values by change setting in config file (all set to 1) but no change. A little weird thing, game STILL respon to keyboard even when config is set to 1.   I tryed to take my UNO with unmodified code where joystick was supposed to control Throttle axis but it didnt work either. Rest of things work (Leds, Lcd, Nixie tubes), but seem only controls doesnt work. Anybody get some ideas? I ll be glad for any suggestion. 

Specs : Build on MEGA2560, code build on KSPIODemo10 with plugin 0.17.1

Link to comment
Share on other sites

@Gouttfi

Yes, KSPSerialIO does not work correctly with Windows 10. It sends values to the Arduino, but cannot read from it. There is an option somewhere in the config files that allows KSP to spam the Arduino with data even if you are using Win 10, but you cannot send any data back, so you cannot do any control.

@Mattew

Both plugin and demo has updated, I think to 17.6 and Demo12, respectively.

Link to comment
Share on other sites

5 minutes ago, Freshmeat said:

Both plugin and demo has updated, I think to 17.6 and Demo12, respectively.

Should I understand that KSP 1.0.5 and plugin 0.17.1 can have some issues? (like my no axis input control :D )  We dont have reverse compatibility? :)

Link to comment
Share on other sites

@Mattew

The plugin needs to update with every version of KSP. But usually, you can just change vdata and cpacket definition in your Arduino software, then it runs with the new version of the plugin.

Edited by Freshmeat
Clarification
Link to comment
Share on other sites

I know Windows 10 has issues, but how does the Mac OS variant fare? I play on Mac OS primarily, but have a tablet that I've been avoiding upgrading to Windows 10 (from 8.1) over this issue. I use the tablet for development when I'm in my workshop, or on the rare occasions when I go to a local robotics meeting (that meets at a Maker Space... It's over 2 hours away, but it's my only chance to get there). With this bug, Upgrading to Windows 10 would nuke my option to really use the tablet for easy development.

Do we have any long term solution for the receiving of data from Arduino to Windows 10? Come this summer, people like me who have been holding out will have no choice but to make the decision to lose full support, or have to pay if we ever upgrade Windows later.

Link to comment
Share on other sites

Made an account just to post this reply.

I have this working on Win10 using the Arduino Mega 2560. My Uno still doesn't work tho. Didn't make any changes, anyone else having luck with the Mega ?

 

I'm currently building my dad a PC and want to make a custom control panel for him, but I don't want to stick him with windows 7 just to use this if I can avoid it.

Link to comment
Share on other sites

On 3/19/2016 at 10:17 AM, richfiles said:

I know Windows 10 has issues, but how does the Mac OS variant fare?

The last time I tested it properly in OS X was a few months ago now. It worked for me, but my 2013 Mac Air struggles with KSP to begin with, and had a really hard time keeping up with my controller. It was sending data, but dropped a lot of packets coming back in. Depending on what you play on, you may need to tune polling rates and how often your controller is sending.

I usually play on a Linux desktop with the same code, though, and it runs fine there.

On 3/19/2016 at 10:17 AM, richfiles said:

Do we have any long term solution for the receiving of data from Arduino to Windows 10? Come this summer, people like me who have been holding out will have no choice but to make the decision to lose full support, or have to pay if we ever upgrade Windows later.

I don't think it's possible to speculate too much on what's going to happen post-1.1. Although Unity 5 does seem to have much improved serial handling, so I'm quietly hoping the need for external serial libraries and painful futzing will just go away.

Link to comment
Share on other sites

There is currently no solution for windows 10, only the work around of disabling receiving in KSP.

If someone can get in touch with Squad and tell them to do this http://forum.unity3d.com/threads/serial-communication-between-unity-5-and-arduino.331005/

Then we can use the .net serial library instead of the crappy free one we are using now, that would solve the probem. However, there is probably a good reason they are not doing that, they may want to limit what plugins can do for security reasons for example.

The other possible solution is to make a KSP plugin that sends UDP packets to an external application which would convert it to serial, this will require quite a bit of work, but I might make something like that if a large number of people (say more than 5) are having this issue.

 

Edit: also I'm still waiting on 1.1 to see what happens.

Edited by zitronen
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...