Using SpaceNavigator with Arduino?
Moderator: Moderators
Using SpaceNavigator with Arduino?
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
Is it possible to connect the SpaceNavigator directly to a Arduino board without using a computer and the 3Dconnexion SDK as interface?
Thanks!
/Andreas
Re: Using SpaceNavigator with Arduino?
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).
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).
Re: Using SpaceNavigator with Arduino?
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
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
Re: Using SpaceNavigator with Arduino?
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).
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).
Re: Using SpaceNavigator with Arduino?
Thanks a lot for this hint! I'll try my very best
Best regards!
Michael
Best regards!
Michael
Re: Using SpaceNavigator with Arduino?
Hello Michael!
Did you get the USB Shield 2.0 to work with SpaceNavigator?
Thanks!
/Andreas
Did you get the USB Shield 2.0 to work with SpaceNavigator?
Thanks!
/Andreas
Re: Using SpaceNavigator with Arduino?
Yes, it's working!
I 'm going to purge my code and post it here!
Best regards!
Michael
I 'm going to purge my code and post it here!
Best regards!
Michael
Re: Using SpaceNavigator with Arduino?
Here is the code ...
Arduino files for usb host shield 2.0 and SpaceNavigator
Have fun!
Michael
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 2561 times
Re: Using SpaceNavigator with Arduino?
The line that reads "JoystickEvents JoyEvents;" is troubling my Arduino. What does this line call for to run?
Re: Using SpaceNavigator with Arduino?
I was able to get this code to work, however there is no rotation data.
Any idea why that might be?
I'm using the SpaceMouse Wireless with Arduino UNO and a USB shield.
Re: Using SpaceNavigator with Arduino?
I didn't look at that code, but there is a difference between the Spacenavigator and SpaceMouse Wireless data packet.
In recent devices, such as the SMW, the rotations are included in the same packet as the translations. The packet is longer.
In recent devices, such as the SMW, the rotations are included in the same packet as the translations. The packet is longer.
Re: Using SpaceNavigator with Arduino?
Yep, that's what it was. I used a USB analyzer on my laptop to see all the data it was sending and saw there were a bunch of data packets that weren't being used by the Arduino code. I added six more variables to hold the six extra data packets that represent the rotation and was able to read the rotation data. The rotation packets are still in x-y-z order. Attached is the updated code (credits to mlkoch for the original code).
- Attachments
-
- USBHIDSpaceNavigator.zip
- (1.91 KiB) Downloaded 904 times
Re: Using SpaceNavigator with Arduino?
I probably need to update my code on GitHub too.
I was using a SN to control a car with an Arduino and Raspberry Pi.
I wanted to do it wirelessly but we didn't have a wireless device at the time.
I was using a SN to control a car with an Arduino and Raspberry Pi.
I wanted to do it wirelessly but we didn't have a wireless device at the time.
Re: Using SpaceNavigator with Arduino?
Hey there,
I am trying to connect the SpaceMouse Wireless to an USB Shield on my UNO to control 3 Stepperdrivers on a CNC-Shield.
In the first step I just want to output the values from the mouse (Axis).
I found the provided code and it started but now I struggle to get the USB Input to the Serial Monitor. I am unsure how to get back the values from the dongle.
Is it possible to steer a CNC-Shield with the spacemouse?
Thank you
I am trying to connect the SpaceMouse Wireless to an USB Shield on my UNO to control 3 Stepperdrivers on a CNC-Shield.
In the first step I just want to output the values from the mouse (Axis).
I found the provided code and it started but now I struggle to get the USB Input to the Serial Monitor. I am unsure how to get back the values from the dongle.
Is it possible to steer a CNC-Shield with the spacemouse?
Thank you