Skip to the content
PCBKitNew board
2 layers52.7 × 40 mmLauryno torque controller, the printed circuit board in 3D

Lauryno torque controller

NyanCat42/torque_sensor_controller

This repository contains hardware and firmware for an ESP32-S3 based torque sensor controller that talks to a VESC over CAN bus.

Size
52.7 × 40 mm
Copper layers
2
Thickness
1.58 mm
Parts
35
Nets
54
Pads
156
Tracks, vias
200, 48
Pours
1
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
11 Apr 2026
Updated
26 May 2026

Overview

Lauryno torque controller is an open-source printed circuit board by NyanCat42, from the NyanCat42/torque_sensor_controller repository on GitHub. It is a 2-layer board of 52.7 × 40 mm with 35 parts on 54 nets, routed with 200 tracks and 48 vias.

It is built around the ESP32-S3-WROOM-1-N8, TJA1051T/3/1 and IRLML2502TRPBF, with the FM24CL16B-G among its other parts. Its parts include 13 resistors, 6 capacitors and 2 transistors. It belongs with the ESP32 boards of this library.

Main components

4

README

README.md

Torque Sensor Controller for VESC E-Bike Assist

This repository contains hardware and firmware for an ESP32-S3 based torque sensor controller that talks to a VESC over CAN bus.

The controller reads bottom bracket torque and cadence, computes an assist current target, and sends motor current commands to the VESC. It also tracks odometer data with FRAM-backed persistence and exposes a local web UI for status, tuning, and OTA firmware updates.

Features

  • Torque and cadence based pedal-assist control loop (10 ms period).
  • CAN communication to VESC at 500 kbit/s.
  • Odometer and speed tracking with persistent FRAM storage.
  • Wi-Fi station mode with fallback access point mode.
  • Embedded HTTP console for telemetry, runtime config, and calibration.
  • OTA firmware upload endpoint.
  • TCP bridge for VESC tool connectivity over Wi-Fi.

Repository Layout

  • lauryno_torque_controller_hardware/: KiCad schematic, PCB, and BOM.
  • lauryno_torque_controller_software/: PlatformIO firmware project.
  • documents/: reference documents, including torque sensor datasheet.
  • images/: board render and finished board photo.

Hardware

PCB render

Finished PCB

Hardware highlights:

  • ESP32-S3 module as main controller.
  • CAN transceiver interface to VESC.
  • FRAM storage for high-endurance persistent data.
  • 2 MOSFET outputs and a buck stage for front/rear LED lighting.

The PCB was designed to fit AISLER simple 2-layer constraints for low-cost fabrication.

Available hardware design artifacts:

Firmware Architecture

Main runtime modules:

  • PedalAssistManager: torque/cadence processing and motor current command generation.
  • VescCan: CAN transport and VESC status/current command handling.
  • OdometerManager: wheel pulse tracking, speed estimation, and persistence.
  • FramStorage: I2C FRAM read/write backend.
  • NetworkManager: station connect with timeout and fallback AP startup.
  • OtaHttpServer: web UI, REST endpoints, and OTA upload flow.
  • VescTcpBridge: optional TCP bridge (disabled by default).

Task model:

  • Pedal-assist control task on core 1.
  • Communication task (HTTP + TCP bridge update loop) on core 0.
  • Main loop polls CAN and updates odometer processing.

Quick Start

First flash has to be done over UART, later ones can be done OTA.

  1. Install PlatformIO CLI.
  2. Open terminal in lauryno_torque_controller_software/.
  3. Create a local platformio.secrets.ini (this file is git-ignored):
ini
[env:esp32-s3-devkitc-1]
build_flags =
	-DWIFI_STA_SSID=\"YOUR_WIFI_SSID\"
	-DWIFI_STA_PASSWORD=\"YOUR_WIFI_PASSWORD\"
  1. Build firmware:
bash
pio run -e esp32-s3-devkitc-1
  1. Upload over UART (pads at top left of board):
bash
pio run -e esp32-s3-devkitc-1 -t upload

First Boot Notes

  • Device tries configured Wi-Fi STA first, then falls back to AP mode if connection times out.
  • AP SSID format: TorqueCtrl-Setup-<chipid>.
  • mDNS host: lauryno-dviratis.local.
  • HTTP console runs on port 80.
  • VESC TCP bridge port: 65102 (can be toggled from API/UI).
  • Run pedal sensor zero calibration after installation using POST /api/pedal/calibrate_zero.

OTA Update

Firmware can be uploaded from the web UI or directly by HTTP multipart upload:

bash
curl -F "file=@.pio/build/esp32-s3-devkitc-1/firmware.bin" http://lauryno-dviratis.local/api/update

After a successful upload, the controller restarts automatically.

Configuration Baseline

