Bot Builder Guide
This guide covers how to build a BotPyle-compatible robot from scratch. If you already have a robot, skip to Registering a Bot.
Supported Hardware
BotPyle works with any robot that can:
- Stream video over a network (MJPEG, WebSocket binary frames, or RTSP)
- Receive control commands via WebSocket
- Connect to the internet via WiFi or Ethernet
Recommended Compute Boards
| Board | Best For | Price Range | Notes |
|---|---|---|---|
| Raspberry Pi 4/5 | General purpose, ground bots | $35–75 | Best community support. Use Pi Camera for low latency. |
| Jetson Nano | Computer vision, AI bots | $99–149 | GPU acceleration for ML tasks, object detection. |
| ESP32-CAM | Ultra-simple bots | $8–15 | Built-in camera + WiFi. Limited to basic image streaming. |
| Arduino + WiFi Shield | Simple motor control | $15–40 | Pair with a Pi or ESP32 for video. Arduino handles motors. |
| Any Linux SBC | Advanced builds | Varies | Orange Pi, BeagleBone, etc. — if it runs Python, it works. |
Common Bot Configurations
Differential Drive
- 2 DC motors + motor driver (L298N or similar)
- Raspberry Pi or ESP32-CAM
- USB camera or Pi Camera
- Battery pack (LiPo or USB powerbank)
- Chassis (3D printed, laser cut, or kit)
Mecanum Drive
- 4 DC motors + 4-channel driver
- Mecanum or omni wheels ($20–40/set)
- Raspberry Pi or Jetson Nano
- Camera + optional servo pan/tilt
- Higher battery capacity needed
Software Requirements
Your bot needs a script that:
- Connects to BotPyle's relay server via WebSocket
- Streams camera frames as binary WebSocket messages
- Receives and parses control commands (JSON gamepad data)
- Translates commands to motor signals (PWM, serial, I2C, etc.)
Example: Basic Python Bot Script
import asyncio
import websockets
import json
import cv2
RELAY_URL = "ws://botpyle.com:8090" # Your relay port
async def bot_main():
async with websockets.connect(RELAY_URL) as ws:
cap = cv2.VideoCapture(0) # Camera
while True:
# Send video frame
ret, frame = cap.read()
if ret:
_, buf = cv2.imencode('.jpg', frame,
[cv2.IMWRITE_JPEG_QUALITY, 50])
await ws.send(buf.tobytes())
# Receive control commands
try:
msg = await asyncio.wait_for(
ws.recv(), timeout=0.03)
cmd = json.loads(msg)
handle_controls(cmd)
except asyncio.TimeoutError:
pass
def handle_controls(cmd):
"""Translate gamepad input to motor commands."""
axes = cmd.get('axes', [])
buttons = cmd.get('buttons', [])
# Example: differential drive
throttle = -axes[1] if len(axes) > 1 else 0
turn = axes[0] if len(axes) > 0 else 0
left_speed = throttle + turn
right_speed = throttle - turn
# Send to motors (implementation depends on your hardware)
# set_motors(left_speed, right_speed)
print(f"L: {left_speed:.2f} R: {right_speed:.2f}")
asyncio.run(bot_main())
Wiring Considerations
- Motor driver — Connect motor driver enable/input pins to GPIO. Use PWM for speed control.
- Power — Separate power for motors and compute (prevents brownouts). Use a voltage regulator or BEC.
- Camera — USB cameras work everywhere. Pi Camera has lower latency on Pi boards.
- WiFi range — Standard WiFi is usually ~30m indoors. Use a WiFi extender for larger areas.