Know where you are
Add wheel encoders and compare commanded movement with actual travel. Wheel slip and uneven ground still need testing.
A useful idea. A moving machine.
Program a garden rover, explore the systems inside it and follow a supervised hardware project with a complete starter sketch.
Program it. Run it. Improve it.
Guide the robot to the green plant. Add a sequence of forward moves and turns, then run it or test one instruction at a time. Rocks and the edge of the garden stop a forward move. This is a grid-based programming exercise, not a physical robot model.
🤖 Robot · 🪨 Obstacle · 🌿 Destination · highlighted squares show the route
Forward moves one square. Left and right turn 90° without moving. Run starts the sequence from the original position. One step continues from the current position. Reset keeps your instructions; Clear removes them.
Understand the machine
From the screen to the bench
This starter uses an Arduino Uno R3, an Adafruit Motor Shield V2 and a forward-facing HC-SR04 ultrasonic module. It is a supervised learning rover, with a hold-to-run button and simple stop-on-obstacle behaviour. The supplied hardware sketch has not been physically tested.
The Uno's control pins do not power the motors. Use the shield's motor-power terminals and follow the manufacturer's split-supply instructions, including removing its power jumper. A motor driver's electrical ratings and your motor's stall current determine compatibility.
| Part | Connection |
|---|---|
| Motor Shield V2 | Seat on Uno headers with all power disconnected. Uses I²C; Uno SDA/SCL correspond to A4/A5. |
| Left and right motors | Shield motor ports M1 and M2. Verify wheel direction with wheels raised. |
| Motor supply | Shield motor-power terminal, correct polarity, jumper removed for separate supplies. Do not feed motor power into the Uno 5 V pin. |
| HC-SR04 VCC / GND | Uno 5 V / GND. This example is for the 5 V Uno R3, not a 3.3 V ESP32. |
| HC-SR04 TRIG / ECHO | Uno D7 / D6. |
| Hold-to-run button | Uno D2 to GND through the momentary button. Sketch uses INPUT_PULLUP. |
| Controller power | Uno USB connector from a suitable USB supply; use a shared ground as provided through the shield. |
Motors are released on button release, missing/out-of-range distance readings or an obstacle at 25 cm or closer. This simple example intentionally stops rather than automatically turning into an unobserved area. The screen mission and physical rover are different learning tools.
Build responsibly. Then go further.
Add wheel encoders and compare commanded movement with actual travel. Wheel slip and uneven ground still need testing.
Log conditions along a defined greenhouse route. Shield sensors from motor heat and sunlight, and compare with stationary reference sensors.
Add bumper switches, physical guards, better power isolation and a tested stop design before adding speed or more autonomous behaviour.