Raspberry Pi Pico Oscilloscope:
Raspberry Pi Pico Oscilloscope for your Smart Phone or Tablet, Scoppy Oscilloscope– In this article, you will learn how to make a Raspberry Pi Pico based Oscilloscope and logic analyzer powered by an Android Smart phone or Tablet. An oscilloscope is the most essential tool in all of electronics. It is used to graph an electrical signal as it varies over time. Sooner or later you will need an Oscilloscope for Analyzing low or high-frequency PWM signals, you will need it for testing your analog or digital sensors, and you will also need an Oscilloscope for testing your timing circuits, wireless devices, function generators, and so on.
The Multimeter and Oscilloscope are two very important measurement tools used extensively for analyzing and diagnosing electrical and electronic circuits, components, devices, etc. Multimeters are cheap and Oscilloscopes are too expensive and that’s why I decided to make myself the cheapest Oscilloscope on this planet which cost me only 5 dollars. You don’t have to write even a single line of code both the firmware and Scoppy App are free to download. All you need is to download the Scoppy Oscilloscope firmware from Github, upload it to your Raspberry Pi Pico and you are good to go.
If you have never used Raspberry Pi Pico then I Highly recommend, read my Getting started article on the Raspberry Pi Pico because you should know about the Raspberry Pi Pico board pinouts and technical specifications.
Scoppy App has got lots of buttons; but don’t worry I will explain each and every button and of course I will also explain how to use all these buttons.
After building the Raspberry Pi Pico Oscilloscope then I will share with you test results including,
- Capacitor charge and discharge testing.
- Testing an Analog Sensor and
- We will be measuring the Arduino PWM Signal.
So, without any further delay, let’s get started!!!
Other Tools and Components:
*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!
Making of Raspberry Pi Pico Oscilloscope:
For this smartphone Oscilloscope, you will need
- Raspberry Pi Pico.
- Scoppy Android App.
- 1K ohm resistors, you will need two of these.
- 100K ohm Resistor.
- USB OTG Adapter and
- An Android smartphone or Tablet.
Android version 6.0 (Marshmallow) or higher should be running on your Android device “Smartphone or Tablet”. Your device must also support USB OTG. OTG stands for On the Go – The OTG feature is available on most modern phones and tablets. The Scoppy Oscilloscope App won’t run if a lower android version is running on your device or if your device doesn’t support OTG. So, double-check your device before you start working on this Oscilloscope.
Raspberry Pi Pico Oscilloscope Making:
Install the Firmware on Raspberry Pi Pico:
Download the Scoppy Oscilloscope firmware from Github.
Once the firmware is downloaded, next, press and hold the boot selection button on your Raspberry Pi Pico board and connect it to your Laptop or Computer. It will mount as a Mass Storage Device RPI-RP2. Release the BOOT Selection button after your Pico is connected. Next, copy the uf2 file (firmware). Right-click on the storage device RP1-RP2 and paste the file. Now, you can go ahead and disconnect your Pico board. If you face any issues then you can watch the video tutorial given at the end of this article.
Install Scoppy Android App:
Open Play Store. Search for the Scoppy Oscilloscope and Logic Analyzer and install it. The demo version is free of cost. The free (zero cost) version of the Scoppy app is limited to one channel. To enable extra channel(s) and remove all advertising, a small in-app purchase is required (approx. USD1 for a yearly subscription or USD2 for a lifetime purchase – exact price depends on your location)… You can see my Oscilloscope and Logic Analyzer App has been installed.
For the initial testing, you can connect GP22 directly to the ADC pin GP26 which is channel1.
The GP22 generates a 1kHz Square wave with a duty cycle of 50%. Now, you can connect your cell phone with the Raspberry Pi Pico using USB OTG adapter.
While you connect your cell phone with the Raspberry Pi Pico; allow Scoppy to access the Pico.
You can see its working. If you can see this PWM signal then it means you have done everything correctly. Anyways, if you want to use an external signal source then you will need to connect some resistors. Let me explain this with the help of a circuit diagram.
Raspberry Pi Pico Oscilloscope Circuit Diagram:
Attach the +ve output of your signal source to GPIO26 of the Pico ( Signal Input) and the ground to gnd. This will allow you to measure signals between 0V and 3.3V. Of course, the signal voltage should be within the allowed range of the ADC pins of the RP2040. You will need this 100K ohm resistor between the signal source and the Pico ADC GP26 and GP27. Since on the demo version, I am only allowed to use channel1 so that’s why I have connected only one resistor with the GP26 which is channel1. This 100K ohm resistor will limit the current through the Raspberry Pi Pico ESD diodes in case you accidentally apply a voltage higher than 3.3 volts.
The two 1k ohm resistors connected with the GND and 3.3V pins of the Raspberry Pi Pico make the voltage divider circuit and we are using the divided voltage as our ground reference.
I connected all three resistors as per the circuit diagram and now I am going to explain how to use the Scoppy App.
Altium Designer is the world’s most trusted PCB design system. Altium Designer enables engineers to effortlessly connect with every facet of the electronics design process. Over 35 years of innovation and development focused on a truly unified design environment makes it the most widely used PCB design solution. With Altium Designer you can create PCB designs with an intuitive and powerful interface that connects you to every aspect of the electronics design process. Route it your way through any angle, tune for the delay, Push, Slide, and Walkaround faster than ever. Interact and collaborate with mechanical designers like never before in a photo-realistic, 3D design environment. If you want to get started with the Altium designer, you can click on the get started.
How to use Scoppy App:
Before, you connect, your cell phone with the Raspberry Pi Pico, first, make sure you turn ON the OTG. Now, connect your android smart phone with the Raspberry Pi Pico using USB OTG Adapter. The Scoppy App will ask for the permission “Allow Scoppy to access Pico?” simply press on the OK button.
You can see this button on the bottom left side, press this button and then click on the change input. You will see two input options Demo and USB; make sure you select USB.
Next, you can see channel1 and channel2. By default, Channel1 is ON and channel2 is OFF. The channel2 won’t turn ON until you upgrade to premium. So, forget about the channel2, we can’t use it on this free version. Anyways, click on the channel1.
You will see,
Select input voltage range
You can Switch OFF and Switch ON the channel1.
If you click on the measurements, you will see two options; On-screen and Snapshot.
Let’s click On-screen.
From here you can control which measurements you want to display on the screen. Using this top right button you can turn ON all the values or you can turn off all the values. We also have these check boxes, let’s say you don’t want to display the Vpp value, simply uncheck this box and press on the Ok button. If you want to display it again, repeat the same process…
If you click on the Snapshot, it will give you a complete Measurement Snapshot of Channel1.
You can take a screenshot of these values for the later analysis.
Now, let’s check the settings, under the settings we have only Voltage range, so let’s go ahead and click on this.
Over here you can select the minimum and maximum voltage. I am going to leave these values as it is.
Now, let’s check this Trigger which is by default selected for Channel1. If you click on the trigger you will see these four options.
And Pre-trigger samples.
Let’s first start with the Channel. If you click on the channel, you will get two options and you can only select one of these options. You want to use Trigger channel1 or Trigger channel2? In my case as I am using free app so I will go with the Trigger Channel1.
Now, by clicking on the Level, you will see a slider and by using that slider you can select the Trigger Level voltage.
Now, by clicking on the Type, you can select between the Rising edge and falling edge.
Now, by clicking on the Pre-trigger samples, you will see Pre-trigger samples to select from.
On the right side of the Scoppy App, you can see lots of buttons and you should definitely know about these buttons.
On the top you can see we have got two normal buttons STOP and SINGLE and the third button is the MENU button>>. First, let’s start with the STOP button.
If you click on the stop button, it will freez or stop the graph, this is quite a handy feature, you will need it for checking your graph.
If you click on the SINGLE button. SINGLE CAPTURE IN PROGRESS is displayed on the screen, a ten seconds timer is activated and any activity that happens in this ten seconds duration will be displayed on the graph. The graph is stopped for you, it’s will not move and you can easily study the graph. When you are done, then again you can click on the RUN button and it will start again.
If you click on the Menu button. You will see
UPGRADE TO PREMIUM.
You also got this stop and play button over here.
This +1 button has the same function as the Single button.
Upgrade to Premium:
You can use this Upgrade to Premium button, if you want to purchase this App…
The Scoppy App has two modes,
Oscilloscope and Logic Analyzer.
So, click on the Mode button and select Oscilloscope or Logic Analyzer as per your requirement.
If you click on the display button, you will see by default YT is selected, the XY and XY + YT can only be selected when both the channels are enabled; and you know both the channels can only be enabled on the premium version. So, on the free Scoppy App, you can continue with the YT.
CURSORS in Oscilloscope:
You can measure waveform data using cursors. Cursors are horizontal and vertical markers that indicate X-axis values (usually time) and Y-axis values (usually voltage) on a selected waveform source. I will practically explain how to use Cursors on Oscilloscope while testing some circuits.
Scoppy App also includes a very basic PWM signal generator that you can access by clicking on the Signal Generator button. You can select the type of signal, Square or Sine PWM. By default, the frequency is set to 1kHz, which you can change as per your requirement or you can enter a frequency of your choice by clicking on the custom. For now, I will continue with the 1kHz frequency. The signal is output on GP22 of the Raspberry Pi Pico. I already demonstrated this during performing my initial test.
Export only work on the premium version.
If you click on the settings, you can change the Trace line width, Grid line width, and if you want to keep the screen ON. So, that’s all about how to use the Scoppy App. Now, I am going to perform some tests.
Raspberry Pi Pico Oscilloscope Testing:
Capacitor charging and discharging:
I have this very basic RC circuit. You can see a 10K ohm resistor and a 10uF electrolyte capacitor are connected in series. A pushbutton is connected in parallel with the Capacitor. When the button is open the capacitor is charged using this 10k resistor and when the button is pressed the charge stored in the capacitor directly goes to the ground so, 0V will appear on the GP26 pin of the Raspberry Pi Pico which is the signal input. So, let’s see on the Raspberry Pi Pico based Oscilloscope; how much time it takes for the 3.3v to charge this 10uF capacitor through this 10k ohm resistor.
I completed my connections as per the circuit diagram, and now I am going to connect Raspberry Pi Pico with the Cell phone using a USB OTG adapter as previously explained.
A straight line on the top means, the capacitor is fully charged. If I am going to click on the push button the capacitor will completely discharge and if I release the button the capacitor will start charging. Our capacitor charging graph is quite similar to a standard capacitor charging graph. As I am using a small value capacitor, that’s why it quickly charges. So, the capacitor charging time depends on the voltage, resistor, and size of the capacitor. Anyways, on the screen, you can see the minimum and maximum voltage and other measurements. Let’s use Cursors to find out how much time it takes to charge this capacitor.
Adjust the vertical lines y1 and y2 and it will give you the time difference. So this capacitor takes around 577msec to completely charge. This is simply amazing. With this Raspberry Pi Pico Oscilloscope you can see in real time how a capacitor charges and discharges.
Testing an Analog Sensor:
Now, I am going to test a Variable resistor or Potentiometer which I am going to use as the analog sensor. Let’s take a look at the Circuit Diagram.
Raspberry Pi Pico Oscilloscope Analog Sensor Test:
The middle leg of the potentiometer is connected with the signal input. The rightmost leg of the potentiometer is connected with 3.3 volts and the leftmost leg is connected with the GND. You might have noticed one thing, that is, this time I am not using the float ground. If you are using 3.3 volts then there is no need to use this voltage divider. You can follow the same connections for all 3.3V supported analog and digital sensors.
I want to perform this test to check the minimum and maximum voltage of the potentiometer. So, let go ahead and perform the test.
So, you can see the minimum voltage is +0.06V volts and the maximum voltage is +3.07 volts. You can see when I rotate the Knob of the potentiometer all the way to the left, still, there is some voltage drop and this is good, the voltage and ground will never short. In the same way, you can check other analog sensors. Now, let’s measure the PWM signal from an Arduino board.
Arduino PWM Signal:
In this next example, I am going to use Arduino as the Signal Generator. I will generate different PWM frequencies and I will also change the duty cycle.
Arduino has multiple PWM pins and the normal PWM frequency which you can generate on any of these pins is 490Hz. Pins 5 and 6 are capable to generate PWM frequencies up to 980Hz. So, I will be monitoring the normal PWM frequency 490Hz, I don’t want to complicate things. With Arduino, you can generate PWM frequency up to 4Mhz.
The maximum frequency you can achieve is clock / 4, by setting the prescaler to 1 and TOP to 3 in fast PWM mode – a lower value isn’t allowed. This will give you a 4 MHz PWM with 2 bit resolution. It can be on 0%, 25%, 50%, or 75% of the time. For now, let’s forget about this maximum frequency and we will continue with the 490Hz normal frequency. So, let’s take a look at the circuit diagram.
Raspberry Pi Pico with Arduino PWM generator circuit diagram:
I am generating a PWM signal on pin 9 of the Arduino and as you can see it’s connected to the 100k ohm resistor. I am using Potentiometer 1 to control the Duty cycle and potentiometer 2 to control the frequency. Everything else remains exactly the same. I connected everything as per the circuit diagram and now, let’s take a look at the Arduino PWM frequency generator programming.
Arduino PWM Frequency Generator Programming:
int32_t frequency = 50; // frequency in hertz
int Duty_Cycle_Pot = A0;
int Frequency_Pot = A1;
int PWM_Pin = 9;
bool success = SetPinFrequency(PWM_Pin,frequency);
int Duty_Cycle = analogRead(Duty_Cycle_Pot);
Duty_Cycle = map(Duty_Cycle, 0, 1023, 0, 255);
int Set_Frequency = analogRead(Frequency_Pot);
Set_Frequency = map(Set_Frequency, 0,1023, 1, 490);
pwmWrite(PWM_Pin, Duty_Cycle); // 128 SHOW THE DUTY CYCLE WHICH IS 50% AT 128.
//THE ON TIME AND OFF TIME CAN BE VARIED AS WE
//CHANGE THIS NUMBER
I started off by adding the PWM.h header file.
Next, I defined a variable for storing the frequency value.
Next, I defined two pins for the potentiometers. Potentiometer 1 is connected with Analog pin A0 which controls the duty cycle and potentiometer 2 is connected with Analog pin A1 which controls the frequency.
Next, I defined a pin on which I am generating a PWM signal. I selected pin 9.
Inside the setup() function, I set both the potentiometers as input.
Inside the loop() function, first I read the Potentiometer 1 and then I map it’s value. Next, I read the Potentiometer 2 and then I map its value. I can set any frequency between 1 and 490. This is the normal frequency which you can generate on PWM pin 9 of the Arduino. I have already explained this in very detail.
Finally, we set the frequency and the duty cycle. So, that’s all about the programming. Now, let’s go ahead and check this in action.
You can see, the minimum and maximum voltage and also the frequency. You can see change in the duty cycle as I rotate the knob. Now, let’s go ahead and change the frequency.
It’s simply amazing. What else you want from a 5 dollars Oscilloscope? If you want to learn how to use an oscilloscope, Frequency Generator, and Logic Analyzer then this Raspberry Pi Pico based Oscilloscope is perfect for you.
Logic analyzers are the best tools for measuring and viewing digital electronic signals, and digital protocols like I2C, SPI, and Serial.
The specifications of this oscilloscope are not so impressive. It features a maximum sampling rate of 500kS/s shared between two channels. The resolution in time/div is 5us to 20s. The memory depth ranges between 2kpts and 20kpts (K for “thousand” pts for “points”) in run mode shared between channels and up to 100kpts for single-shot captures. It depends on the sampling rate. Scoppy can also work as an 8-channel logic analyzer with a sample rate of 25MS/s. The input voltage range is limited between 0 and 3.3V, and the signal to be analyzed must be within this allowed range. For measuring out-of-range voltages, you will need analog circuitry like a voltage divider or something more complex, depending on your requirements.
Watch Video Tutorial: