Oscilloscope based around the STM32F401 Black Pill and a color LCD screen, meant to be used as an educational tool
The goal of this project was to create a simple and easy to build but still very usable oscillsocope. I wanted to learn the basics of how a digital storage oscilloscope functions, while also ending up with something which can be used as an educational tool in the lab. A short description of how oscillscopes (and this one in particular) work can be found here.
- -3.3V to 3.3V input range (can be increased if using attenuator probes)
- 1MOhm input impedance
- 10uS/div minimum timebase
- 1.6 MSa/S sampling rate
- On screen measurements:
- min/max voltage
- peak-to-peak voltage
- frequency
- Captured waveforms can be sent to a computer over UART and analyzed in the Tektronix TekScope app
- STM32F401CC Black Pill development board
- 128x160 ST7735-based TFT display
- 3 pushbuttons
- LM358 dual op-amp (rail-to-rail opamps should work better in this context, but this is what I had on hand)
- 2x 68kOhm resistors (to create a 1.65V offset voltage)
- 2x 500kOhm resistors (to create the input attenuator)
- a 5V power supply
- an opto-isolated USB UART adapter
- a BNC connector, for using proper oscilloscope probes
The LCD screen is connected to SPI1 (PB3-SCK, PB5-MOSI, PB12-CS, PB13-RST, PB14-DC). The buttons are connected as follows:
- PB9: Up
- PB8: Select
- PB7: Down
The output of the analog frontend is connected to ADC1_IN0, which corresponds to PA0.
The schematic of the frontend can be found in the frontend.pdf file.
The Select button cycles through the different parameters, which can be adjusted using the Up and Down buttons.
Pressing Up and Down at the same time triggers the auto-calibration function. The tip and ground clip of the probed should be coupled together while calibrating.
The frontend of the instrument makes use of a virtual ground point which is 1.65V above the real ground. Because of this, the oscilloscope and the device under test must not be sharing the same ground reference. If you need to send data to the computer while measuring a device which shares ground with the scope, you should connect the computer via an opto-isolated adapter, while powering the oscilloscope from an external source.
The captured waveforms can be sent to a computer over UART.
Sending s
(lowercase s) to the UART tells the instrument to output the captured waveform in CSV format, which is compatible with the Tektronix TekScope app.
Sending S
(capital S) tells the scope to output raw data, which can be read by a companion app. This app automatically streams the captured data to TekScope, which allows almost real-time waveform analysis on the computer.
The code can be compiled with make
. The actual oscilloscope code of this project is located in Core\Src
, the scope.c, ui.c and wave.c files. Feel free to take a look, as they're commented for ease of understanding.