USB Mouse buttons as sensors?

Can the LH and RH buttons of a corded USB mouse be used as sensors, like a momentary switch connected to an arduino? I'm prepared to have to cut the cable open and separate wires to do this, but do you think it will get me anywhere?

No, it is not that simple.
There are shields for a "USB host" and some Arduino boards can be a USB host. They might come with a library can can read a mouse. That is a lot of trouble for only two buttons with a wire.

Does it have to be a mouse ? Then grab an old mouse, either replace the USB cable with your own cable or cut the USB connector and use the wires of the USB cable. In the mouse, connect those wires to the buttons.

What is your project ? Would a Raspberry Pi be a better choice ?

"Does it have to be a mouse ? Then grab an old mouse, either replace the USB cable with your own cable or cut the USB connector and use the wires of the USB cable. In the mouse, connect those wires to the buttons."

Yes, that's what I'm thinking of doing if, when I open up the USB cable, I find wires leading to the buttons, that will give a HIGH or LOW signal to the digital pins. After that, it's easy.

My project may give you some amusement. If you're a Monty Python fan you'll have heard of the "Mouse Organ". Unlike the Python version, which uses real mice, mine will use computer mice. I've already built devices using simple momentary push buttons connected to an Arduino Leonardo. The Leonardo can monitor the buttons and "presses a letter" on the keyboard when one of the buttons is pressed. This in turn plays a note on a VST synthesiser via my music software, Reaper. Since corded computer mice are quite cheap to buy, I don't mind getting about seven of them and cutting into them to make them work as buttons. Then I'll have created the Mouse Organ for real!

I did not know the Mouse Organ: Mouse Organ - YouTube.
That got me thinking. When you watch a few videos about cosplay, you should be able to make a hammer made of foam. With a few fluffy mice and strong wires, it should be possible to make that as well. The switch inside the mouse has to be able to take a punch and make contact very easily. I don't know which switches can do that.

:slight_smile:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.