System Integration — Smart Beehive

This week focuses on integrating all the subsystems of my final project — the Smart Beehive — into one coherent system. The beehive combines cameras, environmental sensors, load cells, a servo-controlled entrance, LED lighting, and network connectivity, all managed by a single Raspberry Pi 5 powered over Ethernet.

Assignment Requirements

Individual Assignment:

System Overview

The Smart Beehive integrates the following subsystems:

3D CAD Models — Electronics Packaging

I designed two custom housings in Fusion 360 to package the electronics and cameras into the beehive. Both parts are 3D printed — the bottom board in PLA (interior, protected from weather) and the entrance in white ASA (exterior, UV/weather resistant).

Bottom Board

The bottom board is the main electronics enclosure. It holds the Raspberry Pi 5, the Waveshare PoE HAT, the I²C multiplexer, and all wiring. It mounts underneath the hive body and keeps everything organized and protected from the bees. The board has mounting posts for the Pi, cable routing channels, and ventilation slots for the PoE HAT's cooling fan.

Bottom Board — holds the Raspberry Pi 5, PoE HAT, and other electronics. Click and drag to rotate, scroll to zoom.

Entrance Camera Housing

The entrance housing mounts at the hive entrance and holds both Pi Camera Module 3 Wide units and the 4 custom LED PCBs (2 white, 2 red). It's designed so the cameras have a clear view of bees entering and exiting, while the LEDs provide illumination without being in the cameras' field of view. The housing also integrates with the servo-driven rotating entrance gate.

Entrance Camera Housing — holds both cameras and LED boards at the hive entrance. Click and drag to rotate, scroll to zoom.

Design Files

Download the STL files for 3D printing:

📥 Download Bottom Board STL 📥 Download Entrance Housing STL

Power & Networking — PoE Change

Previously I was planning to use a large battery with a complex power supply system, but I've switched to Power over Ethernet (PoE). This simplifies everything — one Ethernet cable from the house to the hive carries both data and power. No batteries to recharge, no 140W solar panel, no power management circuitry.

Waveshare PoE HAT (F) for Raspberry Pi 5

Entrance Housing — Material Choice

The entrance housing is 3D printed in white ASA filament. ASA was chosen because:

Interior Parts — PLA

For parts that stay inside the hive or electronics housing (not exposed to the elements), I'm using PLA. PLA is cheaper, prints easily, and holds up fine when it's not dealing with UV or moisture. Using ASA only where it's needed saves material cost and simplifies printing for the interior components.

Print-Size Challenge — Entrance Housing

The entrance housing is too large to print on my Bambu A1 in one piece. My approach:

  1. Test print one half on my A1 — I printed half of the entrance housing at home to verify the design. This let me test-fit the Pi Camera Module 3 and my custom LED PCB before committing to a full-size print. Catching any issues at this stage saved me from paying for a failed large print.
  2. Reached out for quotes — I contacted several people and services about printing the full-size part in ASA. A person on Facebook in Georgia with a Bambu H2 quoted $125 but the deal fell through. PCBWay quoted $200 for the camera box alone. The cost is high for a single part, so I'm still exploring options — possibly printing it at school on the X1 printers if I can split the design into pieces that interlock while staying waterproof.

Print Settings Planned

ASA specifically requires a heated chamber to print reliably at this size — without one, ASA warps, cracks, and delaminates on large parts. A Bambu H2, Bambu X1C with enclosure, or professional print service like PCBWay all have the enclosed chamber and heated build volume needed for this. If I end up making a lot more of these housings in the future, I'd invest in my own enclosed printer rather than continuing to outsource.

Entrance camera box — 3D model showing dual camera housing

Entrance camera box — houses both Pi Camera Module 3 units and the LED boards

Servo-Controlled Entrance Gate

The hive entrance has a rotating gate that opens and closes the entrance digitally. This is driven by a servo motor through a belt drive.

Rotating entrance gate — servo-driven via belt

The rotating entrance gate — driven by a servo motor through a belt drive

