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

FeaturedContest WinnerContest Winner
Picture of Make an Oscilloscope Using the SainSmart Mega2560 with the TFT LCD shield and the 3.5

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.

Remove these adsRemove these ads by Signing Up
1-40 of 62Next »

An excellent article!

I will be looking for a tft for my mega!

What sort of refresh rate do you think your tft has?

Have you considered reading the analogue port by interrupt-

I have a 153K oscilloscope design using a mega with hardware and software triggering.

It would be interesting to bring the two concepts together.

johnag (author)  DavidPatterson1 month ago

Sorry for the delay in responding. Thanks for your comment. I don't know the refresh rate of the screen, haven't checked the specs in detail. It would definitely improve the scope if you could increase the bandwidth by using your design. If you get the kit and try your concepts on it , please share.. If I have time I might try it myself..Again thanks.

The 3.2 inch screen and Shield finally arrived. I used my Mega rather than the Sainsmart.

Assembly was easy- I added connecters for the analogue port, pwm10, zero and 5V. Programming was not difficult- Henning, the library author has excellent documentation. I found no issues in implementing his protocols.

My scope runs at up to 237-238 Khz.

The sdcard reader which is on the shield, works and opens up the possibility of data saving. (Not to mention adding pictures)

This has produced a very nice stand alone oscilloscope.

Thanks for your work.



I ordered the lcd a month ago- apparently it is somewhere between China and the uk.

In the mean time I have developed code which runs at

237.3 Khz, with configurable software triggering.

I have also written software which runs at 1.2MHz using a TLV571, also with software triggering.

Whitmore12 made it!1 month ago

Great Instructable! It got me thinking and I decided to make my own PipBoy from it!

johnag (author)  Whitmore121 month ago
Cool, thanks forsharing..
grumpyboots made it!7 months ago

neato! thanks, maybe ill see what uses i can for this

Photo on 2014-04-20 at 5.51 PM.jpg
johnag (author)  grumpyboots7 months ago

Cool grumpyboots.. thanks for sharimg!

Hamzaikky13 days ago

Can this program work on aurdino UNO aswell ? how many pins does the lcd shied have ?

Looks more complicated the it is. The Lego enclosure is a nice touch!

johnag (author)  peter.kocsis.7796415 days ago


guys my library shows a problem in this line UTFT myGLCD (ITDB24E_16,38,39,40,41). with the following Message: UTF does not name a type. can someone help me?

johnag (author)  Rogério Santana3 months ago

Make sure you have the library properly instaled and that you run the demo programs, as described in steps. 4 and 5 before loading the oscpe sketch

johnag (author)  Rogério Santana3 months ago

if you are usimg the sainsmart kit the line should read::

UTFT myGLCD(ITDB32S,38,39,40,41);

what does ('UTFT' does not name a type) mean I get this when I told it to load the sketch.


UTFT myGLCD(ITDB32S,38,39,40,41);

rroque54 months ago

Is to do this using a nano aruino v3.0?

johnag (author)  rroque54 months ago

I don't.think. so, sorry

rroque5 johnag4 months ago


alejandroym936 months ago

Nice work! Only one thing, how did you solved the problem of the negative part of the signal when you plug in the function generator?

johnag (author)  alejandroym936 months ago

check tis instructabel to giv you an idea:

How to make an Arduino oscilloscope probe by NeoRecasata

indeed it graph most part of the signal with the probe, but it keeps cutting a minimum part of the signal.

johnag (author)  alejandroym936 months ago

the signal needs to be "conditioned " to be between 0 and 5 volts before it is input into the arduino analog input. You may need to attenuate the signal and float it on a dc voltage. Use two resistors in series connect one end to ground and the other to the 5 volt arduino pin, connect a capacitor to the junction and to your function generator. Connect a jumper from the junction to the analog pin. This will float the waveform on a dc of 2.5 volts. You can use two 1 meg resistors and a .47 micro farad capacitor. Remember the voltage. From your function generator has to be 5 volts peak to peak,if it is not, you. Will need to attenuate it using a potentiometer..

thank you a lot man, it worked perfectly:)

johnag (author)  alejandroym936 months ago

glad to the I made it button and share a picture if you want...

johnag (author)  alejandroym936 months ago
Use a voltage divider and a capacitor at the input.
Jan_Henrik6 months ago

Awesome project, I love it!!!

johnag (author)  Jan_Henrik6 months ago've got some awesome projects too!

Jan_Henrik johnag6 months ago

Thank you! :)

Mr. E6 months ago

Nicely done ! Something every work bench should have.

johnag (author)  Mr. E6 months ago

Thanks Mr. E, By the way, I tried your , another awesome project, thanks for sharing

OK I see where the pins go, from the PDF it did not show this and now looking at your design on the Instructables Interweb site I must have been off in well thanks and sorry to have bothered you.


murfmv7 months ago

Johnag, Thought I was having trouble compiling because of different Arduino versions, but then realized where are the libraries after the include statement and also problems cutting and IDE code. It's up and running and can't to test something. Always wanted an oscilloscope, now I have one and will be following ur blog.

Great Job!!

johnag (author)  murfmv7 months ago

Glad you worked out the problem. Take a picture, and click on the I made it button! Have fun using it.

dustint20047 months ago

Sooo. If you have specific parameters already set.

Does PC still need to be connected to test or capture data?

johnag (author)  dustint20047 months ago

no it doesn't need to be connected to the PC, and you can vary some of the parameters with the touch screen buttons.

murfmv7 months ago

Hello Johnag,

Great thing I'm unable to compile your program in version 1.05 after running the TFT examples. I've gotten no errors, but suspect that might be the problem. I'm certainly looking forward making this work!

30-067 months ago

Could this read from 10Hz to 20kHz?

johnag (author)  30-067 months ago

Probably not without an external ADC due to the limitations of the Arduino. But, the fundamentals of human voices are roughly in the range of 80 Hz to 1100 Hz, so you can use it to monitor voice patterns for stress and lie detection. The audio range of the human ear is from 20 hz to 20 khz which, I presume, is what you want to monitor.

I haven't finished tweaking the code, so if I figure out a way to increase the bandwidth without additional hardware I will update the instructuble.

grumpyboots7 months ago

what would be the usable limits for this scope, without dividers and such I mean?

Volts peak to peak etc


1-40 of 62Next »