PDA

View Full Version : Teensy 3 as a osciloscope and logic analizer.



Xeon
08-06-2013, 04:33 PM
After endless searching for a cheap oscilloscope for small hobby projects I came across the following link.
http://www.gabotronics.com/development-boards/xmega-xprotolab.htm

I noticed he's using a Atmel 32 16MHz..
Got me thinking if my teensy3.0 could do the same?
If anything it should have more resolution and accuracy right?
Could really use some advice.

Constantin
08-06-2013, 07:58 PM
I would not bother. IMO, you need to take a long hard look at what you need and then buy the hardware to fit the need. If it costs extra, so be it.

For example, I bought the QA100 mixed oscilloscope from QuantAsylum. A unit with great specifications hobbled by a horrible UI. I am still kicking myself for not plunking down a little extra cash and buying a proper Oscilloscope and a separate Logic Analyzer. Similarly, I seriously question the stated results of the ADC in the K20 ARM chip - you'd probably be lucky to get anything near that and then only if you have done a lot of on-board conditioning to get the signals into a format that a SAR ADC like the one in the K20 can handle. I went with a dedicated ADC instead, have not looked back. Less cost, better performance.

Then the question becomes how much time you want to spend developing tools vs. other projects. There is nothing wrong with developing tools - many machinist apprentices learn the hard way how to make perfect cubes, etc. But I'd rather spend the time working on projects that interest me, leave tool development to others. The key thing is to understand what kinds of tools are needed in the first place. Ie. being somewhat familiar with issues such as Mr. Nyquist when it comes to sampling data, etc.

For example, despite the relatively low max sampling rate of 24MHz, I find the Saleae Logic 8 to be a great logic analyzer, even if the current Linux implementation is terrible (ask Paul). On the Mac, the thing is intuitive, easy to use. Some Asian outfits even produce knock-offs that use the same hardware but ask you to download the software from Saleae (something I don't do or condone - how else encourage folk to develop that kind of software / hardware?)!!! ... for the same cost as your display there.

Saelig.com offers a wide range of Oscilloscopes and analyzers. Have a look at the reviews / etc. there to see which one fits your needs best. Like a good camera, a good piece of equipment won't make you an expert user overnight but it improves the chances that you'll get it right.

PaulStoffregen
08-06-2013, 08:50 PM
For an oscilloscope, the low-end Rigol DS1052E scope at about $320 is probably the least expensive scope available today that's genuinely useful for a wide range of projects. It may seem tempting to buy something for only $50, but my advise would be to just save up for a real scope.

Probably the cheapest scope available today that offers pretty good performance would be the Agilent DSOX2004A, at about $1900. 4 channels, a fast waveform update rate, a reasonably long record length, and fast user interface really are incredibly useful features. A "large" screen (large by oscilloscope standards anyway) is also pretty useful. Sadly, nobody makes such a thing in the hobbyist or student price range.

PaulStoffregen
08-06-2013, 09:15 PM
Here's a good video....

http://www.youtube.com/watch?v=_TSr9nFN1GU

Constantin
08-06-2013, 11:09 PM
Here's a good video.... http://www.youtube.com/watch?v=_TSr9nFN1GU

Dave's a great resource, no wonder he's become as popular as he has with his online tutorials, reviews, and so on.

I do wonder though whether the 2000 series isn't complete overkill for a hobbyist. I guess it depends on the kinds of signals one is trying to process! I am currently tempted by a slightly different scope, the SDS7102 (http://www.saelig.com/PSBE1002/PSBE100008.htm). It offers a bigger screen than the Rigol 1102 or 1052 it competes against, can be operated from a battery, and otherwise has pretty similar or better specifications, as best as I can tell.

PaulStoffregen
08-07-2013, 12:55 AM
I have not personally used an Owan scope. Is there any info about whether it does intensity graded rendering (aka "digital phosphor") and the number of wafeforms/second it can process?

It claims to have a 10M record length. I wonder how its speed is while using longer records? On high-end scopes like an Agilent 3000/4000, the scope always uses the full record length. You can't even tell them to use less (or if there is any way, I've never seen it... and I have spent quite a bit of time using those scopes). At any time, you can press stop or if the trigger source stops, you can do deep zooming because it captured a high speed to the full record length. But on cheaper scopes, they make it menu option, where you'll typically use a short length so the scope is more responsive. Budget scopes can run slowly when using more memory. Usually the full memory is only used for a single-shot or segmented capture you set up in advance and do once. You might have noticed in that video that Dave used both scopes, even the DS2000, mostly with only a small fraction of their full memory.

