Motors, Displays and Power
Motors need drivers
Microcontroller pins provide only a few milliamps. Motors need far more current, and they create voltage spikes.
| Motor | Driver |
|---|---|
| Small servo | powered from a suitable supply; signal from a pin (Servo library) |
| DC motor | motor driver board (e.g. TB6612 or DRV8833) or a MOSFET with a flyback diode |
| Stepper motor | stepper driver (A4988, TMC2209) |
| Relay (switching other circuits) | relay module with driver and isolation |
Use a separate power supply for motors, sharing ground with the microcontroller.
Displays
- OLED (SSD1306, I²C): small, sharp text and graphics.
- LCD 16×2 with I²C backpack: simple text.
- TFT screens (SPI): colour interfaces.
- LED strips (WS2812/"NeoPixel"): addressable colour LEDs; need adequate 5 V power and a resistor on the data line.
Power
- USB power is fine for small projects.
- Batteries: choose by voltage and capacity; lithium batteries need proper charging and protection circuits.
- Deep sleep on ESP32 reduces power to microamps between readings, letting battery sensors run for months.
- Add decoupling capacitors near power-hungry parts if things reset randomly.
Exercise
Build a plant monitor: a soil-moisture sensor and an OLED display showing the moisture level, with a small pump or LED (through a MOSFET or driver and its own supply) triggered when the soil is dry.
Check yourself
- Why can't a motor be powered directly from a pin?
- Why must separate supplies share ground?
- How does deep sleep extend battery life?
Ваш прогресс сохраняется только в этом браузере.
Отправить на проверку (10 баллов)