# ESP32 Lathe Retrofit Controller
## Description
Welcome to your new project. Imagine what you can build here.
## Project Details
- **Owner:** hassan75
- **Created:** 4/2/2026
- **Last Updated:** 4/2/2026
- **Visibility:** Public
- **System Architecture:** flowchart TD
A[12V Input] --> B[Reverse Polarity Protection]
B --> C[5V Buck Regulator]
C --> D[3.3V LDO]
B --> E[Stepper Driver 1]
B --> F[Stepper Driver 2]
D --> G[ESP32 WROOM]
D --> H[Vibration Sensor]
D --> I[SSD1306 OLED]
G --> E
G --> F
G --> H
G --> I
- **Implementation Details:** Industrial lathe retrofit controller with protected 12V input, 5V buck, 3.3V logic rail, ESP32-WROOM control, dual stepper drivers, vibration sensing, and SSD1306 display. Use 4-layer PCB with continuous ground plane on Layer 2, segregated high-current motor/power region from quiet logic/sensor region, compact switching loops, short decoupling paths, and copper heat spreading under motor drivers.
## Key Components
### D1 — [SM6T12A](https://www.flux.ai/jecstronic/sm6t12a~mln.md)
- License: https://creativecommons.org/licenses/by/4.0/
- Package: SMB
- Part Type: Diode
- Role: TVS Protection
- Datasheet URL: https://www.mouser.com/datasheet/2/389/sm6t100a-1916590.pdf
- Role Details: 12V input surge suppressor from VIN_12V_RAW to GND
- Manufacturer Part Number: SM6T12A
- Manufacturer Name: STMicroelectronics
**Pins:**
- A [pin 2]
- K [pin 1]
### F1 — [1812L200/12DR](https://www.flux.ai/jecstronic/1812l20012dr~98l.md)
- Manufacturer Name: Littelfuse Inc.
- Package: 1812
- Manufacturer Part Number: 1812L200/12DR
- Current Rating: 2A
- Role Details: Resettable inline protection on 12V input before reverse polarity MOSFET
- Role: Fuse
- Part Type: Fuse
- License: https://creativecommons.org/licenses/by/4.0/
- Datasheet URL: https://www.littelfuse.com/~/media/electronics/datasheets/resettable_ptcs/littelfuse_ptc_1812l_datasheet.pdf.pdf
**Pins:**
- P1 [pin 1]
- P2 [pin 2]
### J1 — [61300411121](https://www.flux.ai/adrian95/61300411121~pw9.md)
- Manufacturer Name: Wurth Elektronik
- Manufacturer Part Number: 61300411121
- License: https://creativecommons.org/licenses/by/4.0/
- Role: Programming Header
- Package: THT 1x4 2.54mm
- Package or Case Code: HDRV4W95P0X254_1X4_1016X254X854P
- Datasheet URL: https://www.we-online.com/components/products/datasheet/61300411121.pdf
- Role Details: UART programming and debug header with GND TX RX 3.3V
- Part Type: Connector
**Pins:**
- 1 [pin 1]
- 2 [pin 2]
- 3 [pin 3]
- 4 [pin 4]
### J2 — [282837-4](https://www.flux.ai/adrian95/282837-4~o7p.md)
- License: https://creativecommons.org/licenses/by/4.0/
- Package: THT 4-pos 5.08mm
- Datasheet URL: https://www.te.com/usa-en/product-282837-4.datasheet.pdf
- Role: Motor Connector
- Manufacturer Name: TE Connectivity AMP Connectors
- Role Details: 4-wire stepper motor field wiring connector
- Manufacturer Part Number: 282837-4
- Part Type: Connector
**Pins:**
- 1 [pin 1]
- 2 [pin 2]
- 3 [pin 3]
- 4 [pin 4]
### J3 — [282837-4](https://www.flux.ai/adrian95/282837-4~o7p.md)
- Datasheet URL: https://www.te.com/usa-en/product-282837-4.datasheet.pdf
- License: https://creativecommons.org/licenses/by/4.0/
- Role Details: 4-wire stepper motor field wiring connector
- Manufacturer Part Number: 282837-4
- Role: Motor Connector
- Part Type: Connector
- Manufacturer Name: TE Connectivity AMP Connectors
- Package: THT 4-pos 5.08mm
**Pins:**
- 1 [pin 1]
- 2 [pin 2]
- 3 [pin 3]
- 4 [pin 4]
### OLED1 — [OLED 128 x 64 0.96inch](https://www.flux.ai/lmiller/oled-128-x-64-0p96inch~gt.md)
- Part Type: Display Device
- Package: Module
- Role: Display
- Operating Voltage: 3.3V
- Role Details: SSD1306 I2C OLED status and control display
**Pins:**
- 5V [pin 2]
- GND [pin 1]
- SCL [pin 3]
- SDA [pin 4]
### Q1 — [DMP3013SFV](https://www.flux.ai/kicad-part-library/dmp3013sfv~5bo.md)
- Package: PowerDI3333-8
- Role Details: P-channel MOSFET ideal-diode style reverse polarity protection on 12V input
- Manufacturer Part Number: DMP3013SFV
- Package or Case Code: Diodes_PowerDI3333-8
- Role: Reverse Protection
- Datasheet URL: https://www.diodes.com/assets/Datasheets/DMP3013SFV.pdf
**Pins:**
- D [pin 5]
- G [pin 4]
- S [pin 1]
- S [pin 3]
- S [pin 2]
### Q2 — [DRV8825PWPR](https://www.flux.ai/cherepanyadima/drv8825pwpr~9u.md)
- Symbol Style: Parametric
- Role: Stepper Driver
- Manufacturer Name: Texas Instruments
- Package: HTSSOP-28
- Role Details: Bipolar stepper motor driver channel with current regulation
- Manufacturer Part Number: DRV8825PWPR
- Part Type: Transistors
- Datasheet URL: ti.com/general/docs/suppproductinfo.tsp?distId=10&gotoUrl=https%3A%2F%2Fwww.ti.com%2Flit%2Fgpn%2Fdrv8825
**Pins:**
- AOUT1 [pin 5]
- AOUT2 [pin 7]
- AVREF [pin 12]
- BOUT1 [pin 10]
- BOUT2 [pin 8]
- BVREF [pin 13]
- CP1 [pin 1]
- CP2 [pin 2]
- DECAY [pin 19]
- DIR [pin 20]
- GND [pin 28]
- GND [pin 14]
- ISENA [pin 6]
- ISENB [pin 9]
- MODE0 [pin 24]
- MODE1 [pin 25]
- MODE2 [pin 26]
- N\R\E\S\E\T\\ [pin 16]
- NENBL [pin 21]
- NFAULT [pin 18]
- NHOME [pin 27]
- NSLEEP [pin 17]
- STEP [pin 22]
- V3P3OUT [pin 15]
- VCP [pin 3]
- VMA [pin 4]
- VMB [pin 11]
### Q3 — [DRV8825PWPR](https://www.flux.ai/cherepanyadima/drv8825pwpr~9u.md)
- Manufacturer Name: Texas Instruments
- Role Details: Bipolar stepper motor driver channel with current regulation
- Symbol Style: Parametric
- Manufacturer Part Number: DRV8825PWPR
- Role: Stepper Driver
- Part Type: Transistors
- Datasheet URL: ti.com/general/docs/suppproductinfo.tsp?distId=10&gotoUrl=https%3A%2F%2Fwww.ti.com%2Flit%2Fgpn%2Fdrv8825
- Package: HTSSOP-28
**Pins:**
- AOUT1 [pin 5]
- AOUT2 [pin 7]
- AVREF [pin 12]
- BOUT1 [pin 10]
- BOUT2 [pin 8]
- BVREF [pin 13]
- CP1 [pin 1]
- CP2 [pin 2]
- DECAY [pin 19]
- DIR [pin 20]
- GND [pin 28]
- GND [pin 14]
- ISENA [pin 6]
- ISENB [pin 9]
- MODE0 [pin 24]
- MODE1 [pin 25]
- MODE2 [pin 26]
- N\R\E\S\E\T\\ [pin 16]
- NENBL [pin 21]
- NFAULT [pin 18]
- NHOME [pin 27]
- NSLEEP [pin 17]
- STEP [pin 22]
- V3P3OUT [pin 15]
- VCP [pin 3]
- VMA [pin 4]
- VMB [pin 11]
### U1 — [KF128-5.08-2P-AA](https://www.flux.ai/lcsc/kf128-5p08-2p-aa~0pbi.md)
- Operating Temperature: -40℃~+105℃
- LCSC Part Number: C474952
- Datasheet URL: https://storage.googleapis.com/graviton-electric-symbols/document_assets/lcsc/2408211511_Cixi-Kefa-Elec-KF128-5-08-2P-AA_C474952.pdf
- Manufacturer Part Number: KF128-5.08-2P-AA
- Role: Power Input
- Connector Positions: 2
- Connector Type: Screw terminal
- Part Type: Screw terminal
- Role Details: 12V DC input terminal for industrial field wiring
- Connector Pitch: 5.08mm
- JLCPCB Part Class: Extended Part
- Package: THT
- Package or Case Code: CONN-TH_P5.08_KF128-5.08-2P
- Connector Rows: 1
- Connector Gender: Female
- Manufacturer Name: KEFA(科发)
- Current Rating: 24A
- Product Info Url: https://lcsc.com/product-detail/New-Quadratic-Unclassified-Data_Cixi-Kefa-Elec-KF128-5-08-2P_C474952.html
**Pins:**
- 1 [pin 1]
- 2 [pin 2]
### U2 — [LMR50410Y5FQDBVRQ1](https://www.flux.ai/adrian95/lmr50410y5fqdbvrq1~tdn.md)
- Role: Buck Regulator
- Part Type: Integrated Circuit
- Manufacturer Part Number: LMR50410Y5FQDBVRQ1
- Manufacturer Name: Texas Instruments
- Datasheet URL: https://www.ti.com/lit/ds/symlink/lmr50410-q1.pdf
- Role Details: Primary 12V to 5V conversion for logic and display power
- License: https://creativecommons.org/licenses/by/4.0/
- Package: SOT-23-6
**Pins:**
- CB [pin 1]
- EN [pin 4]
- FB [pin 3]
- GND [pin 2]
- SW [pin 6]
- VIN [pin 5]
### U3 — [AP2112K-3.3TRG1](https://www.flux.ai/adrian95/ap2112k-33trg1~zlq.md)
- Part Type: Integrated Circuit
- License: https://creativecommons.org/licenses/by/4.0/
- Role: LDO
- Role Details: 5V to 3.3V low-noise regulation for ESP32 and sensors
- Datasheet URL: https://www.diodes.com/assets/Datasheets/AP2112.pdf
- Manufacturer Part Number: AP2112K-3.3TRG1
- Package: SOT-25
- Manufacturer Name: Diodes Incorporated
**Pins:**
- EN [pin 3]
- GND [pin 2]
- NC [pin 4]
- VIN [pin 1]
- VOUT [pin 5]
### U4 — [ESP32-WROOM-32](https://www.flux.ai/vasyl/esp32-wroom-32~siz.md)
- Datasheet URL: https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32_datasheet_en.pdf
- Role Details: Main control MCU for lathe retrofit automation
- Part Type: RF module
- Manufacturer Name: Espressif Systems
- Manufacturer Part Number: ESP32-WROOM-32
- Package: Module
- Role: MCU
**Pins:**
- EN [pin 3]
- GND [pin 38]
- GND [pin 39]
- GND [pin 1]
- GND [pin 15]
- IO0 [pin 25]
- IO12 [pin 14]
- IO13 [pin 16]
- IO14 [pin 13]
- IO15 [pin 23]
- IO16 [pin 27]
- IO17 [pin 28]
- IO18 [pin 30]
- IO19 [pin 31]
- IO2 [pin 24]
- IO21 [pin 33]
- IO22 [pin 36]
- IO23 [pin 37]
- IO25 [pin 10]
- IO26 [pin 11]
- IO27 [pin 12]
- IO32 [pin 8]
- IO33 [pin 9]
- IO34 [pin 6]
- IO35 [pin 7]
- IO4 [pin 26]
- IO5 [pin 29]
- NC [pin 32]
- RXD0/IO3 [pin 34]
- SCK/CLK [pin 20]
- SCS/CMD [pin 19]
- SDI/SD1 [pin 22]
- SDO/SD0 [pin 21]
- SENSOR_VN [pin 5]
- SENSOR_VP [pin 4]
- SHD/SD2 [pin 17]
- SWP/SD3 [pin 18]
- TXD0/IO1 [pin 35]
- VDD [pin 2]
### U5 — [mpu6050 6DOF](https://www.flux.ai/jecstronic/mpu6050-6dof~ahh.md)
- Operating Voltage: 3.3V
- Manufacturer Part Number: mpu6050 6DOF
- License: https://creativecommons.org/licenses/by/4.0/
- Part Type: module
- Package: Module
- Datasheet URL: https://www.mouser.com/datasheet/2/737/mpu6050_6_dof_accelerometer_and_gyro-2489019.pdf
- Role Details: MPU6050 I2C IMU replacing LSM6DS3
- Role: Vibration Sensor
- Manufacturer Name: Adafruit Industries
**Pins:**
- 3Vo
- AD0
- CLKN
- FSYNC_IN
- GND
- GND
- INT
- SCL
- SCL_EXT
- SDA
- SDA_EXT
- VIN
*The full schematic, PCB layout, bill of materials, and interactive design are available at [https://www.flux.ai/hassan75/esp32-lathe-retrofit-controller~3v](https://www.flux.ai/hassan75/esp32-lathe-retrofit-controller~3v).*
---
*Generated from [https://www.flux.ai/hassan75/esp32-lathe-retrofit-controller~3v](https://www.flux.ai/hassan75/esp32-lathe-retrofit-controller~3v)*