Good morning,

Needed a closet light and had a doorbell transformer in the closet so I run a light off of that junction, finding out covering the transformer is not up to code. Problem is exposed 115 wire in box if I take cover off, looking for solution to keep existing transformer as well as lights while keeping things up to code. Will be selling house soon so I was hoping to have something up to code/that can pass homeowners inspection. Any suggestions are greatly appreciated.

Thanks in advance!

enter image description here.

enter image description here

  • 1
    If the issue is the 120v wiring, how about showing us that. Or, maybe a pic of what this looked like before - what bits did you add that aren't up to code? Also, "code" varies by locale, what state (and even city) are you in?
    – FreeMan
    Commented Jan 3, 2022 at 16:39
  • 1
    I am in Virginia Beach, VA. I don't have a before pic. It was a metal blank plate on the junction box with the transformer attached to it.
    – Erik R
    Commented Jan 3, 2022 at 16:49

1 Answer 1


There are a few problems:

  • Transformer shouldn't be covered up.

  • Low voltage wiring of transformer output can't be in the same box as the high voltage wiring of transformer input (and of the lights).

The usual solution is to put the transformer on the outside of the box. However, it is not clear exactly what you've got - e.g., where is the 120V wiring coming from? Where is the transformer wiring going to?

A typical solution is to use a metal box and mount the transformer on the outside. The low voltage transformer output can then take any path except side-by-side with the 120V wires. The box can also be used as a way to splice to other locations (like your lights), receptacle, switch, whatever.

These instructions for a Hampton Bay transformer illustrate the mounting pretty clearly, but most brands should work pretty much the same way. "Metal box is ugly" you say? Doesn't matter - it is in a closet and it is the safest way to do this. Just make sure to ground the box properly.

Update based on comments

I don't have a before pic. It was a metal blank plate on the junction box with the transformer attached to it.

Aha! That is the right way to install a transformer.

  • Pull off plate/transformer (you already did, but starting at step 1)
  • Attach new cable (i.e., incoming hot, transformer hot, light hot together; same for neutrals).
  • Route new cable out the box to the new location (either through the wall or via wiremold)
  • Put the plate/transformer back on, with the transformer (as before, I hope) on the outside.

A typical doorbell transformer generates very little heat. As long as no clothing, boxes, etc. is within a few inches of the transformer, it is safe. The low voltage wiring goes to the doorbell but does not go into or through the junction box.

  • 1
    Thanks! Ended up doing something similar to what you suggested.
    – Erik R
    Commented Jan 3, 2022 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.