Connecting traffic lights


How to control access using a traffic light

In a narrow passage, parking lot, garage, or loading area, a traffic light is sometimes needed. Typically, the light stays green, but switches to red as soon as another vehicle or a pedestrian enters the passage. Or, conversely, it stays red until movement is detected, then turns green. 

A traffic light is essentially just an LED lamp with colored lights, which cannot do anything on its own. It simply lights up depending on which wire you send power through. Here’s how to automate it using a relay and a pair of photoelectric sensors.

What will we need?

  1. Photoelectric sensors: one pair (or more pairs) of standard relay-output photoelectric sensors (for example, NICE EPM, or other standard photoelectric sensors from any manufacturer that switch via a volt-free contact when the beam is interrupted). Photoelectric sensors are typically powered by 24 V.
  2. Traffic light (Red / Green): It can have one or two aspects, and be available in either a 24 V or 230 V version. The choice is entirely up to you; it depends on the power supply you choose and match to the light. From our range, we recommend, for example, a 24 V single-aspect dual-colour traffic light, or its mains-voltage alternative, a 230 V single-aspect dual-colour traffic light.
  3. Interposing device (electromechanical relay): A standard interposing relay for DIN-rail mounting, with a changeover contact (SPDT). The relay coil must be rated for 24 V (since it will be switched by the 24 V photoelectric sensors), but its contacts can easily handle 24 V or 230 V for the traffic light itself. You can find this relay at any electrical supplies store.
  4. Power supply: If you choose a 24 V traffic light, one shared 24 V power supply for both the light and the photoelectric sensors is enough. If you choose a 230 V traffic light, connect the light to the 230 V mains and use a small 24 V adapter for the photoelectric sensors and relay.

How does it work?

For example, let’s consider a setup where the light is normally green and switches to red when movement is detected: the key is the changeover contact on our relay. This relay has one common input (COM) and two outputs:

  • NC (Normally Closed): Connect the GREEN light here.
  • NO (Normally Open): Connect the RED light here.

While the photoelectric sensor beam is unobstructed, the relay is “at rest” and the current (24 V or 230 V) flows to the green light. But as soon as a car (person, dog, etc.) breaks the beam, the sensor sends a signal and the relay immediately activates, clicks, and switches the power to the red light. When the car leaves, the system returns to green.

How to wire our example—green by default, switching to red when movement is detected:

  • Step 1: Powering up the photoelectric sensors and relay Connect the 24 V power supply (+ and -) to both the transmitter (TX) and receiver (RX) photoelectric sensors. Next, prepare the power supply for the traffic light itself (either 24 V or 230 V, depending on the light) and connect it to the relay’s common contact, usually marked COM.
  • Step 2: Connecting the photoelectric sensor to the relay Use the switching contacts in the receiver (RX) photoelectric sensor. Wire them so that when the beam is interrupted, the sensor sends a low-current control signal (24 V) directly to the coil of our interposing relay.
  • Step 3: Connecting the GREEN light (passage clear) Connect the traffic light’s negative pole (the negative terminal for 24 V, or neutral for 230 V) directly to the power supply/mains. Then connect the wire for the green light to the relay terminal marked NC. This way, the traffic light stays green whenever the passage is clear and the beam is unobstructed.
  • Step 4: Connecting the RED light (passage occupied) Connect the wire for the red light to the relay terminal marked NO. When someone enters the beam, the relay switches the prepared voltage (24 V or 230 V) from NC to NO, and the light changes immediately from green to red.

In theory, you could connect the traffic light wires directly to the photoelectric sensor contacts, since it also contains a miniature relay. Although this would theoretically work with low-power 24 V LED traffic lights, using an external interposing relay is much safer. This protects the photoelectric sensor’s electronics from current surges or a possible short circuit, for example if moisture gets into the traffic light.

Other detection options: microwave detectors and induction loops

Besides standard photoelectric sensors, there are other ways to let the traffic light know that something is happening in the passage. The relay wiring principle remains the same; only the device that sends the signal changes:

  • Microwave motion detectors: We offer detectors that can distinguish between a person and a car (a moving metal object). This lets you set the system to respond only to vehicles and ignore pedestrians, enabling a range of uses in industrial and private premises.
  • Induction loops: The cable is buried directly in the ground and works like a large metal detector. The loop does not respond to people; it activates the relay only when a car (metal object) is stopped or passing over it.

Summary: There are at least three ways to control a traffic light:
photoelectric sensors
microwave detector
induction loop

How can you add a safety delay between colour changes?

If you need the light to turn green a few seconds after the passage clears, rather than immediately, you can use a time-delay relay. The time-delay relay lets you set exactly how long the selected traffic light colour stays on before the system returns to its original state.

Two-way traffic in a single lane (solution for two traffic lights)

For a passage where vehicles travelling in both directions share the same lane (as with temporary traffic lights on a roadworks site, where one side waits while the other proceeds, followed by a short interval when both sides stop), use a stand-alone controller for two traffic lights.

This system ensures that while one side has a green light, the other has a red. The controller also automatically enforces a safety interval during which both sides have a red light, giving the last cars (and speed demons :)) time to clear safely before traffic starts moving in the opposite direction. No external relay is needed for this setup. We offer two versions of the controller, depending on the power supply:

As mentioned at the beginning, a traffic light is essentially just a lamp and behaves according to the device sending it signals. In theory, you can devise any scenario and use relays and timers to achieve what you need.

Photoelectric sensors are usually enough, as they are the most cost-effective option. However, their relay activates whenever the infrared beam is interrupted, so it cannot tell whether the beam was broken by a car, an animal, or children playing nearby.

An induction loop can distinguish this (it detects metal objects), but its major drawback is that it is buried in the ground, so it needs to be planned during construction. Adding one somewhere with beautiful new concrete is fairly expensive.

A microwave detector offers the best technical capabilities, as it can distinguish cars, people, and even direction of movement. It is the most expensive of all the options, but it does not require cables to be run underground, and it is the easiest to install on an existing site. You can also precisely set the detection perimeter.