Skip to the content
PCBKitNew board
4 layers82.6 × 47.6 mmESP32 VESC Controller, the printed circuit board in 3D

ESP32 VESC Controller

jawedhakimi/Hiking_trailer

Custom 4-layer PCB, 82.65 × 47.63 mm, 4 × M2.5 mounting holes (75 × 40 mm).

Size
82.6 × 47.6 mm
Copper layers
4
Thickness
1.6 mm
Parts
108
Nets
105
Pads
402
Tracks, vias
665, 307
Pours
8
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
29 Aug 2026
Updated
1 Oct 2026

Overview

ESP32 VESC Controller is an open-source printed circuit board by jawedhakimi, from the jawedhakimi/Hiking_trailer repository on GitHub. It is a 4-layer board of 82.6 × 47.6 mm with 108 parts on 105 nets, routed with 665 tracks and 307 vias.

It is built around the ESP32-S3-WROOM-1-N16R8, TJA1051T/3/1 and ADS1115IDGS, with the AMS1117, ICM-20948 and H3V3L10B among its other parts. Its parts include 37 capacitors, 34 resistors, 12 diodes, 8 connectors and 7 ICs. It belongs with the ESP32 boards of this library.

Main components

11

README

README.md

Hiking Trailer

A motorised hiking trailer that follows its handle. You walk; the trailer pushes itself. A spring-centred potentiometer in the handle measures how hard you pull or push, and an ESP32-S3 controller turns that into a speed (or torque) command for a VESC motor controller over CAN. The trailer watches its own orientation with an IMU and cuts the motor if it tips over, shows live status on a small touchscreen, and hosts its own WiFi dashboard for telemetry, tuning and calibration — no app, no internet, no reflashing to change settings.

by Jawed Hakimi


Contents


How it works

text
   handle pot ──► ADS1115 ──I2C──┐
                                 │
   ICM-20948 IMU ──────SPI───────┤        ┌──────────────┐   CAN    ┌──────┐
   touch LCD (ST7789+CST816S) ───┼─► ESP32-S3 controller ─┼─TJA1051─► VESC ├─► hub motor
   buzzer / LEDs / VBAT divider ─┘        └──────┬───────┘          └──────┘
                                                 │ WiFi AP
                                           phone / laptop
                                       (web dashboard, 192.168.4.1)
  1. Handle → command. The pot sits at centre when nobody touches the handle. Its position (after calibration, filtering and a dead-band) maps to a forward/backward ERPM (Speed mode) or motor current (Current mode), with separate forward/backward limits set in km/h or ERPM.
  2. Optional speed PID. In Speed mode a closed-loop trim compares the requested ERPM with the VESC's measured ERPM and corrects for slopes and load.
  3. Safety gating. Before anything is sent, the command is forced to zero on a fall, an invalid/missing pot signal, calibration, a direction change, park, or motor power off. After any interruption the motor only resumes once the handle is back at centre and a warning beep sequence has played.
  4. CAN to the VESC. The command is sent at a fixed rate, so the VESC's own timeout stops the motor if the controller ever dies. The VESC's status broadcasts come back over CAN for speed, current, temperatures, battery and distance.
  5. Feedback to the user. The touchscreen and the web dashboard both show speed, battery, trip, heading and every active error or warning.

Features

Drive

  • Pot-follow control in Speed (RPM) or Current (torque) mode
  • Separate forward / backward limits, optional reverse disable
  • Optional closed-loop speed PID trim
  • Downhill braking (VESC current brake) when the trailer runs faster than requested
  • Park — holds the wheel with the VESC handbrake
  • Motor-power enable switch (web + touchscreen); off at every boot

Safety

  • Fall detection with the ICM-20948: tilt past a threshold or an impact spike stops the motor; two-stage automatic recovery (upright, then handle centred + beeps)
  • Rising-pitch buzzer warning as the tilt approaches the fall angle
  • Fault detection for a missing pot ADC, disconnected pot, CAN failure, silent VESC, missing IMU, over-temperature, and more — shown on both displays, error LED blinks
  • Time-bounded sensor reads so a dropped I2C device can't freeze the control loop

