RaptorFans

ESP32 + Ethernet powered DC temperature controlled fan system for off-grid seacans, sheds, and enclosures

COMPLETE BUILD GUIDE + CODE

What This Does

RaptorFans is a complete temperature-regulated ventilation system designed for seacans and off-grid enclosures. It monitors temperatures at multiple points and automatically controls DC fans to keep your equipment cool.

Features

  • 5 temperature sensors — DS18B20 digital sensors placed around the seacan
  • 1 humidity sensor — DHT22 for moisture monitoring
  • 4 fan relay channels — independently controlled DC fans
  • Ethernet dashboard — real-time monitoring via hardwired connection (W5500 module)
  • Smart thresholds — configurable on/off temperatures per fan zone
  • Data logging — 24-hour history with min/max/avg tracking
  • Runs on DC — powered directly from your battery system (12V via buck converter)
  • No WiFi required — hardwired Ethernet, rock-solid in metal seacans where WiFi sucks

System Architecture

┌─────────────────────────────────────────────────┐ │ SEACAN │ │ │ │ [Sensor 1]──┐ ┌──[Fan 1 - Intake] │ │ [Sensor 2]──┤ │ [Fan 2 - Intake] │ │ [Sensor 3]──┼────┼──[Fan 3 - Exhaust] │ │ [Sensor 4]──┤ │ [Fan 4 - Exhaust] │ │ [Sensor 5]──┤ │ │ │ [Humidity]──┘ │ │ │ │ │ │ │ ┌────▼───────────▼────┐ │ │ │ ESP32 │◄── Ethernet Dashboard │ │ │ + W5500 Ethernet │ (phone/laptop) │ │ └────────┬────────────┘ │ │ │ │ │ ┌────────▼────────────┐ │ │ │ 4-Ch Relay Module │ │ │ └────────┬────────────┘ │ │ │ │ │ ┌────────▼────────────┐ ┌───────────────┐ │ │ │ 12V DC Bus │◄────│ Buck Converter │ │ │ │ (Fan Power) │ │ 36V → 12V │ │ │ └─────────────────────┘ └───────┬───────┘ │ │ │ │ └──────────────────────────────────────┼───────────┘ │ ┌────────▼────────┐ │ 36V Battery │ │ System (Solar) │ └─────────────────┘

How Fan Control Works

Each fan zone has configurable thresholds:

SettingDefaultDescription
ON Threshold30°C (86°F)Fan turns ON when any sensor in its zone exceeds this
OFF Threshold27°C (80°F)Fan turns OFF when all sensors in its zone drop below this
Emergency45°C (113°F)ALL fans turn on at maximum
Humidity70%Exhaust fans activate if humidity exceeds this
The 3°C hysteresis gap prevents fans from rapidly cycling on/off when temperature hovers near the threshold.

Parts List

All prices are approximate. Total build cost: ~$45-65 CAD depending on fans you already have.

Electronics

  • ESP32 DevKit V1 — microcontroller (any ESP32 board works)~$8
  • W5500 Ethernet Module — hardwired network, way more reliable than WiFi in a metal seacan~$6
  • DS18B20 Waterproof Sensors × 5 — digital temp sensors, pre-wired with 1m leads~$12
  • DHT22 Sensor × 1 — temperature + humidity combo sensor~$5
  • 4-Channel Relay Module (5V) — for switching fan power~$5
  • 4.7kΩ Resistor × 1 — pull-up for DS18B20 data line~$0.10
  • 10kΩ Resistor × 1 — pull-up for DHT22 (some modules have built-in)~$0.10
  • Ethernet cable — Cat5e or Cat6, whatever length you need to reach your router/switch~$5

Power

  • DC-DC Buck Converter (36V→12V, 10A+) — powers fans from battery system~$10
  • DC-DC Buck Converter (12V→5V, 3A) — powers ESP32 + relay module~$4
  • Inline Fuse Holder + 15A Fuse — safety on battery input~$3

