The Makerville Badge

The Makerville Badge

Winging it.

Made an API endpoint to set RGB color

void handleRGB(AsyncWebServerRequest *request)
{
  Serial.println("request on /rgb");
  String R = request->arg("R");
  String G = request->arg("G");
  String B = request->arg("B");
  pixel.setPixelColor(0, pixel.Color(R.toInt(), G.toInt(), B.toInt())); // Set to green
  pixel.show();                                                         // Set pixel
  request->send(200, "text/plain", "OK");
}

server.on("/rgb", HTTP_GET, handleRGB);

The Makerville ESP32 Badge

Mutliplication tables

Made an API endpoint to update text

void handleSetText(AsyncWebServerRequest *request)
{
  if (request->hasArg("text"))
  {
    String textArg = request->arg("text");
    displayText = textArg;
  }
  request->send(200, "text/plain", "OK");
}

void scrollOn(AsyncWebServerRequest *request)
{
  scrolling = true;
  request->send(200, "text/plain", "OK");
}

  server.on("/text", HTTP_GET, handleSetText);
  server.on("/scrollOn", HTTP_GET, scrollOn);
  server.on("/scrollOff", HTTP_GET, scrollOff);

Objectives

  • test BLE
  • Set text on the OLED with the existing firmware
  • host a web server running visual programming on this, and make a wifi endpoint to set badge text.

Simple Python app to scan BLE

# ble_scanner.py
# pip install bleak
import asyncio
from bleak import BleakScanner

async def scan_ble_devices():
    """
    Scans for Bluetooth Low Energy devices and prints their details.
    """
    try:
        devices = await BleakScanner.discover(timeout=5.0)

        if not devices:
            print("No BLE devices found.")
            return
        print(f"\nFound {len(devices)} device(s):\n")
        # Iterate through and print
        for i, device in enumerate(devices, 1):
            print(f"--- Device {i} ---")
            if hasattr(device,'address'):print(f"  Address: {device.address}")
            if hasattr(device,'name'):print(f"  name: {device.name}")
            if hasattr(device,'rssi'):print(f"  rssi: {device.rssi} dBm")
            if hasattr(device,'metadata'):print(f"  Meta: {device.metadata}")
            print("-" * 20)

    except Exception as e:
        print(f"An error occurred: {e} \n  permissions?")

if __name__ == "__main__":
    asyncio.run(scan_ble_devices())

outputs

jithin@jithin-Victus:~/Downloads/tmp/makerville$ python3 test.py 
Starting BLE scan... (Press Ctrl+C to stop)
Scanning may take a few seconds.

Found 5 device(s):
~~~
--- Device 3 ---
  Address: DC:06:75:39:FF:6C
  name: Makerville Badge
--------------------

So the MAC is DC:06:75:39:FF:6C . Now to send data.

Can’t do that. Issues with BLE on my Ubuntu running on HP Victus. Using an Android app called BLE Tester

It Works!

Setting up Platform-io