Skip to the content
PCBKitNew board
2 layers70.4 × 38.9 mmStone pcb v1, the printed circuit board in 3D

A collection of motor control implementations for the ESP32-S2 Mini with DRV8833 motor driver.

Size
70.4 × 38.9 mm
Copper layers
2
Thickness
1.6 mm
Parts
20
Nets
28
Pads
77
Tracks, vias
102, 2
Pours
1
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
5 Mar 2025
Updated
23 May 2025

Overview

Stone pcb v1 is an open-source printed circuit board by prt-prt, from the prt-prt/esp32-MotorController repository on GitHub. It is a 2-layer board of 70.4 × 38.9 mm with 20 parts on 28 nets, routed with 102 tracks and 2 vias.

It is built around the DRV8833PW. Its parts include 8 connectors and 1 diode.

Main components

1

README

README.md

ESP32 Motor Controller

A collection of motor control implementations for the ESP32-S2 Mini with DRV8833 motor driver.

Version Overview

v1: Basic Test

  • Simple motor test sequence
  • Basic forward/backward/turn movements
  • No fault detection

v2: Mode System

  • Multiple movement modes (wander, rotate, test)
  • Mode switching logic
  • Basic error handling

v3: Power Management

  • Improved power handling
  • Speed ramping
  • Basic fault detection
  • Reduced motor speeds

v4: Organic Movement

  • Slow, rock-like movement patterns
  • Advanced fault detection
  • PWM-based motor control
  • Random movement generation
  • Detailed debugging

v5: Simple Forward Test

  • Continuous forward movement
  • Basic PWM control
  • Minimal code for testing
  • No mode switching or complex logic

v6: All Directions Test

  • Tests all motor directions sequentially
  • Basic PWM control
  • Auxiliary pin control (GPIO39)
  • Cycle between directions automatically

Hardware

  • ESP32-S2 Mini (Lolin)
  • DRV8833 Motor Driver
  • 2 DC Motors
  • Power Supply (5V recommended)

Pin Configuration

  • Motor A: GPIO11 (IN1), GPIO9 (IN2)
  • Motor B: GPIO7 (IN1), GPIO5 (IN2)
  • Fault Pin: GPIO12
  • LED: GPIO15

Project Structure

This project is organized into two versions:

  • v1: Uses the ESP32-CAM and L298N motor driver (older, traditional driver)
  • v2: Uses the ESP32-S2 Mini and DRV8833 motor driver (more efficient, modern setup)

Each version contains its own complete implementation for its respective hardware. For detailed wiring and implementation specifics, see the WIRING.md file in each subproject folder.

Hardware Requirements

Common Components for Both Versions

  • 2-wheel drive robot car chassis with DC motors
  • Jumper wires
  • Small breadboard (optional, for cleaner wiring)

Version Specific Components

  • v1:

    • ESP32-CAM development board
    • L298N dual H-bridge motor driver (detailed documentation)
    • MP1584EN buck converter module (for power regulation)
    • Power supply for motors (battery pack/power bank)
  • v2:

    • Wemos ESP32-S2 Mini development board
    • DRV8833 dual H-bridge motor driver (detailed documentation)
    • 5V powerbank with USB output
    • USB splitter/hub or adapter
    • USB in-line power switch (for global power control)
    • Step-up converter (boosts 5V from powerbank to 6V for motors)

Power Supply Architecture Differences

The v1 and v2 versions use different power supply approaches:

v1 Power Supply:

  • Battery/power source → MP1584EN buck converter → ESP32-CAM (5V)
  • Battery/power source → L298N motor driver (higher voltage)

v2 Power Supply:

  • Powerbank USB output → Global power switch → USB splitter/hub
    • First output: USB-C connection to ESP32-S2 Mini (direct connection)
    • Second output: 5V to Step-up converter → DRV8833 motor driver (6V)

The v2 setup uses a true global power switch that controls the entire system with a single switch, turning both the microcontroller and motors on/off together.

Hardware Comparison

Microcontroller Comparison

Featurev1: ESP32-CAMv2: ESP32-S2 Mini
USB ConnectionExternal programmer requiredBuilt-in USB-C port
SizeLargerCompact
Power Input5V via pinsDirect USB-C
ProgrammingVia serial adapterNative USB
Unnecessary FeaturesCamera moduleNone
Form FactorLess robot-friendlyIdeal for robotics

