🌡️ SUNLU AMS Smart Vent Opener (ESP32-C3 + Servo + Web Control)
A temperature-controlled automatic vent opener built around an ESP32-C3 SuperMini, designed for the Sunlu AMS heater enclosure.
It opens or closes the vent automatically based on temperature, while allowing full manual and web control.
All 3D-printed parts are attached using double-sided tape, making them easy to reposition or modify later.
I’ve used it like this for several weeks with no issues; the mount holds securely and allows easy maintenance or upgrades.
The temperature sensor is placed near the bottom, close to the Sunlu AMS unit, where it detects heat changes ensuring the vent operates reliably and only when needed.
this started as an exercise, there is a lot to improve, feel free to do so and share.
🔧 Features
- Automatic vent control:
- Opens above 30 °C
- Closes below 29 °C
- from the web interface you can adjust the limits any time
- Open/close vent manually with two 6 mm push buttons
- Web control page accessible from any phone or PC on the same Wi-Fi:
- Shows vent status and servo angle
- Buttons for open / close / calibration
- Adjustable temperature thresholds directly from the webpage
- Smooth, quiet servo motion (~1.5 s transition)
- LED always off (stealth operation)
- Position memory: once you declare the vent position (open or closed) for the first time, it is saved permanently in internal memory (NVS) — even after power loss or reboot.
- Temperature control always takes priority over manual actions.
⚙️ Required Hardware
| Component | Description |
|---|---|
| ESP32-C3 SuperMini | Main controller board |
| MG90 / MG90S servo | Drives the vent lid (5 V) |
| AHT10 temperature sensor | Measures ambient temperature |
| 2 × 6 mm push buttons | For manual open / close |
| Jumper wires & Dupont cables | To connect all components |
| 470–1000 µF capacitor | Optional; prevents servo power dips |
| 5 V power supply | Powers ESP + servo (share GND) |
| Basic soldering skills | Needed for clean, solid wire connections |
💡 All parts are low-cost and easy to find on AliExpress or Amazon.
🪛 Wiring Overview
AHT10 sensor:
- VCC → 3V3
- GND → GND
- SDA → GPIO 20
- SCL → GPIO 12
Servo (MG90S):
- Signal → GPIO 4
- V+ → 5 V
- GND → GND
Buttons:
- OPEN → GPIO 2 + GND
- CLOSE → GPIO 1 + GND
💡 If ESP reboots when the servo moves, add a 470–1000 µF capacitor between 5 V and GND near the servo. It wasn't my case.
💻 Software Setup
- Install Arduino IDE.
- In Boards Manager, install ESP32 by Espressif.
- Select board: ESP32 → ESP32C3 Dev Module.
- Install libraries:
- Adafruit AHTX0
- ESP32Servo
- Copy the project code (provided in this MakerWorld listing, in zip).
- unzip and update credentials.h with your wifi credentials
Verify these pin definitions:
#define PIN_SERVO 4
#define PIN_BTN_O 2
#define PIN_BTN_C 3
#define PIN_SDA 5
#define PIN_SCL 6
#define PIN_LED 8
- Upload the code via USB.
🚀 First Start & Calibration
- Power on the device.
→ LED blinks (state unknown). - Press once:
- OPEN → set current vent as open
- CLOSE → set current vent as closed
(no servo movement)
- Once position is set, LED turns off — state saved permanently.
- Now:
- Double-press OPEN → vent opens
- Double-press CLOSE → vent closes
🌐 Web Interface
After the device connects to Wi-Fi, open the browser and type its local IP (shown in serial monitor, e.g., http://ams_vent.local).
You’ll see the control page showing:
- Current vent status (Open / Closed)
- Current and target servo angles
- Current temperature and humidity
- Manual controls (single / double click actions)
- Adjustable temperature thresholds (open / close trigger points)
All changes save automatically to memory.
🔁 Operation Logic
Every 60 seconds:
- Temperature > 30 °C → opens vent (if not already open)
- Temperature < 29 °C → closes vent (if not already closed)
- Between 29–30 °C → no change
Manual double-press can still open/close, but automatic temperature logic always overrides to maintain correct state.
⚙️ Adjusting Temperature Thresholds
Inside the code:
static constexpr float T_OPEN_TRIG = 30.0f;
static constexpr float T_CLOSE_TRIG = 29.0f;
You can also adjust them live via the web interface sliders.
Keep at least 1–3 °C between open and close to prevent flickering.
⚡ Energy Use Estimation
| Mode | Avg. current | Energy/year |
|---|---|---|
| Normal (no Wi-Fi) | ~45 mA | ≈ 1.3 kWh |
| Wi-Fi active | ~90 mA | ≈ 2.6 kWh |
| Servo motion (1× per month) | negligible | – |
🧩 Example Parts (AliExpress) estimation
| Component | Example listing | Price |
|---|---|---|
| ESP32-C3 SuperMini | “NEW ESP32-C3 SuperMini V2 Plus Dev Board” | ≈ US $4.80 |
| MG90S servo | “MG90S 9 g Mini Servo” | ≈ US $2–3 |
| AHT10 sensor | “AHT10 Digital Temp & Humidity Module” | ≈ US $1.50–2.50 |
| 6 mm Push Buttons (×2) | “Tactile Push Button 6×6 mm” | ≈ US $1 (10 pcs) |
| Jumper wires & Dupont cables | Standard sets | ≈ US $1–2 |
Tags
Modellquelle
