This project is a comprehensive system designed for logging and analyzing sensor data from an e-foil or foil-assist. The primary goal is to capture detailed performance metrics, including ESC (Electronic Speed Controller) data, GPS location, temperature, motor current, and throttle input, to provide a clear and useful presentation for performance analysis and system optimization.
The system utilizes a dual ESP32 setup for robust data acquisition and a web-based frontend for intuitive data visualization.
The system is comprised of several key hardware and software components:
- Role: Main controller, data aggregator, Wi-Fi communication hub, and HTTPS server.
- Key Functionalities:
- Integrates and reads data from various sensors:
- ESC Telemetry (e.g., RPM, voltage, current, temperature from the ESC)
- GPS (for location and speed)
- DS18B20 Temperature Sensors
- Throttle Position
- Acts as an I2C master to communicate with the ESP32-C6 for additional ADC readings (primarily motor current).
- Manages data logging, typically to an SD card or internal flash memory in
*.jsonlformat. - Provides a Wi-Fi Access Point (AP) for initial setup or direct connection.
- Connects to an existing Wi-Fi network (Station mode) for broader network access.
- Serves data and potentially a web interface via a built-in HTTPS server.
- Integrates and reads data from various sensors:
- Role: Dedicated ADC (Analog-to-Digital Converter) processor.
- Key Functionalities:
- Acquires analog sensor data, primarily high-frequency motor current readings (e.g., via an ACS758 sensor).
- Acts as an I2C slave, providing the processed ADC data to the ESP32-S3 upon request.
- Role: Data visualization and user interface.
- Key Functionalities:
- Displays logged and potentially live sensor data through interactive charts and graphs.
- Accessible via: https://esp-e90.pages.dev/
- Role: A collection of shell scripts to aid in development and device management.
- Examples: Flashing firmware, synchronizing files to the ESP32 devices, etc.
- These directories contain experimental code using ESP-IDF (C), Rust, and Zig for the ESP32 platform. They are not part of the core operational system but serve as a testbed for alternative firmware development approaches.
The general data flow is as follows:
graph LR
subgraph "Sensors"
A1[ESC Telemetry]
A2[GPS]
A3["DS18B20 Temp"]
A4[Throttle]
A5["Analog Motor Current Sensor"]
end
subgraph "Processing Units"
B1["ESP32-C6 (Arduino)"]
B2["ESP32-S3 (MicroPython)"]
end
subgraph "Data Storage & Presentation"
C1["SD Card / Flash (JSONL Logs)"]
C2["Vue.js Frontend"]
end
A1 --> B2
A2 --> B2
A3 --> B2
A4 --> B2
A5 --> B1
B1 -- I2C Data --> B2
B2 --> C1
B2 -- HTTPS --> C2
- The ESP32-C6 reads analog sensor data (e.g., motor current) and processes it.
- The ESP32-S3 reads data directly from digital sensors (ESC, GPS, Temp, Throttle).
- The ESP32-S3 also requests the processed ADC data from the ESP32-C6 via I2C.
- All aggregated data on the ESP32-S3 is logged (e.g., to an SD card).
- The ESP32-S3's HTTPS server can serve this data (live or logged) to the Vue.js Frontend for visualization.
Hardware:
- ESP32-S3 development board
- ESP32-C6 development board
- Associated sensors (ESC, GPS module, DS18B20, motor current sensor like ACS758, throttle input mechanism)
- Appropriate wiring, power supplies, and level shifters if necessary.
- MicroSD card (if SD logging is used on the ESP32-S3).
Software:
- Python 3.x
esptool.py: For flashing ESP32 firmware. Install via pip:pip install esptoolmpremote: For interacting with MicroPython devices (file transfer, REPL). Install via pip:pip install mpremote- (Alternatively,
ampycan be used, thoughmpremoteis generally preferred for newer MicroPython versions).
- (Alternatively,
- Arduino IDE or
arduino-cli: For compiling and uploading firmware to the ESP32-C6. - Node.js and pnpm: If you intend to run or develop the Vue.js frontend locally.
-
Flash MicroPython Firmware:
- Download a suitable MicroPython firmware binary for the ESP32-S3 (generic S3 build, preferably with SPIRAM support).
- Connect the ESP32-S3 to your computer. Identify its serial port (e.g.,
/dev/tty.usbmodemXXXXon macOS/Linux,COMXon Windows). - Erase the flash:
esptool.py --chip esp32s3 --port /YOUR_ESP32S3_PORT erase_flash
- Write the new firmware (replace
ESP32_GENERIC_S3-VERSION.binwith your downloaded file):(Refer toesptool.py --chip esp32s3 --port /YOUR_ESP32S3_PORT --baud 460800 write_flash -z 0x0 ESP32_GENERIC_S3-VERSION.bin
doc.mdfor more specificesptool.pycommands if needed, adjusting for ESP32-S3).
-
Deploy MicroPython Code:
- The MicroPython code for the ESP32-S3 is located in the
device/directory. - Use
mpremoteto copy the files. Connect to the ESP32-S3's REPL usingmpremote connect /YOUR_ESP32S3_PORTfirst, or specify the port in each command. - To copy all files and directories from
device/to the root of the MicroPython filesystem:mpremote fs cp -r device/* :
- Alternatively, use the synchronization scripts provided in the
scripts/directory if available and configured.
- The MicroPython code for the ESP32-S3 is located in the
- Configure Arduino Environment:
- Ensure you have the ESP32 board support package installed in your Arduino IDE or for
arduino-cli. You'll need support for ESP32-C6. - Select the correct board (ESP32-C6 based) and port in the Arduino IDE.
- Ensure you have the ESP32 board support package installed in your Arduino IDE or for
- Upload Arduino Sketch:
- Open the sketch located at
arduino/sketch/sketch.inoin the Arduino IDE. - Compile and upload the sketch to the ESP32-C6.
- Open the sketch located at
- Accessing the Deployed App: The application is live and can be accessed at: https://esp-e90.pages.dev/
- (Optional) Running Locally:
If you want to run the frontend locally for development or offline use:
- Navigate to the chart directory:
cd chart/ - Install dependencies:
pnpm install(ensure you have pnpm installed:npm install -g pnpm) - Start the development server:
pnpm dev - Open your browser to the local address provided (usually
http://localhost:5173).
- Navigate to the chart directory:
- Power On: Ensure both ESP32 devices are powered correctly and all sensors are connected.
- Connectivity:
- The ESP32-S3 will start a Wi-Fi Access Point (default SSID:
DDDEV, password:aaaaaaaa- checkdevice/ap.pyordevice/main.pyfor current settings). Connect your computer or mobile device to this AP. - Alternatively, if configured, the ESP32-S3 may connect to an existing Wi-Fi network (STA mode).
- The ESP32-S3 will start a Wi-Fi Access Point (default SSID:
- Accessing Data:
- Once connected to the same network as the ESP32-S3, you can access data or interfaces provided by its HTTPS server. The specific IP address and endpoints will depend on your network configuration and the server implementation in
device/http_server.py. - For visualizing data, use the deployed Vue.js app: https://esp-e90.pages.dev/. This app will likely fetch data logs or connect to a live data stream from the ESP32-S3 if properly configured.
- Once connected to the same network as the ESP32-S3, you can access data or interfaces provided by its HTTPS server. The specific IP address and endpoints will depend on your network configuration and the server implementation in
- Data Logging:
- Data is logged in
*.jsonl(JSON Lines) format. - Check the
device/io_local/data_log.pymodule for specifics on log file naming, storage location (e.g.,/sd/logs/if an SD card is used), and rotation.
- Data is logged in
- MicroPython (
device/):- Use
mpremotefor file management and accessing the REPL. - Follow MicroPython best practices. The code utilizes
uasynciofor cooperative multitasking.
- Use
- Arduino (
arduino/):- Standard Arduino C++ development using the Arduino IDE or
arduino-cli. - The ESP32-C6 code uses FreeRTOS tasks for ADC processing and I2C communication.
- Standard Arduino C++ development using the Arduino IDE or
- Utility Scripts (
scripts/):- Explore the scripts in this directory for managing and automating development tasks. They may require some configuration (e.g., serial ports).
- No Wi-Fi AP: Check LED status on ESP32-S3, ensure
device/ap.pyanddevice/main.pyare correctly uploaded andboot.pyis not preventingmain.pyfrom running. - Cannot Connect to HTTPS Server: Verify IP address, firewall settings. Check logs on ESP32-S3 via REPL if possible.
- Sensor Data Issues:
- Double-check wiring for all sensors.
- Verify I2C addresses and communication between ESP32-S3 and ESP32-C6.
- Inspect individual sensor reader modules in
device/io_local/andarduino/sketch/for debugging logic or pin configurations.
- Flashing Issues: Ensure correct
esptool.pycommands, serial port, and that the ESP32 is in bootloader mode if required.
(Placeholder: Add guidelines for contributions if this project is open to it, e.g., coding standards, pull request process.)
(Placeholder: Specify the license for this project, e.g., MIT, GPL, Apache 2.0.)