Hardware pins:

  • CAN: TX GPIO 15, RX GPIO 7, 500000 bit/s.
  • Odometer hall input: GPIO 9.
  • FRAM I2C: SDA GPIO 6, SCL GPIO 5, base address 0x50.
  • Torque ADC input: GPIO 1.
  • Cadence input: GPIO 2.

VESC IDs:

  • Local controller 42, target controller 69 (make sure this matches the CAN ID of your VESC).

See lauryno_torque_controller_software/include/app_config.h for the full set of constants and limits.

Open-Source License

This project is licensed under CERN Open Hardware Licence Version 2 - Permissive (CERN-OHL-P-2.0).

See the repository LICENSE file for the project license notice and the official CERN-OHL-P v2 text reference.

References

Parts

35
QtyValueFootprintReferences
610kResistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR1, R4, R7, R8, R9, R12
40.1uCapacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolderC2, C4, C5, C6
3Conn_01x02_SocketConnector_JST:JST_XH_B2B-XH-A_1x02_P2.50mm_VerticalBattery1, LED1, LED2
215kResistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR10, R11
2220Resistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR5, R6
24.7kResistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR13, R14
2Conn_01x04_SocketConnector_JST:JST_XH_B4B-XH-A_1x04_P2.50mm_VerticalTorque_sensor1, VESC_coms1
2IRLML2502TRPBFPackage_TO_SOT_SMD:SOT-23_HandsolderingQ1, Q2
1120Resistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR2
11uCapacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolderC3
122uCapacitor_Tantalum_SMD:CP_EIA-3216-18_Kemet-A_HandSolderC7
1Conn_01x03_SocketConnector_JST:JST_XH_B3B-XH-A_1x03_P2.50mm_VerticalThrottle1
1Conn_01x04_PinConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalChineesium_60V_to_12V1
1Conn_01x04_SocketConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalFlashing_UART1
1Conn_01x05_SocketConnector_JST:JST_XH_B5B-XH-A_1x05_P2.50mm_VerticalVESC1
1ESP32-S3-WROOM-1RF_Module:ESP32-S3-WROOM-1UESP32
1FM24CL16BPackage_SO:SOIC-8_3.9x4.9mm_P1.27mmFRAM1
1LOGOLOGOG***
1SW_PushButton_Switch_SMD:SW_Push_SPST_NO_Alps_SKRKBoot1
1TJA1051T-3Package_SO:SOIC-8_3.9x4.9mm_P1.27mmCAN_chip1

Questions

How big is the Lauryno torque controller PCB?

It measures 52.7 × 40 mm and has 2 copper layers, 1.58 mm thick.

What parts does the Lauryno torque controller use?

35 parts, built around the ESP32-S3-WROOM-1-N8, TJA1051T/3/1, IRLML2502TRPBF and FM24CL16B-G. 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 Lauryno torque controller KiCad files?

From the NyanCat42/torque_sensor_controller repository on GitHub, at the commit this page was made from: the board is lauryno_torque_controller_hardware/lauryno_torque_controller.kicad_pcb and its schematic lauryno_torque_controller_hardware/lauryno_torque_controller.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Lauryno torque controller design in my own project?

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

Similar boards

  • 2 layers29.5 × 70.5 mmKey fob pcb, the printed circuit board in 3D

    Key fob pcb

    BenMartens15/reviveride-key-fob-pcb

    This repo contains the schematic and PCB for the key fob. The firmware for the key fob can be found here: https://github.com/BenMartens15/reviveride-key-fob-firmware

    27 parts1
  • 2 layers65 × 65 mmLte tracker, the printed circuit board in 3D

    Lte tracker

    MTalon63/localizator

    36 partsMIT
  • 2 layers156 × 66 mmDash 6.8, the printed circuit board in 3D

    Dash 6.8

    romioRN/Dash6.8-hardware

    wifi name "service", password 12345678, connect to 192.167.4.1

    152 parts11Apache-2.0
  • 2 layers37 × 70.9 mmOpendiag, the printed circuit board in 3D

    Opendiag

    maximus64/opendiag-hardware

    OpenDIAG - Open Source OBD2 Interface (Hardware)

    148 parts5CERN-OHL-S-2.0
  • 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 layers69 × 69 mmCooling Pump Board, the printed circuit board in 3D

    Cooling Pump Board

    byui-formula-hybrid/legacy-Cooling-Pump-Board

    BYUI Cooling pump CAN control board

    37 parts
  • 2 layers100 × 75 mmDankdryer, the printed circuit board in 3D

    Dankdryer

    dankamongmen/dankdryer

    the world's best filament dryer

    52 parts21Apache-2.0
  • 2 layers99.1 × 58.4 mmHEAT, the printed circuit board in 3D

    HEAT

    milar111/HEAT

    An open-source STM32 SMD assembly station for precision soldering. Uses a custom Smart Pulse & Coast algorithm to drive 400W mains heaters via SSR. Features OLED UI, NTC feedback, and safety cooling.

    57 parts9