How to make PC-based Oscilloscope Using Arduino?

Programming, Tutorial, Coding, New Design, and/or any project for your Arduino and Raspberry Pi can post your topic /suggestion here.
User avatar
dondon pramis
Posts: 27
Joined: Sun Feb 12, 2017 8:28 am

How to make PC-based Oscilloscope Using Arduino?

Fri Sep 29, 2017 7:15 am

For this project you can use any variant of the Arduino as hardware. The AVR microcontroller has an inbuilt ADC. In the project we use pin A0 to capture the input signal. The captured input signal is fed to UART via UART-USB converter in the Arduino to the PC. A virtual COM port is created by Windows whenever the Arduino connects to the PC. A Windows-based application developed using NI LabWindows opens up the virtual COM port and starts plotting signals visually using Graph libraries.

The sampling speed of the oscilloscope is limited by the baud rate of the UART. The Arduino sketch is coded to read the ADC using ISR, and the UART baud rate is configured at 115200, which sends data at 85µs intervals. This gives an effective sampling rate of 12kSa/s.

The Arduino board connects to your laptop or PC via the USB cable. Any external power supply for the board is not required as the board is powered by the USB only. Connect switching diodes (D1 and D2) as input protection circuit to pin A0 of the Arduino’s ADC. You need Arduino sketch (pcscope.ino) and PC software or executable file (PCScope.exe) in order to use this circuit. Install PCScope.exe program (developed by author) in your Windows PC and open the application. Next, open the Arduino sketch from Arduino IDE and compile the sketch. Connect the Arduino board to the PC and flash the sketch into the microcontroller on the Arduino board.
block-diagram.jpg (74.89 KiB) Viewed 2683 times
The ADC of Arduino can measure voltages up to 5V. So it is advisable to add a small protection circuit to limit the input voltage to 5V and clamp the negative voltage. A low-power, fast-switching diode like 1N4148 can be used to protect the input pin. Connect a 10-kilo-ohm resistor in series with the input. It will work as a current limiter in case the input goes beyond 5V. Additional voltage dividers can be used in case you need to measure voltages higher than 5V.

Arduino sketch. The sampling rate of this PC scope application is limited by the rate at which the data is sent to the PC. Baud rate of 115000 gives time interval of around 85 µs. It is important to get the ADC signals much before this time to get reliable data plotting. The sketch reads pin A0 of Board1 and sends to UART at 115200 baud rate. At this speed, bytes of the input are pushed at time intervals of around 85µs.

By default, the ADC configuration of the Arduino gives samples every 116µs. So here the ADC is configured with additional lines of code to get samples faster than 85µs by setting the prescaler to 16. With this, you get ADC conversion every 20µs, which is much faster than the UART data transfer rate.

Download the Arduino Source Code:
(2.37 MiB) Downloaded 115 times
PC software. As stated earlier, the front-end PC software for signal acquisition and processing is developed using NI LabWindows. The serial port data is captured through Arduino at regular time intervals and plotted as a graph on the screen using the Plot function library. The display points along X-axis are calculated based on the user-defined time scale. The Y-axis range is set using the voltage selection control.
After installing the PC scope application, click ‘Connect’ button on your PC screen to connect to the Arduino board. When the board gets connected to your PC, you will get a confirmation message for three seconds...or so..
Feed any squarewave input of up to 5kHz at CON1. The software must plot its output waveform on your PC. Square and triangular output waveforms of 525Hz and 530Hz captured on the screen during testing are shown below, respectively. Similarly, you can feed rectangular or pulse inputs (but not sine waves) to get output waveforms.
Let me know, How you move forward with this simple but interesting project, by your replay below...
User avatar
Posts: 14
Joined: Tue Oct 04, 2016 4:53 am

Re: How to make PC-based Oscilloscope Using Arduino?

Sun Oct 01, 2017 7:13 am

I just made mine yesterday evening..its working great...i just need to calibrate it properly,. Now i need to buy a proper oscilloscope test probes..

Thanks Don, for this alot of money



In total there are 5 users online :: 1 registered, 0 hidden and 4 guests
Registered users: Bing [Bot]
Most users ever online was 138 on Tue Feb 13, 2018 6:29 pm
Total posts 371
Total topics 268
Total members 55
Our newest member bitcoinhours
No birthdays today