I need some switches and i have looked at these: Switches
My goal is to mount ESP32 and Arduino boards inside boxes and place a switch on the box that turns off all power to the micro controllers. ESP32 is 3.3v and Arduino Uno is 5v.
I have bought power adapters to booth boards. 9v 2amp rated power adapter for Arduino (5v) and 5v 2amp adapters for ESP32 (3.3v)
My goal is to attatch wires from power adapter cable to the switch inside the box and mount the switch on the box throw hole.
Så the switch must then handle the same voltage as the power adapter. (9v and 5v). i can se that i can choose an 5v rated switch, but i can't find 9v rated.
So my question is:
Why is there so many options for voltage on the switch i linked to?
Witch voltage do i have to choose?
The voltage rating on this switches is for the LED inside the switch. But my experience with this switches is that the voltage is not fixed to the given value. The switch itself handles higher voltage without any problems.
I have ordered 5V switches like this and got 24V. I asked the seller about it and he could tell me that the switch can be used from 5-24 V without problem.
I checked it and can confirm that it will work fine.
In one of my projects I need low intensity of the LED in the switch. I fixed that by using a resistor with the LED (in the switch). Working fine
My suggesting: Go for the 5V switch and add a resistor if you choose to use it for higher voltage (on the LED).
thehardwareman:
The voltage rating on this switches is for the LED inside the switch. But my experience with this switches is that the voltage is not fixed to the given value. The switch itself handles higher voltage without any problems.
I have ordered 5V switches like this and got 24V. I asked the seller about it and he could tell me that the switch can be used from 5-24 V without problem.
I checked it and can confirm that it will work fine.
In one of my projects I need low intensity of the LED in the switch. I fixed that by using a resistor with the LED (in the switch). Working fine
My suggesting: Go for the 5V switch and add a resistor if you choose to use it for higher voltage (on the LED).
Thanks for a wery good answer
So i can use an 5v button for voltages from 3.3 and up to 12v without problem (if i add resistor to led)?
Up to about 25VDC you can forget about the voltage rating of a switch (not the LED, the switch part). For low voltages pretty much any switch will do, just watch the current rating.
As you get to higher DC voltages you get arcing on the contacts as they open and close, this quickly damages the contacts. I gave up trying to find a reasonably priced switch for 50V up to 5A.
Cut the positive wire only, not the 0V / ground wire. You will see there are 2 contacts marked + and - and 2 contacts not marked. Connect one cut end of the positive wire to one of the unmarked contacts and the other cut end to the other unmarked contact. That takes care of turning it on and off.
If you want the LED to light when it's on identify the cut end of the positive wire that goes to the Arduino (or whatever) and connect from its contact to the contact labelled +. Connect the one marked - to the 0V / ground wire. As I previously told you not to cut this wire it now makes sense to cut it anyway and solder both cut ends to the contact marked -.
I'm going to order "latching" button (i think)
If you want press for on then press again for off then that's correct.
Bjerknez:
I'm going to order "latching" button (i think)
PerryBebbington:
If you want press for on then press again for off then that's correct.
But for flexibility (otherwise known as changing your mind ) you can do the latching in code quite easily so you could buy a non-latching switch and have some choice later.
fishboneDiagram:
But for flexibility (otherwise known as changing your mind ) you can do the latching in code quite easily so you could buy a non-latching switch and have some choice later.
The state change detect example is based on a momentary button wired from pin to 5V with an external pulldown. A new press would toggle your output from high to low or low to high, eg outputState = !outputState. It looks for the input pin to go high from low, so you can release the button immediately, or hold the button down until Armageddon, and it only counts once. It needs a release to get ready for the next press. (Most folk though, would probably invert the logic of that example, and wire the button from the pin to ground, and pinMode as INPUT_PULLUP to use the internal resistor. Then invert the logic in the code so a press takes the input from high to low, not low to high.)
But for flexibility (otherwise known as changing your mind ) you can do the latching in code quite easily so you could buy a non-latching switch and have some choice later.
Ahem....
Have you read Bjerknez's original question?
...place a switch on the box that turns off all power to the micro controllers.
Note that sometimes a switch has a minimum voltage rating. I have had push button switches that quote a minimum of 5V. I found that when I used them on a 3V3 system they were not very reliable.
Grumpy_Mike:
Note that sometimes a switch has a minimum voltage rating. I have had push button switches that quote a minimum of 5V. I found that when I used them on a 3V3 system they were not very reliable.
I'm not an expert on this, but why should a 5v switch not work for 3v device?
Bjerknez:
I'm not an expert on this, but why should a 5v switch not work for 3v device?
Because of the contact resistance due to the metal contacts are made of. There can be a very thin oxide layer on the contacts that need to be broken down by the voltage across them before they will conduct. Depending on the grade and type of metal this oxide layer could need more breaking down.
I suspect that the switches were designed down to a price for a specific mass production item that used 5V logic and the cheap metal they used required 5V to make contact reliably.
In practice I found that pressing them harder made contact but a normal press often didn't work.
Remember it was not a 5V switch it was a switch with a minimum switching voltage that was specified in the data sheet. Normally it is only the maximum voltage that is specified in the data sheet. It is possible that any switch given a low enough voltage will not work and ultra low voltage switches are available, this is normally spotted by the quoted contact resistance of the switch.
So i can use an 5v button for voltages from 3.3 and up to 12v without problem (if i add resistor to led)?
Bjerknez:
Thanks for a wery good answer
So i can use an 5v button for voltages from 3.3 and up to 12v without problem (if i add resistor to led)?
I tested my switch that is said it was for 24 V. I added a resistor (120R and 220R depending on how much light I want). If you afraid of damaging the LED, try a higher resistor first and check the result.