ESP32 + Ethernet powered DC temperature controlled fan system for off-grid seacans, sheds, and enclosures
COMPLETE BUILD GUIDE + CODERaptorFans 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.
Each fan zone has configurable thresholds:
| Setting | Default | Description |
|---|---|---|
| ON Threshold | 30°C (86°F) | Fan turns ON when any sensor in its zone exceeds this |
| OFF Threshold | 27°C (80°F) | Fan turns OFF when all sensors in its zone drop below this |
| Emergency | 45°C (113°F) | ALL fans turn on at maximum |
| Humidity | 70% | Exhaust fans activate if humidity exceeds this |
| ESP32 Pin | Connected To | Notes |
|---|---|---|
| W5500 Ethernet (SPI) | ||
| GPIO 5 | W5500 CS (Chip Select) | SPI chip select |
| GPIO 18 | W5500 SCK | SPI clock (hardware SPI) |
| GPIO 23 | W5500 MOSI | SPI data out |
| GPIO 19 | W5500 MISO | SPI data in |
| GPIO 16 | W5500 RST | Reset (optional but recommended) |
| Sensors | ||
| GPIO 4 | DS18B20 Data (all 5 sensors) | One-Wire bus — all sensors share this pin |
| GPIO 15 | DHT22 Data | Humidity + temp sensor |
| Relays | ||
| GPIO 25 | Relay CH1 (Fan 1 - Intake) | Active LOW |
| GPIO 26 | Relay CH2 (Fan 2 - Intake) | Active LOW |
| GPIO 27 | Relay CH3 (Fan 3 - Exhaust) | Active LOW |
| GPIO 14 | Relay CH4 (Fan 4 - Exhaust) | Active LOW |
| Power | ||
| 3.3V | DS18B20 VCC (red wires) + W5500 3.3V | All 5 sensors + ethernet power |
| 5V (VIN) | DHT22 VCC + Relay VCC | 5V from buck converter |
| GND | Common ground | All grounds tie together |
| Sensor | Location | Purpose |
|---|---|---|
| Sensor 1 | Near inverter | Monitors hottest equipment |
| Sensor 2 | Near battery | Battery overheating protection |
| Sensor 3 | Ceiling center | Hot air rises — catches heat buildup |
| Sensor 4 | Near intake fans | Incoming air temperature |
| Sensor 5 | Near exhaust fans | Outgoing air temperature (efficiency check) |
| DHT22 | Center of seacan | Ambient temp + humidity |
Complete Arduino sketch. Copy this into Arduino IDE or PlatformIO.
Ethernet — built-in with Arduino IDE (W5500 support included)OneWire by Jim StudtDallasTemperature by Miles BurtonDHT sensor library by AdafruitArduinoJson by Benoit Blanchonhttps://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.jsonSee downloaded .ino file or scroll down for full code
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.
↑ This is a mockup — the real dashboard runs on the ESP32 and updates live every 2 seconds
| Endpoint | Method | Description |
|---|---|---|
GET / | GET | Dashboard HTML page |
GET /api/status | GET | JSON: all temps, humidity, fan states |
GET /api/history | GET | JSON: 24h temperature history |
POST /api/fan/{n}/toggle | POST | Manual toggle fan n (1-4) |
POST /api/config | POST | Update thresholds (JSON body) |
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}
});
raptorfans.ino from the Firmware tab| Problem | Solution |
|---|---|
| Sensor shows -127°C | Bad wiring or missing pull-up resistor. Check connections. |
| Only 1 sensor detected | DS18B20s need good connections. Check solder joints and pull-up. |
| No IP / DHCP failed | Check 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 run | Check relay wiring — use NO (Normally Open) terminals, not NC. |
| ESP32 keeps rebooting | Power issue. Make sure 5V supply can deliver at least 1A. |
| Dashboard won't load | Check IP address. Try power cycling the ESP32. |
| Humidity reads NaN | DHT22 wiring issue or missing pull-up resistor. |