Serial Oscilloscope with STM32 Based Microcontrollers

Serial Oscilloscope

Serial Oscilloscope is an open-source windows application that is created by xioTechnologies and shared in their website. This application takes serial stream from Arduino and plots comma-separated variables as a real-time oscilloscope. The application utilizes Michael Bernstein’s oscilloscope library to plot up to 9 channels on 3 diverse oscilloscope with perspective and trigger menus.

Serial Oscilloscope application is developed in Microsoft Visual Studio C#. Source code of the project can be obtained from their GitHub repository and developed further.

Serial Oscilloscope is good with any serial stream containing comma-separated values ended by another line character (“\r”). For instance, “111,222,333\r” will be deciphered as values 111, 222 and 333 for channels 1, 2 and 3 respectively. If serial stream is “111,222,333,444\r”, then interpreted values will be 111, 222, 333 and 444 for channels 1, 2, 3 and 4 respectively. The serial stream can also have non numerical characters and those characters will be ignored. For instance, “a=0.5,blue,x=3.14,t1t2t3,8\r\n” will be translated as values 0.5, 3.14, 123 and 8 for channels 1, 2, 3 and 4 separately.

They also shared an Arduino code to send analog input values over serial. To be able to enable up to 6 ADC channels, the characters “1” to “6” should be sent to Arduino. Don’t forget that enabling more channels reduce the sample rate.

In a YouTube video they showed the Arduino and Serial Oscilloscope being used to indicate how to plot serial-streamed analog data.

Precompiled binary files can be downloaded from their website.

Baud Rate and Sampling Rate

Serial Oscilloscope is able to receive serial stream in different baud rates. If you are afraid of losing data, I suggest selecting lower baud rate. Nonetheless, decreasing baud rate will decrease the sampling rate. If you like to plot real time signals, highest baud rate will be the best option for you.

Logging to CSV File

One of other beautiful feature of this application is that you can record serial streamed data in “.csv” format. This property is very beneficial for people who makes simulations in MATLAB.

Setting Channels

Understanding of sending data was challenging for me at first. It is because streaming data is shown on the text box and I didn’t realized that it is a text box. If you press the keyboard keys from “1” to “6”, you will see that serial stream and sample rate change.

Migration to STM32

I migrated their open-source Arduino code to STM32 to make Serial Oscilloscope application compatible for all of STM32 based microcontrollers which are my favorite.


Michael Bernstein’s oscilloscope library can plot up to 9 channels. Unlike Arduino, a STM32 based microcontroller can provide more than 9 ADC channels. Now, we are not restricted to 6 ADC channels anymore. To enable ADC channels from “1” to “9”, the characters “1” to “9” can be sent to STM32 base microcontroller by Serial Oscilloscope application.

Hardware Requirements:

  • STM32 based microcontroller (STM32F4-Discovery)
  • RS232 converter (FT232 USB UART Board)

Used Peripherals and Corresponding Pins:

  • ADC1, Channel 1 = PA1
  • ADC1, Channel 2 = PA2
  • ADC1, Channel 3 = PA3
  • ADC1, Channel 4 = PA4
  • ADC1, Channel 5 = PA5
  • ADC1, Channel 6 = PA6
  • ADC1, Channel 7 = PA7
  • ADC1, Channel 8 = PB0
  • ADC1, Channel 9 = PB1
  • USART6, TX = PC6, RX = PC7

Library Dependencies:

  • TM STM32 Libraries of Tilen Majerle (GitHub Repository)
  • stm32f4-hal library of STMicroelectronics
  • stm32f4-cmsis library of STMicroelectronics



At following images, number of channels is set to “2” and two potentiometer are connected to channel 1 and 2. Voltage level of analog signal is changed and observed on screen. There are some undesired peaks on the plot. These may be occurred because of whether some bugs of application or bad cable connection of RS232 converter.




3 thoughts on “Serial Oscilloscope with STM32 Based Microcontrollers

  1. Hi, me again.

    can you pls advice me how to compile in keil ? i didnt get it with the libs including. there are plenty more files as i thought….  have a nice day. dennis

Leave a Comment

%d bloggers like this: