
Every robot is really three things: a sensor that notices something, a brain that decides what to do, and an actuator that does it. A smart home is the same robot, just spread across your house and much less likely to fall off the workbench. If you have a drawer of leftover RC servos and an inexpensive ESP32 board, you already own most of a home automation system.
Below are five projects I'd give a student or a parent-and-kid team as a first smart-home build. They all use the ESP32 with ESPHome (you write a short YAML file instead of C++) and report into Home Assistant over your local network. Two use servos to move things, three are sensors, and every one teaches a real engineering idea: torque, debouncing, I²C, or analog calibration. Specs and settings below come from the ESPHome and Espressif documentation as of June 2026.
The Short Answer
The best first home automation projects with hobby parts are a servo light-switch flipper, a servo pet-feeder gate, a BME280 climate sensor, a reed-switch door or mailbox sensor, and a capacitive soil-moisture monitor, all built on an ESP32 running ESPHome and controlled from Home Assistant.
- Why ESPHome: devices talk to Home Assistant directly over its native API, locally, and are usually auto-discovered.
-
Servos: drive them from an ESP32
ledcoutput at 50 Hz and power them from 5 V, not from the 3.3 V pin. - Sensors: use internal pull-ups and a debounce filter for switches, and ADC1 pins for analog sensors, because ADC2 is shared with Wi-Fi.
- Safety: none of these projects touches mains wiring. Servos push existing switches; they don't replace them.
1. The Shared Toolkit: ESP32, ESPHome and Home Assistant
All five builds share the same brain and software, so learn this part once. The Home Assistant ESPHome integration connects to each device over the native ESPHome API and keeps a persistent connection, so state changes are pushed to Home Assistant rather than polled. Home Assistant can auto-discover ESPHome devices on your network; if it doesn't, you add one by IP address on port 6053.
Pick your pins carefully
Not every ESP32 pin is fair game. Espressif's GPIO reference says GPIO34-39 are input-only with no internal pull-ups, GPIO6-11 (and 16-17 on boards with PSRAM) are usually wired to the module's flash and should not be used, and GPIO0, 2, 5, 12 and 15 are strapping pins that affect how the chip boots. For a servo signal, pick a pin outside all of those groups; GPIO18, 19 or 23 avoid every restriction on that list.
How a servo reads ESPHome's numbers
A hobby servo expects a pulse about every 20 ms (50 Hz). The ESPHome servo component maps -100% to a 3% duty cycle, 0% to 7.5% and +100% to 12% by default. At 50 Hz that is roughly 0.6 ms, 1.5 ms and 2.4 ms pulses. If your servo buzzes against its end stops, narrow min_level and max_level a little. ESPHome also lets you set transition_length to slow the motion and auto_detach_time to stop driving the servo once it arrives, which saves power and stops idle buzzing.
Power the servo from 5 V, share the ground
The ESP32 runs on 3.3 V, and a servo motor can pull far more current than a dev board's regulator is happy to supply. Feed the servo's red wire from a 5 V source (a USB charger and a breakout works for one micro servo), connect its brown or black wire to the same ground as the ESP32, and run only the signal wire to a GPIO. A Hitec HS-65HB, for example, is rated for 4.8-6 V, so 5 V sits comfortably in range.
| Project | Main parts | ESPHome piece | Difficulty |
|---|---|---|---|
| 1. Servo light-switch flipper | ESP32, micro servo, 3D-printed or foam-board bracket |
servo + template number or button
|
Easy |
| 2. Pet-feeder or treat gate | ESP32, metal-gear micro servo, hopper with a flap |
servo + Home Assistant schedule |
Easy to medium |
| 3. Room climate sensor | ESP32, BME280 breakout (I²C) | bme280_i2c |
Easy |
| 4. Door, window or mailbox sensor | ESP32, magnetic reed switch | binary_sensor: gpio |
Easiest |
| 5. Plant soil-moisture monitor | ESP32, capacitive soil sensor |
adc sensor on an ADC1 pin |
Medium (calibration) |
2. Projects 1 and 2: Make Something Move with a Servo
These two are the robotics half of the list. You are converting a Home Assistant button press, schedule or automation into a measured mechanical motion, and you will learn more about torque and lever arms in an afternoon than from a chapter of a textbook.
Project 1: The servo light-switch flipper
This is the classic renter-friendly build: a servo mounted beside a wall switch on a bracket held by removable adhesive strips, with the horn arm pressing the toggle up or down. No electrical work, no landlord conversation. Here is the core ESPHome config, based on the ESPHome servo docs:
output:
- platform: ledc
id: servo_pwm
pin: GPIO18
frequency: 50Hz
servo:
- id: switch_servo
output: servo_pwm
auto_detach_time: 2s
transition_length: 0.5s
number:
- platform: template
name: "Switch Servo"
min_value: -100
max_value: 100
step: 1
optimistic: true
set_action:
- servo.write:
id: switch_servo
level: !lambda 'return x / 100.0;'
Home Assistant has no native servo entity, which is why a template number is used; it shows up as a slider from -100 to 100. Once you have found the two positions that flip the switch, replace the slider with two template buttons that each call servo.write with a fixed level, then add a third step that returns the arm to center so you can still use the switch by hand.
Getting enough push
Torque is force times distance, so a shorter arm pushes harder. If the servo stalls against a stiff toggle, move the pushrod or contact point closer to the output shaft before buying a bigger servo. An adjustable arm makes this easy to tune. Keep the bracket rigid: if the bracket flexes, the servo is just bending plastic instead of flipping the switch.
Project 2: The pet-feeder or treat gate
Mount a metal-gear micro servo under a hopper (a cereal dispenser or a printed funnel) so its arm swings a flap open for a set time, then closes. In ESPHome, write a script that moves the servo to open, waits, and moves it back; in Home Assistant, call that script from a time-based automation. Start with short open times and weigh a few portions on a kitchen scale to calibrate. Metal gears matter here because kibble jams put shock loads on the gear train. Keep a manual backup feeding plan: this is a fun project, not a replacement for checking on your pet.
Build it in this order
- Flash ESPHome to the bare ESP32 and confirm Home Assistant discovers it.
- Wire the servo (5 V, shared ground, signal to GPIO18) and test with the slider, arm removed.
- Find the end positions with the arm attached but the bracket loose.
- Mount the bracket, then tighten
min_levelandmax_levelso the servo never strains at its limits. - Add
auto_detach_timeand build the button or schedule automation last.

