Jump to content

Psimax CS40 Telemetric Joystick


marzubus

Recommended Posts

Hej!

This is not possible at the moment. I use one Arduino as a KspSerialIO board and the others i2c or spi to the main board.

What's the use case? It should not be too hard to make it support multiple boards.

Good Morning Marzubus,

I now see that I have fundamentally misunderstood something you said re: running the KSPIO plugin & displays on separate boards.

So, is it something like using a shift register, but with extra processing power & memory, rather than just pin outs?

While I don't feel that my project is really needing more than one board, I do find the idea intriguing :)

Link to comment
Share on other sites

I found this project from Hackaday. Very cool!

Thanks for including a BOM with links. I just ordered one of those cool $24 joysticks. Whenever I've looked for similar joysticks they usually cost a couple of hundred dollars.

Congratulations on making it onto Hackaday.

Link to comment
Share on other sites

Good Evening T.A.P.O.R!

A shift-register is always on the cards, its just easier for me to develop without it. And I have boards lying around. I plan to switch to a shift-register later, if I can get away with the ~2K of RAM on the UNO / Leonardo.

/K

Good Morning Marzubus,

I now see that I have fundamentally misunderstood something you said re: running the KSPIO plugin & displays on separate boards.

So, is it something like using a shift register, but with extra processing power & memory, rather than just pin outs?

While I don't feel that my project is really needing more than one board, I do find the idea intriguing :)

- - - Updated - - -

