Chapter 03: GreenHouse

Heat Management Pt.2 – Automatic Fan System FAILURE (Power draw too high! – Relays)

The Greenhouse Emergency

The emergency klaxon cuts through the morning stillness as you sprint toward Greenhouse Module 3. Red warning lights pulse through the reinforced glass walls, casting ominous shadows across the carefully tended seedlings inside. Your heart pounds as you reach the control panel, sweat beading on your forehead despite the cool morning air.

"Power draw critical," the system announces in its calm, infuriating voice. "Cooling system offline. Temperature rising." The display shows 78°F and climbing. Your precious plants, the ones keeping the colony's food supply alive, are cooking in their own protective shelter. The stepper motor fan you installed yesterday worked perfectly in testing, but now it's drawing too much power from the greenhouse's delicate electrical system.

You remember the engineering manual's warnings about power-hungry devices and electrical isolation. The stepper motor needs more current than your microcontroller can safely provide. The greenhouse's main power grid is separate from the control systems for good reason, but you need a way to bridge that gap. A relay. A simple electromagnetic switch that lets a small control signal command a much larger power circuit.

Time is running short. The temperature is now 80°F. Every minute of delay means more stress on the plants, more risk to the colony's survival. You grab your toolkit and the relay module, knowing this solution will either save the greenhouse or create an even bigger problem. Either way, there's no turning back now.

What You'll Learn

When you finish this lesson, you'll be able to solve high-power device control problems using relays. You'll understand why microcontrollers can't directly control power-hungry devices like motors, and how electromagnetic relays act as bridges between low-power control signals and high-power circuits.

You'll build an automatic temperature-controlled fan system that can handle the power demands of a stepper motor without overloading your HERO Board. Most importantly, you'll learn to recognize power draw issues before they damage your electronics, and implement solutions that keep both your microcontroller and your high-power devices operating safely.

Understanding Relays and Power Management

Think of a relay like a hotel doorman controlling access to an exclusive club. The doorman (your microcontroller) doesn't have the strength to physically move heavy equipment around inside the club, but they can decide when the club's industrial systems should activate. When you give the doorman a simple signal (a 5V digital output), they use that signal to operate a much more powerful system (240V motors, pumps, or heaters).

Stepper motors are notorious power hogs. While your HERO Board can comfortably provide 40 milliamps per pin, a stepper motor under load can demand 500 milliamps or more. Connect that directly to your microcontroller, and you're asking it to lift a weight far beyond its capacity. The result is voltage drops, erratic behavior, and potentially permanent damage to the control circuits.

A relay solves this through electromagnetic magic. Inside the relay housing sits a small coil of wire wrapped around an iron core. When you send current through this coil (using very little power from your microcontroller), it becomes an electromagnet strong enough to physically move a metal switch. That switch can then control a completely separate, high-power circuit fed from the main electrical supply.

The beauty lies in the isolation. Your microcontroller never touches the high-power circuit. It simply controls whether the relay switch is open or closed, like a remote control for industrial equipment. This keeps your delicate control electronics safe while giving you command over devices that could otherwise destroy your system.

Wiring

  1. DHT11 to HERO Board: Connect VCC to 5V (sensor needs stable power), GND to GND (complete the circuit), and DATA to Digital Pin 7 (our designated sensor pin)
  2. Stepper Motor to Relay: Connect the stepper motor's power wires through the relay's high-power contacts (usually marked COM and NO for Normally Open)
  3. Relay Coil Control: Connect the relay's control pins to HERO Board power (5V and GND) and the signal pin to Digital Pin 12 (this controls when the relay activates)
  4. Stepper Control Lines: Connect the four control wires from the stepper motor to Digital Pins 8, 9, 10, and 11 (these control rotation direction and steps)
  5. Power Supply: Use a separate power supply for the stepper motor circuit, connected through the relay contacts
Power Safety Warning