// MATHEMATICAL & CONTROL SYSTEMS SPECIFICATION

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.

GOVERNING MECHATRONIC & CONTROL EQUATIONSDETERMINISTIC REAL-TIME LOOP
LAW 01 // ACOUSTICS

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.

d(cm) = (t_echo × c_air) / 2 = (t_µs × 0.0343 cm/µs) / 2 = t_µs ÷ 58
LAW 02 // POWER STAGE

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.

V_motor = V_batt - V_drop(L298N) · (PWM / 255) | Fwd: S1∧S4, Rev: S3∧S2
LAW 03 // KINEMATICS

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.

v = (v_R + v_L) / 2 | ω = (v_R - v_L) / L | τ_wheel ≈ 48 · η · τ_motor
LAW 04 // CLOSED-LOOP PWM

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°.

T_period = 20 ms (50 Hz) | t_pulse(θ) = 1.0 ms + (θ / 180°) × 1.0 ms
LAW 05 // AUTOMATA

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.

δ(SEARCH, d≤5) → PICK → CARRY | δ(CARRY, d≤20) → SPIN_AVOID | δ(CARRY, atTarget) → PLACE → DONE
L298N H-BRIDGE LOGIC TRUTH TABLEMOTOR A (ENA, IN1, IN2)
ENAIN1IN2ACTIVE SWITCHESMOTOR RESPONSE
HIGH10S1 + S4 ClosedForward (Full Speed)
HIGH01S3 + S2 ClosedReverse (Full Speed)
HIGH00All OpenStop (Free Coast)
HIGH11Low-Side ShortDynamic Active Brake
PWM (0–255)10S1 + S4 DutyForward (Speed Modulated)
DIFFERENTIAL DRIVE STEERING MATRIXCHASSIS KINEMATICS
CHASSIS MANEUVERLEFT MOTOR (A)RIGHT MOTOR (B)USE IN KINETIX FSM
Drive Straight ForwardForward (IN1=1, IN2=0)Forward (IN3=1, IN4=0)SEARCH & CARRY Cruise
Turn Left ArcStop / Slow PWMForwardHeading Alignment
Turn Right ArcForwardStop / Slow PWMHeading Alignment
Spin in Place (Zero Radius)Forward (IN1=1, IN2=0)Reverse (IN3=0, IN4=1)d ≤ 20 cm Obstacle Bypass
Reverse ClearanceReverse (IN1=0, IN2=1)Reverse (IN3=0, IN4=1)Step 11 Post-Place Backup
PHYSICAL SENSOR CONSTRAINTS VS. V2 ARCHITECTURAL UPGRADESSIMULATE UPGRADES IN 3D STAGE →
[LIM_01] CURRENT HARDWARE CONSTRAINT

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.

→ V2 ARCHITECTURAL SOLUTION: 360° 2D LiDAR + ROS SLAM Occupancy Grid

Replaces single-ray ranging with continuous 360° laser scans, building a real-time Simultaneous Localization and Mapping (SLAM) costmap.

[LIM_02] CURRENT HARDWARE CONSTRAINT

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.

→ V2 ARCHITECTURAL SOLUTION: RGB Camera + YOLOv8 Real-Time Vision

Adds visual bounding-box classification on a Raspberry Pi / Jetson companion board so obstacles and payloads are recognized optically.

[LIM_03] CURRENT HARDWARE CONSTRAINT

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.

→ V2 ARCHITECTURAL SOLUTION: Multi-Class YOLO Object Recognition & Sorting

Distinguishes target cylinders, warehouse crates, and color-coded drop zones simultaneously for multi-object sorting.

[LIM_04] CURRENT HARDWARE CONSTRAINT

Open-Loop Target Finding & Wheel Slip

Target arrival relies on travel time/distance estimation; smooth floors or battery sag cause dead-reckoning drift.

→ V2 ARCHITECTURAL SOLUTION: Quadrature Wheel Odometry + Closed-Loop Nav2

Optical/magnetic shaft encoders fuse wheel ticks with IMU/LiDAR odometry to guarantee millimeter-accurate target docking.

ARCHITECTURAL & MECHATRONIC DESIGN RATIONALE6 CORE ENGINEERING TRADEOFFS
[ARCH_01] // POWER STAGE ISOLATION

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.

[ARCH_02] // ACOUSTIC TIME-OF-FLIGHT

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.

[ARCH_03] // CLOSED-LOOP ACTUATION

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.

[ARCH_04] // FINITE STATE MACHINE

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.

[ARCH_05] // REFERENCE TOPOLOGY

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.

[ARCH_06] // SENSOR FUSION ROADMAP

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.