For my final project, I designed a custom PCB in KiCad to illuminate the beehive entrance for camera viewing. The board controls 7 LEDs wired in parallel, switched by a MOSFET, and controlled by a single GPIO pin from the Raspberry Pi 5.
Why Two Different LED Colors?
Each half of the hive entrance has a Raspberry Pi Camera Module 3 Wide mounted to observe bee activity. To see the bees clearly, the entrance needs lighting — but there's a catch: I need to observe the bees at night without disturbing them.
This is where bee vision comes in. Honeybees see light differently than humans. Their visual spectrum ranges from about 300nm (ultraviolet) to 650nm (orange), which means they can see UV light that we can't, but they cannot see red light. Red light has a wavelength of approximately 620–750nm, which falls entirely outside the bee's visible range. To a bee, a red LED might as well be off — they simply don't have the photoreceptors to detect it.
Bees have three types of photoreceptors: one peaking in the UV range (~340nm), one in blue (~430nm), and one in green (~535nm). Notice there's no receptor anywhere near the red end of the spectrum. This is why beekeepers have long used red headlamps when inspecting hives at night — the bees remain calm because they literally cannot see the light.
White LEDs, on the other hand, emit a broad spectrum that includes blue and green wavelengths — both of which bees can see clearly. White light would agitate the bees at night, disrupting their rest cycle and potentially triggering defensive behavior.
So the solution is two boards per entrance half:
- White LED board: Used during daytime viewing when the bees are already active and ambient light is present. The white LEDs supplement natural light for clearer camera footage.
- Red LED board: Used during nighttime viewing. The red light illuminates the entrance for the camera (which can see red light just fine) without disturbing the bees at all.
The Raspberry Pi determines whether it's day or night and activates the appropriate board when the cameras turn on. In total, I need 4 boards — 2 white and 2 red (one of each per entrance half).
Circuit Design
I designed the board in KiCad. The circuit is simple but effective:
- 7× 3mm LEDs wired in parallel, each with its own current-limiting resistor
- N-channel MOSFET on the low side to switch all 7 LEDs on/off
- 10kΩ pull-down resistor from the MOSFET gate to ground — this ensures the LEDs stay OFF when the GPIO pin is not actively driving the gate (e.g., during Pi boot-up or if the GPIO is floating). Without the pull-down, the gate could pick up stray voltage and turn the LEDs on unexpectedly.
- Gate resistor between the GPIO pin and the MOSFET gate to limit inrush current to the gate capacitance
The entire board is controlled by just 3 wires:
- Power (VCC): 3.3V or 5V from the Pi (depending on LED forward voltage requirements)
- Ground (GND): Common ground with the Pi
- GPIO signal: A single GPIO pin from the Pi drives the MOSFET gate — HIGH turns the LEDs on, LOW turns them off
Power Consumption Calculations
White LED Board (×2):
- Typical 3mm white LED: forward voltage (Vf) ≈ 3.0–3.2V, forward current (If) = 20mA
- Running from 5V supply with a current-limiting resistor per LED
- Resistor value: R = (5V − 3.1V) / 20mA = 95Ω → use 100Ω resistor
- Actual current per LED: (5V − 3.1V) / 100Ω = 19mA per LED
- Power per LED: 5V × 19mA = 95mW per LED
- Per board (7 LEDs): 7 × 19mA = 133mA, 7 × 95mW = 665mW per board
- Both white boards: 266mA total, 1.33W total
Red LED Board (×2):
- Typical 3mm red LED: forward voltage (Vf) ≈ 1.8–2.0V, forward current (If) = 20mA
- Running from 3.3V supply with a current-limiting resistor per LED
- Resistor value: R = (3.3V − 1.9V) / 20mA = 70Ω → use 68Ω resistor (standard value)
- Actual current per LED: (3.3V − 1.9V) / 68Ω = 20.6mA per LED
- Power per LED: 3.3V × 20.6mA = 68mW per LED
- Per board (7 LEDs): 7 × 20.6mA = 144mA, 7 × 68mW = 476mW per board
- Both red boards: 288mA total, 0.95W total
Summary: At worst case (all 4 boards on simultaneously, which wouldn't happen in normal operation), total draw would be about 554mA / 2.28W. In practice, only 2 boards run at a time (either both white or both red), so actual draw is 133–144mA per board pair — very manageable for the Pi's GPIO and power supply.
Raspberry Pi Control Logic
The Pi 5 will determine day/night using one of these methods:
- Time-based: Use sunrise/sunset times for the hive's GPS coordinates (calculated with a Python library like
astral) - Light sensor: An ambient light sensor could provide real-time readings, but adds complexity
When the camera is activated for on-demand viewing:
- If daytime → turn on white LED boards via GPIO
- If nighttime → turn on red LED boards via GPIO
- When camera stream ends → turn off all LED boards to save power
Design Files
KiCad schematic — 7 LEDs in parallel, MOSFET switching with pull-down resistor
KiCad PCB layout — 7 LEDs in parallel with MOSFET switching
KiCad 3D viewer — LED board with components placed
Download the KiCad project and fabrication files: