Competition-ready web controller for dual-track vehicles with 6 fixed throttle levels and Bluetooth Arduino control.
Test URL: http://192.168.137.129:8001
Desktop: Open in browser → Use W/A/S/D + 1-6 keys Mobile: Open on phone (same WiFi) → Touch controls
- 6 Fixed Throttle Levels: 40, 80, 120, 160, 200, 250 RPM
- Strict Motor Control Rules: Independent LEFT/RIGHT motor control
- Real-time Bluetooth: 20 Hz update rate
- Industrial UI: Tech-themed design with grid layout
- Emergency Stop: Immediate cutoff with priority
- PWA Support: Installable as native app
FORWARD: LEFT=FWD + RIGHT=FWD
BACKWARD: LEFT=BWD + RIGHT=BWD
LEFT: LEFT=OFF + RIGHT=FWD (right motor only)
RIGHT: LEFT=FWD + RIGHT=OFF (left motor only)
STOP: LEFT=OFF + RIGHT=OFF
- Throttle Buttons: Tap 1-6 to select speed level
- Direction Buttons: W/A/S/D layout
- Emergency Stop: Large red button
W- ForwardS- BackwardA- Left turnD- Right turn1-6- Select throttle levelSPACE- Emergency stopQ- Quit (stop motors)
| Level | RPM | PWM | Use Case |
|---|---|---|---|
| 1 | 40 | 41 | Precision control |
| 2 | 80 | 82 | Slow movement |
| 3 | 120 | 122 | Default |
| 4 | 160 | 163 | Medium speed |
| 5 | 200 | 204 | Fast movement |
| 6 | 250 | 255 | Maximum speed |
- Arduino Uno/Nano/Mega
- HC-05 Bluetooth Module
- L298N Motor Driver
- 2 DC Motors (max 250 RPM)
- Power supply (7-12V)
HC-05 to Arduino:
HC-05 VCC → 5V
HC-05 GND → GND
HC-05 TX → Pin 10
HC-05 RX → Pin 11 (via voltage divider!)
L298N Motor 1 (LEFT):
IN1 → Pin 5
IN2 → Pin 6
ENA → Pin 3 (PWM)
L298N Motor 2 (RIGHT):
IN3 → Pin 9
IN4 → Pin 10
ENB → Pin 11 (PWM)
-
Upload Arduino Sketch
- Open
arduino/track_controller.ino - Set
SIMULATION_MODE = truefor LED testing - Upload to Arduino
- Open
-
Configure HC-05
AT+NAME=TrackController AT+PSWD=1234 AT+UART=38400,0,0 -
Pair Bluetooth
- Phone Settings → Bluetooth
- Connect to "TrackController" (PIN: 1234)
-
Open Web App
- Navigate to:
http://192.168.137.129:8001 - Click "CONNECT BLUETOOTH"
- Select device from list
- Navigate to:
-
Test Controls
- Select throttle level (default: 3)
- Press direction buttons
- Watch motor status update
- Deploy to GitHub Pages/Netlify
- Visit pwabuilder.com
- Enter your URL
- Download Android APK
npm install @capacitor/core @capacitor/cli @capacitor/android
npx cap init
npx cap add android
npx cap open android
# Build APK in Android StudioPacket Format: <M1_DIR,M1_PWM,M2_DIR,M2_PWM,SAFE>\n
Direction Codes:
0= STOP1= FORWARD2= BACKWARD
Examples:
<1,122,1,122,0> → Both forward at level 3 (120 RPM)
<0,0,1,163,0> → Left turn at level 4 (160 RPM)
<1,204,0,0,0> → Right turn at level 5 (200 RPM)
<0,0,0,0,1> → Emergency stop
✅ Emergency Stop: Overrides all commands ✅ Watchdog Timer: Arduino auto-stops after 500ms no packet ✅ Disconnect Handling: Auto-stop on Bluetooth disconnect ✅ PWM Clamping: Enforced 0-255 range ✅ Motor Rule Validation: Strict turn logic enforced
Set SIMULATION_MODE = true in Arduino sketch:
- Pin 2: Motor 1 Forward LED
- Pin 4: Motor 1 Backward LED
- Pin 7: Motor 2 Forward LED
- Pin 8: Motor 2 Backward LED
- Pin 13: Emergency LED
- Open browser console (F12)
- Watch packet logs
- Test each throttle level
- Verify motor states update correctly
track-controller/
├── index.html # Main interface
├── styles.css # Industrial theme
├── app.js # Controller logic
├── manifest.json # PWA config
├── service-worker.js # Offline support
└── arduino/
└── track_controller.ino # Arduino sketch
Bluetooth won't connect
- Pair HC-05 in phone Settings first
- Use Chrome browser (best Web Bluetooth support)
- Check HC-05 is powered and blinking
Motors don't respond
- Check L298N power supply (7-12V)
- Verify wiring (TX/RX not swapped)
- Test with LED simulation mode first
- Check Serial Monitor for packets
Wrong motor direction
- Swap motor wires on L298N output
- Or modify Arduino pin assignments
- Update Rate: 20 Hz (50ms interval)
- Latency: <50ms touch to motor
- Packet Size: ~20 bytes
- Bluetooth Range: ~10 meters
This system is designed for robotics competitions:
- Deterministic throttle levels
- Instant stop behavior
- Fail-safe mechanisms
- Clean motor control rules
- Professional UI
Project: Dual-Track Controller v1.0 License: MIT Built for: Competition Robotics