Shop OBEX P1 Docs P2 Docs Learn Events
Crazy Joy Stick Idea. — Parallax Forums

Crazy Joy Stick Idea.

I had an idea for a different kind of Joystick because the tolerances on the inexpensive joysticks varied so that it has been difficult to build something that would work to my satisfaction. My idea was to use the guts of an optical mouse, inverted, on the bottom of a ball. Cut the ball in half as only the bottom half of the ball is needed. Boot the mouse software with the joystick is centered and the zero position is known. All movement is relative to the start position and the data can be read from the mouse position changes which could easily be read from smart pins x,y outputs.
Unfortunately for me, I have been unable to extract the mouse data from Garry G's usb 1CogKBM object because when I run it, it is only showing the initial load information in the terminal output and nothing else. @Ramon came up with a modified version, but I can not run his test because it displays its output on a VGA monitor which I do not have available on my laptop. Does the idea have merit? Is it worth extracting the mouse code from Garry's code or should just drop the whole project as a bad idea? I have a usb to PS2 port adapter and a PS2 jack that I can easily connect to the P2 and therefore avoid the USB part of the code. That would simplify the code requirements, but again I ask does the idea seem to have merit?
Jim

Comments

  • I think you'd need some sort of way to detect the stick being in its center resting position so it can re-zero the position accumulation (or add a button to do it manually). Otherwise it will drift off due to the limited precision of the mouse sensor (especially the kind of low-end mouse sensor where you'd be comfortable hacking it up).

  • @Wuerfel_21
    Ada,
    Yeah, I sort of thought I was going to need a "centering" button to re calibrate the position. Also still thinking about something mechanical to physically center it. What do you think of the over all concept?
    Jim

  • Wuerfel_21Wuerfel_21 Posts: 5,106
    edited 2022-02-11 22:55

    I guess it'd work as a really high-res joystick (given a good enough sensor). Note that actually tracking the position would be more complex than accumulating XY deltas. That works on a flat surface, but when moving over a curved surface, there's some math that needs to be done to convert movement as observed by the mouse camera into movement of the stick (ref: "spherical geometry").

    If you can get the tolerance low enough that the sensor lens barely floats above the surface, you could just put a phototransistor at the center position to detect the light coming from the sensor. If it stays on for 100ms or so, the joystick is resting at the center and you can zero the position.

  • RS_JimRS_Jim Posts: 1,768
    edited 2022-02-11 23:45

    Ada,
    Oops! (ref: "spherical geometry").. I forgot about that aspect. my first goal is to get the P2 responding to the mouse. I was reading (the best I could) the 1CogKBm by Garryj and 1 thing I found was a test for a clock freq of 160_000_000 that was actually coded in. That may be why I am getting failure in reading at 200MHz. It was a thought, but is getting getting well outside my meager knowledge.
    Thanks for the feedback.
    Jim
    Edit: corrected Garry"s initial

  • evanhevanh Posts: 16,029

    Forget the extra chip and serial data. Use direct quadrature input straight from the photo sensors. Smartpins even have a mode built just for this. Two pins per axis. The software and wiring is easy, it'll be the mechanics that'll need the hard work.

  • jmgjmg Posts: 15,175

    @RS_Jim said:
    .. Boot the mouse software with the joystick is centered and the zero position is known. All movement is relative to the start position and the data can be read from the mouse position changes which could easily be read from smart pins x,y outputs.

    As above, keeping zero could be tricky, as mouse sensors do not care about gradual zero drift as users fix hat for them.
    Maybe some SW can add a long-term auto-zero to fix hat effect.

    Mounting this and optically managing things will be the real challenge, but maybe a hemisphere can do that ?
    Mouse sensors seem to have a bit of height/separation tolerance.

    An alternative would be to use a QUAD photodiode, I see Vishay have recent releases
    https://www.vishay.com/company/press/releases/2020/K857PE/
    and
    https://www.vishay.com/ppg?80279

    Arrow look to have K857PH in stock at $0.557/100
    A modulated illumination and a high pass amplifier and SW filtering could make it more tolerant to light leakage ?

  • ercoerco Posts: 20,257

    Sounds like the world's biggest trackball. Call Guiness~!

  • @erco
    Whole image not loading?
    @jmg ,how would you use that part?
    Jim

  • @RS_Jim said:
    I have a usb to PS2 port adapter and a PS2 jack that I can easily connect to the P2 and therefore avoid the USB part of the code. That would simplify the code requirements, but again I ask does the idea seem to have merit?

    Most PS2 to USB adapters are dumb and just connect the wires to the alternate physical connector. The USB or PS2 protocol conversion has to be done by the mouse. The mouse has to be specifically designed to allow both connections. Changing the physical connector wouldn't necessary work. If the adapter came with the mouse you want to use, it will likely work; otherwise the odds of it working aren't so good.

  • RS_Jim,

    What about using an old DB15 PC Joystick?

  • @Genetix
    If I had one, I would certainly give it a try. I think I trashed my last one several years ago.
    Jim

  • If you get an old PC joystick, check this out:

    https://markroland.com/portfolio/joystick-hack

  • pik33pik33 Posts: 2,388
    edited 2022-02-15 15:16

    I have an old PC analog joystick and I have a plan to connect it to a P2.
    There is a problem. The joystick has its potentiometer connected to Vcc only, not to GND so it has simply a variable resistance from 0 to 10K. If I simply connect this to ADC with a pulldown resistor, it will work, but in non-linear mode. A translation table or a function will be needed to linearize this. Or maybe implementing a PC-way and use a capacitor may be simpler.

    This is a good stuff, not cheap, but precision is much better than a game controller: https://www.frsky-rc.com/product/taranis-x-lite-pro/ - I use it for a robot control (with a P2)

  • pik33,

    Most Pot circuits I have seen connect Vcc and Gnd to the ends of the Pot and then the Wiper is the input.

    I sometimes see the Wiper and one of the pins connected together.

  • pik33pik33 Posts: 2,388

    A lot of these joystick has Vcc only connection. My joystick is one of these 10 kOhm, single ended things

  • @pik33 said:
    This is a good stuff, not cheap, but precision is much better than a game controller: https://www.frsky-rc.com/product/taranis-x-lite-pro/ - I use it for a robot control (with a P2)

    I also think that's a good radio but I'd caution people new to RC to stay away from FrSky products. In an attempt to keep inexpensive clones from working with their radios, FrSky has changed their radio protocol so new gear is not easily compatible with older gear. I presently actively avoid FrSky products now.

    The RadioMaster TX16s seems to be one of the more popular radios with quadcopter pilots these days. With EdgeTX installed on the radio, the color touchscreen is usable.

    The RadioMaster TX16s has a multi-protocol radio so it works with lots of legacy receivers, including lots of the small cheap quadcopters.

    I have a lot of FrSky gear but I really dislike the way they've broke compatibility between their various products.

  • AribaAriba Posts: 2,690

    @pik33 said:
    I have an old PC analog joystick and I have a plan to connect it to a P2.
    There is a problem. The joystick has its potentiometer connected to Vcc only, not to GND so it has simply a variable resistance from 0 to 10K. If I simply connect this to ADC with a pulldown resistor, it will work, but in non-linear mode. A translation table or a function will be needed to linearize this. Or maybe implementing a PC-way and use a capacitor may be simpler.

    The P2 has also current modes in addition to pulldown resistors. The 100uA current sink should work with a 10k variable resistor to produce a linear voltage of 0 to 1V. If you connect the joysticks Vcc to 3.3v, you get 3.3V ... 2.3V at the pin.
    But why not connect Vcc of the joystick to GND of the P2 if it's only a resistor, and use a 100uA current source, so you get 0V .. 1V at the pin.

  • pik33pik33 Posts: 2,388

    @Ariba said:

    @pik33 said:
    I have an old PC analog joystick and I have a plan to connect it to a P2.
    There is a problem. The joystick has its potentiometer connected to Vcc only, not to GND so it has simply a variable resistance from 0 to 10K. If I simply connect this to ADC with a pulldown resistor, it will work, but in non-linear mode. A translation table or a function will be needed to linearize this. Or maybe implementing a PC-way and use a capacitor may be simpler.

    The P2 has also current modes in addition to pulldown resistors. The 100uA current sink should work with a 10k variable resistor to produce a linear voltage of 0 to 1V. If you connect the joysticks Vcc to 3.3v, you get 3.3V ... 2.3V at the pin.
    But why not connect Vcc of the joystick to GND of the P2 if it's only a resistor, and use a 100uA current source, so you get 0V .. 1V at the pin.

    It seems after a year with a P2 I have to read the documentation again :) to discover what else this chip can do :) Of course I will test this trick, the 3D printed box for a P2 with several sockets including DB15 is ready and I "only" need some free time to connect it.

  • jmgjmg Posts: 15,175

    @jmg, how would you use that part?

    It's an Analog optical sensor, with 4 PIN Photodiode quadrants and zero intelligence.
    So you need 4 x amplifiers and ADCs to read, and you activate with a focused/defined dot that lands zeroed with 1/4 area on each quadrant, giving balanced signals from the 4 areas.
    As the dot moves via the joystick , the quadrant balance skews.
    The dot can come from a laser diode, or a LED with a light-tube. Often those diode(s) are AC modulated to educe ambient light effects.

    Challenges are mostly mechanical :)

    eg creating a joystick with an internal curved mirror and maybe a 3-D printed LED/tube shroud, that clips inside the cavity.
    or, if you wanted more wobble on the joystick, a tiny flat mirror in the centre and an elevated photodiode, whose mirror distance defines the angle range.

Sign In or Register to comment.