Electronics & Circuits · Study deck

Electronics: Controller Design and Review

A fan controller joins sensing, code, drive current, and a safe stop.

Voltage Vera is your guide for this deck.

Voltage Vera, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Explain: The caption's 10 mV per degree Celsius links that output to the ADC calculation, while pin identification and thermal placement warn that the transistor-like package is not self-explanatory.
  • Explain: Its purpose is to reveal the LM35 in this fan controller is a three-lead analog sensor: supply, ground, and a voltage output that changes by 10 mV per degree Celsius.
  • Explain: Your Challenge: Design a circuit that automatically turns on a 12V DC fan (300mA) when temperature exceeds 30°C, using an ESP32 and LM35 temperature sensor.
  • Explain: Diode Choice: 1N5819 Schottky is better.
iotclass.org

Major section

Smart Fan Controller Design

Your Challenge: Design a circuit that automatically turns on a 12V DC fan (300mA) when temperature exceeds 30°C, using an ESP32 and LM35 temperature sensor.

  • Its purpose is to reveal the LM35 in this fan controller is a three-lead analog sensor: supply, ground, and a voltage output that changes by 10 mV per degree Celsius.

Numbers to remember

10 mVand a voltage output that changes by 10 mV per degree Celsius.
1.5VHint: LM35 max output is 1.5V @ 150°C.
150°CHint: LM35 max output is 1.5V @ 150°C.
The LM35 in this fan controller is a three-lead analog sensor: supply, ground, and a voltage output that changes by 10 mV per degree Celsius. Its transistor-like package makes pin identification and thermal placement part of the circuit design, not details the ESP32 code can repair later. Photo: Nevit Dilmen, CC BY-SA 3.0
The LM35 in this fan controller is a three-lead analog sensor: supply, ground, and a voltage output that changes by 10 mV per degree Celsius. Its transistor-like package makes pin identification and thermal placement part of the circuit design, not details the ESP32 code can repair later. Photo: Nevit Dilmen, CC BY-SA 3.0
iotclass.org

Major section

Smart Fan Controller Design (continued)

The component list below is the evidence set for those linked decisions, not a menu of interchangeable parts.

  • Photo: Nevit Dilmen, CC BY-SA 3.0 before a design claim is accepted.
  • Hint: LM35 max output is 1.5V @ 150°C.
  • Step 1 Solution: Sensor Interface: LM35 can connect directly to ESP32 ADC.
iotclass.org

Major section

Smart Fan Controller Design (continued)

The caption's 10 mV per degree Celsius links that output to the ADC calculation, while pin identification and thermal placement warn that the transistor-like package is not self-explanatory.

  • You can test your solution on real ESP32 hardware or in the Wokwi online simulator (search for "ESP32 + LM35" templates).
  • Max output (1.5V @ 150°C) is within ADC range (3.3V).
  • Diode Choice: 1N5819 Schottky is better.
iotclass.org

Major section

Phoebe's Field Notes: Why the Fan Circuit Needs the Math

The mathematical gist.: A GPIO is a command, not a motor supply.

  • For this chapter's 300 mA fan, a 12 mA pin would be overloaded by 25.0 times.

Numbers to remember

12 mAa 12 mA pin would be overloaded by 25.0 times.
iotclass.org

Major section

For Kids: Meet the Sensor Squad!

"Welcome to Electronics School!" announced the microcontroller. "Today I'm going to teach you how I was born -- from tiny pieces of silicon!".

  • Scientists figured out how to add tiny bits of other materials to make it conduct electricity in clever ways.
  • Electricity is just power flowing, but electronics is SMART power -- it can think and decide!
  • Different jobs need different transistors, just like different sports need different shoes!".
iotclass.org

Major section

BJT vs MOSFET Resistors

The Error: A developer uses a 10k ohm resistor from GPIO to the base/gate for both a BJT and a MOSFET.

  • The BJT circuit barely turns on, while the MOSFET works perfectly.
  • MOSFETs are voltage-controlled -- with essentially zero DC gate current, the gate resistor does not set steady-state gate voltage.
  • The MOSFET is suitable only if its datasheet gives low Rds(on) at the available GPIO voltage.