Hi mustangs6551, ( I can't seem to reply to your post directly, I think its a forum issue )

I am not currenly running a "USB Joystick" firmware on any of the boards, since KSPSerialIO can control the ship over serial connection only. That said, a Arduino Leonardo can function as a joystick without too much tinkering, where a UNO, requires you to re-flash the 16u4 controller ( USB-controller ) on the board to make the PC detect it as a joystick.

For advanced custom USB joystick HID's, see hoodloader2 and HID, though it takes a while to figure out all the necessary steps get an actual joystick out of your arduino. And requires you to setup Arduino IDE for third party hardware.

A much simpler project is UnoJoy, https://code.google.com/p/unojoy/ This one makes your UNO into a joystick with buttons and analogs similar to a PS3 controller. So its limited in buttons and analogs in that sense.

Also note that Windows can only detect a limited number of Axis and buttons, less than Mac or Linux, but I don't recall the exact numbers. So just remember that.

Edited by marzubus
Link to comment
Share on other sites

Grats on not making it into LHR (or wherever he landed) security for a good talking to after wiring up an Arduino on a plane.

Well it was all pre-wired and patched in the protoblock, inside a transparent plastic housing. So I didn't have to do anything too dodgy. ;)

Link to comment
Share on other sites

Good Evening T.A.P.O.R!

A shift-register is always on the cards, its just easier for me to develop without it. And I have boards lying around. I plan to switch to a shift-register later, if I can get away with the ~2K of RAM on the UNO / Leonardo.

/K

- - - Updated - - -

Hi mustangs6551, ( I can't seem to reply to your post directly, I think its a forum issue )

I am not currenly running a "USB Joystick" firmware on any of the boards, since KSPSerialIO can control the ship over serial connection only. That said, a Arduino Leonardo can function as a joystick without too much tinkering, where a UNO, requires you to re-flash the 16u4 controller ( USB-controller ) on the board to make the PC detect it as a joystick.

For advanced custom USB joystick HID's, see hoodloader2 and HID, though it takes a while to figure out all the necessary steps get an actual joystick out of your arduino. And requires you to setup Arduino IDE for third party hardware.

A much simpler project is UnoJoy, https://code.google.com/p/unojoy/ This one makes your UNO into a joystick with buttons and analogs similar to a PS3 controller. So its limited in buttons and analogs in that sense.

Also note that Windows can only detect a limited number of Axis and buttons, less than Mac or Linux, but I don't recall the exact numbers. So just remember that.

i want to say 8 axes in windows, 6 axes on other platforms (sdl limit i think). button limit is pretty high on both, and ive never hit it. of course you can put multiple joysticks on a composite device. the default leo (not sure other arduinos) usb libraries already have the composite device set up for mouse/keyboard/cdc. its just two files (HID.cpp and usbapi.h as of v1.06) you have to modify for joysticks, but once you know how that works its not hard to add another joystick. windows or whatever will just see 2 joysticks when you plug it in. there are examples on the net how to do this but i rolled my own because i wanted 16 bit axes (most of the examples were just 8 bit, and i wanted to use my 16 bit adc module).

id have used a raspberry pi with one of these. not only is it a touchscreen and would make a great mfd, it also gives you access to the pi's gpu for some rendering capability. you just need to have strong linux fu to make it all work (and i learned more linux fu fiddling with the pi than i ever did on pc). it also has some additional gpio (the screen pretty much takes over the spi bus, but you still have gpio and i2c to work with). no analog but thats just an i2c adc/dac away. you of course have to run everything at 3.3v but that not a big problem (logic level converters are cheap/easy to build).

Link to comment
Share on other sites

i was able to push 8 axes (16 bit too) on windows, you just need to set your discriptor up thusly:


...
//joystick, 32 buttons, 2 8-way hads, and 8 16-bit axes.
//32 buttons, 2 8-way hats, and 8 axes.
0x05, 0x01, //USAGE_PAGE (Generic Desktop)
0x09, 0x05, //USAGE (Game Pad)
0xa1, 0x01, //COLLECTION (Application)
0x85, 0x03, // REPORT_ID (3)
0xa1, 0x00, // COLLECTION (Physical)
//32 buttons
0x05, 0x09, // USAGE_PAGE (Button)
0x19, 0x01, // USAGE_MINIMUM (Button 1)
0x29, 0x20, // USAGE_MAXIMUM (Button 32)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x95, 0x20, // REPORT_COUNT (32)
0x75, 0x01, // REPORT_SIZE (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
//2 8-way hat switches
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x39, // USAGE (Hat switch)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x07, // LOGICAL_MAXIMUM (7)
0x35, 0x00, // PHYSICAL_MINIMUM (0)
0x46, 0x3B, 0x01, // PHYSICAL_MAXIMUM (315)
0x65, 0x14, // UNIT (Eng Rot:Angular Pos)
0x75, 0x04, // REPORT_SIZE (4)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x39, // USAGE (Hat switch)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x07, // LOGICAL_MAXIMUM (7)
0x35, 0x00, // PHYSICAL_MINIMUM (0)
0x46, 0x3B, 0x01, // PHYSICAL_MAXIMUM (315)
0x65, 0x14, // UNIT (Eng Rot:Angular Pos)
0x75, 0x04, // REPORT_SIZE (4)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
//8 16-bit axes
0xA1, 0x00, // COLLECTION (Physical)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x30, // USAGE (X)
0x09, 0x31, // USAGE (Y)
0x09, 0x32, // USAGE (Z)
0x09, 0x33, // USAGE (Rx)
0x09, 0x34, // USAGE (Ry)
0x09, 0x35, // USAGE (Rz)
0x09, 0x36, // USAGE (Slider)
0x09, 0x37, // USAGE (Dial)
0x16, 0x00, 0x80, // LOGICAL_MINIMUM (-32768)
0x26, 0xff, 0x7f, // LOGICAL_MAXIMUM (32767)
0x75, 0x10, // REPORT_SIZE (16)
0x95, 0x08, // REPORT_COUNT (8)
0x81, 0x02, // INPUT (Data,Var,Abs)
0xc0, // END_COLLECTION
0xc0, // END_COLLECTION
0xc0, //END_COLLECTION
...

and just add it to the end of the _hidReportDescriptor[] array. of course its slightly more complicated than that since there is code for serialization and whatnot. ultimately its 4 bytes for buttons, then both hats share a byte, and then the axes are 2 bytes each * 8. pretty much the order they appear in the descriptor.

Edited by Nuke
Link to comment
Share on other sites

they are signed 16 bit axes. hid is weird, i spent days trying to get unsigned 16 bit axes to work, but the second i set it up as signed it just sort of worked.

where it says


0x16, 0x00, 0x80, // LOGICAL_MINIMUM (-32768)
0x26, 0xff, 0x7f, // LOGICAL_MAXIMUM (32767)
0x75, 0x10, // REPORT_SIZE (16)
0x95, 0x08, // REPORT_COUNT (8)

is where it sets the axis range. hid likes to pack bits as tightly as possible to save space. for example if you used 4 10-bit axes, it would fill up 5 bytes (not sure how they would be packed though). here ive pretty much told it to waste space so i could get full 16 bit axes. limits seem to be context sensitive. the example i found had used usage(SIMULATION CONTROLS), but i switched to usage(GAME PAD) and that might have something to do with it. i pretty much spent a couple days playing with the descriptors till i found one that didnt throw an error and showed the right range. once that worked it wasnt hard to write the serialization code for the data.

now i can use my ads1115 i2c analog digital converter (i found the chip on a breakout board on ebay for cheap), which can do 4 single ended 15-bit channels, or 2 double ended 16-bit channels. so i used 4 15-bit channels, plus 4 of the 10-bit channels from the arduino adcs, and scaled them to fit the full range and had all 8 working in windows.

Edited by Nuke
Link to comment
Share on other sites

  • 3 weeks later...
Ah yeah, I should put in the info.

Its a Retex Abox, I have 3d printed the top plates in multiple interlocking parts, though I wanted to laser CNC the aluminium.

http://www.retex.es/en/Enclosures/Desktop-enclosures/Abox.axd

Hey marzubus,

Looks great. Excellent find on the chassis. Which Retex Abox did you get? It looks like there's a 10" and a 16" (27cm or 40cm). I'm just trying to get a sense for how much room there is.

Link to comment
Share on other sites

Hey marzubus,

Looks great. Excellent find on the chassis. Which Retex Abox did you get? It looks like there's a 10" and a 16" (27cm or 40cm). I'm just trying to get a sense for how much room there is.

Its the 40CM (I did my research)

I've seen the 20cm version in person. Its a console for tiny things.

Link to comment
Share on other sites

Its the 40CM (I did my research)

I've seen the 20cm version in person. Its a console for tiny things.

Many thanks. It looks really cool, I might try to mock it up in SketchUp to see if I can come out with a sensible layout for it. I almost wish it had the opposite dimensions  a higher back and a shorter front.

Link to comment
Share on other sites

Many thanks. It looks really cool, I might try to mock it up in SketchUp to see if I can come out with a sensible layout for it. I almost wish it had the opposite dimensions  a higher back and a shorter front.

I'd have bought one, but the "Australia Tax" makes everything stupidly expensive over here.

So I decided to go with scrap left over from other projects.

I'm going to integrate the oled, even if I still haven't figured out how to make it work!

Link to comment
Share on other sites

  • 3 weeks later...

Hi!

I got so inspired by looking at this and other simpits that I'm thinking of building my own. I'm a beginner when it comes to soldering and programming (basic understanding of JavaScript and html) but I'm willing to givi it a try. If it's ok I would like to ask some questions. If you don't want this discussion in your thread, just tell me and I'll move it somewhere else. I'm aiming for the following setup (to begin with, running KSP on an iMac):

1 analog 3-axis joystick for flight Control including roll maneuvers

1 digital 2-axis joystick for RCS translation

1 digital 1-axis joystick or switch for RCS forward/backwards

1 potentiometer for throttle (knob or linear)

2 switches + missile covers for arming launch/staging and abort buttons

1 abort pushbutton

1 launch/staging pushbutton

Flip switches or pushbuttons for

RCS

SAS

Gear

Lights

Brakes

10 buttons for action Groups

Some questions that has popped up so far:

1) Will I need more than one Arduino board? Which one is best?

2) What programming language do I need to learn?

