Electricians: please help me do this to code.

I am replacing some old hardwtired fluorescent fixtures under my kitchen cabinets with LED strips that are powered by a 12-volt transformer that plugs into a wall outlet. I want to control the LEDs with the same switch that controls the fluorescents.

The easiest thing would be to hang the transformer under the cabinet, cut off the plug, and splice the bare wires to the wires coming out of the wall. But something tells me that that’s not legit.

What do I have to do to be safe and to code? Mount an outlet under the cabinet? Can I put the transformer in a junction box mounted under the cabinet, and then splice the wires inside the box?


I just installed something like that. I used a surface mount junction box that I mounted up under the cabinet where the wires to the old under cabinet fluorescent fixture came out. I installed a regular outlet in the junction box and plugged the 12V power supply for the LED light strip into the outlet.The power supply is out of sight under the cabinet, and all the wires are invisible unless you stick your head under the cabinet. The outlet is switched by the same switch that controlled the old fixture.

Not an electrician. By code 120v connections have to be inside a secured spark proof box, the 120v line secured with a loomex connector.

Usually the transformer is designed so that it can be wired directly, if not you have to install a receptacle box and plug it in to that. Did this not come with instructions? Installing an electrical box is not rocket science but there are clear standards followed, you should go look a few and see how they are done - better yet get an electrician to do this.

Do the existing wires come through the cabinet? If so, do you have room to mount the box and receptacle inside the cabinet? You could then run just the wires to the LED fixture leaving the transformer inside the cabinet out of sight.

No, this transformer is a wall-wart type, with a detachable cord on the input (AC) side

No, the mains wires are just below the cabinet.

I’d think to do this to code you’d have to install an outlet. Otherwise, return the lights and buy ones that are designed to be hardwired. Like the ones you already have, there will be a hole in the side to run the wiring into them instead of trying to run their wire into a box.

If you want to do this to code, do it right.

I’d install the switched outlet just because it’s easy and useful if you want different lights or to plug something else in.

If I hadn’t wanted to do it right, I wouldn’t have asked here. I think you’re right about the outlet, and I can do that, but I’m not a pro, and I’d like to hear what my options are from someone who really knows.

I ran into this same situation a few years ago, and did what others have already mentioned: I installed a standard 120 VAC receptacle. The receptacle was controlled by the switch. The wall-wart plugged into the receptacle.

The OP want’s “to control the LEDs with the same switch that controls the fluorescents.”

Over here it would be totally against all the rules to put an outlet, like a mains power outlet, on a lighting circuit. The cabling is not designed for that. It is OK to put a low amperage switched outlet in, but they are clearly not for power.

I would have an electrician wire the LEDs into the lighting circuit.

“The fluorescents,” in this case, are the existing under cabinet lights.

It’s perfectly fine to use an accessible junction box to contain your splice. I would probably install a switched outlet myself, just so I could isolate the circuit if there was a future problem. I’m not sure what a “spark free” junction box is, as was noted above. A standard junction box of an appropriate size, with a blank cover, is easily available, as are the box connectors for the incoming wiring. Use appropriately sized wire nuts for the connections. Since it’s an existing circuit, you shouldn’t need any sort of permit to do this work.

FYI, I am in Las Vegas, NV, so we’re talking about US code.

And local codes supersede national codes, but for this sort of small job, what I said above will meet your local requirements. If you were installing a new circuit, it would technically require a permit for an electrician to do the work. But for code purposes, this is really no different than changing out an outlet.

while you might cut the plug and splice the wire you have to do that right. it takes the right sized wire nut, ample length of bare stranded wire and good nut manipulation to get it right. it also has to have a method of securing the stranded wire at the exposed junction box outlet, so that the slack wire won’t be moved by pulling on the wire from outside the box.

because clamping the wire may be a hard detail then mounting a small receptacle may be easier.

A bit of friendly advice: you might want to make sure the led fixture can operate without continuous power, particularly the switch. An electronic or push-to-start type switch might not turn on just because it has power again.

Thanks. There’s no power switch.

I agree with chiefguy
Putting in an outlet box on a lighting circuit is the proper way to do this. Use a 15 amp outlet because lights are normally on a 15 amp circuit.

either way will work:

  • cutting the wire & splicing it to the power wire from the switch (inside a proper box), or
  • installing a receptacle controlled by the switch & plugging the LED into that.

The receptacle is a tiny bit easier if you ever choose to replace those LED lights with something else (that also plugs in). But the receptacle will take up more space and be more visible under the cabinet than a simple junction box. That appearance issue may matter more than anything else to your spouse.