VOGONS


First post, by Aviancy

User metadata
Rank Newbie
Rank
Newbie

Hey,

I've written a USB to Serial Mouse adaptor and released it as open source under LGPL. As of 23.07.2021 there's two versions of the software, one that runs on Linux and can also be run on a Raspberry Pi and a micro-controller version for making a stand-alone adaptor out of a Raspberry Pico. As far as I know this is the first implementation on a Pico, which is particularly convenient since it can act in USB host mode for the mouse. A a circuit diagram for making the stand-alone adaptor later has been released as well.

You can find the software at:
https://github.com/Aviancer/amouse
(2021.12.26 update: Now up to version 1.3.0 for Pico, 1.2.0 for Linux)

Give it a poke around and let me know what you think.

Since I initially had some problems finding a serial mouse myself and eventually native serial mice are going to get more rare, I thought it would be nice to share this project with everyone who might find it useful.

Currently the software emulates a Microsoft three button mouse with wheel, or the very basic original Microsoft mouse protocol alternatively. All buttons work as well as the wheel as one would expect. I recommend using something like ctmouse.exe for a DOS driver, but I've also used it successfully with Windows 95. For the Linux version basically all you need is a cheap USB to Serial adaptor to connect from your computer

I wrote up some instructions on the Github page on how to use it which hopefully are fairly straightforward.

Quick and simple video of some input testing with amouse on a 486 with DOS 6.2 + ctmouse.exe, https://www.youtube.com/watch?v=sy9O2Y8Pvo0

Last edited by Aviancy on 2021-12-26, 19:58. Edited 4 times in total.

Reply 4 of 19, by matze79

User metadata
Rank l33t
Rank
l33t

started PCB Design 😀

Thanks for nice work!

https://www.retrokits.de - blog, retro projects, hdd clicker, diy soundcards etc
https://www.retroianer.de - german retro computer board

Reply 5 of 19, by Thermalwrong

User metadata
Rank Oldbie
Rank
Oldbie

Wow, thank you for putting this Anachro Mouse project together and sharing this Aviancy, I'm impressed!
I bought a pair of Pi Pico boards with this exact intent many months ago with a larger order, but just haven't made the time to work on the project - I don't really have much programming experience for that to go well yet. So I've got these boards handy and some TTL to RS232 boards ready to use, this evening I put one together.

Thanks for putting a ready to use build up in the github project page. That was very easy to load up, just connect it to the PC, boot it with the flash button pressed, drop in the firmware and it's done.

The hardware side was a little tougher though. Initially it didn't go well and I found a slight error in the schematic - the schematic shows an RS232 male connector, but the RS232 for a mouse is female, so the CTS needs to be pin 7 rather than 8, the TX should be on 2 and the RX should be on 3.

My ready-made MAX3232 adapter had the TX/RX already positioned correctly, but I put the CTS in the wrong place and was wondering why it didn't work. Ended up having another go on the breadboard and that worked. In Windows it detects as a Standard Serial Mouse:

IMG_1185.JPG
Filename
IMG_1185.JPG
File size
1.07 MiB
Views
3297 views
File license
CC-BY-4.0
IMG_1187.JPG
Filename
IMG_1187.JPG
File size
310.16 KiB
Views
3297 views
File license
CC-BY-4.0

At last the LED on the Pi Pico went green to indicate detection and it was detected by ctmouse in DOS.

Once I had it working, I starting putting it back into the original config, I want to have the Pi Pico zip tied to the plastic of the RS232. The Micro USB port remains and is just used for power, while the USB port for the mouse connects up to the power and USB data pins.
I hit a snag in that there doesn't seem to be a way to have the Micro-USB used just for power - I'm guessing my little USB charger does something to the USB D+ & D- pins. I think a USB power cable that just has the power wires would've resolved it.
While troubleshooting, the Micro-USB port got damaged and won't work for data to the PC anymore, so I cut the USB data traces to the port and hooked the USB port for the mouse directly to the traces before the cut:

IMG_1190.JPG
Filename
IMG_1190.JPG
File size
1019.78 KiB
Views
3297 views
File comment
"cut the red wire..."
File license
CC-BY-4.0

It's hooked up to my Toshiba Portege 610CT, a great little laptop marred by the poor trackpoint and the PS/2 ports being reserved for the impossible to find dock:

IMG_1189.JPG
Filename
IMG_1189.JPG
File size
1.17 MiB
Views
3297 views
File license
CC-BY-4.0

Your adapter works extremely well! So far I've tried a couple of games, the detection of CTmouse with it forced to use com1 (because otherwise it uses the bad PS/2 trackpointer otherwise) detected as an MS mouse without issue. Windows 95 eventually detected it and motion is very good on a VGA screen - although a bit quick, I'm keen to try out anything you can add for changing the sensitivity slightly. The Pico has enough GPIO that jumpers / dip switches could work?

In terms of compatibility, it's worked well with the 2x microsoft USB mice I've tried with it. It doesn't work with my Logitech M185 wireless mouse, or my cheap Silvercrest wireless mouse from lidl, but that's probably limits of tinyusb and USB-HID mouse drivers.
Latency was not perceptible with my MS Basic Optical mouse v2, it did feel a little less responsive with the original intellimouse. At this point I've got so many old mice, I can't test with newer ones 😀

It may be worth posting about this in the general hardware forum, it may have gone under the radar in the releases section.
Since PS/2 mice (or USB mice that can fallback to PS/2) are getting harder to find, there should be some interest I think, especially if someone lijke matze79 can make an easy to use adapter board.

Reply 6 of 19, by Aviancy

User metadata
Rank Newbie
Rank
Newbie

Whoa!

Seeing these responses really made my day. What a feeling to see someone build your design and put it to good use, very happy to hear it's working well and being useful. Great to see the pictures too.

A PCB design started no less? Awesome matze79! Do kindly submit a pull request once that's completed, I've not gotten around to learning how to design that part yet.

Thank you Thermalwrong for mentioning about the pins in the schematic - I will check on it. Believe the thought I originally had was reversing the pins cable-wise, rather than the adapter being directly connected to the port. But that's of course not marked in currently and is likely to cause confusion.

There's certainly enough many GPIO pins to set up a dip switch type solution also. My current thinking is along the lines of detecting when both LMB and RMB are pressed and if the scroll wheel is moved up/down to adjust the sensitivity at runtime. This would of course not save the setting if the adapter was powered down between uses, and would then need to be re-applied. There isn't really purpose intended non-volatile memory on the Pico as per default so it's a bit of a challenge to persist settings without added complexity/components. It looks like it might be possible to erase and write a part of the onboard ROM (Where the program also lives) for persisting the settings but that needs more careful investigation.

I noticed the same about my wireless mouse which has a separate receiver that probably doesn't identify as a mouse, I suspect that anything that uses more specialized drivers isn't likely to play happily with TinyUSB by default. I'm rather curious about the latency differences and what they might be caused by. The adapter should accumulate movement until the next transmission is scheduled and optimize it to be pretty much the same latency on the serial side. Could be a data rate difference on the USB side perhaps?

One of the things I've done with the Pico USB port is using a physical host adapter and that interestingly enough worked fine. Another was using a separate power source directly connected to VSYS. I should eventually get around to poking at using the onboard USB port for power delivery a bit more as well, a cable without data pins might well do.

Reply 7 of 19, by matze79

User metadata
Rank l33t
Rank
l33t

Hi, yes,

but i have some small Problem.
The RP2040 is not so easy to buy.

I have to purchase 3400 Units at once or 500 reel...
Thats way to much!

jlcpcb also assembles them put they tell on their page:
Must be Ordered in Multiples of 100 or 500

So i have at least to order 100 Pieces well..

I will change Design a bit to use RP2040 Dev Board then..

https://www.retrokits.de - blog, retro projects, hdd clicker, diy soundcards etc
https://www.retroianer.de - german retro computer board

Reply 8 of 19, by matze79

User metadata
Rank l33t
Rank
l33t

Now got 2x PicoPi for trying out 😀

https://www.retrokits.de - blog, retro projects, hdd clicker, diy soundcards etc
https://www.retroianer.de - german retro computer board

Reply 9 of 19, by Kamerat

User metadata
Rank Oldbie
Rank
Oldbie

Failed to compile the Linux version on Ubuntu 20.04 and Ubuntu 21.10, here's what I got when trying to compile:

gcc -g -Wall -c src/include/serial.c -o src/include/serial.o
gcc -g -Wall -c src/include/utils.c -o src/include/utils.o
gcc -g -Wall -levdev -I/usr/include/libevdev-1.0/libevdev -I./include -o bin/amouse src/include/serial.c src/include/utils.c src/amouse.c
/usr/bin/ld: /tmp/ccYn05gd.o: in function `open_usbinput':
/home/xxx/amouse/linux/src/amouse.c:133: undefined reference to `libevdev_new_from_fd'
/usr/bin/ld: /home/xxx/amouse/linux/src/amouse.c:138: undefined reference to `libevdev_has_event_type'
/usr/bin/ld: /home/xxx/amouse/linux/src/amouse.c:139: undefined reference to `libevdev_has_event_code'
/usr/bin/ld: /home/xxx/amouse/linux/src/amouse.c:140: undefined reference to `libevdev_has_event_code'
/usr/bin/ld: /home/xxx/amouse/linux/src/amouse.c:141: undefined reference to `libevdev_has_event_code'
/usr/bin/ld: /home/xxx/amouse/linux/src/amouse.c:142: undefined reference to `libevdev_has_event_code'
/usr/bin/ld: /home/xxx/amouse/linux/src/amouse.c:143: undefined reference to `libevdev_has_event_code'
/usr/bin/ld: /home/xxx/amouse/linux/src/amouse.c:144: undefined reference to `libevdev_free'
/usr/bin/ld: /tmp/ccYn05gd.o: in function `main':
/home/xxx/amouse/linux/src/amouse.c:191: undefined reference to `libevdev_new_from_fd'
/usr/bin/ld: /home/xxx/amouse/linux/src/amouse.c:266: undefined reference to `libevdev_next_event'
collect2: error: ld returned 1 exit status
make: *** [Makefile:28: amouse] Error 1

DOS Sound Blaster compatibility: PCI sound cards vs. PCI chipsets
YouTube channel

Reply 10 of 19, by Thermalwrong

User metadata
Rank Oldbie
Rank
Oldbie

Oh BTW, I made this cool case for my one, it's only good for me since it's made from parts I had - but if anyone makes a PCB and wants a case designed, please ask!

It looks like the chips are somewhat available again? Though maybe that's like the Pi Zero and the new Pi Zero 2 W, both sold out from launch and onwards.

Attachments

Reply 11 of 19, by matze79

User metadata
Rank l33t
Rank
l33t

Nice 😀

https://www.retrokits.de - blog, retro projects, hdd clicker, diy soundcards etc
https://www.retroianer.de - german retro computer board

Reply 12 of 19, by Aviancy

User metadata
Rank Newbie
Rank
Newbie

Hi, I've been quiet for a bit but things have been moving (gradually)!

I've just finished implementing on-the-fly sensitivity adjustment for the Pico and released version 1.1.0 of the firmware:
https://github.com/Aviancer/amouse/releases/tag/pico-1.1.0

Basically you hold down left and right mouse buttons and scroll the mouse wheel up to to add sensitivity, scroll down to reduce sensitivity. One mouse wheel click adds/reduces sensitivty by a factor of 0.2, and currently you can adjust sensitivity between 0.2 and 2.0 (multiplier).

What an awesome thing to see a case having been designed for the adapter as well! Nice one Thermalwrong.

Kamerat: I think you're missing the libevdev library from your system and that's the reason compile is failing, you should install at least version 1.11.0-1 of the library and try again.

matze79: Yeah using the dev board does sound like a workable solution all in all, that's the way I've been going about it - while having just a RP2040 would of course be cool also but those order minimums are ridiculous. Excited to see what you come up with.

I need to still get around to updating the diagram from the earlier comments as well.

Reply 13 of 19, by CalamityLime

User metadata
Rank Member
Rank
Member

Hello there.

I guess to let you know if you haven't found it already. I'm working on a very similar project, I have PCB's ordered and just getting the software to a place where I like it.
I started working on my project before I found yours but I continued with my own regardless.

MY thread on it started here:
Re: USB to Serial Mouse using the Pi Pico!

But the most up to date information can be found here.
https://dosreloaded.de/forum/index.php?thread … -pico/&pageNo=1

I have a link to my Github (which has a bit of a mistake in it with the firmware but the KiCad files are there) on both threads.
My firmware problem seems to be a result of my SDK going weird after an update. I took a break from it and set up a new ENV in linux to continue working on this.
It's not final so it's a bit weird in places.