3) Which interface should I choose? Zitronen's IO plugin or lawnmowerlatte's solution with Telemachus and Python? Any differences in stability and response time?

4) Do I need an external power supply?

5) Is it hard to make the setup modular if I want to add output displays later? Adding more arduinos?

Thanks in advance! Again, if this post clogs your thread, I'll start my own, but this thread seemed to have collected the most interesting hardware modders.

Link to comment
Share on other sites

For the setup you describe, an UNO will do just nicely in conjunction with a few shift-in registers. If you want to expand with LCD screen, I'd advise for a Mega, as they hog several pins. LED displays can be done on an UNO with a bit of creativity and some shift-out registers or driver chips, all of which are quite cheap on Ebay. External power supply is probably needed once you start doing displays, but something like a dozen LEDs can be driven directly from the board. My current setup uses an UNO and zitronens plugin, and I know mazubus(?) has done a Mac port.

You might want to move your questions to zitronens thread, as most of the hardware gurus are assembled there.

Link to comment
Share on other sites

For the setup you describe, an UNO will do just nicely in conjunction with a few shift-in registers. If you want to expand with LCD screen, I'd advise for a Mega, as they hog several pins. LED displays can be done on an UNO with a bit of creativity and some shift-out registers or driver chips, all of which are quite cheap on Ebay. External power supply is probably needed once you start doing displays, but something like a dozen LEDs can be driven directly from the board. My current setup uses an UNO and zitronens plugin, and I know mazubus(?) has done a Mac port.

