Skip to content

Releases: atharvap8/2PyBot

2PyBot v1.0.0

18 Apr 09:33

Choose a tag to compare

2PyBot — Firmware Release v1.0.0

Self-balancing wheeled robot platform built on ESP32, TMC2208 stepper drivers,
and a 6-DOF Mahony AHRS fusion filter. Controlled wirelessly over ESP-NOW with
a custom joystick transmitter. Telemetry and live PID tuning over Bluetooth serial.


📦 Release Assets

File Board Description
BaseLink-v1.0.0.bin Robot (BaseLink) Main application binary
BaseLink-v1.0.0.bootloader.bin Robot (BaseLink) ESP32 bootloader
BaseLink-v1.0.0.partitions.bin Robot (BaseLink) Partition table (huge_app, 3 MB)
Controller-v1.0.0.bin Transmitter (Controller) Joystick transmitter binary

⚡ Flashing Instructions

Prerequisites

Install esptool.py via pip:

pip install esptool

Alternatively, use the ESP32 Flash Download Tool (Windows GUI) available from Espressif.


🤖 BaseLink — Robot Receiver

The BaseLink firmware is compiled with the huge_app partition scheme (3 MB application
partition) to accommodate the combined footprint of Bluetooth Serial, ESP-NOW, Mahony AHRS,
TMC2208 UART drivers, and the stepper ISR.

You must flash three files — the bootloader, partition table, and application binary —
at their correct offsets.

esptool.py \
  --chip esp32 \
  --port /dev/ttyUSB0 \
  --baud 921600 \
  --before default_reset \
  --after hard_reset \
  write_flash \
  0x1000  BaseLink-v1.0.0.bootloader.bin \
  0x8000  BaseLink-v1.0.0.partitions.bin \
  0x10000 BaseLink-v1.0.0.bin

Windows users: replace /dev/ttyUSB0 with your COM port, e.g. --port COM3

Flash address summary:

Offset File
0x1000 Bootloader
0x8000 Partition table
0x10000 Application firmware

🎮 Controller — Joystick Transmitter

The Controller firmware only requires flashing the single application binary.

esptool.py \
  --chip esp32 \
  --port /dev/ttyUSB0 \
  --baud 921600 \
  --before default_reset \
  --after hard_reset \
  write_flash \
  0x10000 Controller-v1.0.0.bin

🔧 Arduino IDE Alternative

If you prefer not to use esptool.py:

  1. Open firmware/BaseLink/BaseLink.ino in Arduino IDE 2.x.
  2. Under Tools → Board, select ESP32 Dev Module.
  3. Under Tools → Partition Scheme, select Huge APP (3MB No OTA/1MB SPIFFS).
  4. Select your COM port and click Upload.
  5. Repeat for firmware/Controller/Controller.ino using the default partition scheme.

⚙️ First-Time Configuration

1. Set the Receiver MAC Address

Before flashing the Controller, update the receiver MAC address in firmware/Controller/Controller.ino:

uint8_t receiverMAC[] = {0xEC, 0x62, 0x60, 0x99, 0x97, 0xE0};  // ← replace with your robot's MAC

The robot prints its own MAC address over USB Serial at 115200 baud on boot.

2. Calibrate the Balance Angle

After mounting the robot upright, connect via Bluetooth or USB and tune the target angle:

T=-1.469   ← set the equilibrium angle offset (degrees)

Adjust until the robot stands level with zero motor output.

3. Enable the Motors

Send E over Bluetooth or USB Serial to enable the drive loop. Send X to kill immediately.


🐍 Python Dashboard

cd gui
pip install pyserial customtkinter
python robot_controller_ui.py

Pair the robot's Bluetooth device (Self_Balancing_Robot) before launching.
Select the correct COM port in the dashboard and click Connect.


📋 Hardware

Component Qty Notes
ESP32 DevKit (38-pin) 2 One per board
TMC2208 Stepper Driver 2 UART mode; 1 kΩ resistor on TX line
NEMA 17 Stepper Motor 2 1.8° / 200 steps per revolution
ISM6HG256X IMU 1 Custom breakout; I2C on GPIO 21/22
QMC5883L Magnetometer 1 Same I2C bus
MP1584 Buck Converter 1 12 V → 5 V regulation
3S Li-Ion Battery Pack 1 ~11.1 V nominal
2-Axis Analog Joystick 1 ADC1 pins (GPIO 34/35)

📄 Documentation

Full technical documentation is available in docs/:


Built with Arduino ESP32 Core 3.x / IDF 5.x — compiled and verified by GitHub Actions.