Numbers to remember

26mAwhich can only switch Ic = 26mA (with beta=100).
~1kFix: For BJTs, use a ~1k ohm base resistor (provides ~2.6mA
iotclass.org

Deck summary

Key takeaways

Your Challenge: Design a circuit that automatically turns on a 12V DC fan (300mA) when temperature exceeds 30°C, using an ESP32 and LM35 temperature sensor.

  • The component list below is the evidence set for those linked decisions, not a menu of interchangeable parts.
  • The caption's 10 mV per degree Celsius links that output to the ADC calculation, while pin identification and thermal placement warn that the transistor-like package is not self-explanatory.
  • The mathematical gist.: A GPIO is a command, not a motor supply.
iotclass.org

Retrieval practice

Recall check 1 of 4

Voltage Vera says: answer from memory, then check your reasoning.

Q1You need to switch a 12V, 1.5A motor from an ESP32 GPIO (3.3V output, max 12mA). Which component is MOST appropriate?

ANPN BJT (2N2222) with 1kΩ base resistor - the standard transistor choice
BPNP BJT (2N3906) with emitter to +12V - better for high-side switching
CLogic-level N-channel MOSFET (IRLZ44N) with flyback diode - lowest power loss and GPIO load
DRelay module with 3.3V coil - electrically isolates ESP32 from motor
Show answer

Answer: C

iotclass.org

Retrieval practice

Recall check 2 of 4

Voltage Vera says: answer from memory, then check your reasoning.

Q2An ESP32 GPIO pin outputs 3.3V and can source a maximum of 12 mA. A designer connects it directly to a 12V relay coil that requires 80 mA. What will happen, and what is the correct interface approach?

AA logic-level buffer powered at 3.3V would provide enough drive for the relay.
BThe GPIO pin will be damaged or the microcontroller will reset.
CThe relay will work but at reduced holding force due to the lower voltage
DAdding a resistor in series will limit the current to a safe level while still activating the relay
Show answer

Answer: B

iotclass.org

Retrieval practice

Recall check 3 of 4

Voltage Vera says: answer from memory, then check your reasoning.

Q3A voltage divider made from two equal 10k ohm resistors divides a 3.3V signal to 1.65V for an ADC input. When the sensor (output impedance: 1k ohm) is connected, the voltage reads 1.50V instead of 1.65V. What caused the discrepancy?

AThe resistors have a 10% tolerance, so 1.50V is within expected range
BThe ADC input draws current that loads the divider and changes the output voltage
CThe sensor's 1k ohm output impedance adds in series with the upper 10k resistor.
DTemperature drift of the resistor values changed the divider ratio
Show answer

Answer: C When a source with output impedance is connected to a voltage divider, the source impedance adds in series with the upper resistor.

iotclass.org

Retrieval practice

Recall check 4 of 4

Voltage Vera says: answer from memory, then check your reasoning.

Q4Place each electronics idea where it lives so you can trace how material physics becomes a safe microcontroller-controlled load path.

ASemiconductor material
BDiode behavior
CTransistor driver
DDatasheet check
Show answer

Answer: A Trace material physics through component behavior to a rated load path so you can distinguish what a part does from the evidence that it will operate safely.

Q5Complete the GPIO-to-load safety helper for an electronics overview:

Aneeds_driver = load_current_ma > 12
Bneeds_driver = load_current_ma < 12
Cneeds_driver = is_inductive == False
Dneeds_driver = load_current_ma + 12
Show answer

Answer: A A GPIO pin is a signal source, not a power supply.

iotclass.org

Print reference

Answers

Answer key.

  1. C
  2. B
  3. C · When a source with output impedance is connected to a voltage divider, the source impedance adds in series with the upper resistor.
  4. A · Trace material physics through component behavior to a rated load path so you can distinguish what a part does from the evidence that it will operate safely.
  5. A · A GPIO pin is a signal source, not a power supply.
iotclass.org