Organize and Share your Electronics the way you want. Sign-Up for a free account now. It takes only 30 seconds!

A Really Simple Arduino Oscilloscope Tutorial

A Really Simple Arduino Oscilloscope Tutorial

This Arduino oscilloscope is perfect if you need an oscilloscope right now, but all you have is an Arduino.

I needed an oscilloscope to debug my Radar Arduino library.

The code worked perfectly when it was not in “Arduino library”-form. But when I modified it into a library, it just didn’t work at all.

Since the radar module (from https://www.xethru.com) was using the UART, I didn’t have any way of checking what was going on.

So I needed an oscilloscope to check if there was actually any action on the UART lines.

 

Tools needed:

  • Arduino
  • Jumper wires for measuring

Step 1: Upload Arduino Oscilloscope Code

First of all you need some code to read the analog value from the analog input pin A0. You can do this easily by using the analogRead() function.

Then you need to send this value over to your computer using the serial port. There are plenty of ways to do this. In the following code, the value is sent as two bytes with one 0xff byte in between.

This code reads an analog input and writes the value to the serial port. Upload the following code to your Arduino:

const int analogPin = A0;
 
void setup() {
  //Setup serial connection
  Serial.begin(9600); 
}
 
void loop() {
  //Read analog pin
  int val = analogRead(analogPin);
 
  //Write analog value to serial port:
  Serial.write( 0xff );                                                         
  Serial.write( (val >> 8) & 0xff );                                            
  Serial.write( val & 0xff );
}

This code is from https://gist.github.com/chrismeyersfsu/3270358#file-gistfile1-c

This is really all it takes on the Arduino side to make an Arduino oscilloscope. But to display the values, you need some code on you computer too.

arduino-oscilloscope

Step 2: Install Processing

You need something on your computer to receive the values that are sent from the Arduino, and display them nicely. Processing is a simple programming environment to do this.

Download processing for free from their website: https://processing.org/

Then install it on your computer.

Step 3: Run Processing Code

Then, you’re ready to run the processing code. Copy and run the following code in processing to get a nice oscilloscope interface on your computer:

https://gist.github.com/chrismeyersfsu/3270419

arduino-oscilloscope-output

Step 4: Test Your Arduino Oscilloscope

Connect two jumper wires to your Arduino. One from ground and one from the A0 analog input.

You should now be able to use these wires to measure things and see the measurement on your computer.

Viola! You’ve just created a super simple arduino oscilloscope.

Oscilloscopes are actually very easy to use, once you learn a few basic things: Learn how to use an oscilloscope.

Read more Here

 

More Articles to Read

Guide to build your 3.3v power supply
Guide to build your 3.3v power supply
SDR radio breathes life into a 75 year old Marconi CR100
SDR radio breathes life into a 75 year old Marconi CR100
A Time for Ranting!
A Time for Ranting!
Emulate a Commodore 64 keyboard with a modern PC and an Arduino
Emulate a Commodore 64 keyboard with a modern PC and an Arduino
USB2005 and USB97C202 Sharing ATA/ATAPI Drive w/ Another Controller
USB2005 and USB97C202 Sharing ATA/ATAPI Drive w/ Another Controller
Robotic Cat Laser
Robotic Cat Laser
LED traffic light
LED traffic light
Estimating Power for ADSP-BF561 Blackfin® Processors
Estimating Power for ADSP-BF561 Blackfin® Processors
Teach Your Arduino to Switch Itself Off!
Teach Your Arduino to Switch Itself Off!
Control a tracked robot with your mind (or joystick)
Control a tracked robot with your mind (or joystick)

Top




Shares