In the digital age, turning a regular laptop into a full-fledged oscilloscope has become easier than ever. This method saves thousands of rubles on the purchase of specialized equipment, while maintaining 80-90% of the functionality of professional devices. But how exactly can a sound card or USB port replace expensive hardware? It's all about the right combination of software, hardware adapters and understanding the limitations of such a solution.
Today we will look at three key approaches: using sound card for analysis of low-frequency signals (up to 20 kHz), connection via USB oscilloscopes based on microcontrollers (for example, Arduino or STM32), and work with virtual instruments through specialized ADC modules. Each method has its own nuances - from frequency limitations to the need to solder adapters. Are you ready to build your first oscilloscope in an evening? Let's start with preparation.
1. What you need: hardware
Before you begin setting up the software, assemble a minimum set of components. Without them, even the most advanced program will be useless. The basic elements depend on the method chosen, but the basic kit includes:
- 💻 Laptop with 3.5 mm audio input (for sound card) or USB port (for external modules). Even an outdated model with Windows 7 or Linux.
- 🔌 Signal connection adapter:
- For a sound card: voltage divider across resistors (1:10 or 1:100) to protect the input.
- For Arduino: board Arduino Uno/Nano + library
Firmata. - For USB oscilloscope: ready-made module for ADS1115 or PCS500A (price from 500 ₽).
- 🔧 Soldering iron, wires and breadboard (if you plan to assemble the circuit yourself).
- 📶 Test signal source: generator, function tester or even a smartphone with an application Signal Generator.
Critical moment: do not directly connect 220V mains or high-voltage circuits! The maximum input voltage for most homemade circuits is 5V (for Arduino) or 1V (for sound card). Exceeding this value is guaranteed to damage the equipment.
- Use sound card
- Connect Arduino
- Buy a USB oscilloscope
- Another option
2. Method 1: Oscilloscope via sound card
This is the most accessible method, but with serious limitations. The laptop sound card is designed to process audio signals (20 Hz - 20 kHz), so it is not suitable for analyzing high-frequency or pulsed signals. But it copes perfectly with:
- 🎵 Audio signals (microphones, speakers, guitar gadgets).
- 📉 Low-frequency sensors (thermocouples, photodiodes, humidity sensors).
- 🔋 Batteries and power supplies (pulsation check).
First, assemble a simple voltage divider:
- Take two resistors:
1 kOhmAnd10 kOhm(for division ratio 1:10). - Connect them in series and connect to line input (blue connector on the sound card).
- Connect the negative signal to common wire (GND) audio input (usually this is the connector housing).
☑️ Preparing the sound card
Now install the oscilloscope program. Best free options:
| Program | Supported OS | Max. frequency | Features |
|---|---|---|---|
| VisualAnalyzer | Windows | 48 kHz | Built-in signal generator, FFT support |
| Oscilloscope X | Windows, macOS | 96 kHz | Intuitive interface, data recording |
| Baudline | Linux, macOS | 192 kHz | Command line support, spectrum analysis |
| Soundcard Scope | Windows | 44.1 kHz | Minimalist design, suitable for beginners |
⚠️ Attention: When working with a sound card turn off all system sounds (notifications, music). They will interfere with the measured signal and distort the results. B Windows this is done in Control Panel → Sound → Communications → Mute all sounds.
3. Method 2: Arduino Oscilloscope
If you need higher frequencies (up to 1 MHz) and the ability to work with digital signals, Arduino will be a great solution. The main advantage is flexibility: you can connect different sensors, adjust the ADC bit depth (up to 10 bits) and even add external modules to increase accuracy.
For assembly you will need:
- 🖥️ Fee Arduino Uno or Nano (price ~300 ₽).
- 🔌 Library
Firmata(installed via Arduino IDE). - 📊 Program Processing or Python with module
pySerialfor visualization.
Step by step instructions:
- Install Arduino IDE and connect the board to your laptop.
- Download the example
StandardFirmatavia menuFile → Examples → Firmata. - B Processing use this code to display the signal:
import processing.serial.*;import cc.arduino.*;
Arduino arduino;
void setup() {
arduino = new Arduino(this, Arduino.list()[0], 57600);
arduino.pinMode(0, Arduino.INPUT);
}
void draw() {
int val = arduino.analogRead(0);
float voltage = val * (5.0 / 1023.0);
println(voltage);
}
To increase the sampling frequency to 50 kHz, disable all unnecessary protocols (I2C, SPI) in Firmata and leave only Analog Input.
Limitations of the method:
- ⏱️Sampling rate limited 10 kHz when using standard Firmata.
- 📊 ADC capacity is 10 bits (1024 levels), which gives an error of ~5 mV at a voltage of 5V.
- 🔌 To work with signals >5V, you will need an external voltage divider.
4. Method 3: USB Oscilloscopes and External ADCs
If you want professional performance (up to 200 MHz, 12-16 bit resolution) but without the expense of a full-fledged oscilloscope, consider pre-built USB modules. They connect to the laptop as an external device and are controlled through specialized software.
Popular models:
| Model | Frequency | Bit depth | Price (₽) | software |
|---|---|---|---|---|
| DSO Nano v3 | 1 MHz | 8 bit | 3 500 | BenF DSO |
| Hantek 6022BE | 20 MHz | 8 bit | 8 000 | Hantek6000 |
| ADS1115 (module) | 860 Hz | 16 bit | 500 | Python/Arduino |
| PCS500A | 500 kHz | 8 bit | 1 200 | Zadig + PulseView |
To connect ADS1115 (16-bit ADC) to laptop:
- Connect the module to Arduino via I2C bus (pins
A4AndA5). - Install the library
Adafruit_ADS1X15. - Download this sketch:
#include <Wire.h>#include <Adafruit_ADS1X15.h>
Adafruit_ADS1115 ads;
void setup() {
ads.begin();
}
void loop() {
int16_t val = ads.readADC_SingleEnded(0);
float voltage = (val * 4.096) / 32767.0;
Serial.println(voltage);
delay(100);
} - B Python use
pyserialto read data andmatplotlibto build a graph.
⚠️ Attention: When working with Hantek 6022BE or similar devices install libusb driver through Zadig. Without this, Windows will recognize the oscilloscope as an unknown device, and the software will not be able to interact with it.
5. Calibration and testing
The assembled oscilloscope must be calibrated so that the readings correspond to real values. To do this:
- Connect the source reference voltage (for example, a 1.5V battery or a 5V power supply).
- In the oscilloscope program, set vertical scale so that the signal occupies ~80% of the screen.
- Compare the measured value with the real one. If there are discrepancies, adjust the division factor in the software settings.
To check frequency response:
- 🎛️ Connect a signal generator (or a smartphone with an application Function Generator).
- 📊 Set the frequency to 1 kHz and amplitude to 1V.
- 🔍 Check whether the displayed frequency matches the real one (the permissible error is ±5%).
How to check ADC linearity?
Connect a variable resistor (potentiometer) to the input and smoothly change the voltage from 0 to 5V. Ideally, the graph should be a straight line. If there are bends, your ADC or voltage divider is introducing nonlinear distortion.
Typical problems and their solutions:
| Problem | Possible reason | Solution |
|---|---|---|
| The signal "falls over" at high frequencies | Low sound card sampling rate | Use an external ADC or USB oscilloscope |
| Constant noise on the graph | Poor grounding or interference | Connect all negative wires to one point |
| The program does not see Arduino | The correct COM port is not selected | Check in Device Manager |
| Sine wave distortion | Input overload | Reduce signal amplitude or add a divider |
6. Practical application of a homemade oscilloscope
Even a homemade laptop-based oscilloscope can solve many problems:
- 🔋 Power supply diagnostics: checking output ripple, searching for faulty capacitors.
- 🎤 Audio equipment: setting up guitar pedals, analyzing the frequency response of speakers.
- 📡 Radio electronics: decoding IR signals from remote controls, checking the operation of transceivers.
- 🌡️ Sensors: visualization of data from thermocouples, photodiodes or pressure sensors.
Example: PWM signal check from Arduino:
- Connect output
D9(PWM) to the oscilloscope input. - Upload the sketch from
analogWrite(9, 128)(50% filling). - On the screen you will see rectangular pulses with a frequency of ~490 Hz (for Arduino Uno).
To analyze digital signals (I2C, SPI), use Arduino-based logic analyzers or Saleae USB modules. They allow protocols to be decoded in real time.
Another useful script is Troubleshooting car electronics. Using a homemade oscilloscope you can:
- Check signals with crankshaft sensor (usually 0-5V, frequency up to 1 kHz).
- Analyze injector pulses (12V square wave signals).
- Diagnose generator (checking voltage and ripple at the output).
⚠️ Attention: When working with automotive electrical use galvanic isolation (optocouplers or transformers). The voltage in the on-board network can reach 60V (during surges), which will damage the sound card or Arduino.
7. Alternative solutions and modernization
If you're unhappy with the limitations of homebrew circuits, consider these improvement options:
- 🔧 Increase in bit depth: Replacing the built-in ADC Arduino with an external module ADS1115 (16 bit) or MCP3424 (18 bits).
- ⚡ Frequency boost: use STM32 with library
STM32duino(up to 1 MHz with proper DMA settings). - 📡 Wireless transmission: module connection ESP8266 for data transfer via Wi-Fi.
- 🖥️ Multichannel: circuit assembly on MUX chip (For example, CD4051) to switch between 8 inputs.
For those who want a ready-made solution without soldering, the following are suitable:
- 💻 Digilent Analog Discovery 2 (2 channels, 100 MHz, ~20,000 ₽).
- 📊 Rigol DS1054Z (4 channels, 50 MHz, ~40,000 ₽) - already a full-fledged oscilloscope.
If you decide to build an oscilloscope using Raspberry Pi, consider:
- 🐌 Sampling rate is limited to 100 kHz (even with external ADCs).
- 🔌 To connect analog signals you will need MCP3008 (10-bit ADC).
- 📉 Better to use Pi as a platform for data collection, and visualization transferred to a laptop.
FAQ: Frequently asked questions
❓ Is it possible to use a microphone input instead of a line input?
Technically yes, but microphone input has a built-in amplifier, which distorts the signal. In addition, it is often equipped with a high-pass filter (~300 Hz), which will make it impossible to analyze low-frequency signals. Linear input does not have these disadvantages.
❓ Why do “steps” appear on the chart?
This is a consequence low bit ADC. For example, Arduino has a 10-bit capacity, which gives 1024 levels for a voltage of 0-5V (~5 mV step). To smooth out steps:
- Use an external ADC with 12+ bits.
- Apply software interpolation in the oscilloscope software.
- Zoom in vertically to make the steps less noticeable.
❓ How to measure current using a homemade oscilloscope?
It is impossible to directly measure current - the oscilloscope only works with voltage. But you can use shunt (a resistor with a known resistance, for example, 0.1 Ohm) and measure the voltage drop across it. Formula:
I = U / R, where U - voltage on the shunt, R — shunt resistance.
For currents >1A, use ready-made modules based on ACS712 (measures current up to 20A).
❓ What is the maximum frequency possible when using a sound card?
Theoretical limit - half sample rate (Nyquist theorem). For most sound cards this is:
- 44.1 kHz → max 22 kHz.
- 48 kHz → max 24 kHz.
- 96 kHz → max 48 kHz.
In practice, due to anti-aliasing filters, the actual bandwidth is already ~20 kHz.
❓Can this oscilloscope be used to repair motherboards?
Partially. You will be able to:
- 🔍 Check for voltage on the power lines (3.3V, 5V, 12V).
- 📡 Analyze signals
SDA/SCL(I2C) orTX/RX(UART) at frequencies up to 10 kHz.
But to diagnose high-speed buses (PCIe, DDR), you will need an oscilloscope with a bandwidth >100 MHz.