I am setting up a relay to control my 120v/15a pool light. The relay control will be located in a plastic project box near the pool equipment and will be driven by a 24VAC coil. The light circuit will be a dedicated breaker in the nearby sub-panel. (I'm using 24VAC as it is already available in the project box to drive pool valve actuators).

I would like the relay to tie into a normal 3-way switch mounted outside which would serve as a "manual override" in the event someone needs to turn the light on or off and doesn't have access to the automation control that drives the relay.

Normally, I would wire this by running THWN hot/neutral/ground through conduit from the sub-panel to the project box relay, connect the relay NO/NC contacts to two travelers and run those two plus the neutral/ground wires through conduit to the manual switch, then on to the light itself. However, I'd like to reuse an existing switch already mounted adjacent to the sub-panel (it's not a 3-way, but I will replace it with one).


As a simpler alternative, can I safely to run a single THWN hot wire from the sub-panel breaker through conduit to the project box into the relay's common contact, and two THWN wires (travelers) from the relay's NO/NC contacts back through the same conduit (3 wires total) into the sub-panel. From there, the two travelers, a neutral, and a ground in a separate conduit connecting to a physical 3-way switch, then the 3-way switch's single pole, neutral, and ground make their way to the pool light fixture. Is this code-compliant or safe?

Simpler, but unsure

This feels very strange (wrong) to me and now that I've written out the question I'm fairly confident it isn't compliant and I should go with my first approach.

  • Is your project box NEMA rated? Is there any way to move the relay to the subpanel and run its 24V coil wires between project box and sub? Oct 4, 2020 at 6:34
  • 3
    A manual override should be a three-position switch -- ON, OFF, and AUTO -- not a three-way switch. Oct 4, 2020 at 7:05
  • 1
    Search for "HOA switch" (hand-off-auto) that's the usual way to accomplish this. Oct 4, 2020 at 10:10
  • @Harper-ReinstateMonica I could do that, but was hoping to keep the relay alongside the rest of the automation components in the project box.
    – Travis
    Oct 4, 2020 at 16:08
  • 1
    @A.I.Breveleri I'm not looking for a hard override in that sense, just the ability to toggle the light (on or off) from a physical switch in addition to toggling it from an automation controller (i.e., what a standard 3-way switch does). If the physical switch is toggled, I still want to be able to toggle it remotely
    – Travis
    Oct 4, 2020 at 16:09

5 Answers 5


Your relay-on-a-switch-loop is fine in general...

Your relay-on-a-switch-loop turns out to be up to Code after all -- NEC 300.3(B) only requires the neutral ("grounded conductor") to be in the same conduit as the hots if it's necessary to route the neutral to a location to begin with (note that the wording about "grounded conductor" is prefaced with "where used" in the Code section in question), and in your case its not, as 404.2(C) point 1 is satisfied as long as there's enough spare space in the conduit to pull a neutral thru it later if need be.

But there are a couple of sticky points with your arrangement

However, your plans do have a couple of potential snags in them. First off, in your project box, you'll need to be very careful about line-voltage/low voltage separation if you want your control circuit to be Class 2 instead of Class 1. This will include using a relay capable of providing high/low voltage separation while switching a 15A tungsten or ballast load such as a RIBT24Z (you could use a RIBT24B, but that limits you to 10A of tungsten load), as well as having a barrier inside your project box between high voltage and low voltage wiring; in fact, I would screw a 4" square junction box to the side of your project box and use that to contain the mains wiring and mount the relay, thus keeping all that nasty mains wiring safely out of your low-voltage project box to begin with. Note also that you don't need the NC contacts of the relay here, so you only have to route two wires through your conduit, not three.

The other issue is that while your three-way switch setup will work for what you're doing, it's not often done due to the inability for a local operator to guarantee the load stays in a known state with the wiring you have. In general, what's normally done in this situation is called a HOA (Hand, Off, Auto) switch; while not generally available in familiar wallbox form, it's still possible to pull off. This is done by replacing the existing switch with a DPDT, center off, maintained contact switch such as a Leviton 1281, and use one side as "Hand" (with an always-hot feed) and the other side as "Auto" (fed from the relay-switched hot). You'll have to supply the labeling yourself, but this is probably the best solution for your application as it doesn't limit the load on the circuit any more than the relay does as well as fitting normally into a multi-gang junction box and faceplate. (A 20A circuit can use a Leviton 1284 instead.)

