Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 14 of 14

Thread: Simulate mouse controlled from another pc

  1. #1

    Simulate mouse controlled from another pc

    Hello everyone,

    I have just discovered teensy recently and I would like you to help me to know if it can accomplish what I would like to make.

    My project is to simulate a mouse (also keyboard) and send input controls from another computer ; typically move to x,y.
    The interest here is having everything run outside, the first computer would just know about the existence of a *generic mouse*.

    I indeed found the code to make it from the same computer the teensy is connected to, using serial connection through usb if I ve understood correctly, but is there a way to send my commands through another port I would connect my second computer to? I found out the teensy 3.6 could handle 2 USB ports but it is not really clear. Would I have to solder one by myself ? Or is there any other solution?

    Also, I need it to be reactive (like <1-2ms) ; will teensy satisfy this condition? I have kind of read that going for Arduino to simulate mouse was pretty slow, like every actions/events were taking 1s to be accomplished. Does someone have experience with this kind of problem ?

    Thanks for your advices :-)

  2. #2
    Senior Member
    Join Date
    Dec 2016
    Montreal, Canada
    why not put one teensy on each computer, and wire their uarts together to talk between them?
    Its unclear what your trying to do, do you want the first computer to control the second computer? In what way would you want to control them if you want them connected to both PCs?

  3. #3
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    It will take a smart program element on the controlling PC to capture and combine and send the desired commands to the Teensy to pass along.

    Time will be a factor.

    Given that program it could use a USB to Serial converter to attach to the Teensy and the Teensy could then receive the commands and pass them along over USB.

    It is possible there could be a way to interface to the T_3.6 host controller pins directly - but it would take a working interface driver that doesn't likely exist at this point.

  4. #4
    So basically my goal is to run an application on the pc2 that will send commands always in the pc2 -> pc1 way.
    The teensy would be recognized as a mouse on the pc1 and would receive the commands from the pc2 (move mouse, click).
    The objective is to run 0 program on pc1, just plug the teensy and control it. That way pc1 never knows of anything but a mouse connected to it.

    Do you know if wiring uarts between teenys is a fast way for communication? Does adding a second teensy in the loop would not add another factor of delay?

  5. #5
    Senior Member
    Join Date
    Dec 2016
    Montreal, Canada
    should barely impact performance, as long as you handle the communication properly

    are you saying you want a mouse on PC2 to be controlling the cursor on the PC1 screen?

  6. #6
    Quick update :

    I went for a teensy 3.6, and added a usb to ttl (CP2102).
    It does exactly what I needed, and I am not sure yet if it fits my needs in term of performance, but at first sight with my small prototype apps it seems to be pretty reactive.

    Ty for your answers, time for the fun now :-)

  7. #7
    Hey i wanna do the same thing, can you explain exactly how you connected it and also if the delay was low enough?

  8. #8
    Quote Originally Posted by Laki View Post
    Hey i wanna do the same thing, can you explain exactly how you connected it and also if the delay was low enough?
    What do you want to do exactly ?
    I don't know yet if you got the same usecase as me but, for my case, it's ok but not perfect. I feel overall there is a small delay (maybe from reading/writing to the serial port quite often per bulk) or could be something else. Exemple : if you are going to want to move the mouse by 1 pixel for 300 pixels, it will be quite slow. U will have to go for 'big' moves per big moves, and in my case I had to use workarounds so it is ok.
    If i want to adjust my real mouse and compensate with the teensy, so far I didn't manage to do it, it won't be fast enough, or if I send too many commands I am not sure yet but it seems like it gets lost/overflowed ; I am still working on it tho.

  9. #9
    I actually just need to click the mouse button, I don't need moving. Is it under like 10 ms for clicking? And I'm interested how you connected the teensy for it to work to send the commands from second pc, I'm new to teensy so I'm not sure how would I connect it.

  10. #10
    I hope my answer doesnt come too late.

    Yes it is under 1ms.

    I have fixed all my issues so far, and in the end Im really satisfied with the teensy, no regrets at all, that lil micro controller is a pleasure.

    I have connected a usb to ttl (uart) on the pins 0 1 2, it is known as serial1 when you dev on the teensy. Then you can listen for upcoming commands on this port and reproduce your mouse clicks. I send the commands with an app running on the second pc.

  11. #11
    Heey thanks for response, tho I already asked on another thread and got a response. And I made it work I saw questions about pcileech on their github with same name as yours so I'm safe to assume you are trying to do the same thing as me.. Did you make the pcileech work too? (Just curious, don't need help). Thanks

  12. #12
    Aha, yes it seems obvious now we are working on the same kind of project

    Yes in the end everything works almost perfectly. If you went for a pciescreamer Im not sure pcileech is the best way to go ; it seems the instability and read errors issues are more of a problem of pcileech than the card itself. But it still does the job and is feasible with it, and maybe you wont even meet the same kind of errors than I did/do!

  13. #13
    Ugh well I already made the code and everything using the dll and I ordered the pciescreamer. Still waiting for it tho so not sure if that part will work. Btw what value did you use for the thingy about every ~5 sec freeze?

  14. #14
    Junior Member
    Join Date
    Aug 2022
    I know this thread is old but I would like to somehow get a contact to the author. Im trying to create something similar.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts