user37953: My arduino is powered by 12V.  I am getting some cool looking 12V led switches from amazon, but they need 12 volts to light up. My arduino will perform an override function when it detects the switch is closed. the digital pins can only handle 5V. How can I step down the 12V signal that powers the switch to the 5V that the pin can handle.
12V supply -> 12V led switch -> reduce 12V to 5V -> arduino digital pin

user1576: You need a voltage divider:
The formula is:
V1 = 12V
R2 = 5V max
R1 = The rest (V1-R2)
And then you have to calculate max current. If you use 1/4watt resistors, you have to convert watt to current, P = U x I.
Pmax = 0,25W
R1volt = 7 volt
Imax for R1 = P/U = 0.25/7
Imax for R2= P/U = 0.25/5
Now you have the current and voltage for R1 and R2
And the relation between R1 and R2 is:
R1 = 7/12 x Rtotal
R2 = 5/12 x Rtotal
Rtotal = R1 + R2

simulate this circuit – Schematic created using CircuitLab

37953: <p>My arduino is powered by 12V.  I am getting some cool looking 12V led switches from amazon, but they need 12 volts to light up. My arduino will perform an override function when it detects the switch is closed. the digital pins can only handle 5V. How can I step down the 12V signal that powers the switch to the 5V that the pin can handle.</p>

<p>12V supply -> 12V led switch -> reduce 12V to 5V -> arduino digital pin</p>
 1576: <p>You need a voltage divider:</p>

<p>The formula is:</p>

<p>V1 = 12V</p>

<p>R2 = 5V max</p>

<p>R1 = The rest (V1-R2)</p>

<p>And then you have to calculate max current. If you use 1/4watt resistors, you have to convert watt to current, P = U x I.</p>

<p>P<sub>max</sub> = 0,25W</p>

<p>R1<sub>volt</sub> = 7 volt</p>

<p>I<sub>max</sub> for R1 = P/U = 0.25/7</p>

<p>I<sub>max</sub> for R2= P/U = 0.25/5</p>

<p>Now you have the current and voltage for R1 and R2</p>

<p>And the relation between R1 and R2 is:</p>

<p>R1 = 7/12 x R<sub>total</sub></p>

<p>R2 = 5/12 x R<sub>total</sub></p>

<p>R<sub>total</sub> = R1 + R2</p>



<p><img src="https://i.stack.imgur.com/dD4zf.png" alt="schematic"></p>



<p><sup><a href="/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fdD4zf.png">simulate this circuit</a> &ndash; Schematic created using <a href="https://www.circuitlab.com/" rel="nofollow">CircuitLab</a></sup></p>
