Simple DIY STM32 Oscilloscope Project

In part one of what is intended to be a series on developing an STM32-based oscilloscope, [BTTLab] demonstrates a how to use the built-in ADC of an STM32F207 MCU to develop a straightforward single-channel oscilloscope. This can be followed along both via the YouTube video and the GitHub repository for this single-channel version.

Oscilloscope front-end protections. You want this. (Credit: BTTLab, YouTube)
Oscilloscope front-end protections. You want this.

Of course, an MCU’s ADC generally won’t hold a candle to a dedicated ADC for oscilloscope purposes – along with the typical beefy FPGA-based processing – with even a basic Rigol DS1054Z hitting a cool 1 GSPS, but the 2 MSPS at 12-bit resolution achieved by an STM32F207 isn’t shabby either. For more basic, low-frequency circuit and protocol debugging it would already be enough.

One thing briefly touched upon in the video is the front-end. The ADC’s inputs are rated for a specific voltage range, typically 0 to 3.3 V when running the MCU off 3.3 V, so you do not want to put higher or negative voltages into said ADC input. This is where measuring something like AC becomes rather tricky and you can get some exciting releases of magic smoke.

The demonstrated single-channel oscilloscope firmware uses the ST HAL, so it might be somewhat easy to target other STM32 MCUs as well, though naturally ADC performance will differ per MCU family and sometimes sub-family, so make sure to read the datasheet and programming manual before you dive in too deep.

18 thoughts on “Simple DIY STM32 Oscilloscope Project

  1. The specs looks like the typical junk kit found at amazon and aliexpress. A cheap microcontroller doing the job of proper hardware, resulting in sample rates sufficient for audio only, if you are lucky. Also note the lack of any kind of hardware trigger. And not accepting negative input voltages is ridiculous.

    1. Input scaling and protection would indeed be the task of a proper voltage probe / frontend. However, even when considering it part of a DAQ system, it’s leaving so many things on the table, like data streaming via ethernet, timer trigger source configuration for interleaving to achieve 6 MSps, and probably an external reference.
      I wouldn’t say no to a small current probe in glscopeclient that makes do with µC for interfacing, data handling and mixed-signal stuff, paired with e.g. a CT433 (well-matched 1 MHz BW TMR current sensor and too noisy for anything beyond 12-14 bit).

    2. As someone who bought a real oscilloscope so I could check if the inverter in my ford maverick hybrid was pumping out a square wave or sine (sadly it was square) I kinda wish there were more cheapo ones out there; not all of us need the insane features all the “real” ones have… particularly when they’re all a borjillion dollars and you only have a singular use case.

      1. heh i have to imagine there is, like you say, a proper market for the “junk kit found on amazon and aliexpress”. someone must buy one wanting it for what it is instead of being disappointed! but i think Tux2000’s point is that this project has been done already a zillion times, and generally to a higher quality.

      2. fnirsi is garbage. partly because they outright lie in their specications, and on top of that they actrively try to hide the mailfunctioning hardware in their software, for example by heavy averaging.

        Both Owon and Hantek make usable handheld scopes, with prices starting below EUR 100. I think I like the “zeewei” scope (in landscape format) It has two channels, dedicated buttons for timebase and voltage axis and a decent bandwidth.

        Alientek DM40 may be interesting, but I’m not sure what it is exactly. The lowest cost version seems to be a (graphing) DMM, while the more expensive variants seem to have (some) oscilloscope aspirations.

        On the low end there is also jyetech with the DSO138 (not so good) and DSO150 (DSO Shell). Both of these are also based on STM32F103 (maybe a chinese clone these days) I do sort of like my DSO 150 and use it more then I use my Siglent SDS1104X-E. The DSO Shell does not have a fan and it’s “good enough” to keep an eye on some PWM signals and such while I’m developing firmware. There are also alternative / open source variants of the software for this. For the EUR 30 these boards are also already attractive just as a generic development board with TFT, buttons and rotary encoder.

      3. For something like that, an analog scope would work just fine. You can usually pick them up at ham radio swapmeets pretty cheap. Even an old synchronous sweep tube scope would be sufficient. Those can often be found for under $10, but they will need the capacitors replaced before you power them up.

  2. Reminds me, I once demonstrated equivalent-time sampling on an AVR-DA. This doesn’t do anything very impressive — time is quantized by peripheral clock of course, and the internal ADC’s analog bandwidth is rather modest (maybe 1 or 2MHz by my estimation; consistent with the manual’s description). Maybe I should make that into a proper project some time.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.