From 816197bbdd884910bda9e80a54c9d0b62a2e079b Mon Sep 17 00:00:00 2001 From: osiu97 Date: Mon, 6 Jul 2026 19:37:54 +0200 Subject: [PATCH] migrate to c3 --- gemini.md | 10 +++++----- index.html | 2 +- platformio.ini | 7 ++++--- src/main.cpp | 18 +++++++++--------- web/js/sections/home.js | 2 +- wiring_diagram.md | 36 ++++++++++++++++++------------------ 6 files changed, 38 insertions(+), 37 deletions(-) diff --git a/gemini.md b/gemini.md index d6988c7..5ae05dc 100644 --- a/gemini.md +++ b/gemini.md @@ -22,12 +22,12 @@ only BLE between the ESP32 firmware and a local web SPA. | Component | Detail | |---|---| -| **MCU** | Waveshare ESP32-S3-Zero | +| **MCU** | Tenstar Robot ESP32-C3 Super Mini | | **Framework** | PlatformIO + Arduino core | | **Motors** | 2× 28BYJ-48 (unipolar stepper via ULN2003 driver) | | **Motor mode** | `AccelStepper::FULL4WIRE` — 2048 steps/rev | -| **Motor 1 pins** | IN1=4, IN2=5, IN3=6, IN4=7 | -| **Motor 2 pins** | IN1=8, IN2=9, IN3=10, IN4=11 | +| **Motor 1 pins** | IN1=0, IN2=1, IN3=3, IN4=4 | +| **Motor 2 pins** | IN1=5, IN2=6, IN3=7, IN4=10 | | **USB Serial** | Native USB CDC (`-D ARDUINO_USB_MODE=1 -D ARDUINO_USB_CDC_ON_BOOT=1`) | | **Default speed** | 600 steps/s, accel 100 steps/s² | @@ -105,9 +105,9 @@ Name: WijiBoard ## 4. Project Structure ``` -esp32s3-wiji/ +esp32c3-wiji/ ├── index.html # SPA shell — ES module bootstrap, sidebar, routing -├── platformio.ini # PlatformIO config (env: esp32-s3-devkitc-1) +├── platformio.ini # PlatformIO config (env: esp32-c3-devkitm-1) ├── fivebarIKGame.js # REFERENCE ONLY — original site's kinematics (do not import) ├── src/ │ └── main.cpp # ESP32 firmware (BLE + AccelStepper) diff --git a/index.html b/index.html index 23cbc51..427bda4 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ WijiBoard – Control Dashboard + content="WijiBoard SCARA arm control dashboard. Web Bluetooth interface for the ESP32-C3 stepper controller." /> diff --git a/platformio.ini b/platformio.ini index 8165b96..487d6eb 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1,10 +1,10 @@ ; PlatformIO Project Configuration -; Board: Waveshare ESP32-S3-Zero (or compatible ESP32-S3) +; Board: Tenstar Robot ESP32-C3 Super Mini (or compatible ESP32-C3) ; Project: WijiBoard – BLE SCARA Stepper Controller -[env:esp32-s3-devkitc-1] +[env:esp32-c3-devkitm-1] platform = espressif32 -board = esp32-s3-devkitc-1 +board = esp32-c3-devkitm-1 framework = arduino ; USB CDC on boot – Serial Monitor works over native USB @@ -13,6 +13,7 @@ build_flags = -D ARDUINO_USB_CDC_ON_BOOT=1 board_upload.flash_size = 4MB +board_build.flash_mode = dio board_build.partitions = default.csv ; Adjust to your COM port diff --git a/src/main.cpp b/src/main.cpp index 5364ba0..c8973d6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,7 +2,7 @@ * WijiBoard – BLE Stepper Controller Firmware * src/main.cpp * - * Board : Waveshare ESP32-S3-Zero (or compatible ESP32-S3) + * Board : Tenstar Robot ESP32-C3 Super Mini (or compatible ESP32-C3) * Steppers: Two 28BYJ-48 via ULN2003 (AccelStepper, FULL4WIRE mode) * * BLE Command Characteristic (WRITE_NR): @@ -35,16 +35,16 @@ // ─── Motor pin mapping (28BYJ-48 / ULN2003) ────────────────────── // Motor 1 – Shoulder -#define M1_IN1 4 -#define M1_IN2 5 -#define M1_IN3 6 -#define M1_IN4 7 +#define M1_IN1 0 +#define M1_IN2 1 +#define M1_IN3 3 +#define M1_IN4 4 // Motor 2 – Elbow -#define M2_IN1 8 -#define M2_IN2 9 -#define M2_IN3 10 -#define M2_IN4 11 +#define M2_IN1 5 +#define M2_IN2 6 +#define M2_IN3 7 +#define M2_IN4 10 // ─── Stepper constants ──────────────────────────────────────────── #define STEPS_PER_REV 2048 diff --git a/web/js/sections/home.js b/web/js/sections/home.js index 22e3d5a..78c0a6d 100644 --- a/web/js/sections/home.js +++ b/web/js/sections/home.js @@ -45,7 +45,7 @@ const HomeSection = {

