← Home
Docs/Software/Wireless Setup & Rules

Wireless Setup & Competition Rules

The EVDrive board supports Bluetooth Low Energy (BLE) so you can wirelessly send target distances, view live sensor readings, and tune your car from a phone or laptop.


1. CRITICAL: Wireless Must Be OFF During Competition

WARNING: Science Olympiad rules strictly prohibit any active wireless communication (Bluetooth, Wi-Fi, radio, etc.) during vehicle impound and competition runs. If your vehicle transmits any wireless signal during inspection or runs, you risk immediate disqualification.

How to use wireless safely:

  1. In the pits / during practice: Turn the hardware wireless switch ON. Connect via Bluetooth, send your target distance and time parameters, and test your code.
  2. Before impound / official runs: Flip the hardware wireless switch OFF.
  3. Press the Reset Button: If your firmware only checks the wireless switch once inside setup(), you must push the RESET button after flipping the switch so the board reboots with wireless completely disabled!
  4. Check the Wireless LED (D1): The LED wired to GPIO 16 should be completely OFF. If the wireless LED is on, your Bluetooth radio is still broadcasting!

2. Bluetooth vs Wi-Fi

The ESP32-S3 supports both Bluetooth Low Energy (BLE) and 2.4GHz Wi-Fi:

  • Why Bluetooth is recommended: Bluetooth connects directly from Google Chrome or Microsoft Edge using the Web Bluetooth API. You do not need to switch Wi-Fi networks, connect to an access point, or type in local IP addresses in a crowded gym.
  • Wi-Fi: You can set up an ESP32 web server if you prefer, but BLE is lighter and faster.

3. Super Tiny ESP32 Bluetooth Example

Here is a minimal snippet that starts BLE, listens to the hardware switch, and sends a test message to the dashboard:

cpp
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>

const int PIN_WL_SW  = 15; // Hardware switch (LOW when ON)
const int PIN_WL_LED = 16; // Wireless indicator LED (D1)

#define SERVICE_UUID "19b10000-e8f2-537e-4f6c-d104768a1214"
#define STATUS_UUID  "19b10001-e8f2-537e-4f6c-d104768a1214"

BLECharacteristic* statusChar = nullptr;

void setup() {
  pinMode(PIN_WL_SW, INPUT_PULLUP);
  pinMode(PIN_WL_LED, OUTPUT);

  // Check physical wireless switch
  bool wirelessOn = (digitalRead(PIN_WL_SW) == LOW);
  digitalWrite(PIN_WL_LED, wirelessOn ? HIGH : LOW);

  // Only start Bluetooth if the physical switch is ON!
  if (wirelessOn) {
    BLEDevice::init("SciolyEV");
    BLEServer* server = BLEDevice::createServer();
    BLEService* service = server->createService(SERVICE_UUID);

    statusChar = service->createCharacteristic(
      STATUS_UUID,
      BLECharacteristic::PROPERTY_NOTIFY
    );
    statusChar->addDescriptor(new BLE2902());

    service->start();
    BLEDevice::getAdvertising()->addServiceUUID(SERVICE_UUID);
    BLEDevice::startAdvertising();
  }
}

void loop() {
  // Send a quick message to the dashboard every 2 seconds if wireless is on
  if (statusChar != nullptr) {
    statusChar->setValue("STATUS:Hello World!");
    statusChar->notify();
    delay(2000);
  }
}

4. Safety Warning Alarm

If you want to make sure you never accidentally start an official competition run with wireless still enabled, add this quick check to your start sequence:

cpp
// If start button is pressed while wireless is still ON, beep and flash!
if (digitalRead(PIN_START_BTN) == LOW && digitalRead(PIN_WL_SW) == LOW) {
  // Flash wireless LED and warn the user
  for (int i = 0; i < 3; i++) {
    digitalWrite(PIN_WL_LED, LOW);
    beep(1500, 200);
    digitalWrite(PIN_WL_LED, HIGH);
    delay(100);
  }
  // Do not launch the run until wireless is switched off!
  return;
}

5. Web Dashboard

To receive notifications and send parameters from your browser, see the Web Bluetooth & Telemetry guide.