dgrosen
Posts: 8
Joined: Fri Dec 02, 2016 11:21 pm

wiring a mouse to Rpi to emulate click

Tue May 15, 2018 5:16 pm

Hi smart people! :D I want to emulate a left mouse click every time an event happens :o . Can I wire a mouse to the Raspberry pi 3 via GPIO to make the Rpi "push" the button for me? any ideas? :roll:
Something like this:
Thanks in advance
Untitled.png
Untitled.png (165.96 KiB) Viewed 166 times

User avatar
LetHopeItsSnowing
Posts: 357
Joined: Sat May 26, 2012 6:40 am
Location: UK
Contact: Website

Re: wiring a mouse to Rpi to emulate click

Wed May 16, 2018 2:53 pm

Absolutely. I would take a mouse, rip it apart and wire either to the button or direct to the circuit board.

You may (very likely) need some sort of "relay" between mouse and the gpio pins, but this could be as simple as a transistor.
"am I getting slower, or is stuff more complicated; either way I now have to write it down - stuffaboutcode.com"

dgrosen
Posts: 8
Joined: Fri Dec 02, 2016 11:21 pm

Re: wiring a mouse to Rpi to emulate click

Wed May 16, 2018 4:50 pm

Thanks for your reply. can you recommend any website that will show an example?
Thanks again

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 10725
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: wiring a mouse to Rpi to emulate click

Wed May 16, 2018 5:56 pm

I doubt such an example exists, if it does it probably doesn't use the same mouse you have.
So use your noggin, you can do it!

I would use an opto isolator, (4N35 or similar) start by lighting the LED inside it up permanently, so the photo transistor conducts, and then wire the photo-transistor across the button. Probably the polarity is important, (the positive voltage side over the switch should be wired to the collector of the photo transistor, but as you have a 50% chance you wire the collector to the "hot wire" of the button, and the emitter to the GND of the mouse. If connecting the photo-transistor doesn't generate a click, simply reverse the two wires. I'm guessing the mouse uses a switch that connects a mouse-logic input to GND, as that's the most logical way to wire up the switch (see figure below for an example).

Image

Return to “Beginners”

Who is online

Users browsing this forum: John2809 and 48 guests