Overview & Competition Challenge
On November 11, 2025, our robot secured 2nd Place—winning a 20,000 AED prize—at the 15th Annual Engineering Competition (Mechanical Engineering / Robotic Competition) hosted by Rochester Institute of Technology (RIT) Dubai. The competition originally tasked teams with building a hybrid autonomous-teleoperated mobile manipulator capable of autonomously picking up a sphere from inside a mug, manually driving the car across the arena to a deposit zone, and autonomously dropping it into the target container—though on competition day organizers swapped the sphere for a cube after it proved virtually impossible for the stock kit's flat acrylic jaws to reliably grip a smooth sphere.
Built on the competition-mandated Keyestudio KS0523 4WD Robotic Arm Smart Car (Arduino Uno + PCA9685 I²C 12-bit motor shield at 0x47, 3-DOF clear acrylic robotic arm, and front HC-SR04 ultrasonic sensor), the robot was elevated well beyond the stock kit through four custom software and control layers: a bespoke non-blocking C++ servo velocity-control library (ServoPlus), analytical 2D planar arm kinematics drafted in AutoCAD (RobotArmCar.dwg), closed-loop ultrasonic standoff positioning (DistanceSequence()), and a reverse-engineered custom Bluetooth controller app rebuilt in MIT App Inventor after decompiling the manufacturer's stock APK.
Reverse-Engineering the Stock APK into a Custom MIT App Inventor Controller
One of the defining constraints of the competition was that the official kit shipped with a closed, bare-bones manufacturer Bluetooth app (keyes 4wd arm.apk), and the competition instructions expected teams to operate using the kit's Bluetooth app. Relying strictly on the stock app meant zero support for automated pick-and-place triggers, ultrasonic auto-alignment, or live mug-geometry calibration.
To unlock the robot's full firmware capabilities without sacrificing the familiar control layout, I decompiled the manufacturer's Android APK, extracted its exact UI assets and serial Bluetooth command characters (F/B/L/R/S for chassis drive, f/b/l/r/s for arm jogs, Q/E for jaw open/close), reverse-engineered its communication flow, and built a visually identical custom replacement in MIT App Inventor (powered by BluetoothLE, TaifunTools, and DaffyMenu extensions) extended with dedicated competition features:
- One-Tap Ultrasonic Auto-Positioning (
't'): CommandsDistanceSequence()to back off smoothly until the frontHC-SR04locks onto the exact kinematic reach radius of the pickup mug. - One-Tap Autonomous Pick-and-Place (
'i'): Runs the fullAutoPickup()state sequence—centering, opening, descending topickUpHeight, clamping, lifting clear, rotating to the adjacent bowl, and releasing. - Live Geometry Calibration Sliders (
'X','Y','Z'): AdjustMug_dia(113 mmdefault),Mug2_dia(155 mmdefault), andpickUpHeight(50 mmdefault) wirelessly between runs without re-flashing the Arduino. - Transfer Side Selector & Speed Stepping (
'U'/'G','a'/'d'): Toggle left/right bowl-to-bowl transfer direction (pickup_dir) and stepMotorSpeedin±10012-bit PWM increments.
Hardware Build, Prototyping & Tech Stack
Assembling the base KS0523 kit quickly exposed two major physical constraints of the acrylic arm: the cantilevered shoulder linkage sagged under load and taxed the shoulder servo (ArmServo2), while the flat, slick acrylic claws struggled to hold smooth round objects inside narrow mugs. During home prototyping—testing bowl-to-bowl transfers with a small textured grenade model—we experimented with dual yellow rubber-band counterbalances to unload the shoulder servo as well as custom foam-and-tape scoop jaws. However, custom scoop jaw hardware modifications were not permitted under competition rules and had to be discarded before event day—forcing us to rely on precision kinematics, smooth ServoPlus motion profiling, and the stock acrylic jaws (which ultimately got a break on competition day when organizers replaced the impossible-to-grip sphere with a cube!).
Tech Stack
- Microcontroller & Motor Drive:
Arduino Uno (ATmega328P)compiled cleanly at 8,096 B Flash (25%) and 466 B SRAM (22%), driving fourTB6612channels over I²C via aPCA968512-bit PWM shield (0x47,60 Hz, with soft-start velocity ramping:rampStep = 50,rampDelay = 20 ms). (Fun legacy note: this exactPCA9685shield later rescued our 1st-place robot at RIT Dubai’s 16th competition after the newer kit's shield burnt out the night before the race!) - Arm Actuators & Sensing: Three metal-gear
MG90S-class arm servos (ArmServo1jaw onD11,ArmServo2shoulder onD10,ArmServo3base rotation onD9) + frontHC-SR04ultrasonic rangefinder (trig = D12,echo = D13). - Mechanical Drafting & Geometry: Exact link and offset geometry measured and drafted in AutoCAD (
RobotArmCar.dwg—ARMLENGTH = 107 mm,JawXComponent = 46.9 mm,JawYComponent = 19.5 mm,STG_dist = 91 mm), paired with dual rubber-band shoulder assist during testing while competing with stock compliant acrylic jaws after custom scoop jaws were disallowed. - Firmware & Companion App: Embedded C++ (
Wire.h,Adafruit_PWMServoDriver.h,HCSR04.h, customServoPlus.h/ServoPlus.cpp) + reverse-engineered MIT App Inventor BLE controller (BluetoothLE,TaifunTools,DaffyMenu).
Custom ServoPlus C++ Velocity-Profiling Library
Calling Arduino's built-in Servo.write() commands an immediate full-speed jump to the target angle, violently jerking a cantilevered acrylic arm and flinging spheres out of the gripper. To eliminate jerk without using blocking delay() loops that freeze Bluetooth input or motor ramping, I authored a reusable C++ library—ServoPlus (ServoPlus.h / ServoPlus.cpp)—that integrates elapsed time in microseconds (micros()) inside run() to step every joint smoothly at a specified angular velocity (deg/s):
setSpeed(degPerSec)controls each axis independently (180°/son the jaw,90°/son the shoulder and base).moveTo(angle)andmoveToWithin(angle, time)schedule non-blocking trajectories across all three joints simultaneously.isServoStillRunning()andgetFinalPos()expose clean state queries for multi-step pick-and-place sequencing and incremental manual jogs (runMoveStates()).
void ServoPlus::run(){
unsigned long now = micros();
double time = (now - time_tracker) / 1e+6;
double pos = servo_speed * time;
// If distance increment is greater then
// final distance - current distance
// set distance to final distance
if (abs(servo_final_pos - servo_pos) < pos){
servo_pos = servo_final_pos;
}
// if distance is less then final distance
// add distance increment to distance
else if (servo_pos < servo_final_pos){
servo_pos += pos;
}
// if distance is greater then final distance
// add distance increment to distance
else if (servo_pos > servo_final_pos){
servo_pos = servo_pos - pos;
}
// Update servo
EnhancedServo.write(int(servo_pos));Analytical 2D Kinematics, Ultrasonic Auto-Positioning & Pick-and-Place
Although I initially wrote a full 3D inverse kinematics solver (InverseKinematics3D() — still preserved in comments inside 4WDROBOTCAR.ino), testing proved the 3-DOF acrylic arm's linkage was far more deterministic when reduced to exact 2D planar kinematics parameterized directly from our AutoCAD dimensions (ARMLENGTH = 107 mm, JawX = 46.9 mm, JawY = 19.5 mm, shaft-to-ground STG_dist = 91 mm).
Three analytical equations govern the autonomous pickup and placement sequence:
- Analytical Shoulder Inverse Kinematics (
FindServoAngleWithY()): Solves the required shoulder servo angle and corresponding horizontal jaw reach for any target pickup elevation :
- Ultrasonic Target Standoff (
DistanceSequence()): Computes the exact front-bumper ultrasonic distance to the mug rim so the jaw descends dead-center into a mug of diameter :
- Container-to-Container Base Swivel (
findTurnAngle()): Calculates the exact yaw offset between adjacent containers of radii and at radial reach :
Here is the FindServoAngleWithY() kinematic solver from 4WDROBOTCAR.ino, clamping elevation to safe bounds before computing both the servo target angle and forward jaw reach:
AngCoordReturn FindServoAngleWithY(double Y){
// Setting Height Limit
Y = constrain(Y, pickUpHeight, Y);
// Subtracting Ground Offset
Y -= STG_dist;
// Calculate Arm Y Pos
Y += JawYComponent;
// Calculate Angle Of Shoulder
Y = constrain(Y, Y, ARMLENGTH); // Constraining Y Max Length
double theta = degrees(asin(Y / ARMLENGTH));
// Calculate Arm X Pos
double X = ARMLENGTH * cos(radians(theta));Before executing AutoPickup(), triggering 't' activates DistanceSequence() inside the main loop. Every 100 ms, the robot samples HCSR04.measureDistanceMm()[0] and smoothly reverses at controlled PWM until the mug rim sits at armDistance - (Mug_dia / 2), automatically parking the gripper directly over the sphere's center axis:
void DistanceSequence(){
if(activeMove == true){
double armDistance = FindServoAngleWithY(pickUpHeight).distance;
double TotalDistance = armDistance - (Mug_dia / 2);
if (now - lastMeasureTime > DistDelay){
lastMeasureTime = now;
double Distance = HCSR04.measureDistanceMm()[0];
double DistanceStopOffset = 0; //unit in mm
if(Distance - DistanceStopOffset >= TotalDistance){
activeMove = false;
targetSpeed = 0;
return;
}
}Challenges & Lessons Learned
Breaking Out of Stock Kit App Limitations via Reverse Engineering
Competition kits are deliberately locked down around a basic manufacturer Bluetooth app, which leaves no room for custom autonomous triggers or trackside calibration. Decompiling keyes 4wd arm.apk, extracting its exact graphics and serial protocol, and rebuilding a visually identical MIT App Inventor BLE app let us keep full compatibility while gaining live mug-diameter sliders, ultrasonic parking ('t'), and one-tap autonomous pickup ('i').
No-Modification Rules & The Sphere-to-Cube Event-Day Twist
Because structural gripper modifications weren't allowed, we had to discard the custom foam scoop jaws we prototyped during home tests on our grenade model and compete using the kit's flat acrylic claws. Ironically, event organizers ran into the exact same physics problem on competition day and swapped the original sphere target for a cube, since gripping a smooth sphere cleanly with flat acrylic jaws proved nearly impossible.
Right-Sizing Kinematics & Smooth ServoPlus Control
Discarding over-engineered 3D inverse kinematics in favor of exact AutoCAD-measured 2D planar trigonometry eliminated floating-point drift and mechanical binding. Pairing that geometry with ServoPlus microsecond velocity ramping ensured the stock acrylic jaws approached, clamped, and lifted payloads smoothly without jerking or dropping the object mid-swing.
Foundation for Returning to Win 1st Place
Finishing 2nd Place (20,000 AED) at the 15th Annual RIT Dubai competition taught us how decisive wireless trackside tuning and deterministic kinematics are under arena pressure—lessons that directly powered our return the following year to win 1st Place at RIT Dubai’s 16th Annual Engineering Competition (ALFRED), where this very robot's PCA9685 shield even stepped in to save the race after our newer shield burnt out the night before!

