Make an Oscilloscope Using the SainSmart Mega2560 with the TFT LCD shield and the 3.5 “color touch screen

This instructable will show you how to build a portable Touch Screen
Oscilloscope for less than 40 U$!

The oscilloscope is one of the most powerful electronic instruments that
is available to electronics hobbyist, experimenters, and engineers. It is
mainly used to measue time-varying signals. Any time you have a signal
that varies with time( slowly, quickly, and /or periodically ) you can use
an oscilloscope to measure it , visualize it, and to find any unexpected
features in it.

We can use an oscilloscope to observe and study signal characteristics
that we could otherwise not see .

You will learn about the Arduino mega analog to digital converter( ADC).

We will be using the Arduino analog A0 input to sample and capture time
varying signals by Writing a program that will also display those signals
in a 3.8″ TFT LCD touch display, and we will input data to modify the
oscilloscope behavior, using the touch capabilities of the screen display.

Before we start building and programming, lets review some basic
characteristics of an oscilloscope.

These are functions you can control on most oscilloscopes:

Sweep speed. Sweep speed is usually measured in units of time per distance,
like milliseconds/centimeter or milliseconds per division.This might also
be referred to as the horizontal sensitivity.

Vertical sensitivity. That’s the measure of how sensitive the display dot
is to voltage applied to the input terminals. It is usually measured in
volts/centimeter or volts per division.

A trigger signal can be generated when the signal value reaches some
particular level – the trigger level. In most cases you can set the trigger
level to a voltage value of your choosing. A trigger is used to capture and
stabilize the waveform on the screen, or to wait for an event before
capturing the data
The oscilloscope, like my 4 channel DC DVM, will not be as accurate as
a commercial unit, but it works pretty good for low voltage and low frequencies.

Make an Oscilloscope Using the SainSmart Mega2560 with the TFT LCD shield

Step 1: UPDATE: Sketch to convert Oscope to 3 Channel DVM with graphic display + Lego enclosure

Thank you to all who voted for me! This Instructable won 3rd prize in the Arduino contest, and first prize in the Gadget contest…

Included are pictures and code to convert your oscope to a 3 Channel DVM and to show the output of each channel individually in the scope display by pressing a soft key on the display. ( the third button from the top)

you will need an L shaped female pin connector if you want to have the flexibility of inserting jumpers, otherwise, just bend the pins on one side of the jumpers to insert them in the analog channels (A0- A3) to use them as your probes.

Just download the sketch and upload it to the Arduino.

You can label each channel individually, just change the wording in the sketch.

I have also made a lego enclosure for the scope..check out the pictures.

OscopemegavwDVM.ino7 KB

Step 2: Parts list

You will need :

Step 3: Build the hardware.

Construction of the Oscilloscope is fairly simple. You just have to put the parts of the Sainsmart kit together. All you need to do is add two jumpers; one for ground, and the other to use as  your oscilloscope test probe.

You will need to bend the pins on one side of the jumper wires, and insert them into the A0 pin and GND pin of the Arduino (see pictures for detail),  before installing the display shield, as the display shield will cover the ports once it’s in place.

Plug  the Shield into the Arduino ,  then plug  the display into the shield, and you’re done!!!

Now let’s  test the display before we turn it into an oscilloscope.

Step 4: The software: UTFT library test.

If you finished putting your kit together, plug it into the USB cable that connects to your PC running the Arduino IDE.

If you haven’t done so, download the UTFT and UTouch Libraries, and copy them to the libraries folder where you have the arduino IDE installed.

If the libraries installed properly, you will see the UTFT and the UTouch options when you click on the Files option, and scroll down to examples.

If the UTFT option is in your menu list, select it, then select arduino, and finally, UTFT_Demo_320x240. This will load the cool demo program.

With the program loaded in the IDE, scroll down to view the following code:

 // Uncomment the next line for Arduino 2009/Uno
//UTFT myGLCD(ITDB32S,19,18,17,16);   // Remember to change the model parameter to suit your display module!

// Uncomment the next line for Arduino Mega
UTFT myGLCD(ITDB32S,38,39,40,41);   // Remember to change the model parameter to suit your display module!

Comment out the command for the UNO , and uncomment the  command for the Mega ,as I did.

Now, go to the tools menu, click on board, and select  Arduino Mega 2560 or Mega ADK , if not already selected.

Click on verify to compile the program. If there are no errors, click on upload to  load and execute the program.

If everything is Ok, you will see a cool demo program running. Pictures in this step, show screenshots of the demo running.

Step 5: The software: UTouch library test.

Now we need to test the Utouch  Library

Go to the files menu  and select ; Examples>UTouch>Arduino>Utouch_ButtonTest and load the program to the IDE.
Verify and  run the program.

You should see a keypad show up in the display, and, as you press the number keys, they should show up at the bottom of the screen.

If all went well, we are ready to load the Oscilloscope software.

Make an Oscilloscope Using the SainSmart Mega2560 with the TFT LCD shield circuit

Step 6: The Oscilloscope

Below, you will find the sketch for the Oscilloscope. Before we copy and paste the program, let’s review some limitations and explain the program.

I’ve had to do a fair amount of research to come up with the code, and many snippets have been “borrowed” from several sources.

I divided the program into several subrutines to make it easier to understand. The code is well documented, but, if you have trouble understanding it, leave a comment and I’ll try to explain it.

The Oscilloscope bandwidth is limited to about 1 khz, but there is room for improvement.


For more detail: Make an Oscilloscope Using the SainSmart Mega2560 with the TFT LCD shield and the 3.5 “color touch screen

This Post / Project can also be found using search terms:

  • осцилограф на ардуино
  • Android Arduino oscilloscopio
  • arduino oscilloscope
  • arduino oscilloscope tft lcd
Clip to Evernote

Leave a Comment

(Spamcheck Enabled)

Read previous post:
Talking Darth Vader Binary Clock
Talking Darth Vader Binary Clock

In this instructable I am going to show you, how to paint a black and white image of Darth Vader...

Scroll to top