Bojan Jurca’s “Esp32_oscilloscope” is an open-source Arduino sketch that can transform an ESP32 board into a web-based oscilloscope that works over WiFi.
We had also written about the Scoppy project to turn the Raspberry Pi Pico W into a 2-channel oscilloscope, but there’s no reason the more powerful ESP32-series microcontroller could not be used for the same purpose, and Bojan’s Esp32_oscilloscope project does just that and works with ESP32, ESP32-S2, ESP32-S3 and ESP32-C3 boards using the I2S interface for fast data sampling.
The project was initially designed to demonstrate the multitasking abilities of the ESP32 microcontroller with Arduino, but this evolved into an ESP32 oscilloscope firmware. It works both with output/PWM and input signals, digital (0 or 1) and analog (0 to 4095) signals, and the web interface shows up to 736 samples per screen although the sampling rate may not be completely constant all the time.
To install it on your board, you’ll need to load the project in the Arduino IDE and set your router credentials and the hostname:
1 2 3 4 5 6 |
// if these #definitions are missing STAtion will not be set up #define DEFAULT_STA_SSID "YOUR_STA_SSID" // <- replace with your information #define DEFAULT_STA_PASSWORD "YOUR_STA_PASSWORD" // <- replace with your information // define the name Esp32 will use as its host name #define HOSTNAME "MyEsp32Oscilloscope" // <- replace with your information, max 32 bytes |
The program relies on the FAT file system, so you’ll need to select one of the FATFS partition schemas in Tools->Partition scheme-> ... unless the ESP32 board does not have external flash in which case you’d need to comment out the
1 |
#define FILE_SYSTEM FILE_SYSTEM_FAT |
…in order for the firmware to use progmem to store the oscilloscope.html file. Now you can build the program and flash it to your board. You’ll also need to upload a few files to the /var/www/html directory (android-192-osc.png, apple-180-osc.png, oscilloscope.html) over FTP, and you should be able to access the oscilloscope with “http://your-esp32-ip/oscilloscope.html” or “http://esp32-hostname/oscilloscope.html” URL from your web browser.
If you are short on time and/or don’t happen to have an ESP32 board on hand, Bojan is also running a demo at http://jurca.dyn.ts.si/oscilloscope.html as shown in the screenshot above. The full details for the Esp32_Oscilloscope project can be found on GitHub. It’s not the first time we cover a project that shows the status of ESP32 GPIO pins in a web browser, as GPIOViewer does just that but serves a different use case.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
would be really interesting to extend this to also be a logic/protocol-analyzer. To dynamically instance a spi device or a serial port för (specific pins, i guess, since esp32 doesnt have full gpio re-routing capabilities) could be done and really useful.
You can already get cheap half decent logic analysers. There are the generic saleae clones (24 MSPS and 8 channels) or the slightly more expensive Sipeed version (8 channels, up to 160 MSPS for 2 channels, only one channel for windows) and Sipeed are releasing a better 1 GSPS USB 3 version soon apparently.
ESP32 has a problem with analogue inputs. It is never accurate. How is that this works as an oscilloscope??
Has the output been checked against a real scope to confirm the calibration?
Put one of the 5 volt signals. or use a voltage divider, to one of the other Analog ports, and now you know what 5 or 2.5 volts value is.
Probably not checked
Why don’t people use half decent MCUs for things like this? Why not use something better for this?
The ESP32 can apparently handle up to 2 MSPS (but lower is recommended) and the rp2040 can only handle 500 KSPS and the ADCs in these MCUs are known to not be the best, especially the ESP32.
Why not use one of the STM32G4 series like the STM32G473 with 5 x 4 MSPS ADCs, 7 DACs, 7 comparators and 7 OP amps? I believe the multiple ADCs can be interleaved too, to at least double interleaved if not triple.
Or one of the STM32H7 series like the STM32H723 with 2 x 16 bit 3.6 MSPS ADCs that can reach 7.2 MSPS at 16 bit in dual interleaved mode plus an additional 12 bit, 5 MSPS ADC and some other analogue peripherals like comparators, a DAC and op amps.
Price also isn’t really the issue as you can get a STM32G473 dev board for around £5 or a cheaper STM32G431 dev board for around £2.50 and you can get a STM32H723 dev board for around £13.
It just doesn’t make sense to pick some of the microcontrollers with the worst analogue performance for oscilloscopes. The rp2040 has a low sampling speed and maximum 4 channels and the ESP32 ADC isn’t that fast either and is known to have accuracy issues.
Obviously using an external high speed ADC would be best but if the goal is low cost and just using a common dev board then the ESP32 and rp2040 are still bad choices.