Community project

Three Sensor Light Controller

Photo of Three Sensor Light Controller
Generated with AI

Ratul Al Arslan

Published November 18, 2026

This project builds an intelligent street lighting system that automatically adjusts six LEDs based on ambient light and motion detection. The system uses an Arduino Uno to monitor a light sensor and three infrared motion detectors, controlling lighting zones that brighten to full brightness when motion is detected in darkness, then dim to a low level after the motion stops.

The guide provides a complete parts list, wiring diagram, and step-by-step assembly instructions for building the controller on stripboard. Firmware is included to handle the sensing logic, with adjustable thresholds for light sensitivity and motion hold times. The power supply uses eight AA batteries stepped down to 5V through a buck converter, with rocker switches for convenient on/off control.

Wiring diagram

Wiring diagram for Three Sensor Light Controller
Loading diagram…

Gather all the parts

QtyComponent
1

8 x AA Battery Holder with 5.5mm/2.1mm Plug and On/Off Switch

Eight-cell AA battery holder with a 5.5mm/2.1mm barrel plug and on/off switch. Provides approximately 12V/3000–4000mAh with alkalines or 9.6V/2000mAh with NiMH rechargeables.

1

Rocker Switch

Classic compact panel-mount rocker switch for on/off power control in enclosures.

1

MP1584 Buck Converter

Adjustable buck (step-down) DC-DC converter, 4.5-28 V in -> 0.8-20 V out, ~3 A. Configured to 5 V to step a 9 V / 12 V supply or battery pack down to the board's 5 V rail.

1

Light Sensor Module V3 (LM393 photoresistor)

Light sensor module with a photoresistor and an LM393 comparator on a small blue board. It outputs an analog light-level voltage on AO and a digital signal on DO that switches low when the light is brighter than the threshold set with the onboard trimmer. It runs from 3.3 to 5 V and connects through a 4-pin 2.54 mm right-angle header (VCC, GND, DO, AO).

1

TCRT5000 IR Line Tracking Sensor Module

Single-channel infrared reflective sensor module built around the Vishay TCRT5000 IR emitter/phototransistor pair. An onboard LM393 comparator with a sensitivity trim-pot drives a thresholded digital output (DO) for line-detection or obstacle-avoidance, while a separate analog pin (AO) exposes the raw reflected-IR reading. Runs on 3.3V-5V, senses reflective surfaces roughly 1-25mm away, and is the standard low-cost sensor on line-following and obstacle-avoiding robot kits. Sold as a generic 4-pin (VCC/GND/DO/AO) breakout under many brand names (HiLetgo, ACEIRMC, OSOYOO, etc.) rather than by a single official manufacturer.

1

TCRT5000 IR Line Tracking Sensor Module

Single-channel infrared reflective sensor module built around the Vishay TCRT5000 IR emitter/phototransistor pair. An onboard LM393 comparator with a sensitivity trim-pot drives a thresholded digital output (DO) for line-detection or obstacle-avoidance, while a separate analog pin (AO) exposes the raw reflected-IR reading. Runs on 3.3V-5V, senses reflective surfaces roughly 1-25mm away, and is the standard low-cost sensor on line-following and obstacle-avoiding robot kits. Sold as a generic 4-pin (VCC/GND/DO/AO) breakout under many brand names (HiLetgo, ACEIRMC, OSOYOO, etc.) rather than by a single official manufacturer.

1

TCRT5000 IR Line Tracking Sensor Module

Single-channel infrared reflective sensor module built around the Vishay TCRT5000 IR emitter/phototransistor pair. An onboard LM393 comparator with a sensitivity trim-pot drives a thresholded digital output (DO) for line-detection or obstacle-avoidance, while a separate analog pin (AO) exposes the raw reflected-IR reading. Runs on 3.3V-5V, senses reflective surfaces roughly 1-25mm away, and is the standard low-cost sensor on line-following and obstacle-avoiding robot kits. Sold as a generic 4-pin (VCC/GND/DO/AO) breakout under many brand names (HiLetgo, ACEIRMC, OSOYOO, etc.) rather than by a single official manufacturer.