My point is just because a budget scope has impressive specs on a feature list doesn't necessarily mean it really implements those features in the very useful ways. Buyer beware.

stevech
08-07-2013, 05:50 AM
I bought a Hantek DS2090 - it's a box with a USB connection to a PC which does the display and GUI.
Bought direct from a China seller for $149. I see them on eBay now for even less. http://www.ebay.com/bhp/dso-2090
It's excellent. Omitting the built-in color LCD saves bucks.

Xeon
08-07-2013, 07:45 AM
Let me put it this way.
Other people have girl friends, family, kids, wife's.

I have free time and electronics.
In any case.. no fun unless u learn something.

Sorry i'm a bit noob-ish but i'm a quick learner.
I just want to try make some tools of my own.

I really cannot afford a expensive oscilloscope.
And many of the cheap ones are lacking simple features.

Headroom
08-08-2013, 01:33 AM
I bought a used Owon 5022s for $225 off of eBay and it has served its purpose (and continues do do so) in helping to solve I2C bus issues. That's what I bought it for!
Dave's eev blog is an excellent source and I really enjoyed the video, but my comment would be that what tool is needed depends on the job at hand. The Owon did for me what was needed but more complicated waveforms and higher frequency stuff would definitely require a better instrument. That's what eBay is for. Get yourself something used and reasonably priced and see if it fits your needs, and if it does not then sell it and get something better later.
It apparently does not make sense to pay high dollars for higher end features in an Oscilloscope that you may only need in a few years (once your expertise has increased to the level that you can actually use these features) as features can be had for much less money down the road.

Xeon
08-08-2013, 12:17 PM
I bought a used Owon 5022s for $225 off of eBay and it has served its purpose (and continues do do so) in helping to solve I2C bus issues. That's what I bought it for!
Dave's eev blog is an excellent source and I really enjoyed the video, but my comment would be that what tool is needed depends on the job at hand. The Owon did for me what was needed but more complicated waveforms and higher frequency stuff would definitely require a better instrument. That's what eBay is for. Get yourself something used and reasonably priced and see if it fits your needs, and if it does not then sell it and get something better later.
It apparently does not make sense to pay high dollars for higher end features in an Oscilloscope that you may only need in a few years (once your expertise has increased to the level that you can actually use these features) as features can be had for much less money down the road.

Ah I understand.
Well considering my idea's I don't really need a massive scope.
I would love to own a proper scope but it's way out of my budget limit.

Building a small scope using a 164x128 tft lcd and a teensy 3.0 sounds like fun.

michal
08-12-2013, 11:54 AM
Hi,

May I suggest you have a look at this page: http://www.mccauslandcenter.sc.edu/CRNL/tools/oscilloscope

Lots of cool stuff there, although I prefer the idea of a Firmata based scope such as this: https://github.com/konsumer/arduinoscope
Unfortunately, as far as I can tell, Firmata on the Teensy 3 doesn't seem to support the resolution or speed hinted at on the former page.

Honestly, this (Arduinoscope + resolution and performance of Teensy 3) would be more than enough for me for what I currently do, and I could tweak the client software with whatever features I wanted after I got past the initial learning curve. And most importantly it would be free, as I already have a Teensy 3 and cannot afford to spend any money for the foreseeable future.

Regards,
Michal

Xeon
08-12-2013, 07:40 PM
Hi,

May I suggest you have a look at this page: http://www.mccauslandcenter.sc.edu/CRNL/tools/oscilloscope

Lots of cool stuff there, although I prefer the idea of a Firmata based scope such as this: https://github.com/konsumer/arduinoscope
Unfortunately, as far as I can tell, Firmata on the Teensy 3 doesn't seem to support the resolution or speed hinted at on the former page.

Honestly, this (Arduinoscope + resolution and performance of Teensy 3) would be more than enough for me for what I currently do, and I could tweak the client software with whatever features I wanted after I got past the initial learning curve. And most importantly it would be free, as I already have a Teensy 3 and cannot afford to spend any money for the foreseeable future.

Regards,
Michal

Ahh handy links there thanks.

stevech
08-12-2013, 11:25 PM
Is the USB 'scope as in post #7 - viable? Needs laptop or PC. I'm very pleased with the 2 channel bandw3idth and what it does vs. its low cost.

michal
08-12-2013, 11:54 PM
It looks interesting, but it sounds like the software lets it down a bit. It's also way out of my price range for the foreseeable future.
Having said that, it's not really comparable to a Teensy 3 based oscilloscope which is only 2Mhz at best (though with many more channels).

michal
08-13-2013, 05:38 AM
Also, these may be of interest:

http://bobdavis321.blogspot.com.au/2013/06/six-channel-3-million-samples-per.html
http://bobdavis321.blogspot.com.au/2013/06/arduino-powered-3-million-samples-per.html

Xeon
08-13-2013, 07:43 AM
Nice.
this one caught my attention.

http://bobdavis321.blogspot.com.au/2013/06/arduino-powered-10-million-samples-per.html

michal
08-13-2013, 07:53 AM
Apparently the ADC used in that one was more complicated to wire, a bit glitchy and also not produced anymore.
It would be interesting to see what someone could come up with if they combined the best aspects of all these attempts into one clean system.

Xeon
08-13-2013, 09:03 AM
Gona mess about and try build the poormans super scope.

AverageGuy
08-13-2013, 07:20 PM
Hm, so I guess I'm a dinosaur with my Tektronix 465? It seems to do all I need to do. I live a simple life. :)

Jim.

PaulStoffregen
08-13-2013, 08:10 PM
I have an old Tek 475 here. I used to love that old scope. ;)

But I haven't used it in years. There's just so many important things you can't do. You can't acquire a single-shot event. The old polaroid cameras (http://www.bmius.com/p-21068-oscilloscope-camera.aspx) don't count as the film is no longer manufactured. Even if you photograph the screen, you can't see pre-trigger waveform which is really essential for debugging modern problems where you know where your code crashes, so you pulse a pin to trigger right before the crash, but what you really need to see are the events that led up to that fateful moment.

You also can't trigger on things like pulse width, rise times, data patterns on common protocols and all sorts of other advanced triggering capability modern (but expensive) scopes have. So far I've only used it a couple times, but the new "zone triggering" feature is really awesome for debugging intermittent problems. You define an area on the screen that augments the normal triggering, so the scope only updates when a waveform based on the normal triggering either does or does not pass through that area. So if you have something that's working 99999 times out of 100000 (perhaps an interrupt delays some response but only in highly unlucky cases), you can set up the zones so the scope ignores all 99999 of the normal waveforms and then shows you just that 1 where things happened differently.

I guess you could say I live a complicated life... :|

AverageGuy
08-13-2013, 08:50 PM
I have an old Tek 475 here. I used to love that old scope. ;)