Motor Driver Comparison

Featurev1: L298Nv2: DRV8833
Efficiency~70%>90%
Control Pins6 total4 total
Heat GenerationHighLow
SizeLargeCompact
Control MethodEnable + Direction pinsPWM on all pins

Power Control Comparison

Featurev1 Approachv2 Approach
Power SwitchControls motors onlyTrue global control (entire system)
Power SourceSeparate pathsSingle source with distribution
Wiring ComplexityMore complexSimplified with USB connectivity
Development ModeESP32 always onSystem fully controlled by one switch

For detailed pin connections, wiring diagrams, and implementation specifics, see:

Software Setup

This project uses PlatformIO for development and deployment:

  1. Install Visual Studio Code
  2. Install the PlatformIO extension
  3. Clone or download this repository
  4. Open either the v1 or v2 project folder in VS Code
  5. Build and upload the project using PlatformIO

V2 Programming Advantage

The v2 version with ESP32-S2 Mini can be programmed directly via USB-C connection without additional hardware, making development and testing significantly easier. During development, you can disconnect the powerbank and connect the ESP32-S2 Mini directly to your computer.

Features

Movement Modes

The robot car supports three different movement modes:

  1. Test Mode: Demonstrates basic movements in a sequence
  2. Wander Mode: Robot randomly wanders with organic movements
  3. Rotate Mode: Robot slowly rotates around its axis

By default, the robot switches between Wander Mode and Rotate Mode every 30 seconds.

Basic Movement Functions

The code includes the following standard movement functions:

  • moveForward(speed): Moves the robot forward
  • moveBackward(speed): Moves the robot backward
  • turnLeft(speed): Turns the robot left
  • turnRight(speed): Turns the robot right
  • stopMotors(): Stops all motor movement

Differential Steering

Advanced movement control is achieved through differential steering:

  • moveDifferential(leftSpeed, rightSpeed): Allows independent control of each wheel
  • curveLeft(leftSpeed, rightSpeed): Creates curved left movement
  • curveRight(leftSpeed, rightSpeed): Creates curved right movement

Speed Control

All movement functions support variable speed control through PWM, with speed values ranging from 0 (stop) to 255 (full speed).

Movement Modes in Detail

Test Mode

Cycles through a series of basic movements to test motor functionality:

  1. Forward → Stop → Backward → Stop → Left turn → Stop → Right turn → Stop

Wander Mode

Implements organic, randomized movement with varying speeds and paths:

  • Straight forward movement
  • Gentle left and right curves
  • Sharp left and right curves
  • 180° spin turns
  • Backward movement
  • Random stops

Rotate Mode

Performs a slow, controlled rotation around the robot's center:

  • Rotates in a random direction (left or right)
  • Changes direction every 10 seconds
  • Uses reduced speed for careful rotation

Customization

You can customize the pin assignments at the beginning of the motor_control.cpp file if you need to use different GPIO pins on your microcontroller.

To implement additional movement modes or alter the existing ones, refer to the corresponding mode files in the src directory.

Troubleshooting

Basic troubleshooting tips are included in the WIRING.md file for each version:

Project Structure

For each version (v1 and v2):

  • platformio.ini: PlatformIO configuration
  • WIRING.md: Detailed wiring and implementation documentation
  • include/motor_control.h: Header file for motor control functions
  • include/movement_modes.h: Defines the movement modes enum
  • include/test_mode.h: Header for test mode
  • include/wander_mode.h: Header for wander mode
  • include/rotate_mode.h: Header for rotate mode
  • src/motor_control.cpp: Motor control functions implementation
  • src/main.cpp: Main program with setup, loop, and mode switching logic
  • src/test_mode.cpp: Test mode implementation
  • src/wander_mode.cpp: Wander mode implementation with organic movement
  • src/rotate_mode.cpp: Rotate mode implementation

License

This project is open source and available under the MIT License.

Parts

