Oscilloscope Arduino-Processing

137,349

194

91

Introduction: Oscilloscope Arduino-Processing

Oscilloscope is a device that allows us to see graphically the electrical signal.

If you want a cheap oscilloscope to learn what it is or to play with, follow the steps below:

Step 1: Have an Arduino Uno

The price of Arduino Uno is around $ 20 in internet stores.

Step 2: Install the Arduino IDE and TimerOne.h Library

  1. First, if you do not already have the Arduino IDE installed, install it from the site Arduino: click here
  2. Install the "TimerOne.h" library for the Arduino IDE, following the steps bellow
    • In the Arduino program click on "Sketch" (see the picture)
    • "Include Library ..."
    • "Manage Libraries ..."
    • On the line "Type: 'all' Topic: 'all'" has a blank search field , type "TimerOne".
    • (Information about the library will appear )
    • click over that text and the "Install" button will appear.
    • click "Install"
    • Restart the program

Step 3: Download Arduino Program and Upload It to Arduino

  1. Download and unzip the Arduino program from this link: (oscilloscope_arduino.ino)
  2. Connect the Arduino to the computer via USB port
  3. Run the Arduino IDE;
  4. Open the downloaded program "oscilloscope_arduino.ino"
  5. Adjust the COM port correctly (see picture)
  6. Upload the program to Arduino.

Step 4: Download the Oscilloscope Processing Program

  1. Download and unzip the Processing program to run on the computer. Choose the correct one below:
  2. Execute the Processing file (ex: Windows 64 bits => oscilloscope_4ch.exe)
    • Obs: lib\ folder is important, do not delete it
    • Java 8 needs to be installed

Step 5: If Oscilloscope_4ch.exe Doesn't Work...

If oscilloscope_4ch.exe doesn't work for any reason:

  1. Install the Processing IDE.
  2. Download and unzip the Processing source oscilloscope program
  3. Run Processing IDE and open the oscilloscope source program
  4. Execute the program clicking on the triangle icon

Step 6: Configure Serial Port to Connect Oscilloscope Program With Arduino

  1. You already have the oscilloscope program running and the Arduino connected to the computer by USB port. Now you have to connect to each other by "serial".
  2. In the "Configurar a serial" (Configure the Serial) box, click "select serial" until the COM where the Arduino is connected appears.(if it did not appear, click "refresh" to update)
  3. Click "select speed" until the speed 115200 appears.
  4. Click "off" to switch to "on"
  5. If everything is correct, the oscilloscope will show the 4 channels [A0 (ch-0), A1 (ch-1), A2 (ch-2) and A3 (ch-3)]
    obs: if nothing is connected you will see a noise.

Step 7: Connect the Output (~10) to Input (A0) and (~9) to (A1)

  • With wires connect the Arduino's digital output (~10) to analog input (A0) and digital output (~9) to input (A1).

You will see appear a signal like the picture.
The out (~9) and (~10) are generated by the "Ger.Sinal" box:
(~9) is PWM of 10Hz (T = 100ms) with 25% ON.
(~10) is a square of period 2T (200ms)

  • You can adjust the values on that box dragging the edge or clicking around the control.

Step 8: Tips

  1. Click "Trigger" at the Ch-0 (red) to stabilish the signals.
  2. To not read the signals of Ch-2 and Ch-3, click on the names "Ch-2" and Ch-3 ".
  3. To see the XY (Lissajous figures), click on the name "XYZ"
  4. To detect the frequencies, click on "detect freq."
  5. To measure voltage and time/frequency, click on "medir" (measure) of the desired channel then click on a point on the graph and drag to the other desired point.
  6. To change the dial control value click between vertical lines or drag the edge indicated by the triangles. (see picture)
  7. There is so much more! Explore!

Step 9: Aplication: Detecting Flash Frequency

You can find out the frequency that the flashlight is blinking using a LDR and a resistor (see the picture)

Step 10: Application: Detecting RPM of Fan

To find out the RPM of a fan use the circuit with LDR, resistor and a flashlight (not blinking).

Using the frequency value shown by the oscilloscope, apply the formula of the picture.

Step 11: Application: Analysing the Remote Control Signal

You can see the IR signal from remote control using the phototransistor TIL78.