Fans (12V DC)

  • 120mm or 140mm 12V DC Fans × 4 — or whatever size fits your vents. PC fans work great for lower airflow. For serious ventilation, use 4" or 6" inline duct fans.~$8-40

Misc

  • Project enclosure box — weatherproof if mounting outside~$5
  • Wire (18 AWG for fans, 22 AWG for sensors)~$5
  • USB-C cable — for programming ESP32 (one time)~$0
  • Terminal blocks or Wago connectors — for clean wiring~$3
Use properly rated wire for your DC current. 18 AWG is good for runs up to ~5A at 12V. For longer runs or higher current fans, go thicker (16 or 14 AWG).

Wiring Diagram

ESP32 Pin Assignments

ESP32 PinConnected ToNotes
W5500 Ethernet (SPI)
GPIO 5W5500 CS (Chip Select)SPI chip select
GPIO 18W5500 SCKSPI clock (hardware SPI)
GPIO 23W5500 MOSISPI data out
GPIO 19W5500 MISOSPI data in
GPIO 16W5500 RSTReset (optional but recommended)
Sensors
GPIO 4DS18B20 Data (all 5 sensors)One-Wire bus — all sensors share this pin
GPIO 15DHT22 DataHumidity + temp sensor
Relays
GPIO 25Relay CH1 (Fan 1 - Intake)Active LOW
GPIO 26Relay CH2 (Fan 2 - Intake)Active LOW
GPIO 27Relay CH3 (Fan 3 - Exhaust)Active LOW
GPIO 14Relay CH4 (Fan 4 - Exhaust)Active LOW
Power
3.3VDS18B20 VCC (red wires) + W5500 3.3VAll 5 sensors + ethernet power
5V (VIN)DHT22 VCC + Relay VCC5V from buck converter
GNDCommon groundAll grounds tie together

Complete Wiring

36V BATTERY SYSTEM │ ├── [15A FUSE] ──► DC-DC Buck (36V → 12V) │ │ │ 12V DC BUS │ │ │ ├── Fan 1 (+) ◄── Relay CH1 COM │ ├── Fan 2 (+) ◄── Relay CH2 COM │ ├── Fan 3 (+) ◄── Relay CH3 COM │ ├── Fan 4 (+) ◄── Relay CH4 COM │ │ │ └── DC-DC Buck (12V → 5V) │ │ │ 5V / 3.3V │ │ │ ┌────┴────┐ │ │ ESP32 │ │ └──┬───┬──┘ │ │ │ │ │ SPI Bus │ │ │ │ │ ┌────┴─────┐ │ │ │ W5500 │◄── Ethernet Cable │ │ │ Ethernet │ to Router/Switch │ │ └──────────┘ GND ◄─── ALL GROUNDS ──────┘ W5500 ETHERNET MODULE (SPI): ┌──────────────────────────────────────────────┐ │ │ │ W5500 VCC ──── 3.3V (some modules take 5V) │ │ W5500 GND ──── GND │ │ W5500 CS ──── GPIO 5 │ │ W5500 SCK ──── GPIO 18 │ │ W5500 MOSI ─── GPIO 23 │ │ W5500 MISO ─── GPIO 19 │ │ W5500 RST ──── GPIO 16 (optional) │ │ W5500 INT ──── not connected │ │ │ │ Plug Ethernet cable into the RJ45 jack │ │ Run cable to your router/switch │ └──────────────────────────────────────────────┘ DS18B20 WIRING (all 5 sensors share one bus): ┌──────────────────────────────────────────────┐ │ │ │ ESP32 GPIO4 ──┬── 4.7kΩ ──┬── 3.3V │ │ │ │ │ │ ┌─────┴─────┐ │ │ │ │ DATA BUS │ │ │ │ │ │ │ │ │ S1 data S2 data S3 data ... │ │ S1 VCC ────────────────┘ (all to 3.3V) │ │ S1 GND ──── GND (all to GND) │ │ │ │ Wire colors (standard DS18B20): │ │ RED = VCC (3.3V) │ │ YELLOW/WHITE = DATA (GPIO 4) │ │ BLACK = GND │ └──────────────────────────────────────────────┘ DHT22 WIRING: ┌──────────────────────────────────────┐ │ │ │ Pin 1 (VCC) ──── 5V │ │ Pin 2 (DATA) ─┬─ GPIO 15 │ │ └─ 10kΩ ── 5V │ │ Pin 3 (NC) │ │ Pin 4 (GND) ──── GND │ │ │ └──────────────────────────────────────┘ RELAY MODULE: ┌──────────────────────────────────────┐ │ │ │ VCC ──── 5V │ │ GND ──── GND │ │ IN1 ──── GPIO 25 (Fan 1) │ │ IN2 ──── GPIO 26 (Fan 2) │ │ IN3 ──── GPIO 27 (Fan 3) │ │ IN4 ──── GPIO 14 (Fan 4) │ │ │ │ Each relay COM ──── 12V DC BUS │ │ Each relay NO ───── Fan (+) wire │ │ Fan (-) wires ───── 12V GND │ │ │ │ (NO = Normally Open, fan OFF when │ │ relay not energized = failsafe) │ └──────────────────────────────────────┘
Double-check your relay module's logic level. Most common modules are ACTIVE LOW (relay triggers when pin goes LOW). The firmware handles this automatically.
The DS18B20 sensors use the Dallas One-Wire protocol — all 5 sensors connect to the SAME data pin (GPIO 4). Each sensor has a unique address that the firmware auto-discovers.

