vdeschwb / esp32-signal-generator

Open-Source Signal Generator using the ESP32 uC
MIT License
122 stars 32 forks source link

esp32-signal-generator

Open-source signal generator built for the ESP32 family of microcontrollers. Currently supports sine- and square waves. Configuration of the signal generator is done using a web-based UI, which is served directly from the device via WiFi.

Prerequisites

Hardware

The ESP32 DevKitC V4 was used for development and testing.

Software

The Arduino software version 1.8.15 with the esp32 board extension version 1.0.6 was used for building and uploading. To upload the static web files to the device, ESP32 Filesystem Uploader was used.

Building

Build and upload using Arduino. Since the static files of the website are being served from a simple on-device filesystem, it is necessary to format the flash storage once prior to first use:

  1. Uncomment #define FORMAT_FILESYSTEM in SigGen.ino
  2. Build and upload
  3. Comment #define FORMAT_FILESYSTEM in SigGen.ino
  4. Build and upload again
  5. [Optional] If you changed the front-end code, run parcel
  6. In Arduino: Tools > ESP32 Sketch Data Upload (this copies the contents of /data to the µC's flash memory)

First run

The software is configured to connect to a WiFi network after booting, for which the configuration is stored in the µC's EEPROM. At first boot, that configuration is uninitialized and thus, connecting to WiFi will fail.

AP Mode

Whenever a WiFi connection could not be established, the device enters the access-point (AP) mode, acting as a WiFi AP with SigGen as its SSID. The AP mode can be forced by uncommenting #define FORCE_AP in SigGen.ino.

WiFi Configuration

In AP mode, the device's IP address is 192.168.4.1. To configure the device for your WiFi, navigate to http://<DEVICE_IP>, select Configuration in the header menu and set the SSID and enter a password. You can optionally assign a static IP address to the device, as well as configure the gateway and subnet mask.

"The signal generator's UI"

After writing the configuration to EEPROM, you need to restart the device to apply the changes. This can be achieved either via the reset button on the device itself or by navigating to http://<DEVICE_IP>/reboot.

Usage

Visit http://<DEVICE_IP> to bring up the signal generator's UI, which is separated into two tabs (one for each waveform).

Square Waves

"The signal generator's UI"

Sine Waves

"The signal generator's UI"

Technical Details

Front-End

The front-end is built using Materialize. The number of static files has been reduced to its practical minimum due to limitations of the webserver. As a consequence, all image data is defined inline and only the CSS file is served separately from the HTML.

Tools

Visual Studio Code version 1.43.1 with the Arduino extension was used for development.

Web API

Documentation pending (monitor HTTP requests from the UI for reference).

Future Work

Collaboration

If you find a bug, have suggestions or are interested in extending this project, drop me a line or issue a pull request.