Question ORB:Connect with Arduino

Phil Smith

Donator
Donator
Joined
Jun 5, 2011
Messages
341
Reaction score
206
Points
58
Location
UK
Hey guys,

Finally have started to play with software side of things of my Simpit and to learn more about programming and networking.
My question is how to make Arduino receive/send commands from/to Orbiter via Orb:Connect plugin?
My connection is as follows:
PC with Orbiter -> ethernet switch -> Arduino Mega with W5100 ethernet shield.
What I have achieved so far:
1) Tested a simple UDP chat - sending messages from Arduino via serial monitor and receiving them on the PC using java console app. And vice versa. All works fine. (Big shout out to Horace from Arduino forums for their help)
2) Set up orb:connect with Orbiter 2024 installation on the PC. The plugin works fine, tested in raspberry pi browser connected to the same ethernet switch.

What I don't know yet is how to catch data by Arduino to display information (via leds, lcd's, 7segmen displays, etc.) and send commands back to Orbiter (e.g. if pin 7 low, landing gear retracts, etc.).

In theory Arduino should access that your_ip:37777 port the same way as web browser does and gather required data. E.g. something like this:
Code:
//Arduino pseudo code:
open 10.10.0.25:37777; // ip of the PC on my local network
connection ok;
open index.html; // html file under Orbiter/www folder, getting altitude value from Orb:connect
a = get(altitude);
LDC_show(a " km"); // shows var "a" on external LCD connected to Arduino

But how to implement it?
Should there be another script running on the PC sending that data?

Pardon my stupid questions, but this is a COMPLETELY new territory to me, comparing to the hardware design.. :)
PS. main requirement for the simpit - no USB connection, ethernet only :)

Appreciate any help.
:hailprobe:
 
Last edited:
Hi! I am kinda back... Not really working on SIMPIT stuff and still hate to tinker with Python VNC client, but... I have 2 old Logitech joysticks. Kinda force feedback (not working on linux), kinda gamepad (Sub-d 15, but with arduino tranfored int USB. This information is uselees for you, but...

I read Orb:Connect:Web plugin documentations and... It works in TWO modes:
1) Web server. You can craft web page with custom controls and display. Then use it on your tablet/phone, etc
2) TCP server. It opens TCP port and... When you do telnet to it, you can send plain text commands to plug-in
All stuff if totally plain text. No net to deal with HTTP and similar b**it.

To get it done with arduino, you need to make TCP connetion from arduino. Send plain text commands and Orbiter will react.

So far I tried SendBufferedKey from telnet and "Kill Rotation" worked. Next tring, you can "subscribe" to parameters like "altitude, pitch, roll, bank etc. and Orbiter will send you regularly latest value. So, you need to send "subscribe command" and need parse received text, then show it on any display or blinkenlights as you want. I'll not try to write code for arduino+Ethernet, but... I'll try to write TCP client in C for linux to bride two USB joysticks with Orbiter.

PS: I think, but, don't remember details, I already experimented with arduino and orb:connect client 4-5 years ago, when we had conversations. I think I got altitude on 2x16 char display or something like that.
 
Aha! I found old arduino sketch from experiment. I was Time Acceleration stuff. I receiver TimeAccel data from Orbiter via Ehternet and showed results on Serial monitor. Sorry, there isn't subscribe stuff. ONly request to get TimeAccel and simple response. Need more work on String parsing and it will work! Good luck!
 

Attachments

Back
Top