A real-time digital oscilloscope implemented on the DE10-Lite development board using a RISC-V soft processor and external AD7705 16-bit ADC.
This project implements a functional oscilloscope that:
- Samples analog signals (0-3.3V) via an external AD7705 sigma-delta ADC
- Displays real-time waveforms on a VGA monitor (320×240, 8-bit color)
- Provides user controls for gain, sample rate, pause, and freeze functions
- Shows live measurements on both VGA display and 7-segment displays
- Added a BNC connector so you can hook up actual oscilloscope probes, and a potentiometer for testing.
| Gain 1x, 150 Hz | Gain 4x, 150 Hz | Gain 1x, 350 Hz |
|---|---|---|
![]() |
![]() |
![]() |
- ADC: AD7705 16-bit sigma-delta converter
- Interface: Bit-banged SPI Mode 3 (CPOL=1, CPHA=1)
- Sample Rate: Adjustable 50-500 Hz
- Gain: Selectable 1×, 2×, 4×, 8×
- Voltage Range: 0-3.3V (unipolar mode)
- VGA Output: 320×240 pixels, RGB332 color encoding
- Waveform: Orange trace with sweep-style update
- Grid: Dashed grid lines
- Info Display: Current voltage, min/max, gain, sample rate
- 7-Segment: Real-time voltage and gain readout
| Switch/Button | What it does |
|---|---|
| Button | Pause/Resume |
| SW0 | Freeze the screen |
| SW2 | Gain = 2× |
| SW3 | Gain = 4× |
| SW4 | Gain = 8× |
| SW8 | Slower sample rate (-50 Hz) |
| SW9 | Faster sample rate (+50 Hz) |
- DTEK-V RISC-V: Terasic DE10-Lite with DTEK-V RISC-V soft processor
- ADC: AD7705 adc board
- Display: VGA monitor
- Power: 3.3V power for the ADC
- potentiometer: Potentiometer (optional, for testing voltage changes)
- BNC: BNC to screw terminal adapter (optional, for oscilloscope probes)
DE10-Lite GPIO AD7705
─────────────────────────
GPIO[0] ───► CS (Chip Select)
GPIO[1] ───► SCLK (SPI Clock)
GPIO[2] ───► DIN (MOSI)
GPIO[3] ◄─── DOUT (MISO)
GPIO[4] ◄─── DRDY (Data Ready)
GPIO[5] ───► RESET
3.3V ───► VCC, REF+
GND ───► GND, REF-
src/
├── main.c # Main loop
├── ad7705_driver.c/.h # ADC communication
├── spi_driver.c/.h # SPI bit-banging
├── vga_driver.c/.h # Drawing stuff on screen
├── vga_text.c # Text/font rendering
├── timer.c/.h # Timer for consistent sampling
├── hardware.c/.h # Switches, LEDs, 7-segment
├── delay.c/.h # Delay functions
├── performance_counter.S # Performance counter assembly
├── performance_counter.h # Performance counter header
├── performance_counter_prints.c # Print counters function
├── boot.S # Startup code
├── dtekv-lib.c/.h # DTEK-V library
├── dtekv-script.lds # Linker script
└── Makefile # Build file (modified for -O0/-O3)
- RISC-V toolchain (riscv32-unknown-elf-gcc)
- MCB32tools
cd src
makejtagd --user-start
dtekv-run main.binIf it doesn't start, try:
killall jtagd
jtagd --user-start
dtekv-run main.binmake cleanThis project includes a performance analysis component using DTEK-V hardware performance counters.
# No optimization
make build-O0
# Heavy optimization
make build-O3This creates main-O0.bin or main-O3.bin
dtekv-run main-O0.bin # or main-O3.binWait for 500 samples (~3-4 seconds), and counter values will be printed to the terminal.
You can change the number of samples by editing PERF_TEST_SAMPLES in main.c.
Since DTEK-V doesn't have hardware SPI, we had to bit-bang it ourselves. It runs at about 1 MHz and uses Mode 3 (clock idles high, sample on rising edge). The ADC does self-calibration when it starts up and whenever you change the gain.
The frame buffer sits at 0x08000000. We use Bresenham's algorithm for drawing lines and a column-erase approach so the display doesn't flicker when updating.
There's a calibration factor (around 1.535) in the ADC driver to account for the voltage divider and component tolerances. If your readings are off, you might need to tweak this value in ad7705_driver.c.
The voltage reading includes a calibration factor (1.535×) to compensate for:
- Input voltage divider effects
- ADC reference voltage tolerance
- Component variations
Developed for IS1200 HT25 Datorteknik at KTH Royal Institute of Technology.
This project is under a proprietary license.
- Sana Monhaseri
DE10-Lite Oscilloscope - IS1200 Project 2025 - TcomK



