Month 2 of 6
Microcontrollers, motors and sensors, and your first moving robot
Microcontrollers, motors and sensors, and your first moving robot
This is the month robotics stops being theory, and it is also the month where most of the fundamental skills of the whole field first appear in miniature
A line-following robot is a closed control loop with sensor input, actuator output and a tuning problem, which is exactly what a humanoid is, only smaller and cheaper to break
What to learn
1Arduino
Start on Arduino rather than ESP32, because the ecosystem is enormous and every tutorial in existence targets it
You will move to ESP32 within weeks, and nothing you learn here is wasted
Resources
Paul McWhorter, Arduino Lessons (free)
Over 100 lessons taught slowly with homework at the end of each one, and the single best fit for a true beginner who has failed at Arduino before
Arduino Built-in Examples (official, free)
Runnable sketches already inside your IDE, which is the fastest route from "installed" to "something moved"
Arduino Official Docs, Learn section (official, free)
The authoritative reference for digital and analog IO, PWM, I2C, SPI and UART, best used as lookup rather than as a course
Arduino Project Hub (free)
Over 6,000 projects with wiring and code, and this is where you go when tutorials end and you need something to build
What to focus on
Practice task
build a reaction-timer game. An LED fires after a random delay, a button stops the clock, and the time in milliseconds prints to serial. It uses interrupts, debouncing and non-blocking timing, and it has a score, which makes it demonstrable in fifteen seconds of video
2ESP32
The ESP32 is where you go the moment you want WiFi, Bluetooth, more processing power or two cores, and it is cheaper than an Arduino Uno
Buy an ESP32-S3 as your main board, which is the most capable current variant, and one classic ESP32 so that older tutorial code runs unmodified
Resources
Random Nerd Tutorials, Getting Started with ESP32 (free)
The highest-signal free tutorial library anywhere for this chip, with a specific fix for nearly every beginner failure mode, and a 250+ project index alongside it
ESP-IDF Programming Guide (Espressif official, free)
The only source of truth once you outgrow the Arduino layer, covering the real toolchain, menuconfig and the build system
Arduino ESP32 Core documentation (Espressif official, free)
Espressif's own docs for the Arduino layer, and the bridge that makes "Arduino versus ESP-IDF" a spectrum rather than a fork in the road
DroneBot Workshop ESP32 hub (free)
Long-form, wiring-diagram-heavy tutorials with written articles mirroring every video, covering ESP-NOW, OTA updates and low-power modes
Board prices, verified
- ESP32-S3-DevKitC-1, 8MB flash, $15.95 at Adafruit Link: www.adafruit.com/product/5312
- Classic ESP32 Dev Board, $15.00 at Adafruit Link: www.adafruit.com/product/3269
- Seeed XIAO ESP32-C3, $4.99, for when you need something tiny Link: www.seeedstudio.com/Seeed-XIAO-ESP32C3-p-5431.html
- Generic ESP32 clones on AliExpress run roughly $4 to $9, which is unverified but is the well-known street range
Decision framework
- Arduino framework for speed to a working robot, with the largest library ecosystem
- ESP-IDF when you need real control over tasks, cores, power and timing
- MicroPython for fast sensor experimentation, but not for a balancing loop, since garbage collection pauses will wreck your timing
Practice task
build something that could not exist on an Arduino Uno. Serve a web page from the ESP32 that shows live sensor readings and has buttons that drive a servo, then access it from your phone on the same network. This teaches WiFi, HTTP handling and asynchronous work at the same time
3Motors, drivers and actuation
This is where electronics stops being abstract, because motors draw real current and behave badly
Four types matter, and you should understand all four by the end of the month
Brushed DC gearmotor: cheap, needs an H-bridge, and has no position feedback unless you add an encoder. The default for a first rover
Hobby servo: an internal closed loop with roughly 180 degrees of travel and no feedback out
Smart serial bus servo: daisy-chained, with position, velocity and current feedback and a 12-bit magnetic encoder. This is what modern low-cost arms use
Stepper: open-loop absolute positioning with high holding torque
Resources
DroneBot Workshop, Controlling DC Motors with the L298N (free)
DC motor theory, PWM, H-bridge internals and three complete sketches, ending in a joystick-driven robot car
SparkFun TB6612FNG Hookup Guide (free)
Pinout, wiring and library for the driver you should actually use, with the reasoning for why
DroneBot Workshop, Stepper Motors with Arduino (free)
Unipolar versus bipolar, microstepping, NEMA sizing, and four demos across three different drivers
SimpleFOC documentation (open source, free)
The clearest free explanation of field-oriented control anywhere, and the affordable on-ramp to brushless motors when you get there
Hardware, verified prices
- Adafruit DRV8833 motor driver, $5.95, the cheapest good driver on the list Link: www.adafruit.com/product/3297
- SparkFun TB6612FNG breakout, $14.77, the correct default replacement for the L298N Link: www.sparkfun.com/sparkfun-motor-driver-dual-tb6612fng-1a.html
- Pololu gearmotor with encoder assembly, $19.95 each, with the encoder wiring already solved Link: www.pololu.com/product/3675
- Pololu A4988 stepper driver carrier, $8.95Link: www.pololu.com/product/1182
- FeeTech STS3215 smart servo, 12V, 30 kg·cm, $31.71 at RobotShop, which is the servo used in the open-source SO-101 arm Link: www.robotshop.com/products/feetech-12v-30kgcm-magnetic-encoding-servo-sts3215
What to memorize: the L298N is in every tutorial and you should not use it. It is an obsolete bipolar-transistor H-bridge that drops about 2V across its output stage, gets hot and wastes your battery. Learn it because the tutorials use it, then switch to the TB6612FNG or DRV8833
Practice task
drive one DC motor forward and backward at five different speeds using PWM, then add an encoder and write a function that turns the wheel exactly one full revolution regardless of battery voltage. The second half is your first real closed loop, and it is much harder than it sounds
4Sensors and reading the physical world
Resources
Adafruit BNO085 9-DoF IMU guide (free)
Covers an IMU that does sensor fusion on-chip and hands you a quaternion, which is the "buy your way out of the maths" option
Kalman and Bayesian Filters in Python, Roger Labbe (free, CC-BY)
Jupyter notebooks with runnable code and solved exercises covering g-h, discrete Bayes, KF, EKF, UKF and particle filters, and it is the best free filtering education that exists
MathWorks, Understanding Sensor Fusion and Tracking (free)
Six short parts from "what is sensor fusion" to fusing IMU and GPS for pose, and the right conceptual overview before you touch code
Sensor prices, verified
- HC-SR04 ultrasonic, $3.95, cheap obstacle detection with a wide cone and poor performance on soft surfaces
- VL53L0X time-of-flight laser, $14.95, a much narrower 35-degree cone and no double-imaging problems
- MPU-6050 6-DoF IMU, $12.95, the cheap classic where you do the fusion yourself, which is the point
- BNO085 9-DoF IMU, $29.50, fusion on-chip with a UART mode built for robotics
- Pololu magnetic encoder pair, $8.95, for adding odometry to motors that lack it
- RPLIDAR C1 360-degree lidar, $69.00 at DFRobot, newer and cheaper than the classic A1
Beginner tip: for a balancing robot, write a complementary filter before you write a Kalman filter. It is four lines, angle = a * (angle + gyro * dt) + (1 - a) * accelAngle with a around 0.98, and it works. Graduate to Kalman when you understand why the complementary filter fails
Practice task
mount an IMU on a board, print the pitch angle to serial, hold the board perfectly still and watch the number drift anyway. Now add a complementary filter and watch that drift disappear, which is the single most important lesson in state estimation and it took you twenty minutes
5Your first two robots
These two projects together teach more than any course will
Line-following robot. Quality build roughly $105, budget build roughly $38
Bill of materials, quality: ESP32-S3 $15.95, Pololu Romi chassis kit $39.95, TB6612FNG driver $14.77, QTR-8RC reflectance array $12.95, batteries and holder about $12, wiring and headers about $10
Budget version: generic ESP32 about $6, 2WD acrylic chassis about $12, DRV8833 $5.95, five TCRT5000 sensors about $3, batteries about $6, wiring about $5
Self-balancing robot. Quality build roughly $134, budget build roughly $62
Bill of materials, quality: ESP32 $15.95, two gearmotor-with-encoder assemblies $39.90, TB6612FNG $14.77, MPU-6050 $12.95, printed or laser-cut chassis about $10, LiPo and charger and wheels about $30, misc about $10
Practice task
Practice task for the month: build the line follower first, tune it with a P controller, then add the D term and watch the oscillation disappear, filming both versions. The video of a badly tuned robot next to the same robot tuned properly is one of the most persuasive things a beginner can put in a portfolio, because it proves you understand the loop rather than having copied a gain
Then build the balancer, which will not work at all until your filter and your loop timing are both correct, and that frustration is the point
Month 2 Milestone
By the end of this month you should be able to:
Check yourself
2–3 hours a day is the design load.