1

Resistor

220 ohm, 1/4 W

Through-hole resistor (current-limiting in series with an LED)

1

LED

White 5 mm LED

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

220 ohm, 1/4 W

Through-hole resistor (current-limiting in series with an LED)

1

LED

White 5 mm LED

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

220 ohm, 1/4 W

Through-hole resistor (current-limiting in series with an LED)

1

LED

White 5 mm LED

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

220 ohm, 1/4 W

Through-hole resistor (current-limiting in series with an LED)

1

LED

White 5 mm LED

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

220 ohm, 1/4 W

Through-hole resistor (current-limiting in series with an LED)

1

LED

White 5 mm LED

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

220 ohm, 1/4 W

Through-hole resistor (current-limiting in series with an LED)

1

LED

White 5 mm LED

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

Assemble it in 6 steps

1. Prepare isolated stripboard tracks

Use one copper strip for 5 V and another for GND. Keep every sensor signal and LED output on separate isolated strips or insulated jumpers. Stripboard copper is on the underside; check continuity rather than trusting the top view.

  • Cut tracks where needed. An uncut strip joining two outputs or joining 5 V to GND can damage the board.

2. Set the battery supply to 5 V

Use eight alkaline AA cells in the battery holder. Battery positive goes through the external rocker switch to buck VIN. Battery negative goes to buck GND. With the Uno and sensors disconnected, measure buck VOUT to GND and adjust it to 5.0 V. Turn power off before continuing.

  • Do not connect 12 V to the Uno 5V pin. Do not charge alkaline cells. Keep exposed battery wires from touching.

3. Connect the common power buses

Buck VOUT goes to the 5 V strip and Uno 5V pin. Buck GND goes to the GND strip and Uno GND. Both strips also feed VCC and GND on all four sensor modules. Leave unused AO pins disconnected.

  • Disconnect buck VOUT from the 5 V strip before plugging USB into the Uno; never feed USB and external 5 V together.

4. Wire the sensor signals

IR1 DO goes to D2, IR2 DO to D4, and IR3 DO to D7 (detection signals). LDR DO goes to A0 (day/night signal); A0 is used as a digital input here. The selected IR modules label the diagram's OUT pin DO.

5. Connect six small street lights

Connect D3, D5, D6, D9, D10 and D11 to R1 through R6 respectively. Each 220 ohm resistor then connects to its LED's long positive leg. Each short negative leg connects to GND. Pair lights 1–2 with IR1, 3–4 with IR2, and 5–6 with IR3.

  • Only small individual LEDs belong on these outputs. LED strips or 12 V lamps require separate drivers and must not connect directly.

6. Adjust the sensing thresholds

Keep the LDR away from the six LEDs so it measures room light. Adjust its trimmer until DO changes between bright and dark. Position the TCRT5000 modules about 1–25 mm from a model target; adjust each trimmer so a low-reflectance target gives LOW and the clear condition gives HIGH. At night each detected target brightens its pair for five seconds after it leaves.

  • These are close-range model sensors, not outdoor traffic sensors. If your existing IR modules report detection as HIGH, change IR_DETECTED_LEVEL in the firmware to HIGH.

Review all connections

1. Connections between "battery" and "Arduino"

FunctionbatteryArduino
powerVOUT → Rocker Switch T1EXT
groundGNDGND

2. Connections between "switch" and "Arduino"

FunctionswitchArduino
powerT2 → MP1584 Buck Converter VINEXT

3. Connections between "buck" and "Arduino"

FunctionbuckArduino
groundGNDGND
powerVOUT5V

4. Connections between "ldr" and "Arduino"

FunctionldrArduino
powerVCC5V
groundGNDGND
digitalDOGPIO 14

5. Connections between "ir1" and "Arduino"