Sensor Placement Guide

SensorLocationPurpose
Sensor 1Near inverterMonitors hottest equipment
Sensor 2Near batteryBattery overheating protection
Sensor 3Ceiling centerHot air rises — catches heat buildup
Sensor 4Near intake fansIncoming air temperature
Sensor 5Near exhaust fansOutgoing air temperature (efficiency check)
DHT22Center of seacanAmbient temp + humidity

Fan Placement

  • Fans 1 & 2 (Intake) — mount low on one end of the seacan. Cut holes, mount fans blowing IN.
  • Fans 3 & 4 (Exhaust) — mount high on the opposite end. Cut holes, mount fans blowing OUT.
  • This creates cross-ventilation: cool air enters low, hot air exits high.

ESP32 Firmware

Complete Arduino sketch. Copy this into Arduino IDE or PlatformIO.

Before uploading, change the WiFi credentials and optionally adjust temperature thresholds at the top of the code.
Download raptorfans.ino

Required Libraries (install via Arduino Library Manager)

  • Ethernet — built-in with Arduino IDE (W5500 support included)
  • OneWire by Jim Studt
  • DallasTemperature by Miles Burton
  • DHT sensor library by Adafruit
  • ArduinoJson by Benoit Blanchon
No more ESPAsyncWebServer/AsyncTCP dependency hassle — the Ethernet version uses the built-in EthernetServer which is simpler and more stable.

Board Setup in Arduino IDE

  1. Go to File → Preferences
  2. Add to Board Manager URLs: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
  3. Go to Tools → Board → Board Manager, search "esp32", install
  4. Select board: ESP32 Dev Module
  5. Upload speed: 115200
See downloaded .ino file or scroll down for full code

Live Dashboard

Once the ESP32 is running and connected to your WiFi, the dashboard is served directly from the ESP32. Just open a browser and go to its IP address.

The ESP32 prints its IP address to the Serial Monitor when it boots. You can also check your router's DHCP client list — look for the MAC address DE:AD:BE:EF:FE:01 (or whatever you set in the code).

Dashboard Features

  • Real-time temperature readings from all 5 sensors
  • Humidity reading
  • Fan status (ON/OFF) for all 4 channels
  • Temperature history graph (24 hours)
  • Adjustable thresholds via web interface
  • Min/Max/Average stats
  • Manual fan override buttons
  • System uptime and Ethernet link status

Dashboard Preview

INVERTER
32.4°C
90.3°F
BATTERY
28.1°C
82.6°F
CEILING
36.7°C
98.1°F
HUMIDITY
54%
Normal
FAN 1 ON
FAN 2 OFF
FAN 3 ON
FAN 4 OFF