3. Projects 3, 4 and 5: Give the House Senses
The sensor projects are where Home Assistant automations become useful: once the house knows the temperature, whether a door is open or whether a plant is thirsty, you can tie that to a fan, a notification or one of the servo builds above.
Project 3: A BME280 room climate sensor
A BME280 breakout reports temperature, humidity and barometric pressure over I²C, using just two data wires (SDA and SCL) plus power. The ESPHome BME280 component defaults to I²C address 0x77 (set address: 0x76 if your board uses that one) and updates every 60 seconds. The docs also note that in I²C mode the chip's CSB pin should be pulled high to 3 V, or you'll see a communication error. Mount the sensor away from the ESP32 itself, since the board's own warmth can nudge the temperature reading up. A first automation: turn on a bathroom fan when humidity climbs after a shower.
Project 4: A door, window or mailbox sensor
A magnetic reed switch is just two contacts that close when a magnet is near. Wire one side to a GPIO and the other to ground, then use the ESPHome GPIO binary sensor with pullup: true and inverted: true in the pin settings so the input doesn't float. Add a delayed_on: 10ms filter to debounce the contacts, and set device_class: window or door so Home Assistant shows the right icon. On a mailbox, the lid is the moving part: tape the magnet to the lid and the switch to the box, and have Home Assistant ping your phone when the mail arrives.
Project 5: A soil-moisture monitor
Capacitive soil sensors output an analog voltage, so this is your introduction to the ESP32's ADC. Use an ADC1 pin (GPIO32-39 on the original ESP32), because Espressif's ADC documentation notes that ADC2 is also used by Wi-Fi. The ESPHome ADC sensor offers several attenuation settings; with attenuation: auto, ESPHome's own tests found a usable range of about 0.075 V to 3.12 V. Calibrate by logging the reading in dry air and in a glass of water, then use a calibrate_linear filter to map those two values to 0% and 100%.
Tie it together
The real lesson is the loop: sense, decide, act. Once Project 5 reports a dry pot, a Home Assistant automation can send a notification, and a more ambitious student can use a servo to tip a small watering cup. That is a complete robot, built from parts you can hold in one hand.

Conclusion
Start with Project 4: a reed switch is the cheapest, most forgiving way to get ESPHome and Home Assistant talking. Then add the climate sensor, and save the servos for once you are comfortable with pins and power. By the end you will have handled PWM timing, pull-up resistors, I²C addressing, ADC calibration and lever-arm torque, which is a fair chunk of an intro robotics course hidden inside some useful gadgets.
Need a servo that fits your bracket, an adjustable arm or a soldering iron for header pins? Browse our servo collection, or contact the shop and bring your build to our Cumming showroom. We are always happy to look at a wiring diagram.
Gear Mentioned in This Guide

Hitec HS-81 Micro Analog Servo
A small, light servo for switch flippers, latches and pet-feeder flaps.
Shop now
Hitec HS-65HB Sub-Micro Servo
About 25 oz-in at 4.8 V from an 11 g package, and it runs happily on a 5 V USB supply.
Shop now
Hitec HS-5065MG Sub-Micro Digital Metal Gear Servo
Metal gears for a mechanism that gets pushed on, like a feeder gate or a stiff switch.
Shop now
Du-Bro Micro Adjustable Servo Arm
Lets you fine-tune throw length so the arm presses a switch without stalling.
Shop now
Trinity TK950 Digital Soldering Station
Temperature-controlled iron for header pins, sensor leads and servo extensions.
Shop nowFrequently Asked Questions
Can an ESP32 power a servo directly?
Not reliably. The ESP32 runs on 3.3 V and its board regulator is not built for motor current. Power the servo from a 5 V supply, connect its ground to the ESP32's ground, and run only the signal wire to a GPIO pin.
Why doesn't my servo show up in Home Assistant?
Home Assistant has no native servo entity. In ESPHome you expose the servo through a template number (a slider) or template buttons whose actions call servo.write.
Do I need to know how to code to use ESPHome?
No. ESPHome configurations are YAML files that list your components, pins and names. You will copy and edit short examples from the ESPHome documentation. Small lambdas, like the one that scales the slider value for the servo, are optional extras.
Which ESP32 pins should I avoid?
Avoid GPIO6-11 (connected to the flash chip on most modules), be careful with the strapping pins GPIO0, 2, 5, 12 and 15, and remember GPIO34-39 are input-only. For analog sensors, use ADC1 pins because ADC2 is shared with Wi-Fi.
Is a servo light-switch pusher safe?
Yes, because it only presses the existing switch from outside. You never open the wall box or touch mains wiring. Use removable mounting tape so it comes off cleanly, and make sure the switch can still be operated by hand.
Will these projects work without the internet?
Yes. ESPHome devices talk to Home Assistant over your local network using the native API, so the sensors and servos keep working if your internet connection drops, as long as your Home Assistant server and Wi-Fi are up.