I successfully printed the rotating entrance as the final part on my Bambu A1 in PLA. Since the rotating gate sits inside the entrance housing — enclosed and shielded from direct UV and weather — PLA is fine here. The housing around it handles the outdoor exposure, so the gate itself doesn't need ASA or PETG.

Why a Belt Drive?

A belt drive separates the servo from the rotating part, giving me flexibility in where the servo is mounted and how the gearing is arranged. It also gives mechanical advantage if I need torque multiplication, and isolates the servo shaft from any side-loads the gate might experience.

Why Move the Servo Slowly?

The servo needs to move slowly for two reasons:

The Pi will ramp the servo position gradually instead of commanding it to slam from 0° to 180° instantly.

Daily Anti-Propolis Movement

The system is programmed to automatically move the gate a small amount a few times a day. This prevents the bees from sealing the gate shut with propolis.

What is propolis? Propolis is a sticky, resinous substance bees collect from tree buds and sap flows. They use it as a hive sealant — filling cracks, smoothing rough surfaces, and even mummifying intruders that are too large to remove. Bees will gradually coat any gap or moving joint in the hive with propolis, and over time it can seize up mechanical parts completely.

By moving the gate a few millimeters several times a day, the system breaks up any propolis buildup before it can harden and lock the mechanism. The movements are small and slow so the bees aren't disturbed, but frequent enough to keep the gate operable.

Subsystem Integration

Cameras

Two Raspberry Pi Camera Module 3 Wide units connect to the Pi 5's dual CSI ports (CAM0 and CAM1). Full documentation of the dual-camera MJPEG streaming setup is on the Week 11 — Networking and Communications page.

Environmental Sensors

Three SHT45 temperature/humidity sensors (with PTFE protection) are placed throughout the hive to monitor different zones — one per box. Because all three sensors share the same I²C address, they're connected through a TCA9548A I²C multiplexer that lets the Pi select which sensor to read. Full sensor details are on the Week 9 — Input Devices page.

Load Cells

Load cells under the hive measure total weight. Weight trends indicate honey production during a nectar flow, honey consumption in winter, and can alert to sudden changes (robbing, swarming, or a lost colony). The load cells interface to the Pi via an HX711 amplifier.

Servo-Controlled Entrance

A servo motor drives a rotating gate at the hive entrance through a belt drive — full details in the Servo-Controlled Entrance Gate section above. This allows the entrance to be opened or closed remotely from the Pi, useful for:

LED Lighting

Four custom LED PCBs (2 white, 2 red) provide illumination for the cameras. White LEDs for daytime viewing, red LEDs for nighttime viewing since bees cannot see red light. Each board is controlled by a single GPIO pin from the Pi via a MOSFET. Full board design is on the Week 10 — Output Devices page.

System Diagram

┌─────────────────────────────────────────────────────────────────┐
│                  SMART BEEHIVE SYSTEM (PoE)                      │
└─────────────────────────────────────────────────────────────────┘

    ┌──────────────────┐
    │   House (500ft)  │
    │  PoE Switch /    │
    │  PoE Injector    │
    └────────┬─────────┘
             │
             │ Single Ethernet Cable
             │ (Power + Data, 802.3af/at)
             │
    ┌────────▼──────────────────────────────────────┐
    │     WAVESHARE PoE HAT (F) — Pi 5              │
    │     • 802.3af/at compliant                    │
    │     • Onboard cooling fan + metal heatsink    │
    │     • Gigabit Ethernet                        │
    └────────┬──────────────────────────────────────┘
             │
    ┌────────▼──────────────────────────────────────┐
    │         RASPBERRY PI 5 (8GB RAM)               │
    │         Main Controller                        │
    └──┬──┬──┬──┬──────────────────────────┬────────┘
       │  │  │  │                          │
       │  │  │  │ GPIO                     │ I²C
       │  │  │  └──────┐                   │
       │  │  │         │                   │
       │  │  └──CSI────┴──CSI────┐    ┌────▼──────────────┐
       │  │                      │    │ TCA9548A          │
       │  │  ┌──────┐    ┌──────┐│    │ I²C Multiplexer   │
       │  │  │ CAM  │    │ CAM  ││    └────┬──────────────┘
       │  │  │  0   │    │  1   ││         │
       │  │  └──────┘    └──────┘│    ┌────┴─────┬─────┬─────┐
       │  │                      │    │          │     │     │
       │  │                      │   ┌▼──┐     ┌▼──┐ ┌▼──┐ ┌▼──┐
       │  │                      │   │SHT│     │SHT│ │SHT│ │SHT│
       │  │                      │   │45 │     │45 │ │45 │ │45 │
       │  │                      │   └───┘     └───┘ └───┘ └───┘
       │  │                      │
       │  │                 ┌────▼────┐
       │  │                 │ LED PCBs│ (4 total)
       │  │                 │ 2×white │
       │  │                 │ 2×red   │
       │  │                 └─────────┘
       │  │
       │  └─────┐
       │        │
    ┌──▼──┐  ┌──▼──────┐
    │HX711│  │ SERVO   │
    │  +  │  │ MOTOR   │
    │LOAD │  │(entrance│
    │CELLS│  │ gate)   │
    └─────┘  └─────────┘

