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:

  1. Stream video over a network (MJPEG, WebSocket binary frames, or RTSP)
  2. Receive control commands via WebSocket
  3. Connect to the internet via WiFi or Ethernet
Recommended Compute Boards
BoardBest ForPrice RangeNotes
Raspberry Pi 4/5General purpose, ground bots$35–75Best community support. Use Pi Camera for low latency.
Jetson NanoComputer vision, AI bots$99–149GPU acceleration for ML tasks, object detection.
ESP32-CAMUltra-simple bots$8–15Built-in camera + WiFi. Limited to basic image streaming.
Arduino + WiFi ShieldSimple motor control$15–40Pair with a Pi or ESP32 for video. Arduino handles motors.
Any Linux SBCAdvanced buildsVariesOrange 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:

  1. Connects to BotPyle's relay server via WebSocket
  2. Streams camera frames as binary WebSocket messages
  3. Receives and parses control commands (JSON gamepad data)
  4. 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.