Touchscreen (1.69", 280×240)

  • Speed arc, battery voltage, trip distance, compass heading, live pot position
  • WiFi name/password/address
  • Pop-up warning panel listing all active issues

Web dashboard (WiFi AP Hiking-trailer, http://192.168.4.1/ or http://hiking-trailer.local/)

  • Speed gauge with actual vs requested speed, drive command, battery, currents, energy, temperatures, orientation
  • Error window with every active error/warning and what to check
  • CAN Monitor — live per-ID frame table with decoded VESC status values
  • Pot calibration wizard, IMU upright-zero + magnetometer calibration, fall-threshold tuning
  • Speed PID tuning with a live target-vs-actual chart
  • System settings: controller ID, CAN baud, pole pairs, wheel, gear ratio, battery source + calibration, WiFi credentials, restart / factory reset — all saved to flash, no reflashing

Repository layout

PathWhat it is
SW/VESC CAN interface/Main firmware (PlatformIO, ESP32-S3 N16R8): control loop, CAN, IMU, LCD, web server + dashboard. Has its own detailed README.
SW/GUI/SquareLine Studio project for the touchscreen UI. Its export is copied into the firmware's lib/ui/ (never its lv_conf.h).
SW/VESC motor config/vesc_mcconf.xml — VESC Tool motor configuration backup (FOC, 14 pole pairs).
SW/ESP32 CAN test/Minimal TWAI/CAN bring-up test for the TJA1051 transceiver.
HW/ESP32_VESC_controller/KiCad project of the controller PCB (schematic sheets: ESP32-S3, power, CAN/RS485, sensors, connectors, thermals).
HW/ESP32_VESC_Controller.pdfSchematic as PDF.
HW/Hardware_Template/Board reference: every pin as #defines (board_pins.h), working platformio.ini, and a self-test firmware for bringing up a new board. See its README.
HW/Hiking_trailer.step3D model of the trailer assembly.
Mech/STEP models: controller PCB, enclosure face plate, wall mounts, display.

Hardware

Custom 4-layer PCB, 82.65 × 47.63 mm, 4 × M2.5 mounting holes (75 × 40 mm).

PartRole
ESP32-S3-WROOM-1-N16R8Main MCU (16 MB flash, 8 MB PSRAM)
TJA1051T/3CAN transceiver to the VESC (500 kbit/s, controller ID 97 by default)
ADS111516-bit ADC for the handle potentiometer (channel A0)
ICM-209489-axis IMU: fall detection + tilt-compensated compass
ST7789 1.69" LCD + CST816S touchOn-trailer display
Piezo buzzer, 2 LEDsWarnings, CAN status (IO40), error (IO41)
Battery divider (510k/15k)ESP32-side pack voltage (alternative to the VESC's reading)
VESCMotor controller (FOC), drives the hub motor

Power comes in on J2 (+48 V nominal, max ≈ 80 V) or USB-C for programming.

Main pins: CAN TX/RX = IO17/IO18 · I2C (ADS1115) SDA/SCL = IO7/IO6 · IMU CS/SCK/MOSI/MISO = IO8/IO12/IO11/IO13 (SPI bus shared with the LCD, LCD CS = IO10) · touch I2C SDA/SCL = IO47/IO48 · buzzer IO39 · VBAT IO4. Full tables: firmware README and hardware template.

Software

  • Framework: Arduino on ESP-IDF 5 via the pioarduino PlatformIO platform (Arduino-ESP32 core 3.x is required by the display library).
  • Libraries: LVGL 8 + GFX Library for Arduino (display), ESPAsyncWebServer/AsyncTCP, ArduinoJson 7, Adafruit ADS1X15, SparkFun ICM-20948.
  • Two flash images: the firmware, and the web dashboard (data/) on LittleFS.
  • Settings live in NVS flash and are edited from the dashboard; include/config.h only holds pins and first-boot defaults.

Getting started

  1. Install PlatformIO (VS Code extension).
  2. Open SW/VESC CAN interface/ as a PlatformIO project.
  3. In VESC Tool: set up and detect the motor, set CAN ID / baud, enable CAN status messages 1, 4 and 5, set a sensible timeout and current/ERPM limits (details in the firmware README).
  4. Flash both images:
    text
    pio run --target upload     # firmware
    pio run --target uploadfs   # web dashboard
  5. Connect to WiFi Hiking-trailer (password trailerhiking), open http://192.168.4.1/, and change the password on the System tab.
  6. With the wheel off the ground: calibrate the pot (Pot Calibration tab), set the IMU upright zero (IMU tab), enter pole pairs / wheel diameter / gear ratio (System tab), then enable motor power and test.

Safety

This is a home-built motorised vehicle that moves on its own. The firmware's fail-safes are a backstop, not a guarantee:

  • Test with the wheel off the ground first, and again after every change.
  • Fit a physical emergency power cut-off for the VESC, independent of this controller.
  • Set conservative current/ERPM limits in the VESC itself — they apply whatever the controller sends.
  • Fall-detection thresholds are untuned defaults; verify them by hand before relying on them.
  • Change the default WiFi password.

Project status

Work in progress. Working: CAN control of the VESC, pot calibration, web dashboard, IMU, touchscreen. Still to verify on the real trailer: fall thresholds, the new fault detection, the touchscreen layout, and real wheel diameter / gear ratio. Ideas for later: live requested-vs-actual speed chart and data logging, hill hold, battery range estimate, GPS, lights.

Parts

108
QtyValueFootprintReferences
1710kΩPCM_JLCPCB:R_0402R1, R2, R3, R4, R5, R8, R19, R25, R28, R29, R30, R31, R32, R33, R34, R35 +1
124.7uFPCM_JLCPCB:C_0603C3, C4, C5, C6, C8, C19, C20, C21, C22, C23, C24, C32
82.2nFPCM_JLCPCB:C_0402C1, C2, C7, C10, C34, C35, C36, C37
82.2uFPCM_JLCPCB:C_0805C11, C12, C13, C14, C15, C16, C17, C18
4BM08B-GHS-TBT_LF__SN__N_Added comps:JST_BM08B-GHS-TBT_LF__SN__N_P1, P2, P3, P4
4H3V3L10BPCM_JLCPCB:D_DFN1006-2LD3, D4, D11, D12
4MountingHole_PadMountingHole:MountingHole_2.7mm_M2.5_PadH1, H2, H3, H4
3100kΩPCM_JLCPCB:R_0402R15, R16, R21
3100nFPCM_JLCPCB:C_0402C25, C33, C38
32.2uFPCM_JLCPCB:C_0402C29, C30, C31
322uFPCM_JLCPCB:C_1206C26, C27, C28
3RedPCM_JLCPCB:D_0603D2, D6, D10
21N4001WPCM_JLCPCB:D_SOD-123FLD8, D9
239kΩPCM_JLCPCB:R_0402R23, R24
25.1kΩPCM_JLCPCB:R_0402R12, R13
2Tactile Button, 160gfPCM_JLCPCB:SW_TS-1088-AR02016S1, S2
10ΩPCM_JLCPCB:R_0402R26
1120ΩPCM_JLCPCB:R_1206R27
115kΩPCM_JLCPCB:R_0402R11
11kΩPCM_JLCPCB:R_0402R7
12.4kΩPCM_JLCPCB:R_0402R20
1200ΩPCM_JLCPCB:R_0402R22
120kΩPCM_JLCPCB:R_0402R14
1510kΩPCM_JLCPCB:R_0402R10
156kΩPCM_JLCPCB:R_0402R17
18.2kΩPCM_JLCPCB:R_0402R18
18uH2-5ADownloded_footprints:IND-SMD_L6.0-W6.0L1
1ADS1115IDGSPackage_SO:TSSOP-10_3x3mm_P0.5mmU6
1AMS1117PCM_JLCPCB:SOT-223_L6.5-W3.5-P2.30-LS7.0-BRU2
1AMS1117PCM_JLCPCB:SOT-223-3_L6.5-W3.4-P2.30-LS7.0-BRU3
1AO3400APCM_JLCPCB:Q_SOT-23Q1
1BM14B-GHS-TBT_LF__SN__N_Connector_JST:JST_GH_BM14B-GHS-TBT_1x14-1MP_P1.25mm_VerticalJ3
1Conn_01x02_SocketConnector_PinHeader_1.27mm:PinHeader_1x02_P1.27mm_VerticalJ4
1Connector, USB-TYPE-C-16PPCM_JLCPCB:TYPE-C-SMD_HX-TYPE-C-16PINJ1
1ESP32-S3-WROOM-1-N16R8RF_Module:ESP32-S3-WROOM-1U1
1ICM-20948Sensor_Motion:InvenSense_QFN-24_3x3mm_P0.4mmU5
1Jumper_3_OpenJumper:SolderJumper-3_P1.3mm_Open_RoundedPad1.0x1.5mm_NumberLabelsJP1
1LMR38020SDDARAdded comps:SOIC127P600X170-9NIC1
1PKLCS1212E4001-R1Downloded_footprints:SPKR_PKLCS1212E4001-R1LS1
1SM06B-GHS-TB_LF__SN_Added comps:JST_SM06B-GHS-TB_LF__SN_J2
1SS110FPCM_JLCPCB:D_SMAFD7
1SS52CPCM_JLCPCB:D_SMCD5
1TJA1051T-3Package_SO:SOIC-8_3.9x4.9mm_P1.27mmU4
1YellowPCM_JLCPCB:D_0603D1

Questions

How big is the ESP32 VESC Controller PCB?

It measures 82.6 × 47.6 mm and has 4 copper layers, 1.6 mm thick.

What parts does the ESP32 VESC Controller use?

108 parts, built around the ESP32-S3-WROOM-1-N16R8, TJA1051T/3/1, ADS1115IDGS and AMS1117. 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 ESP32 VESC Controller KiCad files?

From the jawedhakimi/Hiking_trailer repository on GitHub, at the commit this page was made from: the board is HW/ESP32_VESC_controller/ESP32_VESC_Controller/ESP32_VESC_Controller.kicad_pcb and its schematic HW/ESP32_VESC_controller/ESP32_VESC_Controller/CAN_RS485.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the ESP32 VESC Controller design in my own project?

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

Similar boards

  • 4 layers66.9 × 66.9 mmTemp Monitor, the printed circuit board in 3D

    Temp Monitor

    Alex-C-EE/Reliable-Temp-Monitor

    A CAN Node designed to take temperature measurement from 3 analog-output sensors and control 2x 24V fans

    127 parts1
  • 2 layers84.5 × 43.8 mmControl v1.5, the printed circuit board in 3D

    Control v1.5

    miketrombley/Sole-Pod

    All things sole.

    50 parts
  • 4 layers100 × 100 mmLV Controller, the printed circuit board in 3D

    LV Controller

    MECSEM/electrical

    All the electrical designs for MECSEM.

    208 partsGPL-3.0
  • 4 layers95 × 78 mmSmart db, the printed circuit board in 3D

    Smart db

    c-lydia/SmartDB

    A distribution board system designed for automatic electrical fault monitoring using Digital Signal Processing (FFT analysis), Isolation Forest, and YOLO thermal imaging detection with a Mobile App, alerting system, and…

    82 partsApache-2.0
  • 2 layers49 × 67 mmCalliope mirror heater, the printed circuit board in 3D

    Calliope mirror heater

    openUC2/TechnicalDocs-openUC2-HoloBox

    This is the holographic box for openUC2

    67 parts5
  • 4 layers28.7 × 42.5 mmSquathero V1, the printed circuit board in 3D

    Squathero V1

    jasonbowman55/PCB_Design

    This repository will hold all of the necessary files for me to begin learning how to better design PCB boards, as well as project files for various PCB design projects.

    41 parts
  • 2 layers64.9 × 38.1 mmMSPM0L1105 Dev Board, the printed circuit board in 3D

    MSPM0L1105 Dev Board

    sarthakchikte0312/MSPM0L1105_Dev_Board

    Custom MSPM0L1105 development board designed in KiCad with USB, UART, SWD, and GPIO support.

    50 parts