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

App note: EPIC: Electro-Pyrotechnic Initiator Chip Resistor
App note: EPIC: Electro-Pyrotechnic Initiator Chip Resistor
Free PCB Sunday: Pick your PCB
Free PCB Sunday: Pick your PCB
App note: Noise analysis for high-speed op amps
App note: Noise analysis for high-speed op amps
Skill Sunday: Arrays
Skill Sunday: Arrays
App note: Infrared remote control implementation with MSP430FR4xx
App note: Infrared remote control implementation with MSP430FR4xx
Gesture Controlled Smart Home
Gesture Controlled Smart Home
Design for a Wideband, Differential Transimpedance DAC Output
Design for a Wideband, Differential Transimpedance DAC Output
Wrist thrusters let you fly through the water effortlessly
Wrist thrusters let you fly through the water effortlessly
Bertan/Spellman 225-20R HV power supply teardown
Bertan/Spellman 225-20R HV power supply teardown
Blinking Christmas Lights
Blinking Christmas Lights
Adjusting clock with alarm, hygrometer & thermometer on 1.8″ ST7735 display
Adjusting clock with alarm, hygrometer & thermometer on 1.8″ ST7735 display
Adding an “extra sense” with rangefinders
Adding an “extra sense” with rangefinders
This wireless game controller looks like a rug
This wireless game controller looks like a rug
How to run your ESP8266 for years on a battery
How to run your ESP8266 for years on a battery
Calibration of a 3-Phase Energy Meter Board on the ADE7754
Calibration of a 3-Phase Energy Meter Board on the ADE7754
Making beats on a tiny Arduino DJ controller
Making beats on a tiny Arduino DJ controller
Qinsi-QS5100 Sn63Pb37 solder profile
Qinsi-QS5100 Sn63Pb37 solder profile
Water Detection System
Water Detection System
Professional Hi-Fi 15W Tube Amplifier circuit
Professional Hi-Fi 15W Tube Amplifier circuit
This Arduino machine will judge how sick your ollies are
This Arduino machine will judge how sick your ollies are

Top


Shares