┌─────────────────────────────────────────────────────────────────┐
│  ENTRANCE HOUSING                                                │
│  • White ASA filament (UV resistant, weatherproof)              │
│  • Holds 2 cameras, 4 LED boards, servo gate                    │
│  • Mounts to standard Langstroth hive                           │
└─────────────────────────────────────────────────────────────────┘
        

Software Integration

System running — all subsystems connected and communicating

All subsystems connected and communicating — sensors, cameras, and controls running over PoE

The Pi runs a Python application that coordinates all subsystems:

Hardware Configuration & Wiring

Pi 5 Specs

I²C Multiplexer Wiring (PCA9548)

Pi GPIO Mux Pin Wire Color
3V3VINRed
GNDGNDBlack
GPIO 3 (SCL)SCLYellow
GPIO 2 (SDA)SDABlue

SHT45 Sensor Channels

Configuration Steps

1. Enable I²C

I²C was disabled by default on a fresh Pi OS install:

sudo raspi-config nonint do_i2c 0
sudo reboot

Verify the multiplexer is detected at address 0x70:

sudo i2cdetect -y 1
# Should show 0x70 (PCA9548 mux)

2. Scan Sensors Through the Mux

This script loops through each mux channel and checks for an SHT45 (address 0x44):

for ch in 0 1 2 3 4 5 6 7; do
  sudo i2cset -y 1 0x70 $((1 << ch))
  result=$(sudo i2cdetect -y 1 | grep "44")
  if echo "$result" | grep -q "44"; then
    echo "Channel $ch: SHT45 found at 0x44"
  fi
done
sudo i2cset -y 1 0x70 0x00

3. Fan Control (Waveshare PoE HAT F)

The PoE HAT's onboard cooling fan is controlled via the thermal subsystem:

# Set fan speed (0-4)
echo 4 | sudo tee /sys/class/thermal/cooling_device0/cur_state

# Read RPM
cat /sys/devices/platform/cooling_fan/hwmon/hwmon2/fan1_input

# Reset to auto
echo 0 | sudo tee /sys/class/thermal/cooling_device0/cur_state

4. Camera Test

Quick capture test (use rpicam-* on Trixie, NOT libcamera-*):

rpicam-still --camera 0 -o /tmp/cam0.jpg --immediate -n
rpicam-still --camera 1 -o /tmp/cam1.jpg --immediate -n

Live Stream Server

The streaming server combines dual-camera MJPEG streaming with live sensor readings into a single web dashboard on port 8080:

Start Manually

nohup python3 ~/stream.py > /tmp/stream.log 2>&1 &

Auto-Start on Boot

(crontab -l 2>/dev/null; echo "@reboot sleep 10 && python3 ~/stream.py > /tmp/stream.log 2>&1") | crontab -

Server Endpoints

Path Description
/Dashboard (cameras + sensors)
/snap0Camera 0 JPEG snapshot
/snap1Camera 1 JPEG snapshot
/sensorsJSON: [{"temp": x, "hum": y}, ...]

Next Steps

Related Weekly Work

Useful Links