Jump to content

A device DIY to replace my mouse


Recommended Posts

In a cyclic-collective configuration, usage of mouse (and for a right-hander) is not very easy and requires an available area.

My idea was to make a 'tactile' mouse with buttons suitable for dashboard instruments. (Initially for the Huey, but also usable in other modules).

A pad (recovered on an old PC) for the cursor.


In center, a rotary encoder to replace the mouse wheel with a function 'pressed' for a fast mode.
On left, a rotary encoder for left and right button of the mouse and 'pressed' for the middle button (which I use to freeze 'momentarily' the trackIR).
At right, a momentary switch (on)off(on) for up and down position that also corresponds to the left and right buttons of the mouse.

 

All driven by a Pro-Micro Arduino in 'mouse' mode.

 

This makes it possible to get closer to the natural movements of the (left) hand for dashboard buttons and to be able to keep the right hand on the cyclic.

 

I am still trying to improve the management of the wheel, simultaneous use of Interrupts and PS2 communication of the Touchpad hang the Pro-Micro Arduino.


For the moment, without solution, I do not use the interrupts, it already works well.
If a specialist in the coding of the Arduino has an idea ... 🤔

 

handmouse_.png


Edited by Tanuki44
  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

Thank you for this comment.

 

Of course, I can put these infos and the sources that helped me.

 

I'm always looking for a solution to improve the button 'wheel mouse'.

 

I will gather and publish these elements.


Edited by Tanuki44
Link to comment
Share on other sites

Reuse a trackpad on a old laptop

 

Trackpad source1

Trackpad source2

 

Known issues :

Sometimes the device is not recognized at startup W10 or hangs during operation,

It's better to add a button to reset it easily.

Can not use interrupt for the wheel (incompatible with the PS2 trackpad ???) the rotation of the wheel should not be too fast,

To quickly advance, press the wheel at the same time accelerates incrementation.

 

 

hand_mouse_wiring.png

 

I am not very competent with Arduino coding, any suggestion will be welcome 😉

My arduino code

 

 

 


Edited by Tanuki44
Link to comment
Share on other sites

I dont really have time at the moment to do a full review of the Arduino code, but it gets a pass for not having any obvious faults and being clean enough. Your method of doing button presses with delay makes me suspect you cant do other actions while this is happening, like press and hold a volume knob and drag to increase/decrease. Using delay to combat input hysteresis isn't really optimal, you should look into other code based techniques such as a confidence counter, to only register the input if the button has been low/high for x cycles.


Edited by Myrsnipe
Link to comment
Share on other sites

Thank you for your comment, but as indicated, I do not have great skills in this type of coding.

I only assemble some code from the example found on the net.

Overall, the mouse wheel works properly with the interrupt when there is not the PS2 trackpad.

But when I add PS2 trackpad is a problem.

I will try to understand " you should look into other code based techniques such as a confidence counter"  🤔

 

 

Link to comment
Share on other sites

So confidence might not be the right word, but lets just first confirm that you know about about input hysteresis. When you press a button that has no hardware level hysteresis measures, there is a moment from when  you press the button down until it is completely down where the input value can fluctuate between high/low, as a MCU can do millions of operations per second, if you just read the raw data it can be perceived like you are pressing the button hundreds of times until it stabilizes. To me it looks like you combat this by using a delay, first you delay by 20ms to stabilize on click down and then you delay by 20ms to click release. While the code is delayed nothing else can happen on the MCU, its effectively paused at this moment and given your code it will stay like that until you release the click.

 

So how do you overcome this in code? The solution is generally a statemachine that tracks the buttons logical state (what is seen by the computer the MCU is connected to), the current and previous physical state (the signal sent by the button to the MCU) and a timestamp or cycle counter. So whenever the physical state changes you will set a timestamp or the cycle counter, and only after a certain time or x cycles where the current and previous state has been the same (no hysteresis) you will change the logical state (in other words, when you are confident the signal wont fluctuate). This obviously only works if there is no delay/pause in the code.

Link to comment
Share on other sites

After search, I changed libaries for the management of TouchPad PS2 ( https://github.com/kristopher/PS2-Mouse-Arduino )

and also for rotary encoder. ( http://www.pjrc.com/teensy/td_libs_Encoder.html )

No more crash .

 

I made a change on the 'Push' button of the wheel, it works in mode 'toggle' for the slow and fast.

 

I also added a keyboard 12 keys to emulate the F1-F12.

 

keyb.pnghandmouse.png

 

Arduino Code for Pro Micro

handmouse.ino

 

 


Edited by Tanuki44
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...