But I haven't used it in years. There's just so many important things you can't do. You can't acquire a single-shot event. The old polaroid cameras (http://www.bmius.com/p-21068-oscilloscope-camera.aspx) don't count as the film is no longer manufactured. Even if you photograph the screen, you can't see pre-trigger waveform which is really essential for debugging modern problems where you know where your code crashes, so you pulse a pin to trigger right before the crash, but what you really need to see are the events that led up to that fateful moment.

<snip good stuff>
I guess you could say I live a complicated life... :|

I recognize the desirability of the advanced scopes of today. They would have made my life much easier in an earlier life even though we had storage scopes. At this point in my life where electronics is my hobby rather than my occupation, I haven't found any reason for the upgrade. Most of the time I'm happy with a digital multimeter. Obviously I'm not doing any cutting edge stuff. I'll let you guys break new ground, I'm happy using what trails you've blazed. At this point, I have a lot of solutions, but am just waiting around looking for problems and it's fun.

Jim.

Xeon
08-14-2013, 05:42 AM
Truly wish I could afford a quality scope.
Been looking at prices here and so far it's not looking good, even a really basic scope is bloody expensive.

you guys have no idea how lucky you are.

stevech
08-14-2013, 05:55 AM
$135 is too much?

Xeon
08-14-2013, 10:38 AM
In south africa that's $259

PaulStoffregen
08-14-2013, 12:42 PM
Nice.
this one caught my attention.
http://bobdavis321.blogspot.com.au/2013/06/arduino-powered-10-million-samples-per.html

I wonder if a really high performance (for a microcontroller) version of this could be built using the DMA controller in Teensy 3.0?

Of course, this only acquires digital signals. The cheapest way to do that is with the Cypress FX2 USB chip, which Saleae sells as a an 8 channel logic analyzer for $150, but lots of very cheap knock-offs are available (none of them developing or publishing any software of course... they all send you over to Saleae for the software).

Polymorph
09-03-2013, 09:15 PM
So it sounds like the key is to use a fast ADC chip with a large fast FIFO memory chip. Then the microcontroller can get the data back out at its own speed.

I'm looking to make something like a 10 or 20MHz dual trace 'scope using a Teensy 3.0.

joachimp
11-28-2013, 10:49 PM
I was part of the Kickstarter for the Gabtronics Xminilab Portable. For general n00b/portable hacking it's really quite useful, and super tiny! I esp like MSO features for triggering and moderate debugging, the UART/SPI/I2C real time decoding is awesome. The arb wave form gen is really nice for playing with and testing basic analog filter circuits. While it will never replace a bench top scope, or a nice portable scope, it's really quite amazing for ~$100.

I use the Gabtronics scope mostly for checking loop/function call timing on debugging pins. It's great fun to see how code execution time changes as a fns of clock speed.

BTW, I love my Teensy 3.0!

PaulStoffregen
11-29-2013, 01:00 AM
For a poor man's oscilloscope, your best bet is a PC sound card with some sort of front-end to give you DC measurement and high impedance input. For example:

http://www.instructables.com/id/PC-SOUND-CARD-SCOPE-INTERFACE-FACILITATES-DC-RESTO/#step1

If you're going to spend significant money on a scope, you'd probably do much better to limp along with a sound card until you can get a real scope.

http://www.rigolna.com/products/digital-oscilloscopes/ds1000e/ds1052e/

http://www.rigolna.com/products/digital-oscilloscopes/ds1000Z/ds1074z/

stevech
11-29-2013, 04:40 AM
DSO 2090

China direct prices

PaulStoffregen
11-29-2013, 10:01 AM
For anyone considering a cheap USB scope like a DSO-2090, I would highly recommend you avoid it and save up for a good scope that can manage at least 20000 waveforms/sec capture with intensity-graded display.

mhelin
12-12-2013, 12:54 PM
Check out this one:

http://www.embeddedartists.com/products/lpcxpresso/lpclink2.php

Looks like your regular USB JTAG, here for the NXP Cortex-M4 controllers (and implemented using a LPC4370), but it is not if you plug in this board:

http://www.embeddedartists.com/products/app/labtool.php

The LabTool kit actually contains the LPC Link 2 so you don't have to buy one (but you can do so if you want to use it as a target/development board, but then you will need yet another to work as programmer...).

Specs:
11 channel logic analyzer (up to 100Msamples per second)
2 channel oscilloscope (up to 80 Msamples per second, 6MHz BW)
11 channel digital signal generator (up to 80 Msamples per second)
2 channel analog signal generator (40kHz BW)

Linux/Windows Open Source software.

linuxgeek
02-02-2014, 05:45 AM
FYI,

The DS1052E(50Mhz) can be flashed to behave like a DS1102E (100MHz). Same hardware apparently.
http://www.instructables.com/id/Hacking-the-Rigol-DS1052E-Oscilloscope-with-Linux/

scargill
10-19-2014, 11:57 AM
I think there's a good point here - not everyone wants to spend hundreds of pounds of a scope and I've seen some Chinese ones at little over 100 who's displays are TERRIBLE.

Here's a freeby based on the Arduino...

http://www.instructables.com/id/Arduino-High-speed-Oscilloscope-with-PC-interface/

The display on the PC looks EXCELLENT but best case you are talking 227Khz operation... with a Teensy 3.1 surely you could bring that up to well over 1Mhz which is useful for monitoring some microcontroller operations... not to mention making use of the 64K buffer. I'd give it a shot but I'm sitting here with a Teensy 3.1 and I can't even figure out how to make fast register-based port control work yet (only got it yesterday)...

Pete.



I wonder if a really high performance (for a microcontroller) version of this could be built using the DMA controller in Teensy 3.0?

Of course, this only acquires digital signals. The cheapest way to do that is with the Cypress FX2 USB chip, which Saleae sells as a an 8 channel logic analyzer for $150, but lots of very cheap knock-offs are available (none of them developing or publishing any software of course... they all send you over to Saleae for the software).

mausi_mick
10-30-2014, 11:46 AM
I think there's a good point here - not everyone wants to spend hundreds of pounds of a scope and I've seen some Chinese ones at little over 100 who's displays are TERRIBLE.

Here's a freeby based on the Arduino...

http://www.instructables.com/id/Arduino-High-speed-Oscilloscope-with-PC-interface/

The display on the PC looks EXCELLENT but best case you are talking 227Khz operation... with a Teensy 3.1 surely you could bring that up to well over 1Mhz which is useful for monitoring some microcontroller operations... not to mention making use of the 64K buffer. I'd give it a shot but I'm sitting here with a Teensy 3.1 and I can't even figure out how to make fast register-based port control work yet (only got it yesterday)...

Pete.



I have made an Dual-Osci with teensy3.1 and a 4.2" touch display:

http://http://forum.pjrc.com/threads/25532-ADC-library-update-now-with-support-for-Teensy-3-1/page4 (http://forum.pjrc.com/threads/25532-ADC-library-update-now-with-support-for-Teensy-3-1/page4)

I had some problems to connect the 16 display-pins (d0..d15) with the teensy-pins (most of them on the backside).

scargill
10-30-2014, 11:51 AM
I have made an Dual-Osci with teensy3.1 an an

And... were you thinking of sharing code etc (he says, hopefully)...

mausi_mick
10-30-2014, 12:32 PM
And... were you thinking of sharing code etc (he says, hopefully)...

yes, some more pictures and the code is coming. Now I try to make a simple layout for an adapter for teensy3 with all ? (-64) pins "Dual-In-Line".

mausi_mick
10-30-2014, 03:13 PM
yes, some more pictures and the code is coming. Now I try to make a simple layout for an adapter for teensy3 with all ? (-64) pins "Dual-In-Line".


here the code:2849

mausi_mick
11-02-2014, 03:37 PM
and here the adapter for teensy3 with 5V supply:

287028712872

DemolishunWork
12-02-2014, 08:27 PM
One thing you can consider doing is getting an old scope with a dead tube. Then you have all the conditioning electronics on the front end. You will have to strip out the tube power supply and tap into where it spits out the conditioned waveform. Then put in an LCD display and the electronics.

Also, CPLDs and GALs are good options for doing very fast timing for your ADC and memory capture of the waveform. You don't need an FPGA. Then you can suck the data out with the Teensy 3.1 and send to the USB to display. Or just use the Teensy itself. If you can figure out DMA transfer via USB it could be really fast. Not real scope fast, but pretty fast.

DemolishunWork
12-02-2014, 10:51 PM
I am finding I need a scope type function for troubleshooting some sensors. So I am going to try this:
https://code.google.com/p/xoscillo/

stevech
12-03-2014, 06:52 AM
I just bought this
https://www.saleae.com/ Logic 8 product.
and I really like it.
Digital logic analyzer with SPI, UART and other decoders. Up to 50Msps.
Analog up to 10MHz bandwidth - a lot of my work doesn't need more analog bandwidth. And I have a DSO2090 (cheap) for more analog.

But this little Logic 8 (very small) is really helpful.
top notch harware quality and made in the USA.

DemolishunWork
12-03-2014, 07:50 PM
That https://www.saleae.com/ is really nice. I also like the price breakout structure.

DemolishunWork
12-03-2014, 09:20 PM
Okay I am using this for displaying data from sensors hooked to my teensy:
http://www.instructables.com/id/Arduino-Improved-Poor-Mans-Oscilloscope/

The output looks like this:
http://imgur.com/NzvGy6N

I have to change the serial port in their Processing sketch to match my serial port:


//port = new Serial(this, Serial.list()[com_port], 9600); // Com port specified here
port = new Serial(this, "COM15", 9600); // Com port specified here


My code integration of their Arduino code is this:


int val = testSensor->ReadSensor();
Serial.write( 0xff );
Serial.write( (val >> 8) & 0xff );
Serial.write( val & 0xff );


The testSensor is a C++ object specific to my stuff. With the Processing sketch being simple of open source this could be customized to display anything you might want.

I did find I cannot send it data any faster than every 5 milli-seconds or it messes up and does not display anything. I tried higher baud rates, but I think the program is just not fast enough. So for simple scope type data visualization for semi slow data this works great. The sensors I am using are digital in nature so this is the easiest way for me to display them.