For my electronics cabinets, I always have a need for internal lighting anytime I need to inspect or make modifications to the components inside.
Here is how I did it.
Step 1: Led and Switch.
I used an led capable of AC and DC input. This module is actually for cars and uses 2watts.
The momentary push button switch allows for the auto light feature.
Step 2: Attaching Leads to the Switch.
This switch has both NC and NO contacts. I need the NC for my needs. I soldered wires onto the relevant pins and now for the next step.
Step 3: Wiring the Led to the Switch.
Again more soldering and I wired the switch in series with the led so that it can open one of the supply wires. The polarity of this led module is a non issue since it can work with AC power.
Step 4: The Cabinet.
This cabinet houses my home automation system. I will take a 25v dc supply from the M4 atx power supply input terminals.
Step 5: Wiring in the Light.
Carefully unscrewing the terminals, inserting the light wires then screwing back tight the led comes on. I secured the led module with a cable tie so now the insides of the cabinet is bathed in light.
Step 6: Sticking on the Switch.
Using evostik I glued the switch into the inside of the cabinet. The position of the red switch head is such that when the lid closes fully, the led goes off.
Step 7: Completion!
Now I have an automatic led light for my automation pc cabinet!