add more boards. Closes #8
This commit is contained in:
@@ -22,7 +22,7 @@ only BLE between the ESP32 firmware and a local web SPA.
|
||||
|
||||
| Component | Detail |
|
||||
|---|---|
|
||||
| **MCU** | Tenstar Robot ESP32-C3 Super Mini |
|
||||
| **MCU** | Tenstar Robot ESP32-C3 Super Mini (also supports ESP32-S3 and ESP32-WROOM) |
|
||||
| **Framework** | PlatformIO + Arduino core |
|
||||
| **Motors** | 2× 28BYJ-48 (unipolar stepper via ULN2003 driver) |
|
||||
| **Motor mode** | `AccelStepper::HALF4WIRE` — 4096 steps/rev |
|
||||
|
||||
+28
-14
@@ -1,28 +1,42 @@
|
||||
; PlatformIO Project Configuration
|
||||
; Board: Tenstar Robot ESP32-C3 Super Mini (or compatible ESP32-C3)
|
||||
; Project: WijiBoard – BLE SCARA Stepper Controller
|
||||
|
||||
[env:esp32-c3-devkitm-1]
|
||||
[env]
|
||||
platform = espressif32
|
||||
board = esp32-c3-devkitm-1
|
||||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
upload_protocol = esptool
|
||||
lib_deps =
|
||||
; AccelStepper for smooth, non-blocking stepper control
|
||||
waspinator/AccelStepper @ ^1.64
|
||||
|
||||
; USB CDC on boot – Serial Monitor works over native USB
|
||||
; ---------------------------------------------------------
|
||||
; Board 1: ESP32-C3 Super Mini (Original)
|
||||
; ---------------------------------------------------------
|
||||
[env:esp32-c3-devkitm-1]
|
||||
board = esp32-c3-devkitm-1
|
||||
build_flags =
|
||||
-D BOARD_ESP32_C3
|
||||
-D ARDUINO_USB_MODE=1
|
||||
-D ARDUINO_USB_CDC_ON_BOOT=1
|
||||
-D STATUS_LED_PIN=8
|
||||
-D STATUS_LED_ON=LOW
|
||||
-D STATUS_LED_OFF=HIGH
|
||||
|
||||
board_upload.flash_size = 4MB
|
||||
board_build.flash_mode = dio
|
||||
board_build.partitions = default.csv
|
||||
|
||||
; Adjust to your COM port
|
||||
monitor_speed = 115200
|
||||
upload_protocol = esptool
|
||||
; ---------------------------------------------------------
|
||||
; Board 2: ESP32-S3 (e.g. DevKitC)
|
||||
; ---------------------------------------------------------
|
||||
[env:esp32s3]
|
||||
board = esp32-s3-devkitc-1
|
||||
build_flags =
|
||||
-D BOARD_ESP32_S3
|
||||
-D ARDUINO_USB_MODE=1
|
||||
-D ARDUINO_USB_CDC_ON_BOOT=1
|
||||
|
||||
lib_deps =
|
||||
; AccelStepper for smooth, non-blocking stepper control
|
||||
waspinator/AccelStepper @ ^1.64
|
||||
; ---------------------------------------------------------
|
||||
; Board 3: ESP32 WROOM (e.g. NodeMCU / DevKit V1)
|
||||
; ---------------------------------------------------------
|
||||
[env:esp32dev]
|
||||
board = esp32dev
|
||||
build_flags =
|
||||
-D BOARD_ESP32_WROOM
|
||||
|
||||
+59
-10
@@ -2,17 +2,66 @@
|
||||
#include <Arduino.h>
|
||||
|
||||
// ─── Motor pin mapping (28BYJ-48 / ULN2003) ──────────────────────
|
||||
// Motor 1 – Shoulder
|
||||
#define M1_IN1 0
|
||||
#define M1_IN2 1
|
||||
#define M1_IN3 3
|
||||
#define M1_IN4 4
|
||||
#if defined(BOARD_ESP32_C3)
|
||||
// ESP32-C3 Super Mini
|
||||
// Motor 1 – Shoulder
|
||||
#define M1_IN1 0
|
||||
#define M1_IN2 1
|
||||
#define M1_IN3 3
|
||||
#define M1_IN4 4
|
||||
|
||||
// Motor 2 – Elbow
|
||||
#define M2_IN1 5
|
||||
#define M2_IN2 6
|
||||
#define M2_IN3 7
|
||||
#define M2_IN4 10
|
||||
// Motor 2 – Elbow
|
||||
#define M2_IN1 5
|
||||
#define M2_IN2 6
|
||||
#define M2_IN3 7
|
||||
#define M2_IN4 10
|
||||
|
||||
// LED
|
||||
#define STATUS_LED_PIN 8
|
||||
#define STATUS_LED_ON LOW
|
||||
#define STATUS_LED_OFF HIGH
|
||||
|
||||
#elif defined(BOARD_ESP32_S3)
|
||||
// ESP32-S3
|
||||
// Motor 1 – Shoulder
|
||||
#define M1_IN1 4
|
||||
#define M1_IN2 5
|
||||
#define M1_IN3 6
|
||||
#define M1_IN4 7
|
||||
|
||||
// Motor 2 – Elbow
|
||||
#define M2_IN1 15
|
||||
#define M2_IN2 16
|
||||
#define M2_IN3 17
|
||||
#define M2_IN4 18
|
||||
|
||||
// LED
|
||||
#define STATUS_LED_PIN 2
|
||||
#define STATUS_LED_ON HIGH
|
||||
#define STATUS_LED_OFF LOW
|
||||
|
||||
#elif defined(BOARD_ESP32_WROOM)
|
||||
// ESP32-WROOM (DevKit V1)
|
||||
// Motor 1 – Shoulder
|
||||
#define M1_IN1 13
|
||||
#define M1_IN2 14
|
||||
#define M1_IN3 27
|
||||
#define M1_IN4 26
|
||||
|
||||
// Motor 2 – Elbow
|
||||
#define M2_IN1 25
|
||||
#define M2_IN2 33
|
||||
#define M2_IN3 32
|
||||
#define M2_IN4 23
|
||||
|
||||
// LED
|
||||
#define STATUS_LED_PIN 2
|
||||
#define STATUS_LED_ON HIGH
|
||||
#define STATUS_LED_OFF LOW
|
||||
|
||||
#else
|
||||
#error "No board defined! Please set a board environment in platformio.ini."
|
||||
#endif
|
||||
|
||||
// ─── Stepper constants ────────────────────────────────────────────
|
||||
#define STEPS_PER_REV 4096
|
||||
|
||||
@@ -61,6 +61,24 @@ The system is powered by a 4S LiPo battery. To protect the battery from over-dis
|
||||
## Stepper to Driver Connections
|
||||
Simply plug the white 5-pin JST connectors from the 28BYJ-48 motors into the corresponding white sockets on their respective ULN2003 driver boards. The connector is keyed and only fits one way.
|
||||
|
||||
---
|
||||
|
||||
## Alternative Board Pinouts
|
||||
|
||||
The project supports multiple ESP32 variants. The main tables above show the default ESP32-C3 Super Mini. If you are using a different board, follow these logic connections:
|
||||
|
||||
### ESP32-S3 (e.g. DevKitC)
|
||||
| Motor | IN1 | IN2 | IN3 | IN4 |
|
||||
| :--- | :--- | :--- | :--- | :--- |
|
||||
| **Motor 1 (Right)** | GPIO 4 | GPIO 5 | GPIO 6 | GPIO 7 |
|
||||
| **Motor 2 (Left)** | GPIO 15 | GPIO 16 | GPIO 17 | GPIO 18 |
|
||||
|
||||
### ESP32-WROOM (e.g. NodeMCU / DevKit V1)
|
||||
| Motor | IN1 | IN2 | IN3 | IN4 |
|
||||
| :--- | :--- | :--- | :--- | :--- |
|
||||
| **Motor 1 (Right)** | GPIO 13 | GPIO 14 | GPIO 27 | GPIO 26 |
|
||||
| **Motor 2 (Left)** | GPIO 25 | GPIO 33 | GPIO 32 | GPIO 23 |
|
||||
|
||||
## Schematic Overview
|
||||
|
||||
```mermaid
|
||||
|
||||
Reference in New Issue
Block a user