Arduino – Poor Man’s Oscilloscope

Hi guys,

Today I’ll talk about a really good project you can do with your Arduino! This is the best way you can have a cheap oscilloscope around. Let’s start…Arduino Oscilloscope image

And then you just need to connect the Arduino analog pin 0 to the signal you want to read.

And It’s done!

This is the Circuit I’ll be measuring , it’s a simple 555 timer circuit… that flashes a LED, parts list:

  • 1x Arduino

    555 Timer LED Blinks

    555 Timer LED Blinks

  • 1x Breadboard
  • 1x LED
  • 1x 10k resistor
  • 1×4.7k resistor
  • 1x 1k resistor
  • 1x 100nF electrolytic capacitor
  • Jumper cables

Check my YouTube video and watch it working.

Thanks for reading, leave a comment or send me an email. If you like this post probably you might like my next ones, so please support me by subscribing my blog and my Facebook page (you can find everything right column )

Advertisements

About Rui Santos

Arduino Tinkerer. Circuits Designer. Electronics Hobbyist. Blogger and Entrepeneur. I live in Portugal and I'm studying electrical engineering.
This entry was posted in Arduino, Arduino Tutorials and tagged , , , , , , , , . Bookmark the permalink.

11 Responses to Arduino – Poor Man’s Oscilloscope

  1. Pingback: Tools – 200$ How To Set Up An Electronics Lab | Random Tutorials

  2. Pingback: A Poor Man’s Oscilloscope « diy with electronic

  3. Pingback: » An Arduino O-Scope Fuzzy Hypothesis Online

  4. zurab says:

    I like it.

  5. Ryan says:

    What is the Scope time base setting?

  6. Dominic says:

    I tried it but the screen is blank..do I need to make a special probe..please let me know..thanks

    • Rui Santos says:

      please use my new website… randomnerdtutorials.com
      you don’t need any special probes, that should be working right away? are you using windows?
      download the 32 bits version of processing and try again..

      • Dominic says:

        Yes I am on windows vista /7 ..I only get a red line in the middle..when I feed in a signal there is no effect..I’m using arduino dumeilenova 328..please help…

  7. varind says:

    I had to change:
    port = new Serial(this, Serial.list()[0], 9600);
    to:
    port = new Serial(this, Serial.list()[4], 9600);

    Try a different port # or add: println(Serial.list()); to setup() to display your serial ports. Make sure you use the same number that you use in Arduino->Tools->Serial Port

    Complete Processing Code:
    /*
    * Oscilloscope
    * Gives a visual rendering of analog pin 0 in realtime.
    *
    * This project is part of Accrochages
    * See http://accrochages.drone.ws
    *
    * (c) 2008 Sofian Audry (info@sofianaudry.com)
    *
    * This program is free software: you can redistribute it and/or modify
    * it under the terms of the GNU General Public License as published by
    * the Free Software Foundation, either version 3 of the License, or
    * (at your option) any later version.
    *
    * This program is distributed in the hope that it will be useful,
    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    * GNU General Public License for more details.
    *
    * You should have received a copy of the GNU General Public License
    * along with this program. If not, see .
    */
    import processing.serial.*;

    Serial port; // Create object from Serial class
    int val; // Data received from the serial port
    int[] values;
    float zoom;

    void setup()
    {
    size(1280, 480);
    println(Serial.list());
    // You may need to change the number in [ ] to match the correct port for your system
    // Look at the output in the bottom of this window
    // Open the port that the board is connected to and use the same speed (9600 bps)
    port = new Serial(this, Serial.list()[4], 9600);
    values = new int[width];
    zoom = 1.0f;
    smooth();
    }

    int getY(int val) {
    return (int)(height – val / 1023.0f * (height – 1));
    }

    int getValue() {
    int value = -1;
    while (port.available() >= 3) {
    if (port.read() == 0xff) {
    value = (port.read() << 8) | (port.read());
    }
    }
    return value;
    }

    void pushValue(int value) {
    for (int i=0; i<width-1; i++)
    values[i] = values[i+1];
    values[width-1] = value;
    }

    void drawLines() {
    stroke(255);

    int displayWidth = (int) (width / zoom);

    int k = values.length – displayWidth;

    int x0 = 0;
    int y0 = getY(values[k]);
    for (int i=1; i<displayWidth; i++) {
    k++;
    int x1 = (int) (i * (width-1) / (displayWidth-1));
    int y1 = getY(values[k]);
    line(x0, y0, x1, y1);
    x0 = x1;
    y0 = y1;
    }
    }

    void drawGrid() {
    stroke(255, 0, 0);
    line(0, height/2, width, height/2);
    }

    void keyReleased() {
    switch (key) {
    case '+':
    zoom *= 2.0f;
    println(zoom);
    if ( (int) (width / zoom) <= 1 )
    zoom /= 2.0f;
    break;
    case '-':
    zoom /= 2.0f;
    if (zoom < 1.0f)
    zoom *= 2.0f;
    break;
    }
    }

    void draw()
    {
    background(0);
    drawGrid();
    val = getValue();
    if (val != -1) {
    pushValue(val);
    }
    drawLines();
    }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s