KINEMATICS, CONTROL LAWS & ARCHITECTURE
Governing acoustic time-of-flight equations, H-Bridge switching truth tables, differential drive kinematics, SG90 PWM closed-loop feedback, and hardware design tradeoffs.
ULTRASONIC TIME-OF-FLIGHT ACOUSTIC RANGING (HC-SR04)
Arduino sets Pin D10 HIGH for 10 µs, triggering an 8-cycle 40 kHz burst. Pin D11 stays HIGH for the round-trip duration t_µs. Because the acoustic wave traverses 2d (to the obstacle and back), dividing by 58 converts microseconds directly into one-way centimeters.
DUAL H-BRIDGE DIAGONAL SWITCHING & BJT VOLTAGE DROP (L298N)
Four power switches (S1–S4) surround the DC motor crossbar. Closing diagonal pair S1+S4 drives current left-to-right (Forward); closing S3+S2 reverses polarity (Reverse); closing both top or bottom switches dynamically brakes the rotor.
1:48 GEAR REDUCTION & DIFFERENTIAL DRIVE KINEMATICS
The 1:48 spur gearbox steps down raw motor RPM (>6000 RPM) to ~140 RPM while multiplying shaft torque. Setting v_L = -v_R (left forward, right reverse) yields linear velocity v = 0 and pure angular spin ω around the chassis center.
CLOSED-LOOP SERVO POTENTIOMETER FEEDBACK & 50HZ PWM (SG90)
An internal potentiometer measures actual horn angle θ_actual and compares it against the target pulse width on Pin D9: 1.0 ms = 0°, 1.17 ms = 30° (Gripper Closed), 1.5 ms = 90° (Gripper Open), 2.0 ms = 180°.
5-STATE DETERMINISTIC FINITE AUTOMATON (DFA) CONTROL LOOP
With a single ultrasonic transducer, object-vs-obstacle classification is resolved deterministically by state phase: detections in SEARCH are approached and gripped at d ≤ 5 cm, whereas detections in CARRY trigger obstacle avoidance at d ≤ 20 cm.
| ENA | IN1 | IN2 | ACTIVE SWITCHES | MOTOR RESPONSE |
|---|---|---|---|---|
| HIGH | 1 | 0 | S1 + S4 Closed | Forward (Full Speed) |
| HIGH | 0 | 1 | S3 + S2 Closed | Reverse (Full Speed) |
| HIGH | 0 | 0 | All Open | Stop (Free Coast) |
| HIGH | 1 | 1 | Low-Side Short | Dynamic Active Brake |
| PWM (0–255) | 1 | 0 | S1 + S4 Duty | Forward (Speed Modulated) |
| CHASSIS MANEUVER | LEFT MOTOR (A) | RIGHT MOTOR (B) | USE IN KINETIX FSM |
|---|---|---|---|
| Drive Straight Forward | Forward (IN1=1, IN2=0) | Forward (IN3=1, IN4=0) | SEARCH & CARRY Cruise |
| Turn Left Arc | Stop / Slow PWM | Forward | Heading Alignment |
| Turn Right Arc | Forward | Stop / Slow PWM | Heading Alignment |
| Spin in Place (Zero Radius) | Forward (IN1=1, IN2=0) | Reverse (IN3=0, IN4=1) | d ≤ 20 cm Obstacle Bypass |
| Reverse Clearance | Reverse (IN1=0, IN2=1) | Reverse (IN3=0, IN4=1) | Step 11 Post-Place Backup |
Narrow 15° Single-Sensor Cone
HC-SR04 only samples a 15° acoustic cone straight ahead; thin chair legs or off-axis obstacles outside the cone can clip the wheels.
Replaces single-ray ranging with continuous 360° laser scans, building a real-time Simultaneous Localization and Mapping (SLAM) costmap.
Soft / Angled Surface Acoustic Loss
Foam/cloth absorbs 40 kHz ultrasound and walls angled >45° deflect the echo away from the receiver, causing false 400 cm clear readings.
Adds visual bounding-box classification on a Raspberry Pi / Jetson companion board so obstacles and payloads are recognized optically.
Phase-Only Object vs. Obstacle Distinction
Ultrasonic time-of-flight measures distance only, relying on SEARCH vs. CARRY state phase to tell the target cylinder from an obstacle.
Distinguishes target cylinders, warehouse crates, and color-coded drop zones simultaneously for multi-object sorting.
Open-Loop Target Finding & Wheel Slip
Target arrival relies on travel time/distance estimation; smooth floors or battery sag cause dead-reckoning drift.
Optical/magnetic shaft encoders fuse wheel ticks with IMU/LiDAR odometry to guarantee millimeter-accurate target docking.
Why isolate the DC motors behind an L298N Dual H-Bridge instead of driving them from Arduino GPIO pins?
Three hardware constraints: (1) Current limit: an ATmega328P I/O pin sources at most ~20 mA, whereas a 1:48 geared DC motor draws 150–500 mA continuously and >1 A at stall. (2) Voltage mismatch: the motors require 6–12 V for rated torque while Arduino logic operates at 5 V. (3) Inductive Back-EMF: switching inductive motor windings generates reverse voltage spikes that would destroy the microcontroller without an H-Bridge driver.
Where does the constant 58 come from in the HC-SR04 formula d (cm) = t (µs) ÷ 58?
At room temperature, sound travels in air at v ≈ 343 m/s = 0.0343 cm/µs. Because the ultrasonic burst travels from the transmitter to the obstacle AND reflects back to the receiver (total path = 2d), one-way distance is d = (t × 0.0343) / 2 = t × 0.01715 cm. Taking the reciprocal gives 1 / 0.01715 ≈ 58.3 µs/cm, so dividing Echo HIGH time in microseconds by 58 yields distance in centimeters.
Why is the SG90 servo connected directly to Arduino Pin D9 instead of through the L298N driver?
Unlike a raw two-wire DC motor, a hobby servo is a complete closed-loop mechatronic subsystem containing its own internal H-bridge driver IC, gear train, and feedback potentiometer. Its power comes from the 5 V rail, while Pin D9 only transmits a low-current (<5 mA) 50 Hz PWM timing signal (1.0 ms to 2.0 ms pulse width) instructing the internal comparator which target angle to hold.
With only a single ultrasonic distance sensor, how does the robot distinguish the pick object from an obstacle?
By task phase inside the 5-state Deterministic Finite Automaton (DFA). In the SEARCH state, the arena pick zone is ahead, so the first ultrasonic reflection is treated as the target cylinder (approached down to d ≤ 5 cm and gripped). Once the state transitions to CARRY, the payload is already held in the jaws, so any subsequent reflection with d ≤ 20 cm is classified as an obstacle and triggers the orthogonal 90° spin bypass.
Why must the Battery (–), L298N GND, Arduino GND, HC-SR04 GND, and SG90 Brown wire all be tied together?
All digital logic signals (5 V HIGH, 0 V LOW) and PWM duty pulses are potential differences measured relative to a 0 V reference node. Without a unified Common Ground bus, the Arduino and L298N float at different reference potentials, causing the H-Bridge logic gates and servo comparator to misinterpret control signals and behave randomly.
What are the physical limitations of single-cone ultrasound and how does v2 solve them?
(1) Narrow 15° beam cone and acoustic absorption/deflection on soft foam or >45° angled walls → solved by adding a camera + YOLOv8 object detection and 360° LiDAR. (2) Open-loop target distance estimation drifts under wheel slip or battery voltage sag → solved by wheel encoders and ROS-based SLAM localization. (3) Single lightweight cylindrical payload (1.8 kg·cm SG90 limit) → solved by a parallel-jaw high-torque metal-gear gripper and multi-DOF robotic arm.