↑ This is a mockup — the real dashboard runs on the ESP32 and updates live every 2 seconds

API Endpoints (served by ESP32)

EndpointMethodDescription
GET /GETDashboard HTML page
GET /api/statusGETJSON: all temps, humidity, fan states
GET /api/historyGETJSON: 24h temperature history
POST /api/fan/{n}/togglePOSTManual toggle fan n (1-4)
POST /api/configPOSTUpdate thresholds (JSON body)

For His Own Website

If your buddy wants to pull the data into his own website/server, the ESP32 exposes a JSON API. Here's a simple fetch example:

// Fetch from ESP32 on local network
fetch('http://192.168.1.XXX/api/status')
  .then(r => r.json())
  .then(data => {
    console.log(data.sensors);   // Array of {name, tempC, tempF}
    console.log(data.humidity);  // {temp, humidity}
    console.log(data.fans);     // Array of {name, state, auto}
  });
For remote monitoring (outside the local network), he could set up port forwarding on his router, or use a service like Tailscale for secure remote access without opening ports. Ethernet makes this extra reliable — no WiFi dropouts in a metal box.

Step-by-Step Installation

1

Flash the ESP32

  • Install Arduino IDE (or PlatformIO)
  • Install the ESP32 board package and required libraries
  • Download raptorfans.ino from the Firmware tab
  • Optionally change the MAC address or set a static IP at the top of the file (DHCP is default)
  • Connect ESP32 via USB, select the correct COM port
  • Upload the sketch
  • Plug in the Ethernet cable from the W5500 to your router/switch
  • Open Serial Monitor (115200 baud) — note the IP address it prints
2

Wire the Sensors

  • Connect all 5 DS18B20 sensors to GPIO 4 (see Wiring tab)
  • Add the 4.7kΩ pull-up resistor between DATA and 3.3V
  • Connect DHT22 to GPIO 15 with 10kΩ pull-up
  • Power everything from the 5V buck converter
Test: Open the dashboard in your browser. You should see temperature readings from all sensors. If a sensor shows -127°C, check its wiring.
3

Wire the Relays & Fans

  • Connect relay module inputs to GPIO 26, 27, 32, 33
  • Wire the 36V→12V buck converter to the battery system (through fuse!)
  • Wire 12V to each relay's COM terminal
  • Wire each relay's NO terminal to the corresponding fan's (+) wire
  • Wire all fan (-) wires to 12V ground
ALWAYS install a fuse between the battery and your buck converter. A short circuit on a 36V battery system can cause fire.
4

Mount Everything

  • Mount ESP32 + relay module in project enclosure
  • Run sensor wires to their positions (use cable clips or conduit)
  • Mount intake fans low on one end, exhaust fans high on the other
  • Seal around fans with weatherstripping to prevent backdraft
  • Mount project box somewhere accessible but out of the way
5

Configure & Test

  • Open the dashboard from any device on the same WiFi
  • Adjust temperature thresholds via the Settings panel
  • Test each fan with the manual override buttons
  • Warm a sensor with your hand to verify automatic activation
  • Let it run for 24 hours and check the history graph
If everything works, either set a static IP in the firmware code (change USE_DHCP to false) or assign one in your router's DHCP reservations so the dashboard URL never changes.

Troubleshooting

ProblemSolution
Sensor shows -127°CBad wiring or missing pull-up resistor. Check connections.
Only 1 sensor detectedDS18B20s need good connections. Check solder joints and pull-up.
No IP / DHCP failedCheck Ethernet cable, make sure W5500 SPI wiring is correct (especially CS on GPIO 5). Try a different cable or port on your router.
Relay clicks but fan doesn't runCheck relay wiring — use NO (Normally Open) terminals, not NC.
ESP32 keeps rebootingPower issue. Make sure 5V supply can deliver at least 1A.
Dashboard won't loadCheck IP address. Try power cycling the ESP32.
Humidity reads NaNDHT22 wiring issue or missing pull-up resistor.