This dashboard controls a two-arm SCARA robot that moves a planchette across a spirit board. It uses Web Bluetooth - to communicate with an ESP32-S3 running two 28BYJ-48 stepper motors + to communicate with an ESP32-C3 running two 28BYJ-48 stepper motors with AccelStepper.

diff --git a/wiring_diagram.md b/wiring_diagram.md index 35c7c0d..e3ce6c0 100644 --- a/wiring_diagram.md +++ b/wiring_diagram.md @@ -3,7 +3,7 @@ This document outlines the hardware connections for the WijiBoard. ## Hardware Components -- **Microcontroller**: Waveshare ESP32-S3-Zero +- **Microcontroller**: Tenstar Robot ESP32-C3 Super Mini - **Motors**: 2× 28BYJ-48 (5V Stepper Motors) - **Motor Drivers**: 2× ULN2003 Driver Boards - **Power System**: @@ -16,7 +16,7 @@ This document outlines the hardware connections for the WijiBoard. ## Power Connections The system is powered by a 4S LiPo battery. To protect the battery from over-discharge, it is connected to an **XH-M609** module. The output of the XH-M609 is split into two separate **Buck Regulators**, both tuned to output 5V. -1. **Buck Regulator 1 (MCU Power)**: Dedicated to powering the ESP32-S3-Zero. +1. **Buck Regulator 1 (MCU Power)**: Dedicated to powering the ESP32-C3 Super Mini. 2. **Buck Regulator 2 (Motor Power)**: Dedicated to powering both ULN2003 driver boards to prevent voltage drops or electrical noise from affecting the MCU. > [!IMPORTANT] @@ -26,35 +26,35 @@ The system is powered by a 4S LiPo battery. To protect the battery from over-dis | :--- | :--- | :--- | | **4S LiPo** | `BAT+` / `BAT-` | XH-M609 `VIN+` / `VIN-` | | **XH-M609** | `VOUT+` / `VOUT-` | Split to **IN+** and **IN-** on both Buck Regulators | -| **Buck 1 (MCU)** | `OUT+ (5V)` | ESP32-S3-Zero `5V` (used as power input) | -| **Buck 1 (MCU)** | `OUT- (GND)` | ESP32-S3-Zero `GND` | +| **Buck 1 (MCU)** | `OUT+ (5V)` | ESP32-C3 Super Mini `5V` (used as power input) | +| **Buck 1 (MCU)** | `OUT- (GND)` | ESP32-C3 Super Mini `GND` | | **Buck 2 (Motors)**| `OUT+ (5V)` | ULN2003 (M1) `+ / 5V` and ULN2003 (M2) `+ / 5V` | | **Buck 2 (Motors)**| `OUT- (GND)` | ULN2003 (M1) `- / GND` and ULN2003 (M2) `- / GND` | -| **ESP32-S3-Zero** | `GND` | Tie to the motor ground network (Common Ground) | +| **ESP32-C3 Super Mini** | `GND` | Tie to the motor ground network (Common Ground) | --- ## Motor 1 (Right Motor) Logic **Physical Location**: Right side (pivot at +12.9mm) -| ESP32-S3-Zero Pin | ULN2003 (Motor 1) Pin | +| ESP32-C3 Super Mini Pin | ULN2003 (Motor 1) Pin | | :--- | :--- | -| **GPIO 4** | `IN1` | -| **GPIO 5** | `IN2` | -| **GPIO 6** | `IN3` | -| **GPIO 7** | `IN4` | +| **GPIO 0** | `IN1` | +| **GPIO 1** | `IN2` | +| **GPIO 3** | `IN3` | +| **GPIO 4** | `IN4` | --- ## Motor 2 (Left Motor) Logic **Physical Location**: Left side (pivot at -12.9mm) -| ESP32-S3-Zero Pin | ULN2003 (Motor 2) Pin | +| ESP32-C3 Super Mini Pin | ULN2003 (Motor 2) Pin | | :--- | :--- | -| **GPIO 8** | `IN1` | -| **GPIO 9** | `IN2` | -| **GPIO 10** | `IN3` | -| **GPIO 11** | `IN4` | +| **GPIO 5** | `IN1` | +| **GPIO 6** | `IN2` | +| **GPIO 7** | `IN3` | +| **GPIO 10** | `IN4` | --- @@ -71,7 +71,7 @@ flowchart LR XHM609 -->|14.8V| BUCK2[Buck Regulator 2] end - BUCK1 -->|5V Power| ESP[ESP32-S3-Zero] + BUCK1 -->|5V Power| ESP[ESP32-C3 Super Mini] BUCK2 -->|5V Power| M1_Driver[ULN2003 M1] BUCK2 -->|5V Power| M2_Driver[ULN2003 M2] @@ -80,8 +80,8 @@ flowchart LR ESP -. Common Ground .- M2_Driver %% Logic Signals - ESP -- Pins 4,5,6,7 --> M1_Driver - ESP -- Pins 8,9,10,11 --> M2_Driver + ESP -- Pins 0,1,3,4 --> M1_Driver + ESP -- Pins 5,6,7,10 --> M2_Driver %% Motors M1_Driver == 5-wire cable ==> M1[Motor 1 - Right]