Skip to main content
Version: FILS English

Digital Oscilloscope

A digital oscilloscope that displays the most important parameters

info

Author: Lazaroiu Mihai
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-mihai1402


Description​

This project’s main function is to demonstrate the functionality of a digital oscilloscope programmed in Rust. The hardware consists of:

  • An analog pre-amplifier for preparing the input signal
  • A microcontroller for signal processing
  • A debugger to aid the microcontroller during testing
  • A screen for display

The software allows the hardware to perform various functions of an oscilloscope like displaying an external signal and measuring its key parameters.


Motivation​

I chose to build an oscilloscope,to combine my interest in electronics and audio signals with a practical and useful application. It also helps me understand theoretical concepts I've learned so far.


Architecture​

The hardware is composed of four main components:

  1. Pre-amplifier
    • Built using resistors, diodes, capacitors, and an op-amp in a non-inverting configuration.
  2. Processing unit
    • Based on the Raspberry Pi Pico 2 (main processor) and Raspberry Pi Pico H (debugger during testing).
  3. Display
    • Visualizes the signal from the microcontroller.
  4. Power supply
    • Feeds all the components with necessary voltage.

These 4 components work together to form the oscilloscope in the following way:

Signal flow:

  • Input signal β†’ probe β†’ pre-amplifier β†’ ADC (Pico 2) β†’ display.

Power setup:

  • Raspberry powered via USB; peripherals via 3.3V GPIO pin.

architecture


Log​

Week 12​

  • Moved my hardware from the breadboard to a protoboard

Week 11​

  • Decided on a screen to use for the final hardware iteration of the project
  • Developed a working program that receives ADC data and displays it on the screen

Week 10​

  • Wrote the documentation
  • Finished the pre-amplifier
  • Tested different screen types by drawing signal functions
  • Note: Final screen model still undecided, so specified crate is not yet final

Week 9​

  • Troubleshooting the pre-amplifier
  • Started more detailed software design

Week 8​

  • Started building the pre-amplifier

Week 7​

  • Parts arrived
  • Began planning next steps

Week 6​

  • Ordered parts for the pre-amplifier

Week 5​

  • Finished initial plan (hardware & software bill of materials)
  • Uploaded project idea document

Week 4​

  • Brainstormed project ideas

Hardware​

Components​

  • 5x Resistors (R1 β†’ R5)
  • 5x Capacitors (C1 β†’ C5)
  • 1x Diode (D1)
  • 1x Op-amp (MCP6002, non-inverting configuration)
  • Power source
  • Raspberry Pi Pico 2
  • Raspberry Pi Pico H
  • Display: WaveShare Pico-ResTouch-LCD-2.8
  • Probe

Function of Components​

  • C1: used to eliminate the DC component
  • R1, R2: form a voltage divider that ensures the input bias
  • R3, R4: are used to set the amplification factor of the op-amp to 1
  • C2: used so that the amplification only applies to the AC component
  • Op-amp: part of a MCP6002 integrated circuit that has 2 operational amplifiers. Only one of the 2 was used. A secondary function of the amplifier in combination with the voltage that powers it is to limit the max amplification in order to protect the internal ADC of the microcontroller
  • C3: used to make sure no DC component enters the ADC, after the operational-amplifier. C1 was used to block the DC component before the amplifier
  • C4: used to block high frequencies from generating auto-oscillations
  • C5: is used to eliminate spikes from a switching power supply
  • R5: limits potential high currents from affecting the ADC
  • D1: used to protect the non-inverting input of the amplifier from negative voltages
  • Probe: used to acquire the signal

Prototype Photos​

Breadboard analog pre-amplifier prototype:
Analog Preamp

Processing hardware:
Processing

Signal on screen:
Display Demo

Final Hardware Photos​

Digital Oscilloscope Unit: Top View

Side View: Side View

Demo: Demo​

Schematics​

The connections of the components described previously can be seen on the following electric diagram.

schematics


Bill of Materials​

DeviceUsagePrice
BNC Female ConnectorConnects the probe to the pre-amplifier5.83 RON
1N4148 DiodeProtects the non-inverting input of the op-amp0.49 RON
100kΩ Resistor (x2)Voltage divider and amplification factor0.10 RON
4Β΅F Capacitor (x2)DC decoupling0.49 RON
MCP6002-I/P Op-AmpHigh input impedance operational amplifier3.00 RON
1.8kΩ ResistorAmplification factor setting0.05 RON
10nF CapacitorAvoid DC amplification0.10 RON
200Ω ResistorInput current limiting for ADC0.10 RON
Li-Ion 3.7V Battery 18650 (x2)Powers the oscilloscope32.00 RON
100nF CapacitorAvoid auto-oscillation0.10 RON
10Β΅F CapacitorAvoid voltage spikes0.49 RON
Oscilloscope ProbeSignal acquisition79.99 RON
Raspberry Pi Pico 2Microcontroller unit (MPU)39.66 RON
Raspberry Pi Pico HDebugging42.74 RON
WaveShare Pico-ResTouch-LCD-2.8Shows signal and parameters86.11 RON
IC SocketSocket for op-amp1.37 RON
Header PinsConnects Raspberry Pico0.95 RON
Breadboard + Prototype Power SourcePrototyping circuit25.57 RON

Software​

LibraryDescriptionUsage
embassy-rpRaspberry Pi Pico 2 hardware abstractionUsed for interacting with peripherals like ADC, SPI, I2C, timers, and GPIOs to acquire and display waveform data
embassy-executorAsync task executor for embedded projectsManages concurrent tasks for waveform sampling, processing, and display update in real-time
embassy-timeTimekeeping and async timersUsed to generate accurate sampling intervals for the oscilloscope and trigger time-based actions
embassy-syncAsync-safe signals, mutexes, and channelsCoordinates data flow between ADC sampling, processing, and the display task to ensure smooth real-time updates
heaplessFixed-size data structures for no_stdImplements double buffering for waveform data to ensure no data loss during updates to the display
embedded-graphics2D graphics and text renderingRenders waveforms, signal properties like amplitude/frequency, and other graphical elements on the display
ssd1306Display driver for I2C OLED screensControls the OLED display to show real-time waveforms and signal information in the oscilloscope
display-interface-i2cAdapter crate for I2C display interfaceConnects the SSD1306 driver to the embedded-graphics library via I2C communication
microfftLightweight FFT crate for no_stdPerforms Fast Fourier Transform (FFT) to calculate the frequency of the signal in real time
cortex-mLow-level access to Cortex-M processor featuresSupports interrupts and system functions for handling ADC, DMA, and display updates
cortex-m-rtRuntime crate for Cortex-MInitializes the board and manages interrupt-driven tasks, including DMA and signal sampling
defmtLogging crate for embedded projectsProvides debug logging for signal data, task progress, and error tracking in the oscilloscope
panic-haltPanic handler for embedded projectsSafely halts the CPU on panic, ensuring stable operation in embedded systems like the oscilloscope

  1. Inspiration for the pre-amplifier
  2. Help for building the pre-amplifier