Mission
Build this
Build a temperature node that switches one supervised 5 V USB fan through an approved low-voltage driver and publishes its measured temperature and fan state. Mains power is prohibited.
Borrowed parts are labelled below and have a fallback. The registered device ID is fixed; sensing and behaviour decisions remain yours.
Switch supervised 5 V USB loads through an approved driver. Mains power is prohibited.
Bill of materials
Parts
| Source | Part | Fallback |
|---|---|---|
| ● kit | Thermistor and 10 kΩ resistor | — |
| ○ fablab | Approved MOSFET or load-switch module | Use an LED as the switched load |
| ○ fablab | 5 V USB fan and supervised USB supply | Use only the LED fallback without an approved driver |
Disconnect USB before rewiring. Motors, the relay, and the servo need appropriate power and a shared ground. Never drive an actuator from the ESP32 3V3 pin.
Backup assignment · your invitation
Turn a temperature rule into one calm, supervised breeze
A fan is easy to switch on. A trustworthy controller is harder. It waits for believable warmth, avoids frantic on-off cycling, notices broken sensing, and returns to a safe state when evidence disappears.
You will prove every decision first with an LED. Only after the sensing, state machine, manual stop, wiring, and fault behaviour have been reviewed may the same low-voltage signal control one approved 5 V USB fan through a supplied driver module.
Low-voltage USB equipment only. No mains wiring, opened power supplies, improvised fan cables, bare battery cells, pumps, heaters, or unattended high-power loads.
Meet the idea
A controller combines a witness, a rule, and an actuator
The thermistor is the witness. Its divider voltage changes with the sensor bead’s temperature. A calibration or documented conversion turns that voltage into degrees Celsius.
The state machine is the rule. It decides when enough warm evidence exists to request fan-on and when enough cooler evidence allows fan-off.
The MOSFET module is the electrically approved muscle. GPIO 25 supplies only a tiny control signal; the separate 5 V source supplies the fan current. The ESP32 pin must never power the fan directly.
Hysteresis
Use a higher temperature to turn on and a lower one to turn off, leaving a quiet band between them.
Minimum time
Once switched, remain on or off long enough to prevent wear and rapid cycling.
Fail-safe
A missing, impossible, or stale temperature commands fan-off and a visible error unless staff approve another safe rule.
- in the worldLocal temperatureAir, sun, electronics, and airflow warm or cool the thermistor bead.
- the partThermistor dividerTemperature changes a safe 0–3.3 V analog signal.
- in the codeTrusted temperature + timersCode validates evidence and applies thresholds and minimum times.
- electricalDriver commandOne GPIO tells the approved module on or off.
- on the spinetemperature + statusThe garden sees both the witness and fan state.
Safety decisions happen before the driver command. The fan supply never passes through an ESP32 GPIO.
The lovely trick
Two thresholds make a calm machine
With one boundary at 26 °C, readings of 25.9, 26.1, and 25.9 can switch the fan three times. The controller is obeying each number while ignoring the physical system.
Instead, it might enter fan-on only after temperature remains above a team-chosen upper boundary, then remain on until temperature stays below a lower boundary. Minimum on and off times add another defence against quick cycling.
These numbers are design choices, not universal plant truths. Choose safe demonstration thresholds with staff, document them, and test them using replayed values before live actuation.
- 01Fan offTemperature is valid; minimum off timer runs.then, warm + eligible,
- 02Warm candidateUpper boundary is crossed, but persistence and timing are checked.then, evidence persists,
- 03Fan onApproved driver is active; minimum on timer runs.then, cool + eligible,
- 04Cool candidateLower boundary is crossed and must persist before switch-off.
Back to the start: Return to fan-off after cool confirmation. Any sensor fault, stale local sample, or manual stop also forces fan-off.
Manual stop and invalid sensing can leave any active state immediately. Recovery must begin in fan-off.
Airflow can cool the thermistor faster than the surrounding greenhouse and motor power can warm nearby electronics. Place the sensor outside the direct fan jet, then compare fixed fan-off and fan-on intervals before claiming the air itself cooled.
Wiring
Earn the fan by proving the complete logic with an LED
Begin with the thermistor and Serial Monitor. Replay boundary values in code, disconnect the sensor, and use an LED plus resistor on the command pin. Lab staff must review the final driver, fan, supply, enclosure, and stop behaviour before the fan is connected.
The power rule: The thermistor divider uses 3V3. GPIO 25 drives only the approved module input. The fan receives 5 V from the supervised external USB supply through that module. Join grounds exactly as its verified diagram shows.
Bench referenceOpen the exact wiring map
| ESP32 pin | Part | Part marking | Carries |
|---|---|---|---|
3V3 | Thermistor | one leg | 3V3 power |
GPIO 34 | Thermistor | other leg | Analog voltage — temperature-divider junction |
GPIO 34 | 10 kΩ resistor | one leg | Analog voltage — same divider junction |
GND | 10 kΩ resistor | other leg | Ground |
GPIO 25 | Approved MOSFET module | IN / SIG | Digital in/out — fan command; verify active level with the LED fallback first |
GND | Approved MOSFET module | logic GND | Ground — join logic and 5 V supply grounds |
supervised external 5 V | Approved MOSFET module | power input + | 5V power — module labels differ; follow its supplied diagram |
switched external 5 V | 5 V USB fan | power through module output | 5V power — use only the approved fan and driver |
external supply GND | 5 V USB fan | return through module | Ground |
Mains power is prohibited. Do not cut or open an unknown power supply, connect a fan to an ESP32 pin, omit required driver protection, or run the fan before staff approval. Use the LED fallback whenever approved hardware is unavailable.
- 3V3 power
- Analog voltage
- Ground
- Digital in/out
- 5V power
Approved driver modules use different terminal names and may include their own protection. Treat this as a functional map; the supplied module’s reviewed diagram is authoritative for its exact power and output terminals.
Give it character
What should a safe breeze know how to say?
The device needs more than on and off. A nearby person should be able to distinguish waiting for warmth, actively running, minimum-time hold, sensor fault, stale shared context, and manual stop.
Your team decides:
- Which supervised upper and lower thresholds create a useful quiet band?
- How long must evidence persist, and what minimum on and off times protect the system?
- Where will the thermistor sit so the fan does not immediately cool its own witness?
- How does the manual stop work, and what visible state proves the output is disabled?
Write these decisions in plain language before turning them into code. A clear rule is easier to test, explain, and change.
Your field adventure
Can the controller remain stable and measure its own influence?
Separate the logic test from the airflow test. First prove exact state transitions with an LED and replayed temperatures. Then connect the reviewed fan and compare controlled intervals.
- Prove every transition with an LED.
Replay values below, on, and above both thresholds. Include noise, minimum-time holds, restart, manual stop, and sensor disconnection.
- Review the low-voltage build.
With staff, verify the approved module, 5 V fan, supply current, common ground, protected terminals, and default-off startup.
- Record real threshold crossings.
Under supervision, warm and cool the sensor gradually. Record entry, exit, persistence, and cycle duration.
- Test feedback.
Alternate equal fan-off and fan-on intervals with fixed sensor placement. Compare temperature response inside and outside the direct airflow.
| Trial / interval | Temperature path | Expected state | Observed state | Switch delay | Cycle / placement note |
|---|---|---|---|---|---|
| replayed warm boundary | ___ → ___ °C | fan-on | ___ | ___ s | LED only |
| sensor disconnected | invalid | fan-off + error | ___ | ___ s | ___ |
| supervised fan-on interval | ___ → ___ °C | fan-on | ___ | ___ s | sensor ___ cm from jet |
When it gets dramatic
An unstable fan is a clue, not a reason to remove safeguards
The fan chatters near the boundary
Increase separation between on and off thresholds, require persistent evidence, and verify that minimum state times are measured without blocking the loop.
The fan starts during boot
The driver input is floating or active-low. Add the verified default-off arrangement and prove startup with an LED before reconnecting the fan.
The board restarts when the fan starts
Fan current or electrical noise is disturbing the ESP32 supply. Stop testing, review the separate 5 V path, grounds, module rating, wiring, and protection with staff.
Temperature drops immediately when the fan starts
The sensor may be sitting in the jet. Move it to measure the intended air volume and repeat equal intervals.
Romeo disappears but the fan keeps using its old value
Shared data is context only and needs a freshness limit. Local valid temperature remains the sole control witness unless a separately reviewed design says otherwise.
Choose your direction
What kind of control team will you become?
The state-machine guardians
Make every threshold, timer, restart, stop, fault, and recovery transition visible and testable.
The feedback detectives
Focus on how airflow and electronics change the sensor, then improve placement without overstating room cooling.
The interface stewards
Design a local status and stop control that another person can understand and verify immediately.
Each direction is real engineering. Pick the question that keeps your team curious.
A calm way through the build
Collect four small wins
- fc-01 says hello with no load attached.
Begin in a published fan-off or error state.
- The thermistor conversion survives warm, cool, and disconnected tests.
Keep the output as an LED.
- Replayed values visit every state without chatter.
Freeze thresholds, persistence, minimum times, and manual stop.
- The approved fan follows the already-proven signal.
Connect it only after staff review, then run the supervised feedback experiment.
When a new step fails, return to the last small win. The fault is now somewhere in the few wires or lines you just added.
The garden handshake
Share what you found
These names are the rigid part of the project. They let another team find your work without knowing what you called the variables in your code.
Local controller temperature
garden/greenhouse-1/vent-node/fc-01/temperatureUnit: celsius
Controller and fan state
garden/greenhouse-1/vent-node/fc-01/statusUnit: enum
Listen beyond your own device.
garden/greenhouse-2/climate-node/ro-01/temperatureRomeo offers comparison context only. The fan must remain safe when Romeo is stale or absent, and a remote message must never bypass local validation, timing, or manual stop.
Finish line
Ready to introduce to the garden
fc-01 stays online and publishes valid local temperature plus documented fan-off, fan-on, and error states.
The reject feed stays clear after the final code starts.
The device reads Romeo with a freshness limit but remains safe and useful without it.
The controller uses separate sustained thresholds, minimum state times, default-off startup, sensor-fault shutdown, and manual stop without blocking messages.
The build log contains LED replay trials, reviewed wiring, real crossings, cycle timing, fixed fan-off/on intervals, sensor placement, and feedback limits.
Only the approved 5 V USB fan, driver, and supervised supply are used; terminals and moving blades are guarded and the label can be scanned.
The Fan Club is finished when the breeze is the least surprising part: every decision is calm, visible, reversible, and supported by evidence.