When I get my PCB's and they are confirmed working, you're obviously free to edit your program to work with them and I'd be happy to include a link to it where appropriate.
Feel free to DM me if that's something you'd like to talk about.

Kind regards
-Lime

Be Happy, it's only going to get worse.
- Projects
Limes Strange 3D models
USB-2-232

Reply 14 of 19, by Aviancy

User metadata
Rank Newbie
Rank
Newbie

Hi Lime! What an appropriate name.

Neat! Nice to see people other people helping solve the problem as well. I guess that's the nature of open source, there's often multiple alternatives. I had a quick look through the code and I'm happy to see some of my solutions in amouse have contributed to figuring out some things there too, that's one of the reasons why it's open source after all!

Curious to see how your PCB design turns out, I could certainly consider adapting some support for things like using dip switches for setting options. Generally I need to collapse some of my code into a library so I can just use the core functionality for different platforms like Linux and Pico without having to make changes in each of them. Would like for it to be somewhat modular in the end, times been a bit tight but we could certainly discuss collaborating on things like that.

Reply 15 of 19, by CalamityLime

User metadata
Rank Member
Rank
Member

Hey there.

Yeah, I make it no secret in the comments that I had more than a peak at amouses code and scorps ps/2 to serials code. I'm not a software developer so it does help.

I should have probably explained a bit more about what I meant by editing your program. I use UART1 from pin 6 and 7 I think it was and yours uses UART0 from pin 0 and 1. I enjoy a good DIP switch but there's no obligation on your end to use them. I'm open to collaborating on things but honestly I'm kinda new to pretty much all that's involved with this project (partly why I've decided to do it) so I have no idea how fruitful a collaboration would be.

There is a thread on DosReloaded about your project that Matze created. Thought I'd point that out just in case you didn't know that it existed.
https://dosreloaded.de/forum/index.php?thread … -mouse-adapter/

I suppose let me know if you have any ideas that you'd like to talk about.

-Lime

Be Happy, it's only going to get worse.
- Projects
Limes Strange 3D models
USB-2-232

Reply 16 of 19, by Aviancy

User metadata
Rank Newbie
Rank
Newbie

Another update!

Pico branch is now up to version 1.1.1, with a fix to the sensitivity controls (they were being too sensitive 😀)
Linux now also has on-the-fly sensitivity controls just like the Pico branch does.

I did a major refactoring of the codebase to shuffle common functionality in both branches into one shared library. Going onwards it'll be a lot less work to maintain things or add functionality to both because I have to implement it just once rather than twice, and especially the Linux code quality has been improved significantly from earlier. It's telling that after the refactoring it took only two lines of code to add sensitivity controls to the Linux branch! There's still bits on the Linux side I want to address but that'll come later.

https://github.com/Aviancer/amouse/releases/tag/pico-1.1.1 (For both Pico and Linux release, or you can just pull the main branch)

Reply 17 of 19, by Aviancy

User metadata
Rank Newbie
Rank
Newbie

I just released version 1.3.0 with a major new feature! A serial console you can do much more extensive configuration of the features of the adapter over software rather than needing any additional components or inputs/outputs aside from the computer the mouse is connected to. The same serial line that is used to send mouse data can be used to configure the adapter, instructions for use can be found at https://github.com/Aviancer/amouse/

Unfortunately I still don't seem to be able to send PMs on the forums after a number of posts made, I guess I need to post to different threads altogether? I haven't meant to ignore your message from earlier CalamityLime. Maybe there's some other way to contact you? (edit: There we go, finally seems to be working!)

Video of the serial console feature in action: https://www.youtube.com/watch?v=DIYM_tL-Ly4

Left and right mouse buttons are now swappable on the adapter which can be quite useful especially if you're left-handed and the old software being used doesn't have support for it. The build also contains a few fixes versus 1.1.1 and 1.2.0 previously released so it's a good idea to update to it.

Here's also my own build of the adapter in a neat package, it still needs a better power solution but I'm rather happy with it.
amouse-box.jpg

Last edited by Aviancy on 2021-12-26, 23:45. Edited 1 time in total.

Reply 18 of 19, by Aviancy

User metadata
Rank Newbie
Rank
Newbie

I also updated the main schematic to use a female serial port so that the adapter can be directly connected to a computers serial port if desired, I've kept the male serial port one available as well as an alternative with it's pins.