HID Joystick using 3D Hall effect positioning sensor

Hi guys

So I'm currently filling my time with attempting to make my own joystick for use with a PC. I had started by combining parts from existing sticks CH Fighterstick and Thrustmaster's T16000M but as I have gone along I been slowly replacing parts with my own builds.

My original idea was to use the buttons and control board from the CH stick and 3D Hall effect sensor and control board from the T16000M (as neither board can do the job of both). I would then connect two USBs up and the stick would essentially operate as two devices.

Now being a bit anal this has been a bit of an irritation to me as I like things to be neat and efficient and having it operate as two devices just doesn't fit the bill, so I thought I would do some research into the possibility of using Arduino.

Now I've had success in the past adding analog thumbsticks and extra buttons to sticks using the Micro which a PC can recognise as a HID device. So my first thought ran to the Micro but I have come across a few details that have me worried.

The Micro ATmega32U4 is an 8-bit processor. The Melexis 3D Hall effect sensor is set up in Serial Protocol mode with the output values (from Melexis MLX90333 data sheet):

either:

1) an analog output level through a 12 bit DAC followed by a buffer 2) a digital PWM signal with 12 bit depth (programmable frequency 100 Hz … 1 kHz) 3) a digital Serial Protocol (SP − 16 bits computed angular information available)

So my questions are thus:

Will the Micro be able to handle 16 bits from the SP? Will it damage either component?

If so, are there any other off the shelf boards that are 16-bit that could be used as a HID? If not, could I make my own board using an Arduino Proto board and what chip|s could I use to accomplish the task e.g. ATxmega128A4U/64A4?

Any help in this problem would be greatly appreciated. I do have the full data sheet for the Melexis positioning sensor but cannot post it on here due to the whole confidentiality thing but will gladly find specific details when needed.

TL;DR I need to find or make an Arduino board that can a) operate as a HID b) Handle a 16-bit sensor in Serial Protocol mode.

This is a hobby for me so cost, difficulty and time are not issues.

Thanks for reading

Ginge.

Many questions ;-)

I'd use an accelerator module for my joystick, or dumb hall sensors. But if you want to experiment and learn by doing, every approach is okay.

If you want to connect your joystick as an USB HID, you need a special Arduino (Leonardo...) that can act as a HID. But even then this is a single (USB module) output, not a port to connect further USB devices. It's not clear whether your devices connect using USB (for serial protocol?), unusable with an Arduino.

Similar for multiple serial inputs, most Arduinos provide only one hardware serial connection, which is normally used for the USB connection. Another SoftwareSerial connection can be added, though. An Arduino Mega comes with 3 UARTs.

How many axis will your joystick have, how many (serial) connections for that purpose?

2) An analog output is the easiest to connect to an Arduino ADC. 2) PWM is fine for output, but overly complicated for input. 3) The Serial Protocol may be usable when it carries all information on a single connection. How exactly are the signals transferred (TTL level, RS-232...)? Additional hardware may be needed and is commonly available.

DrDiettrich: Many questions ;-)

I'd use an accelerator module for my joystick, or dumb hall sensors. But if you want to experiment and learn by doing, every approach is okay.

If you want to connect your joystick as an USB HID, you need a special Arduino (Leonardo...) that can act as a HID. But even then this is a single (USB module) output, not a port to connect further USB devices. It's not clear whether your devices connect using USB (for serial protocol?), unusable with an Arduino.

Similar for multiple serial inputs, most Arduinos provide only one hardware serial connection, which is normally used for the USB connection. Another SoftwareSerial connection can be added, though. An Arduino Mega comes with 3 UARTs.

How many axis will your joystick have, how many (serial) connections for that purpose?

2) An analog output is the easiest to connect to an Arduino ADC. 2) PWM is fine for output, but overly complicated for input. 3) The Serial Protocol may be usable when it carries all information on a single connection. How exactly are the signals transferred (TTL level, RS-232...)? Additional hardware may be needed and is commonly available.

Thanks for your post @DrDiettrich, it's given me a lot to think about.

So to keep it simple I will forget about the buttons for now and just concentrate on the axis. My stick will have three (3) axis...x, y, z (twist). The IC that I stole from the T16000M is this little baby:

http://www.melexis.com/Position--Speed-Sensors/Triaxis%C2%AE-Hall-ICs/MLX90333-648.aspx

...and takes care of (x, y) axis. For twist I would need to use either a second one of these or a standard analog pot.

In short the Melexis IC measures the flux density of a magnet passing over it in three dimensions (bx, by, bz) and outputs its position in two axis (x, y).

From stock it can be setup in three different modes to transmit it's data. Analog, PWM or Serial Protocol mode. The chip on the T16000M board is already set up in SP mode, so has five (5) pins:

Vss Vdd SCLK MOSI/MISO /SS

Changing it's mode would require making a new board and expertise I just don't have so either using it as it is or not using it are really my only options.

So I guess in simple terms the question is can an Arduino Micro/Pro Micro read this sensor? If not I have two options. Stick with sensor but use microcontroller from T16000M as well...or scrap the 3D Hall effect sensor and go with something else.

That leads me onto your comment about the accelerator. I looked around and found this:

https://www.sparkfun.com/products/10724

I nifty little sensor which will do x, y and z axis. It's an accelerometer , gyro and magnetometer in one and could communicate with a Micro/Pro Micro via I2C....I guess the only question will be is it accurate enough but looking at a headtracking tutorial that has been done for it, I think it will.

https://vimeo.com/32898673

This could probably solve a lot of problems for me. Thoughts?

Your "Serial Protocol" is known as SPI (Serial Peripheral Interface). You have to know how many bits belong to one data record, and how the values are represented in that record.

Now you see why I mentioned accelerators as a possible solution. Their resolution should be in a useful range, but I don't know your requirements - check yourself.