Mechanical Keyboard Switch to Toggle a 120V LED Lamp

Thread Starter

Ballgraff

Joined Dec 6, 2026
2
I’m currently designing a small desktop lamp and would love to incorporate a mechanical keyboard switch (MX-style) as the on/off button because of its satisfying tactile feedback.

I’m relatively inexperienced with electronics and am having trouble figuring out how to use a momentary keyboard switch to control a standard 120V AC, non dimmable LED bulb. Ideally, pressing the switch once would turn the lamp on, and pressing it again would turn it off.

Ideally, I’m looking for a compact solution that can be powered directly from the existing lamp cord, without requiring a separate external power supply or programming, while keeping the keyboard switch electrically isolated from the mains voltage.

Does anyone have any suggestions on how to achieve this or recommendations for specific components?

Any help would be greatly appreciated!
 
Sorry if this sounds a bit harsh, but if you have to ask I’d suggest you don’t know enough about electronics and electricity to be messing around with 120V AC. There are mains push button switches available but I recommend a mains voltage rocker switch as the safest and most tactile solution

Maybe consider a low voltage LED solution powered by a 12V supply?
 

ronsimpson

Joined Oct 7, 2019
4,933
Both complicated and simple.
I think this is the type of switch you have.
I think you need a different type of switch. 1796574110482.png

It most likely was never designed for 120Vac.
Here is a push on/off switch for power line. You can get them round or square. This one bolts in a box, but they also come snap in and many other versions.
You are looking for a SPST switch. Single Pole Single Terminal. (has two posts) Most simple type.

1796574218744.png
I see that different companies have different ways of saying this type of switch. "Push"
Under push is see Push for on release for off. (and the reverse for that) not what you want.
I see Push on-off, off-on I think this is it, but some companies call it push on/off. Don't get "momentary (mom)"
 

Thread Starter

Ballgraff

Joined Dec 6, 2026
2
Sorry if this sounds a bit harsh, but if you have to ask I’d suggest you don’t know enough about electronics and electricity to be messing around with 120V AC. There are mains push button switches available but I recommend a mains voltage rocker switch as the safest and most tactile solution

Maybe consider a low voltage LED solution powered by a 12V supply?
I appreciate the concern, but if people never bothered to learn about things they weren’t familiar with, nothing would ever get done. That’s precisely why I’m here asking questions.

I’ve already considered push button switches rated for mains voltage, but most either lack the tactile feedback I’m looking for or require considerably more actuation force than a mechanical keyboard switch.

I've also looked into a low voltage LED powered solutions by a 12V supply. However, I'd prefer to stick with 120V due to the wider availability of bulbs and the cleaner appearance of a traditional lamp cord without a bulky wall adapter.

I’m simply trying to explore alternative solutions and learn how this could be achieved safely before moving forward with the design.
 

dl324

Joined Mar 30, 2015
18,528
Welcome to AAC!
I’m relatively inexperienced with electronics
Ideally, I’m looking for a compact solution that can be powered directly from the existing lamp cord, without requiring a separate external power supply or programming, while keeping the keyboard switch electrically isolated from the mains voltage.
Your inexperience has led you to an impractical solution.

To isolate the switch from mains voltage, you'd need to use a relay. That would require a separate power supply for the switch logic to keep it isolated from mains voltage.

An alternate action switch would do it without electronics, but it requires more force to activate.

What does "compact" mean? A specific volume would be more informative.
 
A practical way to keep the MX switch isolated is to use a small encapsulated 120 VAC-to-low-voltage module inside the lamp base, then have the switch drive a latching relay or a zero-cross optotriac plus triac. That gives push-on/push-off without programming or an external brick. A 120 V latching relay is simpler, but its coil and wiring remain mains-referenced, so the keyboard switch would not be isolated. In either case, include a fuse, maintain proper creepage/clearance, enclose all mains parts, and have the mains section reviewed by someone qualified.
 

MrChips

Joined Oct 2, 2009
35,337
I’m currently designing a small desktop lamp and would love to incorporate a mechanical keyboard switch (MX-style) as the on/off button because of its satisfying tactile feedback.
Therein lies the problem.
You are asking for a small switch with tactile feedback that can toggle 120 VAC.
Most small switches are not rated for 120 VAC. If they did, it would be hard to find one that toggles. To toggle a switch, you need heavier force on the switch mechanism.

To implement what you want in hardware would rewire something like this scheme:

low voltage tactile switch --> low voltage bi-stable circuit --> optocoupler or relay or solid-state relay --> 120 VAC circuit

As you can see, it is much more complicated than what you first imagined.

A simple solution is to adapt a touch sensitive house lamp. You would have do without the tactile feedback switch.

touch switch for lamp
 
Top