# Turn a switch off with the correct voltage

I have an old mouse side switch which seems to produce a constant 3.28 volts which acts as the off state. Then when I push the button the voltage drops to 0. What is the easiest way to inverse these actions? I am wanting to apply 3.28 volts in order for the button state to be perceived as on but I am not sure how that could be done.

This is needed because I am running a program that takes in a mouse button as the action so instead of clicking the button I need to be able to apply a voltage across the pins in order to simulate a click. I could use a different device instead of a mouse to do this but I am trying to complete my project without buying anything new.

• You could use a 3.3V powered NOT gate. However, wouldn't a mechanical rework to replace the switch from normally-open to normally-closed (or the other way around) be easier? Dec 29, 2021 at 19:51
• yes you are correct however I am using the switch while its still attached to the mouse. The reason is I am trying to reconfigure that button so that I can "click" it unconventionally while still having my program I made recognize it has a native mouse click. This just seems like the easiest way of doing it without buying a whole bunch of new stuff for a rather simple project. Dec 29, 2021 at 20:06
• You should edit that information into your question along with details of the operating system (Windows?). Dec 29, 2021 at 20:24
• what does this mean? ... "click" it unconventionally Dec 29, 2021 at 20:27
• You can add a second mouse (assuming USB) and parallel whatever switch inside that with circuitry (dependent on the schematic, but could include a MOS SSR, a relay or maybe just a transistor (the latter requiring more knowledge of the internals etc.) Dec 29, 2021 at 21:04

... I am wanting to apply 3.28 volts in order for the button state to be perceived as on ...

It means I want to wire the button up to something so that when a voltage is applied the computer will think I was pressing that button. So really I am not clicking it but I am simulating a click by applying voltage.

Applying a voltage is not the way to do it. The switch is "ACTIVE LOW". You want to apply a short-circuit to pull the line low in the same way the switch does to simulate a button press.

simulate this circuit – Schematic created using CircuitLab

Figure 1. Two options.

If your control circuit shares a common ground with the mouse and computer then you can use the circuit of Figure 1a. When the μC (microcontroller) output goes high Q1 will switch on and pull the OUT line low in the same way the button does.

If your control circuit cannot share a common ground then the opto-isolator circuit shown in Figure 1b does the same job while maintaining isolation between the two circuits.

First off, switches don't produce voltage, what you are most likely seeing is that you are measuring a voltage potential across the switch. The switch is in an 'open' state, and that voltage would be there whether the switch was there or not.

When you press the button, you are closing the switch and grounding the two points across it, thus the voltage goes to zero.

The safest thing to do, to avoid destroying your mouse, is to wire these two points to the N.O. contacts of a relay. If you use a relay board made for a microcontroller such as an arduino or raspberry pi, then you can control the state of the relay programatically.

• I am know how voltage works I am just assuming everyone else does as well which is why I did not feel the need to over explain. Anyways do you know of any switches which I can attach to my current switch to bypass it? Since grounding it seems to signal to the mouse that a switch is being pressed I need a switch which I can use to apply an external voltage across a set of pins in order to create a short circuit. Jan 2 at 7:16
• No, you don't understand how voltage works, if you did you, you wouldn't be asking to apply an external voltage across your switch. "Transistor" and I have both given you solutions to how to achieve what you want. Neither of which involve applying a voltage across your switch, which most likely would result in destroying your mouse. Jan 3 at 21:57