Functionir1Arduino
powerVCC5V
groundGNDGND
digitalDOGPIO 2

6. Connections between "ir2" and "Arduino"

Functionir2Arduino
powerVCC5V
groundGNDGND
digitalDOGPIO 4

7. Connections between "ir3" and "Arduino"

Functionir3Arduino
powerVCC5V
groundGNDGND
digitalDOGPIO 7

8. Connections between "r1" and "Arduino"

Functionr1Arduino
digitalP1GPIO 3
digitalP2 → LED ANODEEXT

9. Connections between "led1" and "Arduino"

Functionled1Arduino
groundGNDGND

10. Connections between "r2" and "Arduino"

Functionr2Arduino
digitalP1GPIO 5
digitalP2 → LED ANODEEXT

11. Connections between "led2" and "Arduino"

Functionled2Arduino
groundGNDGND

12. Connections between "r3" and "Arduino"

Functionr3Arduino
digitalP1GPIO 6
digitalP2 → LED ANODEEXT

13. Connections between "led3" and "Arduino"

Functionled3Arduino
groundGNDGND

14. Connections between "r4" and "Arduino"

Functionr4Arduino
digitalP1GPIO 9
digitalP2 → LED ANODEEXT

15. Connections between "led4" and "Arduino"

Functionled4Arduino
groundGNDGND

16. Connections between "r5" and "Arduino"

Functionr5Arduino
digitalP1GPIO 10
digitalP2 → LED ANODEEXT

17. Connections between "led5" and "Arduino"

Functionled5Arduino
groundGNDGND

18. Connections between "r6" and "Arduino"

Functionr6Arduino
digitalP1GPIO 11
digitalP2 → LED ANODEEXT

19. Connections between "led6" and "Arduino"

Functionled6Arduino
groundGNDGND

Deploy the firmware

#include <Arduino.h>
const uint8_t IR_PINS[3] = {2, 4, 7};
const uint8_t LED_PINS[6] = {3, 5, 6, 9, 10, 11};
const uint8_t LIGHT_PIN = A0;
// Selected LM393 LDR module: HIGH = dark. Selected IR modules:
// LOW = low-reflectance target. Change this for opposite-output modules.
const uint8_t IR_DETECTED_LEVEL = LOW;
const uint8_t DIM_LEVEL = 45;
const uint32_t HOLD_MS = 5000;
uint32_t lastDetection[3] = {};
bool holding[3] = {};
uint8_t previous[6] = {};
bool dark = false, candidateDark = false;
uint32_t candidateSince = 0;
void setup() {
  pinMode(LIGHT_PIN, INPUT);
  for (uint8_t i=0;i<3;i++) pinMode(IR_PINS[i], INPUT_PULLUP);
  for (uint8_t i=0;i<6;i++) { pinMode(LED_PINS[i], OUTPUT); analogWrite(LED_PINS[i],0); }
  candidateDark = digitalRead(LIGHT_PIN) == HIGH;
  candidateSince = millis();
}
void loop() {
  const uint32_t now = millis();
  const bool readingDark = digitalRead(LIGHT_PIN) == HIGH;
  if (readingDark != candidateDark) { candidateDark=readingDark; candidateSince=now; }
  if (now-candidateSince >= 500) dark=candidateDark;
  for (uint8_t zone=0; zone<3; zone++) {
    if (!dark) holding[zone]=false;
    else if (digitalRead(IR_PINS[zone]) == IR_DETECTED_LEVEL) {
      lastDetection[zone]=now; holding[zone]=true;
    } else if (holding[zone] && now-lastDetection[zone]>=HOLD_MS) holding[zone]=false;
    const uint8_t level = !dark ? 0 : holding[zone] ? 255 : DIM_LEVEL;
    for (uint8_t j=0;j<2;j++) {
      const uint8_t i=zone*2+j;
      if (previous[i]!=level) { analogWrite(LED_PINS[i],level); previous[i]=level; }
    }
  }
  delay(5);
}

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik