# Building a hobbyist oscilloscope

I have a project that I've been thinking about for a little while, and I've come to the realization that at some point during its development, I'm going to need an oscilloscope. Okay, not a problem.

Instead of purchasing an oscilloscope, I've decided that I'd like to -- at the very least -- design my own, and hopefully build the result. To make things simpler, I'm thinking about using a Raspberry Pi to do all the fun calculations and visualizations (I don't feel like implementing the FFT on an AVR, thank you very much).

The more I read about oscilloscopes, the more confused I am, to be honest. Why isn't an oscilloscope just an ADC? If I were to hook up something like this (with appropriate over-voltage protection and pre-amplification) to a circuit on one end, and an appropriately-programmed CPU on the other, wouldn't that be an oscilloscope?

[In the past I've only worked with simple digital circuits -- I'm mainly a theoretical computer scientist! -- and so I'm trying to wrap my head around analog electronics right now. As such, I apologize if the answer to this is extremely obvious...]

-
It might be useful to start by studying a few existing open source oscilloscopes: Some links here, also see this. With the RPi, it's closed SoC design requires signing NDAs and convincing the SoC manufacturer to let you have the kind of info you might need to make it do what you want. Something like a Tiva-C Launchpad, or better yet, the Beagle Bone Black might make an easier starting point for that reason. BBB has more than ample IO and processing power, and good documentation too. –  Anindo Ghosh Feb 5 at 20:03
Even an inexpensive 100MHz oscilloscope might have a sample rate of 1GSps. A 20MSps 8-bit ADC is not going to be good for much over a few MHz (Harry and Claude tell use that 10MHz is the absolute limit). You have to be able get the information out of the ADC and into your processor where it can be displayed. A commercial quality front end is non-trivial too. I don't want to discourage you, but something you will build will not have the performance of a $350 Rigol. It will certainly be a good project for learning. – Spehro Pefhany Feb 5 at 20:11 Why do you think an oscilloscope requires implementing the FFT? – Phil Frost Feb 5 at 20:30 For a study model the most important thing to realize besides the ADC is the triggering circuit. You want a steady display, not one that keeps moving all the time. You have to figure out how to start drawing the wave every single time at exactly the same moment. It can be done can be fun and you'll potentially learn a lot from it. Probably most important lesson will be that digital scopes at reasonable quality are quite cheap these days. – jippie Feb 5 at 20:50 I hope you have access to a oscilloscope, while you build this. :-p – Oxinabox Feb 6 at 2:20 ## 4 Answers At it's heart, a (digital) oscilloscope is just an ADC, along with some memory to hold the samples. The samples are then read out of the memory and displayed. The practical implementation issues make commercial oscilloscopes complicated. The input signal needs to be scaled appropriately for the range of the ADC, which means that you need to have attenuators and/or amplifiers that have very precise gain values that are very flat across a huge range of frequencies (DC to 10s or 100s of MHz at a minimum) in order to measure waveforms with minimal distortion. Also, depending on the application, the sample rate of the ADC needs to be adjusted (very precisely) over a wide dynamic range — 1 ns/sample to 1 s/sample (9 orders of magnitude) would be typical. Then there's the question of knowing when to start — or more importantly, stop — sampling; this is known as triggering. Different applications have different needs for triggering, and commercial 'scopes have a wide selection to accomodate them. - It's good to see I wasn't too far off the mark, thank you! I think this clears up most of my confusion. In order to have bare minimum functionality (let's say, display a square wave without the phase changing unnecessarily on the display), what would be a subset of triggering mechanisms to implement? Or is that a stupid question? – Ethereal Feb 5 at 22:05 Rather than adjust the sample rate of the ADC, consider a digital decimation filter in an FPGA or the display software. Crude designs which merely drop the sample rate suffer from confusing aliasing which the operator must rule out either by knowledge of the signal or experimentally changing the timebase to check if the signal is oversampled or undersampled. – Chris Stratton Feb 5 at 23:38 Crude triggering can be done with an analog or digital comparator, perhaps having hysteresis. Also, on a digital scope, you usually sample continuously into a circular buffer while waiting to trigger, and then stop some period of time after the trigger condition has been met. By adjusting the amount of post-trigger sampling, you can be left with a buffer that includes what happened before the trigger as well as after it. – Chris Stratton Feb 5 at 23:52 On a digital scope, the triggering can be done entirely in the digital domain, although it takes some fairly sophisticated firmware to correctly overlay the results of repetitive triggers on a periodic signal. One-shot triggers are relatively trivial. – Dave Tweed Feb 6 at 0:50 It's important to distinguish a hobby project from equipment that's ready to use, and to make the right choice for you. This doesn't have to be the right choice for others. If what you want is equipment to use for another project THIS year, I'd buy one. Could be new or used based on your requirements and budget. If what you want is to build an oscilloscope as a hobby or educational project then by all means go ahead! I wish you a fun and educational experience. You'll learn a lot. Likely you will encounter nay-sayers; tell them that they can save a lot of time and money on their next vacation by e.g. not going to Europe and buying a picture-book instead. They are missing the point! A (basic) digital oscilloscope is indeed composed of a front-end (including an ADC and perhaps trigger circuitry), an embedded computer, a display and software. I will suggest that the following issues are likely to come up: • Time. This project will take you a while, depending on desired performance, your experience, etc. • Cost. It'll cost more than buying one of equal performance. • Performance. What kind of performance are you looking for? Including input ranges, time resolution, how much voltage must the front end withstand. • Testing. How will you debug it? How will you check that it works correctly? • Safety. What happens if you probe 120VAC or hit higher voltage? - You know that Europeans will be amused by your vacation advice, right? :-) – RedGrittyBrick Feb 6 at 9:36 I think you can get a few ideas from AVR 10MHz 50MS/s Digital Storage Oscilloscope. It includes full schematics and source code. It uses a small CPLD that reads the ADC results and fills a RAM, then it uses an AVR mcu to read the RAM data and send it to a PC You may also find useful: There is a block diagram in openDSO project page which should be useful to visualize the sections used in a DSO. - JYE Tech has a$49 oscilloscope kit:

with the following features:

5M samples/second
8 bit resolution
256 sample memory depth
1MHz analog bandwidth
100mV/Div-5V/Div sensitivity
1MΩ impedance
50Vpeak-to-peak max input voltage
DC/AC coupling
Save and display up to 6 captures to memory
Transfer screen capture to PC as a bitmap file (serial adapter not included)
Backlit LCD display
FFT function available


Sparkfun also carries it but for $10 more. All of the surface mount components are already soldered. It uses an ATmega 64. They provide the schematic and parts list on their website if you want to use them an a guide to rolling your own, but I doubt if you could do that for anywhere near$49. The firmware source code is also available.

For just $30 more ($79.50) they have an assembled unit with a 5 MHz analog bandwidth.

-
For what it's worth, that's roughly the performance of a 1950s-era Heathkit oscilloscope. AC-coupled only (vacuum tube-based). theoldcatvequipmentmuseum.org/180/182/… –  Spehro Pefhany Feb 5 at 21:46
Ironically, Heath introduced its first electronic kit oscilloscope (the O1) in 1947, which also sold for $50. But that would be a little over$500 in today's dollars. –  tcrosley Feb 5 at 21:56
This is extremely annoying to use, because there's no indication of how recently it has triggered. If an indicator would flash, or something appear after a half second to show that the display is stale, it would be much more usable, albeit within the limitations of such a primitive sampler. –  Chris Stratton Feb 5 at 23:36
Since they provide the firmware source code, you could probably add a triggering indicator to the display without too much trouble. –  keshlam Feb 6 at 3:41
The source they provide is of a more limited firmware than on the device however. –  Chris Stratton Feb 6 at 13:30