What is an Oscilloscope? How do I choose one? How to use it on Arduino?

Introduction

In this course, we’ll look at how to use an oscilloscope with Arduino and how it can help you create your circuit.

What is an oscilloscope?

An oscilloscope is a measuring instrument designed to display an electrical signal over time. It is used to visualize electrical voltages. The rendering curve of an oscilloscope is called an oscillogram.

An oscilloscope comes with probes to measure precise points on your electronic circuit.
A probe consists of a ground and a probe for measurement.

This probe is very important, as it has a maximum operating frequency that must match that of your oscilloscope in order to use it to its full potential.

The different types of oscilloscope

There are two types of oscilloscope: analog and digital.

  • Analog oscilloscope

Analog oscilloscopes use the input voltage directly to produce the on-screen analysis. This type of device is becoming obsolete, as it generally only allows observation of periodic voltages.

What’s more, it has no memory and can’t process the curve obtained as a digital oscilloscope can.
It is increasingly being replaced by digital oscilloscopes.

  • Digital Oscilloscope

Digital oscilloscopes transform input voltage into numbers. The display is reconstructed afterwards.

On a digital oscilloscope, the signal to be displayed is first digitized by an analog-to-digital converter. The device’s ability to display a high-frequency signal without distortion depends on the quality of this interface.

The main characteristics to be taken into account on a digital oscilloscope are :

  • the resolution of the analog-to-digital converter
  • Sampling frequency in Megahertz or GigaHertz.
  • Memory size

To buy a digital oscilloscope, you have several brands to choose from: Rigol, siglent, hantek…

Miniaturized digital oscilloscope!

Computers have made it possible to miniaturize oscilloscopes. Some models have a display directly on the computer, making them even smaller and cheaper.

This oscillosocope can be very handy for use on Arduino, as it’s inexpensive and quite suitable for this type of project. If you’re looking for a low-cost, good-quality oscilloscope to get you started, this one will be perfect!

You can buy it here for around 15 euros.

What's the advantage of digital over analog?

A digital oscilloscope can do much more than an analog oscilloscope.

Thanks to the digital oscilloscope’s memory, it can store measured signals, and is equipped with analysis and processing tools that can be used to obtain numerous characteristics of the signal observed:

  • Measurement of signal characteristics: peak value, RMS value, period, frequency, etc.
  • Fast Fourier transformation to obtain the signal spectrum;
  • Advanced filters which, when applied to this digital signal, increase the visibility of details;
  • Digital signal decoding: LIN, CAN, USB

Digital oscilloscopes have now completely overtaken analog ones, thanks to their greater portability, ease of use and, above all, lower cost.

Using an oscilloscope with an Arduino board

Not every project will require the use of an oscilloscope and an Arduino board. In fact, the aim of the Arduino board is to simplify the use of electronics, to make the creation of electronic projects accessible to people who are not necessarily trained in this field.
What’s more, an oscilloscope is not a simple measuring tool for beginners.
Most people prefer to debug with the serial monitor and “print”. Nevertheless, the oscilloscope can be useful for finding out whether a voltage is 0 or 1, or whether the signal obtained is the desired one, as with a pwm signal.
In this course, we’ll look at how to read signals on the Arduino board from two types of oscilloscope: the miniaturized one that can be read on the computer, and a digital oscilloscope.

What's the advantage of digital over analog?

If you only want an oscilloscope for arduino, we recommend the miniaturized oscilloscope. It’s inexpensive compared with other oscilloscopes and lets you visualize the signals coming from your arduino board.

Arduino circuit

To read the value of a pin, we’ll send a program to the Arduino board.
Here, we’ve chosen to switch on pin 5 at the board’s high state, and to send a PWM signal to pin 11 with a square-wave signal.
Here’s the program:

int pin_pwm = 11; // Spindle with pwm
int pin = 5; // Spindle in high state

void setup() {
 // We output both signals
 pinMode(pin_pwm, OUTPUT); 
 pinMode(pin, OUTPUT);
 digitalWrite(pin,HIGH); // turn on pin 5
}

void loop() {
// Pin 11 flashes.
digitalWrite(pin_pwm,HIGH); 
delay(100); 
digitalWrite(pin_pwm,LOW); 
delay(100); 
}

Visualization on the digital oscilloscope

Now let’s see how to read these signals on a digital oscilloscope. To do this, we connect our probes to pin 5 and pin GND of the Arduino board.

Here’s pin 5 of the arduino on the oscilloscope. Here we can see that the pin is at 5V ( 4.96V) :

Here you can see the arduino’s PWM pin on the oscilloscope:

Visualization on the miniaturized digital oscilloscope

To use it, you need to download the PulseView software, which will enable you to receive the signal. You can download it from this site, choosing pulseview 32 or 64 bits. The software is also available for Mac and Linux:

Once downloaded, this is what you get:

What's the advantage of digital over analog?

Now let’s see how to find your analyzer on Pulseview. To do this, you need to find the name of your analyzer.

Click on demo-device then connect to device, and you’ll come to this window:

  • In the red box: You must choose one of the drivers available for your analyzer. If you bought the one suggested earlier, it’s the fx2lafw.
  • In the green square, make sure the usb is selected.
  • In the blue square: click on scan for devices driver above.
  • If all the steps have been followed, your oscilloscope should appear in the orange square.

Connection to miniaturized oscilloscope

 

Click on run to start the simulation:

Pin 5 is in the high state:

Here we find pin 11 with its PWM voltage: