Pages: [1]   Go Down
Author Topic: 12v illuminated toggle switch  (Read 1526 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello! smiley 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?


* IMG_0574.JPG (1974.09 KB, 3264x2448 - viewed 64 times.)
Logged

UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the reply majenko

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

UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Vancouver, WA
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

-skeeter_mcbee-

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The LED works, I've tested it with a 12v circuit and it lights up nice n bright smiley-grin
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6614
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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.

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Pages: [1]   Go Up
Jump to: