USB to Serial Mouse using the Pi Pico!

  • Guten Tag!


    I have been working on a USB to Serial Mouse adapter using a Pi Pico as the MCU. The original thread I made on Vogons can be found here for full details.



    Gesamtübersicht:

    • 25%/50%/75% Mouse XY Tracking Speeds.
    • Two Button/Three Button/Wheel mouse support.
    • 7N1/7N2 Serial (this idea came from a comment in Scorps PS/2 to serial project)
    • Hot swapping the USB mouse. No need to restart anything if you want to use a different USB mouse or if usb connection is lost.
    • KVM's are not supported yet. TinyUSB panics when it's connected to a KVM and I'm still trying to figure out why.
    • Open Source Code, not much of a feature but here is the GitHub repo.


    Pläne für die Zukunft:

    • PCB, I have a general shape in mind for the PCB but the point below is still up in the air.
    • PS/2 support. I'm not entirely sure about supporting both USB and PS/2 mice but I do plan on exploring an implementation when I have a chance.
    • Sell a few ready made adapters, if the interest is there I'd be happy to make a small batch of ready made boards.

    Again check the Vogons thread for full details!


    I'm posting this here to try to bring some awareness to this project and hopefully get some feedback. My ears are open and I'd love to hear what you have to say about this project.


    :thumbup:
    Danke


    Have a few pictures.

  • I should point something out.

    I explained why I'm using resistor dividers on the ROUT lines on the Vogons thread but long story short:

    • I didn't realize that the Pi Pico wasn't 5v tolerant so I ordered the max232 instead of the max3232.
    • The schematic here is not final, it's just what's on my breadboard currently.
    • For the moment I plan to make the pads for R1 and R2 (as shown above) easily bridgeable so either the MAX232 or the MAX3232 can be used.

    Danke!

  • Awesome! I'd omit PS/2 since there's already a dedicated adapter for it, and most mice support both protocols anyway.


    I'm definitely interested in a PCB whenever it's finished.

    Fair point.

    Supporting a PS/2 mouse isn't a priority but I think it's worth exploring the option on some late night. :D I think the only added cost would be the PS2 header itself, maybe some ferries to clean up any noise.


    Danke!

  • Guten Tag!


    So I have been tinkering with a PCB and how to lay out the board.
    I tried a few idea's but I stumbled on a shape I like. Before routing traces and making it look nice. I'd like to ask what ye think and if it's missing anything important.

    Just for context, this is the first time I've layed out a PCB in KiCad from scratch.


    Information:

    • J2 is a serial out, so the signals come out of that as well as from the serial port on the board.
    • J3/J4 is 5v power in.
    • Switch is a run switch for the pico so you can do a hard reset.
    • Mini USB for power in.
    • JP1 is for switching between 3v3 and 5v supply for the max232. This is to allow the board to take a max232 or a max3232
    • The USB port on the pico points in the opposite direction to the serial port.


    While the layout is not final and some bits may shuffle around a little, you can see the shape and rough layout that I had in mind.

    The pin headers are to allow you build the thing into a PC or something. Power can be pumped into it via the pin header, the mini USB port or the picos micro USB with certain USB OTG cables.


    The bottom of the board is bare.


    :thumbup:
    Danke


  • I'd suggest to make the board just as wide as the Serial port. You often have no place around it to have such a wide PCB. Usually there is the case edge from one side and the LPT port from the other, where you could have another cable, or covox, or something else...

  • Yes.


    Needs not much more space then miniusb

    Since the usb data lines are not accessible from the pins on the sides of the pico, I thought it would be a bit messy to run wires to the either the test pads or to a micro usb cable from the board.



    I'd suggest to make the board just as wide as the Serial port. You often have no place around it to have such a wide PCB. Usually there is the case edge from one side and the LPT port from the other, where you could have another cable, or covox, or something else...

    Thanks for pointing that out. That honestly somehow slipped my mind.

  • I got a bit carried away and done all the tracks, keeping the pcb as narrow as I can. I really don't think I can narrow it down anymore without mounting the rp2040 directly to the board OR swapping out the DIP switch with something else which I'd rather not do.

    • PCB TP1 == USB D- == TP2 on the underside of the Pico
    • PCB TP2 == USB D+ == TP3 on the underside of the Pico
    • That way the Pico folds on top of the PCB, which should keep the soldering neat and easy to do.
    • J1 is a USB header out, that is compatible with a the headers that plug into a motherboard.
    • J2 is 5v power in
    • J3 is serial out


    And yes, you can just plug the mouse into USB1, powering the system using the picos micro usb or J2 or hacked USB cable.
    You don't have to solder TP1 and TP2, you can use a USB OTG to plug the mouse into the pico itself.


    Better :?:


  • Hallo!

    So today/tonight I worked on the silk screen.
    The board is pretty much the same but I tried to refine it a little more. A few traces got moved around to less silly places and I added a taper to on the board towards the serial port.

    It needs a name and maybe something for the back then I think it's ready for the first order.

    The test point numbers start with 2 for the sake of the pico.
    TP2 on the pico goes to TP2 on the PCB.
    TP3 on the pico goes to TP3 on the PCB.

    I've been soldering long enough to know that that little thing will save a headache down the line.


  • Glad you added values. :) It's not a big thing but helps alot when building a project, especially if you got just the board from a swap. I often miss that

    Highscreen Colani BlueNote II 486DX4 100 MHz ⋮ Highscreen Colani Tower VL 486DX2 66MHz, Details (klick) ⋮ Highscreen InduS 500ZE-90 Pentium 90 MHz
    Toshiba Satellite 320CDT Pentium MMX 233 MHz ⋮ Apple iMac G3 (Early 2001) Blue Dalmation PowerPC 750cx 600 MHz

  • As I see on the silk, you use CTS for the init notification. It is more reliable to use RTS, or both, if possible. On my adapter I played with both and ended up with RTS. Both is complicated, since max232 has not enough inputs.

    Well that answers why you used RTS, I was wondering why you did that.
    I'm a little confused about this though "max232 has not enough inputs."

    RTS is sent out from the max232, so can't I just plug into pin 10 of the MAX232 from the pico?

    Or have I read a datasheet wrong? It wouldn't be the first time.

    PS: I know that pin 2 could be wired up wrong there. Some reference schematics say to wire it that way and the TI one says to have a cap to ground. I used a cap to VCC there because it worked on my breadboard.

  • Glad you added values. :) It's not a big thing but helps alot when building a project, especially if you got just the board from a swap. I often miss that

    Have to have the values where possible, having to look up at an excel sheet while soldering sucks the fun out of it!
    R4 and R3 don't have a value because I'm not sure what I'll set them to. I'm thinking 1k or if I can get away with it 1.5k to limit the variety of SMD parts on the board. They are indicators, not lights, so long as they are visible in a decently well lit room they'll be fine.

  • if you want you can order your pcb fully assembled from jlcpcb, it does only cost part costs and will save you a lot of time.

    If you swap out led and dip switch this could also be assembled here.

    so you only have to hand solder the connectors ;)

    I was thinking about paying the extra to have the SMD parts done for me, it would save time and fiddly work.
    However, I do love a dip switch and I do prefer a little 3mm led to an SMD one, just easier to see if it's lit from the side.

  • As I see on the silk, you use CTS for the init notification. It is more reliable to use RTS, or both, if possible. On my adapter I played with both and ended up with RTS. Both is complicated, since max232 has not enough inputs.

    Well that answers why you used RTS, I was wondering why you did that.
    I'm a little confused about this though "max232 has not enough inputs."

    RTS is sent out from the max232, so can't I just plug into pin 10 of the MAX232 from the pico?

    Or have I read a datasheet wrong? It wouldn't be the first time.

    PS: I know that pin 2 could be wired up wrong there. Some reference schematics say to wire it that way and the TI one says to have a cap to ground. I used a cap to VCC there because it worked on my breadboard.

    Well I forgot already the details, even if I open sourced it last year, I designed it years ago :D The max232 has two inputs and two outputs. If I remember right, I used RTS and RX for input and TX for output. The RX is not used on my adapter yet, but I wired it just in case, if I want to transfer settings towards the adapter, some mouse drivers use it to set the resolution, whatsoever. If you don't want to use it at all, then you can use the input for CTS/DTR etc., but actually all you really need is RTS and TX. If I remember right, you don't need CTS at all.


    May be this helps: https://linux.die.net/man/4/mouse

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!