A custom Digital Storage Oscilloscope (DSO) built with an STM32F401 Black Pill and a custom PCB. Features a 1.47" SPI display, an analog front-end with hardware over-voltage protection, and real-time DSP for waveform analysis and measurements.
DSO Final is an open-source printed circuit board by ahmedkamel382, from the ahmedkamel382/STM32-Oscilloscope repository on GitHub. It is a 2-layer board of 88 × 60 mm with 25 parts on 42 nets, routed with 196 tracks and 16 vias.
Its parts include 5 capacitors, 5 resistors, 4 connectors, 4 switches and 2 transistors. It belongs with the sensors and measurement boards and the STM32 boards of this library.
README
README.md
⚡ Digital Storage Oscilloscope (STM32F401)
A high-performance, low-cost Digital Storage Oscilloscope (DSO) engineered from the component level up. Built around the STM32F401 "Black Pill", this project bridges embedded hardware and modern data science by combining a custom Analog Front-End (AFE), deterministic DMA-paced sampling, high-speed USB-CDC telemetry, and an offline Machine Learning waveform classifier.
This project was developed for the Embedded Systems (ECE5206) course at the Arab Academy for Science, Technology and Maritime Transport (AASTMT), supervised by Dr. Amr Fahmy.
🚀 Key Features
Bipolar Signal Acquisition: A custom analog conditioning circuit featuring a 1.65V virtual ground allows the single-supply microcontroller ADC to safely read alternating current (AC) waveforms.
Active Hardware Protection: Bipolar Junction Transistor (BJT) clamping arrays (2N3904 / 2N3906) actively protect the STM32 silicon from over-voltage and negative voltage spikes.
Zero-Loss Data Capture: Direct Memory Access (DMA) utilizing a Ping-Pong (Half/Full) buffering strategy ensures continuous, uninterrupted sampling while the CPU processes data.
High-Speed USB Streaming: A custom USB-CDC pipeline streams raw binary data (736-byte packets) to the host PC, vastly outperforming standard UART communication.
Edge AI Classification: A fully offline scikit-learn Random Forest machine learning model analyzes live mathematical features to automatically classify incoming signals (Sine, Square, Triangle, Noise, or DC).
Zero-Lag Desktop UI: A multi-threaded Python companion application built with PyQtGraph delivers 60-FPS real-time rendering alongside an embedded SQLite database for waveform logging.
The AI classifier was trained on approximately 6,000 synthesized waveforms.
📊 Hardware Specifications & Limits
Specification
Value
Notes
Max Input Voltage
~ -5.44V to +8.74V
Scaled via a 0.1315 attenuation factor
Max Sampling Rate
~ 1.56 Msps
ADCCLK pushed to 42 MHz (DIV2)
Practical Bandwidth
~ 150 kHz
Based on requiring 10 data points per wave cycle
Hardware Filter
RC Low-Pass
V1.0 uses a 33pF capacitor (102 MHz cutoff). V2.0 recommends a 4.7nF capacitor to align the anti-alias cutoff to approximately 720 kHz.
⚙️ Getting Started
1. Hardware Setup
Assemble the Analog Front-End using the provided KiCad schematics located in:
text
/Hardware Design
Ensure proper grounding between the device under test (for example, an ICL8038 signal generator) and the STM32.
Connect the STM32 board to your PC using a USB Type-C cable.
2. Firmware Flashing
Open the project using STM32CubeIDE.
Build the firmware.
Flash the firmware to the STM32F401 using an ST-Link V2 programmer.
3. Running the Desktop Application
Ensure Python 3 is installed on your system.
Navigate to the desktop application directory and install the dependencies:
bash
cd dso_pc
pip install -r requirements.txt
Launch the desktop UI:
bash
python dso_app.py
The AI classifier (dso_model.joblib) is pre-trained.
If you wish to retrain the model using different parameters, execute:
bash
python train_model.py
before launching the application.
👨💻 Project Team
Ahmed Khalid Mohamed
Lead Analog HW & USB Architect
1.65V Virtual Ground & Attenuation Mathematics
High-Speed USB-CDC Binary Pipeline
Python Packet Decoding (dso_protocol.py)
Adel Alaa
Lead Display Driver & AI Engineer
ST7789 High-Speed Column-Redraw Renderer
KiCad PCB Routing & Hardware Decoupling
Live Machine Learning UI Integration
Bassel Adel
Lead ADC Firmware & PC UI Engineer
TIM2-Paced Hardware ADC Triggering
DMA Ping-Pong Buffering Architecture
Multithreaded PyQtGraph Desktop UI
Omar Abdel Nasser Omar
Lead DSP Firmware & Database Engineer
Peak-Hold & Interpolation DSP Algorithms
SQLite Waveform Database Logging
Random Forest AI Model Training
📝 License & Academic Disclaimer
This repository contains academic coursework and is provided as-is for educational purposes. Do not connect this device directly to mains AC voltage or high-voltage circuits without proper industrial isolation and safety equipment.
It measures 88 × 60 mm and has 2 copper layers, 1.6 mm thick.
What parts does the DSO Final use?
25 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
Where can I download the DSO Final KiCad files?
From the ahmedkamel382/STM32-Oscilloscope repository on GitHub, at the commit this page was made from: the board is Hardware Design/DSO_Final.kicad_pcb and its schematic Hardware Design/DSO_Final.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Can I use the DSO Final design in my own project?
Its repository states no licence, so its author keeps all rights: ask ahmedkamel382 before reusing the design.