Go Down

Topic: Using 12V illuminated switches as digital input (Read 704 times) previous topic - next topic

zenwebb

I have a collection of SPDT illuminated rocker switches that are designed for 12V systems. I'd like to use them as digital inputs for my Arduino system (Teensy, actually), but would like to have the lights be functional. I could just connect +5V and GND to the outer lugs and the middle lug to my digital in pin, but that probably wouldn't turn on the light.

If I connect these switches to +12VDC, then feed that as input to my Arduino, will the internal protection diodes protect my board, and give me a digital HIGH? Or will it fry it?
Creative technologist + OSHW engineer + lover of learning interested in bio+art+tech, form and digital fabrication

PaulS

Quote
will the internal protection diodes protect my board, and give me a digital HIGH?

Sniff. Sniff. What's that smell? Uh, oh. I think you let the magic smoke out.

You could research, and use, a voltage divider (two appropriately sized resistors):

+12V --> switch --> R1 -+-> Rd --> gnd

Connect the middle of the voltage divider (the +) to a digital pin (and ground to the Arduino, too).

zenwebb

Oh, derr, a voltage divider! I was over-complicating it :P Thanks!
Creative technologist + OSHW engineer + lover of learning interested in bio+art+tech, form and digital fabrication

Go Up