loading

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
megascope2.jpg
WP_20140406_007.jpg
WP_20140406_004.jpg
megascope1.jpg

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.

 
1-40 of 76Next »
DavidPatterson11 months ago

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.

http://www.instructables.com/id/Arduino-High-speed...

It would be interesting to bring the two concepts together.

johnag (author)  DavidPatterson10 months 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.

connections.jpgendview.jpginfo.jpgrun.jpgstartup2.jpginsidebox2.jpg

Can you give the code?

Hello,Which library you using for this?

How did you add images ?

Hi,

For this application I used
Henning's loadBitmap function- which is documented in the examples
supplied with his library. This requires that you convert a screen sized
(or less) picture to raw format. He supplies a program with his library
download for this. Or you can use his online converter at :

http://www.henningkarlsen.com/electronics/t_imagec...

I used a screen sized (320 x 240) file.

#include <tinyFAT.h>
#include <UTFT.h>
#include <UTFT_tinyFAT.h>
#include <UTouch.h>

// Initialize Screen and touch functions
UTFT myGLCD(ITDB32S,38,39,40,41);
UTFT_tinyFAT myFiles(&myGLCD);
UTouch myTouch(6,5,4,3,2);
boolean logo = true;

word res;

const int chipSelect = 53; // sd select pin

void setup(){

pinMode(chipSelect, OUTPUT);

myGLCD.InitLCD();
myGLCD.clrScr();

int picsize_x = myGLCD.getDisplayXSize();
int picsize_y = myGLCD.getDisplayYSize();

if (logo){
if (file.initFAT()==0){
switch (picsize_x);
res = myFiles.loadBitmap(0, 0, picsize_x, picsize_y, "LOGO.RAW");
if (res == 0){
delay(5000);
myGLCD.clrScr();
}

}

}

// more setup stuff

}

The use of the raw file for a one off display is fine.

However
having to convert multiple files seemed a little time consuming to me.
So I wrote an addition to the Henning's utft library to process 24 bit
bmp files directly. This works great and does not require UTFT_tinyFat
and tinyFat. The sdcard can be accessed using the standard arduino sd
library. My patch will load a screen sized bitmap in 1.79S, which is a
little faster than Henning's system.

I have also utilised the sd for data recording.

All in all John has detailed a very useful shield and lcd!

Hi,

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.

http://forum.arduino.cc/index.php?PHPSESSID=3e1pvs...

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

Whitmore12 made it!10 months ago

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

MyPipBoy.jpgOscilloscope.jpgPipboyOscope.jpg
johnag (author)  Whitmore1210 months ago
Cool, thanks forsharing..
grumpyboots made it!1 year ago

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

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

Cool grumpyboots.. thanks for sharimg!

I LOVE it!!!! I haven't been able to use my screen for two years!
e.ma.niak made it!1 month ago

Nice job. But you didn't include those libraries. Actually you did, but the instructable editor cut them out as html tags. So kids, dont forget to include them.

P1070464.jpg

Hello is very good thank you

GrayAlien2 months ago

Hello:

At this time I only have an 2.8 tft lcd with sd card socket that will work with my Uno. I would like to know before I start this project do you think this could be adjusted to work with what I have?

What I would like to do is collect the data and place on the sd card so I can analyzed at a later time. Editing the code for sd card is something I think I can do, but using an tft lcd is not. I would like to know your thoughts on this before I begin.

Thanks

~Chris

Ralphxyz2 months ago

Your Libraries.zip file is corrupt!!

Could not extract your files, to bad great project. Thank You!!

hemal15 months ago

Hi,can anyone help me to graph a analog input in 3.2''tft?any updated library available for this?

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?

What is the size of your tft?

johnag (author)  Rogério Santana1 year 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 Santana1 year ago

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

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

waqasbadarwb5 months ago

Sir will you explain these lines.

Secondly, I am using 400x240 tft and the negative part of the waveform is disappeared and a horizontal line appears.

for( int xpos = 0; xpos < 239;

xpos ++)
{
// Erase previous display
myGLCD.setColor( 0, 0, 0);
myGLCD.drawLine (xpos + 1, 255-OldSample[ xpos + 1]* vsens-hpos, xpos + 2, 255-OldSample[ xpos + 2]* vsens-hpos);
if (xpos == 0) myGLCD.drawLine (xpos + 1, 1, xpos + 1, 239);
// Draw the new data
myGLCD.setColor (255, 255, 255);
myGLCD.drawLine (xpos, 255-Sample[ xpos]* vsens-hpos, xpos + 1, 255-Sample[ xpos + 1]* vsens-hpos);
}

tell me if i can use

2.4 inch TFT touch LCD Screen Module and an arduino uno or not by using same libraries and code in this post ?
mimhs9 months ago

I made it. Good tutorial-impressive work. Thank you.

Hamzaikky9 months 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.779649 months ago

thannks..:)

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

Jim

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

rroque51 year ago

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

johnag (author)  rroque51 year ago

I don't.think. so, sorry

rroque5 johnag1 year ago

Thanks!

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)  alejandroym931 year ago

check tis instructabel to giv you an idea:

How to make an Arduino oscilloscope probe by NeoRecasata

http://m.instructables.com/id/How-to-make-an-Arduino-oscilloscope-probe/

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

johnag (author)  alejandroym931 year 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)  alejandroym931 year ago

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

johnag (author)  alejandroym931 year ago
Use a voltage divider and a capacitor at the input.
1-40 of 76Next »