Go Down

Topic: 12v illuminated toggle switch (Read 1 time) previous topic - next topic

jonnyboy

Hello! :) I am trying to wrap my head around how to properly wire this 12v illuminated switch from radioshack with the Arduino for reading on/off state into one of the digital input pins. I have been able to successfully get the Arduino reading it with a pull up resistor and using just the switch's SPST contacts (labelled "ACC" and "POWER"), but I am trying to get the LED in the switch lighting up, too.

The toggle switch wants 12v to power it's LED and I have a 12v supply powering the Arduino. Judging from what I have found so far I think I need some sort of voltage divider and pull up/down combo platter? I just don't know enough about electrical engineering to know how to wire it (and I've tried about every combination I can think of so far)

Anyone know how this can be done?

majenko

Is the LED driven by its own pin?  If so, you will need to switch the 12V supply to it using a transistor.

If it is integral to the switch and cannot be controlled separately, then you will have to come up with some form of 12V->TTL switching circuit.  Possibly involving a voltage divider, or transistors, or whatever.
Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

jonnyboy

Thanks for the reply majenko

I believe that the LED load is shared, so it definitely cannot be controlled separately.

majenko

Then you are going to have to switch 12V on and off to a voltage divider.

12v->switch->divider "high" -> input + divider "low" -> ground.

You will need to size the divider to give enough voltage to switch a digital input on, but not overpower it.  47K? and 22K? should do the trick.  To be safe, measure the voltage in the middle node of the divider before you connect to the arduino.
Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

jonnyboy

I'm still kind of a beginner and having trouble visualizing the circuit and where exactly things attach to the arduino / switch pins. Is it too much trouble to ask for a schematic or description of exact connections? This is my first thread here and I don't want to overstep any bounds!

Thank you for the help!

skeeter_mcbee

I've got a switch almost exactly like this one, It's got the exact same base, and mine lights up too. I don't, however, have a 12V power supply hooked up to it. I've got 2 C-cell alkaline batteries hooked up to it, and the LED lights up just fine. You might have a dud LED. Try taking the switch back to Radioshack for a trade-in or a refund.
-skeeter_mcbee-

jonnyboy

The LED works, I've tested it with a 12v circuit and it lights up nice n bright :D

dc42

You may be able to run the LED from 5V, although it will be less bright. If it takes less than 40mA when run from 5v, you can drive it directly from an Arduino output pin.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

jonnyboy


You may be able to run the LED from 5V, although it will be less bright. If it takes less than 40mA when run from 5v, you can drive it directly from an Arduino output pin.


Tried it. Works great- plenty bright enough for my tastes. Dunno why I didn't think just to connect the 5v and try it. Thanks!

Go Up