You might want to move your questions to zitronens thread, as most of the hardware gurus are assembled there.

Marzubus' version works on linux too :)

I'd say go for the Arduino Mega.

The Uno is great (as is the leonardo), but I ran out of pins fast.

Even with the mega, I think I'm gong to need a couple of shift registers!

My project is super slow on account of the weather not being conducive to allowing paint to dry in a reasonable amount of time, which has led to some interesting (and unwanted) patterns on my panel.

Link to comment
Share on other sites

Hej MrLao!

There are quite a few complexities to overcome when designing any input system. I advise you to start with something very simple, like just a button panel for action groups and simple LED outputs. Get to know the arduino, and interfacing it with the game. You should ask yourself, are you making just a joystick, or are you making a whole new Input system ( which requires its own firmware ).

Remember you can just turn your arduino into a Joystick with UnoJoy for instance! works great! MegaJoy would support more buttons!

To your questions:

1. If you are only going to buy ONE arduino, then make it a Mega. You will be able to do much more on it later. Or you end up like me with 20 of the things lying around. ;) But you need to be careful when wiring these things up. They release their magic smoke quite easily. So buy it from Aliexpress, or somewhere where its like 10 USD, not 100USD like here in Sweden.

2. I don't know if you are a programmer or not., but Arduino is C, and you don't need to read a book on C just yet. There are plenty of online tutorials to help you out. Take a look at zitronen's arduino source code for KSPDemo10 for example. Because that is what you want to extend to support your type of setup.

3. I have no experience with lawnmowerlatte's solution. I like KSPSerialIO, because its direct interface with my Arduino, not through any proxy / network system.

4. You probably don't need a external power supply. But you need to monitor your power draw on the Arduino, there are limits to how much stuff a AVR chip can power. There are per-pin limits and total limits.

5. Modular setups can be tricky. Its what I am trying to achieve. The problems you can encounter are things like building a common protocol that your modules speak. eg. I have a OLED gauge module, which I send values over i2c. So I know I need to send 4 bytes at a time to populate the 4 gauges on the OLED. That module also has a specific "address" which it listens on. ex 0x6c. So thats my Gauge module. Then if I have another one, I need a way to set it to have a different address, 0x6d perhaps.

In retrospect. I started with UnoJoy, which gives you two analogs, and 10 or 12 buttons and DPAD. Its great to start with. The MegaJoy supports like 40 buttons or more. I highly recommend starting there, since you will find the firmwares already made for you, and you can tweak them a little. This would give you a Arduino that detects as a true joystick on your computer or PS3 even!

Once you have had your fun with that, you can look at changing the software on the arduino to be a slave to something like KSPSerialIO.

Regards!

/Kegan

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