Using SpaceNavigator with Arduino?

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
gast0n
Posts: 3
Joined: Sat Sep 29, 2012 8:58 am

Using SpaceNavigator with Arduino?

Post by gast0n » Sat Sep 29, 2012 10:03 am

Hello,

Is it possible to connect the SpaceNavigator directly to a Arduino board without using a computer and the 3Dconnexion SDK as interface?

Thanks!

/Andreas

ngomes
Moderator
Moderator
Posts: 1945
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Using SpaceNavigator with Arduino?

Post by ngomes » Mon Oct 01, 2012 2:42 am

Hi Andreas,

This would be a very cool project but we're not very familiar with the Arduino.

As far as I understand, the USB port on the Arduino is used to set up a serial connection to the programming host. You would need to be able to have a "USB host" capability in the Arduino board to get data directly from the 3D mouse.

One possible alternative, is to use the Raspberry Pi board as it has USB host capabilities (and it should be fairly doable to interface with other Arduino hardware).

mlkoch
Posts: 4
Joined: Mon Jun 24, 2013 1:06 am

Re: Using SpaceNavigator with Arduino?

Post by mlkoch » Mon Jun 24, 2013 1:27 am

Hello,

it is possible to connect a HID device to an arduino board (e.g. Arduino Mega 2560) using a "usb shield" (e. g. the USB Shield 2.0 by circuitsathome http://www.circuitsathome.com/products- ... r-arduino/).
In combination with a joystick (e.g. Logitech Extreme 3D Pro) this works very well.

The problem I have is to define a DataEvent for the SpaceNavigator.

The working DataEvent for the joystick:
struct GamePadEventData
{
union { //axes and hut switch
uint32_t axes;
struct {
uint32_t x : 10;
uint32_t y : 10;
uint32_t hat : 4;
uint32_t twist : 8;
};
};
uint8_t buttons_a;
uint8_t slider;
uint8_t buttons_b;
};

How to define the DataEvent für the SpaceNavigator?

Thanks for any advice!
Michael

jwick
Moderator
Moderator
Posts: 2544
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Using SpaceNavigator with Arduino?

Post by jwick » Mon Jun 24, 2013 7:33 am

Most 3Dx devices send motion data in two packets. The first byte of the packet is a muxing byte that determines which packet it is. 1 for translations; 2 for rotations; 3 for buttons, etc. Some newer devices send all motion the data in one translation packet--your code should be prepared to handle both.

The muxing byte is followed by 3 double byte values (or 6 double bytes) of axis data. The axis data is in X, Y, Z order, little endian.
For the long packets, you get Tx, Ty, Tz, Rx, Ry, Rz. You know which packet it is by the length (7 or 13).

mlkoch
Posts: 4
Joined: Mon Jun 24, 2013 1:06 am

Re: Using SpaceNavigator with Arduino?

Post by mlkoch » Mon Jun 24, 2013 11:21 pm

Thanks a lot for this hint! I'll try my very best :D

Best regards!
Michael

gast0n
Posts: 3
Joined: Sat Sep 29, 2012 8:58 am

Re: Using SpaceNavigator with Arduino?

Post by gast0n » Fri Jul 05, 2013 12:28 pm

Hello Michael!
Did you get the USB Shield 2.0 to work with SpaceNavigator?

Thanks!

/Andreas

mlkoch
Posts: 4
Joined: Mon Jun 24, 2013 1:06 am

Re: Using SpaceNavigator with Arduino?

Post by mlkoch » Tue Jul 16, 2013 3:41 am

Yes, it's working! :D
I 'm going to purge my code and post it here!
Best regards!
Michael

mlkoch
Posts: 4
Joined: Mon Jun 24, 2013 1:06 am

Re: Using SpaceNavigator with Arduino?

Post by mlkoch » Wed Jul 17, 2013 4:40 am

Here is the code ...
Arduino files for usb host shield 2.0 and SpaceNavigator

Have fun!
Michael
Attachments
USB_SpaceNavigator.rar
Arduino files for usb host shield 2.0 and SpaceNavigator
(2.2 KiB) Downloaded 1541 times

jorgef
Posts: 1
Joined: Thu Oct 23, 2014 5:07 pm

Re: Using SpaceNavigator with Arduino?

Post by jorgef » Thu Oct 23, 2014 5:09 pm

The line that reads "JoystickEvents JoyEvents;" is troubling my Arduino. What does this line call for to run?

jwick
Moderator
Moderator
Posts: 2544
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Using SpaceNavigator with Arduino?

Post by jwick » Fri Apr 21, 2017 3:33 am


Post Reply