(The more typical "industrial" solution would be to use a 3-position selector switch; while a 22mm selector can be mounted into a junction/gang box using a faceplate with a 1/2" trade size knockout in it, such faceplates are not available in multigang configurations, and 22mm selector switches have pilot duty contacts on them, which means they're rated for much lighter loads than 15A of tungsten or ballast lighting. One could use a SIB02S from Functional Devices, but the form factor of that part isn't right for your application as it provides its own hub-mounted box.)

  • I intend to use a AZ2280-1C-24AF relay. High and low voltage are never run in the same conduit, but I could probably do a better job of physically separating them in the box. Right now the high voltage comes into the box and connects to two terminal blocks, along with a 24v transformer and two 5v DC power supplies. That's where the high voltage stops (aside from this new run to the relay). Re: the "functional issue" - that is actually the desired behavior. The physical switch isn't a disconnect, just a way to toggle the light.
    – Travis
    Oct 4, 2020 at 16:27
  • @Travis -- ah, I see how you're thinking, you don't quite want the hard-override capacity a H/O/A switching arrangement gives Oct 4, 2020 at 18:59
  • @Travis -- also, you might want to look at rearranging things so you do get the proper high/low voltage separation in your system, using a junction box to house the mains with mounts for the relay and 24VAC transformer, then deriving 5V for the Pi from the 24VAC NEC Class 2 supply coming into the project box Oct 4, 2020 at 19:04
  • Thanks for the edit. I figure if I need to disconnect, I would just flip the breaker. Conceivably I could put an HOA or 3-position selector after this switch if I really wanted an override. Right now this is mostly a prototype; I will likely do what you suggest and place the high voltage connections into a separate smaller enclosure mounted nearby.
    – Travis
    Oct 4, 2020 at 19:25
  • Out of curiosity, is there a reason to derive the 5V from 24VAC instead of 120VAC (other than having fewer items in the high voltage box)?
    – Travis
    Oct 4, 2020 at 19:32

Your plastic project box is not NEMA rated for handling AC power.

You also will have difficulty achieving hard separation inside that box between AC mains and low voltage, as ThreePhaseEel discusses.

Why run THHN in conduit, when you could run thermostat wire? Put the relay in the AC mains equipment and use the thermostat wire to carry 24V relay coil current to the relay.

I don't see any conceivable "neatness" achieved by keeping all low voltage together and porting AC mains into a gob of DC wiring nor into a project box not rated for AC mains. That just looks like a safety horror show to me.

A RiB and several similar products are UL-listed to provide correct separation between AC mains and low voltage.

When people get a little bit of experience with AC power, they often conclude it's not nearly as dangerous as everyone says. That is erroneous - it is quite dangerous. Just, most of the time, people get lucky.

That control scheme won't do what you want anyway.

Note that commodity 3-way switches do NOT have a center position.

I also agree with ThreePhaseEel that your "back-to-back 3-ways" approach is misguided. In one 3-way position, the light will light when the controller tells it to. In the other 3-way position, the pool light will be on when the controller tells it not to. Sure, in the immediate moment, the switch will do as the human intends, countermand the controller... but thence forth and evermore, the controller's intent will be inverted, and the controller won't know that.

  • I'm using THHN because it is for a 15a circuit. Thermostat wire is not rated for 15a.
    – Travis
    Oct 4, 2020 at 18:16
  • 1
    Please read my comment regarding the desired behavior - I'm not looking for a disconnect/HOA; I actually am looking for a 3-way toggle (each position could be on or off depending on the other switch). I'm using THHN for the light because it is for a 15a circuit. Thermostat wire is not rated for 15a. I'm not sure why you mention the pump - the pump is controlled by low voltage relays from the Pi run in a separate conduit. This 3-way switch is purely for the pool light.
    – Travis
    Oct 4, 2020 at 18:22
  • @Travis Sorry, I assumed it was for a pump. I'll edit. The thermostat wire is to carry the the small 24V relay coil current from the project box where AC does not belong, to the service panel where it does belong. Oct 5, 2020 at 1:38
  • Basically, the controller will have to treat the state as sort of a toggle, instead of an off/on output. Oct 5, 2020 at 3:10

I need to post this as an answer, bc I don't have enough room in the comment response.

This is an interesting and creative project. But I don't think it will operate as you hope. What is the "automation control"? A timer? Motion sensor? Remote control? Magic wand?

If the relay is open and the user toggles the 3-way switch to turn on the light and leaves it that way, when whatever controls the relay closes it, the light will turn off when the "automation controls" want it to be on. The opposite is also true: If the user turns off the light via the 3way switch when the automation controls think the light is on, then when the automation controls (thinking the light is on), tries to turn it off, it will actually turn the light back on.

I think, to accomplish most of what you want, would be install a switch in parallel with the relay. While that switch couldn't turn off the light, it could turn it on.

Regarding combining various line voltage cables in the same conduit (solution #2) is almost always allowed. You can't run low voltage and line voltage in the same conduit. Be sure to pay attention to fill capacities. Code specifies how many wires and what gauge can be run in various sized conduits.

Lastly, please be careful here. These "one off" solutions can be a real headache for subsequent owners and service people. It's hard to make them code compliant without a lot of knowledge of code and separation of low-voltage and line voltage circuits.

  • 1
    The automation control is a Raspberry Pi. What you describe is the intended behavior (the Pi will toggle the light, not necessarily know if it is on or off - same as the manual switch - i.e., what a typical 3-way switch does, just with one side being programmatically controlled). Low voltage and line voltage aren't being run in the same conduit. I'm the pool man, so not too worried about service :) If I ever move, I will either take it with me or leave full documentation for the new owner.
    – Travis
    Oct 4, 2020 at 16:21

What you're doing is basically a switch loop through your control panel and three way switch. I believe this will be a violation of 300.3(B).

300.3(B) Conductors of the Same Circuit. All conductors of the same circuit and, where used, the grounded conductor and all equipment grounding conductors and bonding conductors shall be contained within the same raceway, auxiliary gutter, cable tray, cablebus assembly, trench, cable, or cord, unless otherwise permitted in accordance with 300.3(B)(1) through (B)(4).

If you were using a nonmetallic wiring method, then 300.3(B)(3) would allow for it; this is why switch loops in nonmetallic cable as normally done in residential construction are compliant.

300.3(B)(3) Nonferrous Wiring Methods. Conductors in wiring methods with a nonmetallic or other nonmagnetic sheath, where run in different raceways, auxiliary gutters, cable trays, trenches, cables, or cords, shall comply with the provisions of 300.20(B). Conductors in single-conductor Type MI cable with a nonmagnetic sheath shall comply with the provisions of 332.31. Conductors of single-conductor Type MC cable with a nonmagnetic sheath shall comply with the provisions of 330.31, 330.116, and 300.20(B).

  • No, a switch loop in conduit works just fine -- current in and current out are equal, which means the magnetic fields 300.3(B) is worried about cancel out Oct 4, 2020 at 13:21

Either cable bundling is OK. As pointed out before you’re inverting the controller state not over-riding it. An over-ride would need a center-off switch and 2 relays. contemplate it as one for forced-on and one for forced-off, it can be realized several ways, that one is straight-forward.

The cabling is good, the answer talking about non-metallic raceway being required is misunderstanding the code. The code section about non-metallic conduit for a switch loop isn’t relevant, it’s referring to wiring that doesn’t return current in the same cable (wire bundle) it’s sourced through. that wiring has an open loop area between source and return conductors. It’s a large diameter one turn electromagnet coil. The magnetic field induces currents in everything nearby, including pipes, metal parts of the building, trims, and contents - creating safety hazards. It would induce return currents on the outer surface of metal conduits containing the wires equal the current in the wires. The open loop inductance is a large enough impedance to limit short circuit current and delay the operation of overcurrent protection devices. That aspect drove the change to not grounding the neutral in sub-panels when it had previously been required.

You can do what you plan without segregating wiring if you put the Pi in a listed box and use line voltage switches and cable. You can always find people who read a code section a certain way, but the fact is that a control circuit cabled inside a line voltage conduit has to be wired and insulated as a line voltage circuit. The code doesn’t give a fig what AC voltage and current less than the rated voltage and current are actually carried on a conductor. Build it as if the Pi ran on 120VAC and you were using 120vac coil relays. Don’t bother looking for THHN smaller than 14ga, it exists but you wouldn’t save any money and every electrician and inspector will look sideways at it forever more. Put the Pi in a NEMA box and either use NEMA connectors (n-pole twist locks on SJ cord) -or- attach the box to the building. (Either cord and plug connected or hard-wired, not a mix.)

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.