Make the circuit of the picture, then follow the steps bellow:

  1. Adjust "dt" to 2ms (see all signal) or 100us (see details)
  2. Turn ch-0 trigger ON
  3. Increase level of trigger tension
  4. Click "UMA" (one): oscilloscope will stay waitting for the signal
  5. Press any remote control key directing it to TIL-78
  6. Analyse the graphic

Step 12: Application: Testing Components or Devices

We can use the oscilloscope to test electronic components or devices.

In this example we will test the little joystick for Arduino.

    1. Make the circuit shown in the picture.
    2. Connect the oscilloscope program to Arduino (configuring the Serial Port box)
    3. Click on "fluxo" (flow) so the Arduino sends each point right after reading.
    4. Adjust "dt" to 100ms to have a slow reading.
    5. Turn off the "ch-3" clicking over the name
    6. Adjust "v/div" to 5 (pressing the "shift" key to adjust all channels simultaneously)
    7. Change the ch-0 to up, moving the little left triangle (pressing the "shift" key)
    8. Turn on the XYZ channel and drag the "v/div", adjusting it to fill the free space.
    9. Move the joystick to all directions and press the button some times.
    10. See the curves.

    Step 13: Measure Resistors and Capacitors

    The "medir res./cap." (measure res./cap.) box is for measuring values of resistors and capacitors, but it will only work if you make the circuit of the picture.

    That function has the hability to discover by itself if the component connected is a capacitor or a resistor, and to choose the better result using 3 scales (low, middle or high values)

    Step 14: Do You Want More Fun?

    You can download the entire project directly from the GitHub site clicking here

    Watch the video on Youtube (turn on closecaption and translate to english!)

    Please, let me know if you liked that project or if you had any trouble to follow the steps.

    I will apreciate any help to develop that project. Programmers, users, curious, dreammers, etc.., will be welcome! ;)

    23 People Made This Project!

    Recommendations

    • Hide It Challenge

      Hide It Challenge
    • Unusual Uses Contest

      Unusual Uses Contest
    • Edible Art Challenge

      Edible Art Challenge

    91 Comments

    0
    chrisronaasen
    chrisronaasen

    Tip 15 days ago

    Little tip for anyone having troubles where it crashes upon turning on the device, or if it works with the source but displays nothing in the test:

    Delete everything until now, except the processing IDE program itself.
    Go to the github page https://github.com/rogeriobego/oscilloscope-arduin...
    On the right side, click the latest release shown (1.3 in my case).
    Download the application.windows64.zip file and unzip both folders inside to somewhere you'll remember them (separately on desktop maybe).
    Upload the arduino sketch. Don't change anything, just upload it.
    In the application.windows64 folder, rename the source folder to EXACTLY oscilloscope_4ch
    Open that folder.
    Open the oscilloscope_4ch.pde file.
    Run the program, without changing anything. Just run it.
    Do the rest like normal. It'll work, AND it'll actually work CORRECTLY.
    You don't need the arduino IDE open anymore. You can run this program purely from the processing IDE from now on, so you'll have two windows when you use this, but at least you'll have a working oscilloscope.

    For those wondering, the issue is with a serial communications library in Java or some shit. For most people, it seems like using java 8 32bit solves problems with that library, but seeing as it's hard to choose which version of Java you open a .exe file with, it's easier to just go the IDE way.

    And if anyone has a shitton of money and they're allergic to paper, I'm extremely broke and in debt, so feel free to let me know if you're feeling especially thankful :)

    0
    fdmarcanob
    fdmarcanob

    Question 6 weeks ago on Step 4

    Hi, I have a problem with run the communication in a linux 32, my arduino is conected but the programm dont run, this freezed

    0
    opticsprof
    opticsprof

    Question 3 months ago on Step 13

    I followed instructions for downloading the Processing source, because the 'oscilloscope_4ch.exe' did not work. When I select the triangle on the Processing window, The app shown is 'BegOscopio 1.2', not version 1.3 as shown in the instructions. The controls are similar enough that I can operate it OK. However, when I try the first test using Output (~10) to Input (A0) and (~9) to (A1), there is no signal display on my screen. Can you please help me troubleshoot? The port is configured correctly, because I ran some other programs on it last night. Thank you!

    0
    opticsprof
    opticsprof

    Answer 3 months ago

    Oops. I can answer my own question. After doing a deep dive into the comments, I found that dfurtek had a similar problem and switched to the 32-bit version of the Processing program. It works now. Thank you for a great effort here!

    0
    saad.ranaaa1
    saad.ranaaa1

    Question 5 months ago on Step 4

    Is the oscilloscope GUI available in English? Can you tell me if I can change its language?

    0
    RenatoP5
    RenatoP5

    3 months ago on Introduction

    Parabéns pela iniciativa. Por enquanto é o melhor programa de Scope feito em Processing. Muito 10. Parabéns... Orgulho do Brasil...

    0
    Mecar
    Mecar

    5 months ago

    Hello there,
    I'm having some problems trying to get my oscilloscope to work, I don't know exactly what's going on but when I turn the oscilloscope on (after choosing the Arduino port and setting the speed) it just crashes. The error message it gives me says: "EXCEPTION_ACCESS_VIOLATION". When I use the other option (step 5) it does turn green when I press "on" but nothing happens when I connect the cables as instructed. I hope you can help me, anyways thanks for your time.

    0
    Kissinno
    Kissinno

    Reply 4 months ago

    Hi Mecar,
    Please, did you find the trick !?!!!
    I'm having EXACTLY same both issues.
    Crash or Green
    (connected) but no signal, flat curve for all 4 CH.

    0
    rk7312945
    rk7312945

    Question 1 year ago

    What is the maximum voltage can be measure using this ?

    0
    mklanert
    mklanert

    Answer 1 year ago

    Most arduino boards are limited to 5V for inputs, some are 3.3V. However, you can always use a voltage divider to measure higher voltages. I didn't do this instructable yet, but it looks like you can set in the PC software the voltage divider you are using so it will show the proper voltage reading.

    0
    Tesla32
    Tesla32

    Reply 7 months ago

    In which pc software should i set the voltage divider ?

    0
    suman.menon283
    suman.menon283

    Question 1 year ago

    Hi, i was doing a experiment where i use a function generator to display a sin wave . but when i do this, the negative half cycle of the wave clipped off . it happent to all the other wave. why it happent???? should i add 2.5V to the signal from function generator????
    what should i do to prevent clipping of the signal ????....plz help me..... i don't get a clear idea from the previous comment ..... plz help me with this................

    0
    Tesla32
    Tesla32

    Answer 7 months ago

    Can you please let me know how you connected the function generator with the oscilloscope ? Have you changed anything in the code ? I'm trying to see waveforms from my function generator but the oscilloscope isn't responding that way . Plz help me with this.....

    0
    mklanert
    mklanert

    Answer 1 year ago

    I imagine your wave is going from +5V to -5V, right? Arduino analog ports can only read 0V to +5V signals. It means it can only read the positive portion of your wave as it cannot read negative voltage signals. What the author suggested as the solution in your previous question is that you have to displace the mean voltage of your wave from 0V to +2.5V, and use a maximum amplitude of 2.5V. Doing this, your peak will be +5V (2.5V mean + 2.5V amplitude) and your valley will be 0V (2.5V mean - 2.5V amplitude), so you will stay in the 0V to +5V range of inputs.

    0
    d_pintassilgo
    d_pintassilgo

    7 months ago

    Hello!
    Just by any chance, anybody already made same change to add a triangular generator to another available pin?

    0
    Tesla32
    Tesla32

    Reply 7 months ago

    I also want to know bout it !

    0
    ccms.chemistry
    ccms.chemistry

    Question 7 months ago

    Hello! I'm having issues to run processing code as before it uploads
    I get: "Cannot get a class or type named "Botao"". Same message with Com and Tela. I'm loading from Oscilloscope_4ch.pde
    How can I get it to work? This will be an awesome tool for my physics class. Please help!

    0
    Tesla32
    Tesla32

    Question 10 months ago on Step 14

    Hello !
    The project is really amazing. Willing to try this but having some problems to understand the circuit of "Measuring Resistors & Capacitors" . Can you please tell me how much ohms the resitors persue that are used in the circuit ? Why the leds are used ? Where the A0, A1, A2 & A3 Are connected ? It will be a great help if you give a detailed schematic diagaram also.
    Have a good day.

    0
    d_pintassilgo
    d_pintassilgo

    Answer 7 months ago

    i have a similar problem.
    I cant see exactly the values os the resistors! Any one can help?