Page 1 of 3

Mouse Emulator using Arduino

Posted: Sat Oct 24, 2020 4:22 pm
by g4eml
Instead of modifying an existing USB mouse for tuning the Langstone it is also possible to program an Arduino Pro Micro board to emulate a mouse.
One of the advantages of doing this is that it enables a higher quality rotary optical encoder to be used. These usually have a much higher number of pulses per revolution than the lower cost mechanical encoders. They also do not have the click detents and so can enable smoother tuning and a real tuning knob feel.

The higher number of pulses per revolution can be a problem when trying to use existing mouse boards. Either the tuning rate is too high or the mouse board limits the maximum rate. Both are not ideal.

I have just published a working design for an Arduino pro micro on github at https://github.com/g4eml/Langstone-Mouse

This design has been optimised for the Langstone and can be configured to use high resolution encoders. The USB output is scaled to a suitable value for the Langstone code to handle. The Arduino .ino file is very simple and makes use of the standard arduino mouse and encoder libraries.

Hardware required is an Arduino Pro Micro board, a suitable encoder, and two push switches.

The Arduino Pro Micro board is available from Ebay at around £6 (must have the ATmega32U4 processor 5V 16MHz version)
Optical rotary encoders are available from around £10. The one I used is 400 pulses per revolution but this high is not really required.

Colin G4EML

Re: Mouse Emulator using Arduino

Posted: Sat Oct 24, 2020 4:34 pm
by G4FKK
Hi Colin,

I've used pretty much the same hardware for my Arduino mouse impersonator. I added a feature whereby I can make the Langstone step in 12.5kHz steps - useful when bored and using FM on the lower bands :geek: You can also use the Arduino with a Nextion display to show voltages, control relays etc. etc.

73, Martin - G4FKK

Re: Mouse Emulator using Arduino

Posted: Sat Oct 24, 2020 4:36 pm
by G4FKK
Oh, and I was thinking of making the Arduino generate CTCSS and also, perhaps, do the beaconing functions that Radiogareth suggested in another thread. I thought I'd hang on in case you did it on the Pi though ;)

Re: Mouse Emulator using Arduino

Posted: Sat Oct 24, 2020 5:24 pm
by g4eml
Hi Martin,

I have used the Arduino before for mouse emulation but forgot how easy it was to do. The need this time came about because I wanted to use the nice optical encoder I have. I needed a way to divide down the number of steps. The existing mouse board couldn't handle it.

CTCSS and CW beacon are things that might get added. It would be easy enough to do both. I just need time to get around to implementing them!.

CTCSS has always been low on the priority list because the primary reason for the Langstone was always to encourage use of the microwave bands. There are plenty of other radios out there for use on repeaters.

Colin

Re: Mouse Emulator using Arduino

Posted: Sun Oct 25, 2020 12:04 am
by G4FKK
I admire your position on scope creep Colin. I'm afraid I suffer from "Ooo, I Could Make It Do This Too" syndrome whenever I programme anything :|

Re: Mouse Emulator using Arduino

Posted: Sun Oct 25, 2020 5:08 pm
by g4eml
As the new Arduino mouse emulator allows high resolution rotary encoders without detents and potentially flywheel action tuning knobs I have added a Dial Lock function to prevent inadvertent frequency changes.

This makes use of the previously unused middle button on the mouse.

Pressing the middle button will lock and unlock the dial.

LOCK will be displayed in red above the frequency display.

Touching any of the frequency digits will also remove the lock.

Dial lock only affects the tuning. Adjusting settings is still possible.

Colin G4EML

Re: Mouse Emulator using Arduino

Posted: Mon Oct 26, 2020 1:33 pm
by G4FKK
Hi Colin,

I've updated my own Arduino code and Langstone and I'm happy to report that the lock function works as described.

I don't think it's related to this update as I've seen it before but I noticed that, while SSH'd into the Langstone, doing the update and then running Langstone/run works ok until I stop PuTTY, at which point Langstone seems to freeze. After touching the screen a couple of times it switches to Portsdown. It's not a problem as I can then reboot from Portsdown and everything then appears normal. I wonder if anyone else has noticed this or is it just (yet another), FKK anomaly?

73, Martin - G4FKK

Re: Mouse Emulator using Arduino

Posted: Mon Oct 26, 2020 8:32 pm
by g4eml
Hello Martin,

That’s the normal default behaviour for Linux. When you start a program it only continues to run while you are logged in. When you disconnect any programs you started are terminated.

Colin.

Re: Mouse Emulator using Arduino

Posted: Mon Oct 26, 2020 11:06 pm
by G4FKK
Thanks Colin,

Forgive my ignorance; Linux is even more of a black art to me than GNU Radio :?

73, Martin - G4FKK

Re: Mouse Emulator using Arduino

Posted: Wed Oct 28, 2020 4:26 am
by w0iy
As an alternative, I think you could have an optical mouse, with little modification, look at a large washer on a shaft. Turn the shaft and the optical detector sees the rotation. Depending on sensor orientation it will look like x or y movement.

There would be no detent but would be smoother tuning like a VFO.

This would require having to change the code to follow x,y rather than the scroll wheel. This is quite a ways down my list of things to do.

w0iy