Chapter 1: Darkness to Light

Day 04: Cabin Lighting

Video lesson · 30 min

Your cabin needs proper lighting. Control multiple LEDs independently using DIP switches — wire three separate circuits on one breadboard. Learn power rails, the const byte approach, and how to manage increasing circuit complexity.

Day 04: RGB Color Wheel

What You'll Learn

By the end of this mission, you'll have the skills to control multiple LEDs independently using a single DIP switch module. You'll understand how to:

  • Wire three separate lighting circuits on a single breadboard
  • Use power rails to efficiently distribute voltage across multiple components
  • Replace #define constants with the modern const byte approach
  • Create multiple conditional statements that work together harmoniously
  • Organize your code to handle increasing complexity without chaos

When you power up your HERO board, you'll have complete control over your spacecraft's lighting systems — each switch commanding its own dedicated light circuit, ready to illuminate your path to survival.

Understanding Multiple Circuit Control

Think of your spacecraft like a house during a power outage. Yesterday, you managed to get one room's light working with a single switch. That was like having a flashlight — helpful, but limited. Today, you're becoming the electrical engineer who restores power to the entire house, with each room controlled by its own wall switch.

In your home, you don't need a separate power outlet for each light switch. Instead, all the switches share the same electrical supply (the power coming from your breaker box), but each switch controls its own unique light fixture. That's exactly what we're building today — a shared power system with independent control.

Your DIP switch module is like having three separate wall switches built into one convenient panel. Each tiny switch is completely independent — flip switch 1, and only the light connected to switch 1 responds. Switch 2 controls its own light, and switch 3 controls yet another. But they all share the same power source, just like the light switches in your house all connect to the same electrical panel.

The genius of this system lies in its scalability. Once you understand how to control three lights, you could control ten, twenty, or even a hundred — the principle remains exactly the same. Each switch gets its own input pin on your microcontroller, each light gets its own output pin, and your code simply checks each switch and responds accordingly.

This is foundational knowledge that extends far beyond lighting. The same principles apply to controlling motors, sensors, speakers, displays — any situation where you need independent control over multiple devices. You're not just learning to control LEDs; you're learning the fundamental pattern of modern automation and robotics.

Wiring Your Multi-Light Control System

Today's circuit builds on yesterday's foundation but adds something powerful: power rails. These are the long metal strips running along the sides of your breadboard, and they're about to become your best friend for efficient wiring.

Day 4 Wiring Diagram

Power Distribution (The Smart Way)

  1. Connect 5V to the power rail: Run a red jumper wire from your HERO's 5V pin to the red power rail (the + strip). This creates a "power highway" that all your components can tap into.
  2. Connect GND to the ground rail: Run a black jumper wire from your HERO's GND pin to the blue ground rail (the - strip). This becomes your common return path.
  3. Power the DIP switch: Instead of running three separate wires from 5V, just run one red wire from the power rail to the DIP switch's VCC pin.

Input Connections (Reading the Switches)

  1. Switch 1 to Pin 2: Brown wire from DIP switch position 1 to HERO pin 2
  2. Switch 2 to Pin 3: White wire from DIP switch position 2 to HERO pin 3
  3. Switch 3 to Pin 4: Yellow wire from DIP switch position 3 to HERO pin 4
  4. Pull-down resistors: Connect a 10kΩ resistor from each switch output to the ground rail (this prevents floating signals)

Output Connections (Controlling the Lights)

  1. Red LED (Cabin): Orange wire from HERO pin 10 to red LED's positive leg, LED's negative leg to ground rail
  2. Blue LED (Storage): Blue wire from HERO pin 11 to blue LED's positive leg, LED's negative leg to ground rail
  3. Green LED (Cockpit): Green wire from HERO pin 12 to green LED's positive leg, LED's negative leg to ground rail

Why This Layout Works: By using power rails, you avoid the "spaghetti wire" problem that plagues many circuits. One 5V source feeds everything, one ground connection returns everything, and your signal wires stay organized and easy to trace.

This is lesson 5 of 31 in 30 Days Lost in Space — a professionally produced Arduino course taught by Dr. Greg Lyzenga (NASA JPL scientist, Harvey Mudd professor). Each lesson features cinematic-quality video produced with a 20-30 person professional crew.

All video lessons are free to watch. Get the kit at craftingtable.com — $100 with a 30-day money-back guarantee.