20
QtyValueFootprintReferences
3RResistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P7.62mm_Horizontal5.1k1, 5.1k2, R2
2S2-MiniConnector_PinSocket_2.54mm:PinSocket_1x08_P2.54mm_VerticalJ6, J8
1BreakoutsConnector_PinSocket_2.54mm:PinSocket_1x07_P2.54mm_VerticalJ7
1Conn_01x02_Socket 5V & GND CAMLINEConnector_PinSocket_2.54mm:PinSocket_1x02_P2.54mm_VerticalJ10
1Conn_01x02_Socket EXT_5V & GNDConnector_PinSocket_2.54mm:PinSocket_1x02_P2.54mm_VerticalJ9
1DRV8833Connector_PinSocket_2.54mm:PinSocket_1x06_P2.54mm_VerticalJ2
1LEDLED_THT:LED_D5.0mmD1
1Switch1TestPoint:TestPoint_Pad_D2.0mmTP7
1Switch2TestPoint:TestPoint_Pad_D2.0mmTP8
1TP GroundTestPoint:TestPoint_Pad_D2.0mmTP5
1TP Motor1TestPoint:TestPoint_Pad_D2.0mmTP1
1TP Motor2TestPoint:TestPoint_Pad_D2.0mmTP2
1TP Motor3TestPoint:TestPoint_Pad_D2.0mmTP3
1TP Motor4TestPoint:TestPoint_Pad_D2.0mmTP4
1TP VBUSTestPoint:TestPoint_Pad_D2.0mmTP6
1USB_C_Receptacle_USB2.0_14PConnector_USB:USB_C_Receptacle_HRO_TYPE-C-31-M-12J5
1~Connector_PinSocket_2.54mm:PinSocket_1x06_P2.54mm_VerticalJ1

Questions

How big is the Stone pcb v1 PCB?

It measures 70.4 × 38.9 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Stone pcb v1 use?

20 parts, built around the DRV8833PW. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Stone pcb v1 KiCad files?

From the prt-prt/esp32-MotorController repository on GitHub, at the commit this page was made from: the board is cad/stone_pcb_v1.kicad_pcb and its schematic cad/stone_pcb_v1.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Stone pcb v1 design in my own project?

Its repository states no licence, so its author keeps all rights: ask prt-prt before reusing the design.

Similar boards

  • 2 layers110 × 110 mmMs pcb, the printed circuit board in 3D

    Ms pcb

    opatiny/micromouse

    Designing a custom micromouse robot.

    39 parts15CERN-OHL-P-2.0
  • 4 layers102 × 100 mmZelvicka, the printed circuit board in 3D

    Zelvicka

    RoboticsBrno/Robutek

    Robůtek je robotická platforma založená na čipu ESP32-S3. Je velice rozšitiřelný, ale ze základu umí jezdit, kreslit fixou, jezdit po čáře, pohybovat se bludištěm. Programování je přes Jaculus.

    214 parts12
  • 2 layers60 × 100 mmRobot boosterpack, the printed circuit board in 3D

    Robot boosterpack

    Hylian/BoosterBot

    Turn your TI LaunchPad into a robot!

    62 parts7
  • 2 layers91.9 × 67.1 mmUpdatedPCB2024, the printed circuit board in 3D

    UpdatedPCB2024

    CWRUbotix/Micromouse-2023-24

    A fully autonomous maze-solving not-quite-mouse-sized robot.

    31 parts6GPL-3.0
  • 2 layers119.4 × 98.9 mmPCB Pami, the printed circuit board in 3D

    PCB Pami

    FIPATECH/CDFR26_PAMI

    Open source firmware and PCB for a differential mobile robot (PAMI) based on ESP32-S3 - Coupe de France de Robotique

    25 parts6
  • 2 layers93.6 × 102.8 mmMote hardware, the printed circuit board in 3D

    Mote hardware

    empriselab/mote

    A low cost, high confidence mobile robot optimized for education.

    75 parts5MIT
  • 2 layers104.1 × 76.2 mmBiotracker tracks, the printed circuit board in 3D

    Biotracker tracks

    interspecifics/ComunicacionesEspeculativas

    Es un proyecto basado en una máquina que es capaz de observar y aprender de microorganismos para crear un score audiovisual a partir de los patrones que encuentre en su comportamiento.

    16 parts4
  • 2 layers71.5 × 48.3 mmEsp32-2wd, the printed circuit board in 3D

    Esp32-2wd

    nochkin/esp-line-follower

    A simple educational project to build a line following 2WD robot

    13 parts3MIT