Write Firmware

This demo shows writing firmware for a Smart Camera project with CopperPilot. CopperPilot
can handle firmware for many embedded targets—AVR-GCC for the Teensy, ESP-IDF for the ESP,
STM32CubeIDE for the STM—but here we use the Arduino IDE. The camera is based on the Xiao
ESP32-S3, and we ask CopperPilot to craft firmware for a basic camera stream.

Setup

Direct CopperPilot to the main INO code and point it to your config.h file.
Instruct CopperPilot to write modular code and develop a makefile. Use the Arduino CLI to
compile and upload the code. With everything set, you can let CopperPilot run.

What CopperPilot Builds

CopperPilot analyzes the existing bare-bones codebase and creates files for Camera Pins,
Camera Init, WiFi Manager, and the HTTP Server. This setup exposes your API endpoints and
adds logging so you can see the device’s IP address. CopperPilot then seeks approval to
compile; with a quick “Allow,” it proceeds. It compiles the firmware and refines it
through iterations until it succeeds, then reports back that the camera is active and
provides the URLs.

Clicking a URL gives you a live camera stream. There’s also a capture
endpoint that lets you grab a single frame.

Documentation

Ask CopperPilot to document your discoveries in a README. CopperPilot creates a README
that details all the resolutions and even provides a makefile, so your project is
well-documented.

Benchmarking

To document the device’s frame rate across all resolutions, assign CopperPilot the
task of benchmarking using the laptop to cURL the web server. CopperPilot first tweaks the
firmware so clients can modify the resolution—from QVGA to UXGA, all options become
available as API endpoints. It then develops a benchmark script. After you give the green
light, it runs the script and outputs fps-results.json. Ask CopperPilot to
document its insights from that file into an fps markdown; it generates a report with a
table of all resolutions and their frame rates for the device.

Key Takeaways

  • CopperPilot can write modular firmware and generate a makefile for compile and upload with Arduino CLI.
  • It builds camera, WiFi, and HTTP server modules and exposes API endpoints with logging.
  • It can generate README documentation and, with your approval, run benchmarks and produce fps reports.