Remote Control Circuit Inquiry

1:57

Accessing knowledge base.

Checking if I can make the changes for you.

Net Connections to be added

Table


NetConnections
Net 14U1:D25, J4:Pin_1, U5:1A
Net 15U1:D26, J4:Pin_2, U5:2A
Net 65U1:D27, J4:Pin_3, U5:3A
Net 30U1:D14, J4:Pin_4, U5:4A
Below is a minimal Arduino BLE sketch you can flash to U1. It exposes two writable characteristics for left and right motor commands (signed values −100 to +100). It drives the L293D inputs on the four assigned pins.

Cpp


// Minimal BLE control for two DC motors via L293D on ESP32
// Motor A: U5 1A/2A -> D25/D26
// Motor B: U5 3A/4A -> D27/D14

#include 
#include 
#include 
#include 

#define M1_IN1 25  // U5:1A -> U1:D25 (Net 14)
#define M1_IN2 26  // U5:2A -> U1:D26 (Net 15)
#define M2_IN1 27  // U5:3A -> U1:D27 (Net 65)
#define M2_IN2 14  // U5:4A -> U1:D14 (Net 30)

// LEDC PWM setup
const int freq = 20000; // 20 kHz, above audible for most motors
const int res  = 8;     // 8-bit
const int ch1  = 0;
const int ch2  = 1;
const int ch3  = 2;
const int ch4  = 3;

// BLE UUIDs (random example UUIDs)
#define SVC_UUID  "6e400001-b5a3-f393-e0a9-e50e24dcca9e"
#define M1_UUID   "6e400002-b5a3-f393-e0a9-e50e24dcca9e" // write: -100..100
#define M2_UUID   "6e400003-b5a3-f393-e0a9-e50e24dcca9e" // write: -100..100

BLEServer* server;
BLECharacteristic* m1Char;
BLECharacteristic* m2Char;

int8_t clampCmd(int v) {
  if (v   100) v =  100;
  return (int8_t)v;
}

void driveMotor(int8_t cmd, int pwmFwdChan, int pwmRevChan, int revPin) {
  // cmd  reverse, cmd > 0 => forward
  int duty = map(abs(cmd), 0, 100, 0, 255);
  if (cmd > 0) {
    // forward: FWD PWM, REV low
    ledcWrite(pwmFwdChan, duty);
    ledcWrite(pwmRevChan, 0);
    // make sure the opposite GPIO is driven low
    // (LEDC holds pin low with duty 0, but set pinMode OUTPUT for safety)
  } else if (cmd getValue();
    if (value.empty()) return;

    // Expect 1-byte signed int (-100..100)
    int8_t cmd = (int8_t)value[0];
    cmd = clampCmd(cmd);

    if (c == m1Char) {
      // Motor A: M1_IN1 forward, M1_IN2 reverse
      driveMotor(cmd, ch1, ch2, M1_IN2);
    } else if (c == m2Char) {
      // Motor B: M2_IN1 forward, M2_IN2 reverse
      driveMotor(cmd, ch3, ch4, M2_IN2);
    }
  }
};

void setupPWM() {
  ledcSetup(ch1, freq, res);
  ledcSetup(ch2, freq, res);
  ledcSetup(ch3, freq, res);
  ledcSetup(ch4, freq, res);

  ledcAttachPin(M1_IN1, ch1);
  ledcAttachPin(M1_IN2, ch2);
  ledcAttachPin(M2_IN1, ch3);
  ledcAttachPin(M2_IN2, ch4);

  // Ensure all low at boot
  ledcWrite(ch1, 0);
  ledcWrite(ch2, 0);
  ledcWrite(ch3, 0);
  ledcWrite(ch4, 0);
}

void setupBLE() {
  BLEDevice::init("ESP32-RC-Car");
  server = BLEDevice::createServer();

  BLEService* svc = server->createService(SVC_UUID);

  m1Char = svc->createCharacteristic(M1_UUID, BLECharacteristic::PROPERTY_WRITE);
  m2Char = svc->createCharacteristic(M2_UUID, BLECharacteristic::PROPERTY_WRITE);

  m1Char->setCallbacks(new WriteCallbacks());
  m2Char->setCallbacks(new WriteCallbacks());

  svc->start();
  BLEAdvertising* adv = BLEDevice::getAdvertising();
  adv->addServiceUUID(SVC_UUID);
  BLEDevice::startAdvertising();
}

void setup() {
  // Pins to outputs (LEDC will manage level)
  pinMode(M1_IN1, OUTPUT);
  pinMode(M1_IN2, OUTPUT);
  pinMode(M2_IN1, OUTPUT);
  pinMode(M2_IN2, OUTPUT);

  setupPWM();
  setupBLE();
}

void loop() {
  // Nothing here; motor commands arrive via BLE writes
}
How to test from your phone
  • Install nRF Connect (iOS/Android).
  • Connect to “ESP32-RC-Car”.
  • Write a single signed byte to the M1 and M2 characteristics:
    • 50 = forward half speed, -50 = reverse half, 0 = stop.
  • If motors spin in the opposite direction, swap the two inputs for that motor in software (flip the sign) or swap the two wires at the motor.
171 days

To get started, talk to Flux or create a New Document.

Documents

    Documents are markdown text files which describe project goals, capture details, or even simulation outputs.

    Assets

    No assets added.

    ESP32 RC Car only schema

    ESP32 RC Car only schema thumbnail
    Template for ESP32 DEV KIT V1 #template #project-template #esp32 #microcontrollers

    Properties

    Properties describe core aspects of the project.

    Pricing & Availability

    Distributor

    Qty 1

    Arrow

    $19.60–$22.22

    Digi-Key

    $34.21–$34.92

    LCSC

    $17.22–$21.20

    Mouser

    $34.82

    Verical

    $21.16–$33.30

    Controls