Multi Light Sensor Switch

I created a project that combines a DIP switch and a photoresistor to control three LEDs using an Arduino Uno R3. This project merges two smaller concepts—the use of DIP switches and light sensors—into a single interactive lighting system. I was inspired to combine these elements to explore how conditional input from both a sensor and manual switches can control output behavior in a smart way.
Supplies
- 1x 3-position DIP switch (or 3 individual SPST slide switches)
- 1x Photoresistor (LDR)
- 3x LEDs (preferably in different colors)
- 17x Male-to-male jumper wires
- 1x Small breadboard
- 1x Arduino Uno R3
- 7x Resistors (appropriate values for LEDs and the photoresistor circuit)
Upload the Code

Upload the following code to your Arduino using the Arduino IDE:
This code ensures that each LED only turns on if both the corresponding DIP switch is in the ON position and the photoresistor detects a light level below the threshold.
Downloads
Connect the Jumper Wires
.png)
Use 17 male-to-male jumper wires:
- 9 wires connect the Arduino to the breadboard (for LEDs, switches, and the sensor).
- 8 wires are used on the breadboard to interconnect components.
Color-coding your wires can help you keep track of connections more easily.
Insert the LEDs
.png)
Place three LEDs into the breadboard. Use different colors (e.g., red, green, and blue) to represent different zones or labels (e.g., cockpit, storage, cabin). Connect each LED in series with a resistor (typically 220Ω) to prevent them from burning out.
Install the DIP Switch
.png)
Insert your 3-position DIP switch into the breadboard. Connect each of the three pins on one side to digital pins 2, 3, and 4 on the Arduino (using a pull-down resistor if needed). Connect the corresponding opposite side pins to 5V so that each switch acts as a simple HIGH/LOW toggle.
The DIP switch allows you to manually enable or disable each LED, and it must be ON (HIGH) along with the proper light condition for the LED to light up.
Connect the Photoresistor
.png)
Place the photoresistor (LDR) into the breadboard. Connect one leg to 5V and the other to both analog pin A0 and a pull-down resistor (10kΩ) going to GND. This setup forms a voltage divider, enabling the Arduino to read light levels.
Insert the Resistors
.png)
Install seven resistors total:
- 3x resistors (220Ω) for the LEDs
- 1x 10kΩ resistor for the photoresistor voltage divider
- 3x resistors (10kΩ) as pull-downs for the DIP switch pins (unless using INPUT_PULLUP in software)
Resistors ensure proper functionality and protect components from excess current.
Upload and Test
- Paste the code into the Arduino IDE and upload it.
- Flip the DIP switches to ON.
- Cover or touch the photoresistor to simulate low light conditions.
- The corresponding LEDs should light up only if:
- The switch for that LED is ON.
- The light level is below the threshold.
If it’s not working:
- Use the Serial Monitor to read sensorValue and adjust the threshold.
- Double-check wiring and resistor values.