View Full Version : Discussion AVRscope; Is that an oscilloscope in your pocket?
KreAture
Jan 29, 2008, 07:13 PM
Hi ppl... I'm stuck.
This is one of my side-projects that I've been fiddling with while waiting for parts on other projects and such. Basically it will be a ultra-low component count oscilloscope for the simpler tasks.
The first version uses an AVR coupled to a Nokia 3310 LCD display. These displays are 84x48 pixels so they are semi-ok for displaying low rez graphics.
The beauty of them are their size and the fact that they have a serial interface.
The reason I am "calling the cavalry" so to speak is that I am stuck on the user interface. I want it to be intuitive and sleek for such a simple device.
I have a 4-way + select type button-joystick that i want to use for this and both the capture and wave display works well. All I need is to figure out the interface.
Attached is a picture of the display showing some of my current attempt at a UI as well as a piccy of the display in it's tiny cute box. (The battery next to the box is a AA-cell for scale.)
I'm trying to draw some intuitive symbols for the different functions so the user can scroll left/right to have their required option highlighted in center of screen and then use up/down to adjust it. I think it will work ok, but there just isn't all that much room for menus/symbols. I have 16x84 pixels to work with and the display updates columns of 8 pixels at a time. (So the 16x84 pixels is in essence 2 rows of 84 bytes.)
Any ideas how to make this look and feel good when using?
I am really stuck here. It just doesn't look right. Ofcource some scales will be added to the graph-area but that still doesn't make it intuitive.
Oh, and the unit will ofcource be self contained but I might add MMC/SD storage and such later. So far it looks like I can manage up to 150 or 300ksps allowing a very good view of servo-signals and thelike.
For those interested, I have captured some wave-files directly in the AVR to see how fast I could drive the internal ADC. You will probably need some wave-editor to view the signal in the files.
http://kreature.dynu.com/ee/avr/avrscope/wave5_150000sps_1khz.wav
http://kreature.dynu.com/ee/avr/avrscope/wave5_300000sps_1khz.wav
http://kreature.dynu.com/ee/avr/avrscope/wave5_375000sps_8khz.wav
As you can see, it holds up ok-enough for simple signals.
andrewm1973
Feb 08, 2008, 12:19 AM
Nice work.
I would think there is no way to have decent user interface on the screen at the same time as the wave form.
How about you make the UI come up when button is pressed and then dissapear when funtion is set.
KreAture
Feb 08, 2008, 01:18 AM
Well... 84x48 with waveform displaying on 84x32 gives me 84x16 for the interface.
Maby you're right though. Some info can be displayed continously. Other really ned a popup-menu.
I'd really like to add axis markers. Just some on the edges to denote time and volts.
V/div and T/div would be nice to have on-screen always too.
Alan Hopper
Feb 08, 2008, 03:59 AM
Cool,
You could free up some display area by just having the the menu on the bottom 8 pixels. Left and right joystick would select the option and scroll if you were at the side of the screen, you could invert the selected item. A click could enter edit mode where up and down joystick would adjust the setting. Click again to select. Have you any details on how to interface to these displays?
Alan
KreAture
Feb 08, 2008, 04:23 AM
I have made a library for interfacing the nokia lcd.
It updates a full screen buffer or byte rows and it can draw lines in both "colors".
TheSteve
Feb 08, 2008, 04:47 AM
All I know is that if you share the code and or a PCB I would love to build one.
KreAture
Feb 08, 2008, 05:04 AM
I will probably do so. I dislike mails I get from china about sending them all code and design specs on my projects but I do not think I will ever comercialize this so it might be ok.
The interface to the lcd itself is very simple as it's a serial lcd.
The goal of this project is to make a small (TINY) handheld scope that is functional and can even be usefull, but to keep the partcount very low. I am torn between using an external adc and memory or not.
quax
Feb 08, 2008, 07:28 AM
Great :cool:
"a small (TINY) handheld scope" is one of my dreams.
Hopefully it becomes an open project.
cul
quax
Tomapowa
Feb 08, 2008, 08:28 AM
Great project! I messed with this display too, really slick and easy!...
FWIW, Lot's of info (libraries, tech info, etc...) can be found at these links:
http://www.100acre.org/elec/nokia_lcd/
http://www.geocities.com/dariuskrail20/nokia3310lcd.html
http://www.techdesign.be/projects/routines/nokia_voids.htm
http://www.myplace.nu/mp3/files/pcd8544.pdf
My thoughts...
Maybe the lower half of the display should be used for actual displayed data
(move cursor along wave and along the bottom, it displays voltage and maybe even time if a "mark" can be set). I sort of like the idea some one else mentioned where controls can be accessed on a full-screen display (more room, more functions, bigger/more readeable text, etc...). What would be real slick is to adapt a simple resistive touchscreen to this display (interfaced to A/D's) such as one of these:
http://www.densitron.com/displays/Displays.aspx?nCategoryID=19
Tomapowa
Feb 08, 2008, 08:33 AM
I dislike mails I get from china about sending them all code and design specs on my projects...
Better yet... I love when I get them to purchase a pre-programmed PIC from me for one of my DIY projects with the most-likely intention of copying the code... only to find out the hard way that it is protected. :D
village_idiot
Feb 08, 2008, 10:02 AM
I'd be interested in a DIY scope too. If boards are made I'd be interested in buying a board or two.
KreAture
Feb 08, 2008, 11:07 AM
Thanks for the input guys.
The reason I wanted the wave on top part of display is purely "old school".
It's how most scopes are and I feel it is familiar. Usually it would mean not having to reach over the display when changing options so your hands/arms wouldn't block view but it serves less purpose on this tiny scope.
I have been aiming for graphic symbols atleast for the GUI mostly because it looks cool. However it is taking up resources that could have been used for more advanced code and, when RAM is concerned, also for deeper capture.
I am pondering using a faster external ADC and SRAM so I could increase samplerate and depth. This would make the AVR's job a bit different.
To avois special chips like FPGA's on this one the timing would be a bit more laxed on the triggering. Basically only triggering on every 4, 8 or something sample. The benefit would be to actually handle around (or over) 2 MSPS!
The AVR would be the clock generator for the ADC, allowing different samplerates to be used. It would also be the address generator for the memory.
Neither memory nor adc would require seperate programming making the projects approx equal in build-complexity. Just a few extra chips to solder on.
The stage I have not yet worried about is the analog input-stage. It should be done properly as it's a very important part of a scope.
I was thinking of using opamp coupling with two resistors that adjust the dampening. By controlling the resistors with FETs and combining them in a binary manner I can then create 4 distinct levels of "gain". The idea being to let the avr control the gain via software instead of relying on small mechanical knobs or switches. I don't want clutter on the device. Just the control stick, battery charge port and BNC connector.
Maby add a serial port later for I/O to PC.
How does this sound? I think going for higher samplerate and external SRAM is a good idea simply because it allows one to view higher frequency signals or to use the memory for deeper capture.
rmteo
Feb 08, 2008, 11:26 AM
Instead of resistors and FETs, you could use a digital potentiometer instead:
http://www.microchip.com/ParamChartSearch/chart.aspx?branchID=11026&mid=11&lang=en&pageId=79
An even easier solution may be to use a PGA (programmeable gain amplifier). Here are several with typically 8 steps of gain for around $1:
http://www.microchip.com/ParamChartSearch/chart.aspx?branchID=11014&mid=11&lang=en&pageId=79
Even less expensive ones with 3 step gain (less 50 cents):
http://www.microchip.com/ParamChartSearch/chart.aspx?branchID=11016&mid=11&lang=en&pageId=79
Alan Hopper
Feb 08, 2008, 11:28 AM
I'd also happily buy a board. How about adding a basic serial terminal as well.
Alan
Tomapowa
Feb 08, 2008, 11:33 AM
Sounds like good ideas... seperate ADC and memory (sure they are extra parts, but certainly upgradeable in the future). Auto-Input-Leveling would require more thought...
Here's another interesting AVR scope project I had followed...
http://www.instructables.com/id/Low-speed-AVR-oscilloscope/
A PIC-based version is here:
http://www.semifluid.com/?p=15
KreAture
Feb 08, 2008, 11:58 AM
Yeah. I've seen that one.
Those creens are ok, but big. I wanted to make it fit a shirt pocket.
I have 5 of theese. Will use one on the scope.
http://www.elfa.se/images/highres/h1590.jpg
It has 4 ways + click.
This will be the interface. The switches are readily available and pretty standard.
I really like the idea of a programmable gain amplifier. Will look into those.
Target is to get it to handle DC and AC coupling as well as atleast +/- 2v, 6v and 18v minimum. That would make it quite versatile.
rmteo
Feb 08, 2008, 12:20 PM
Post not relevant...
KreAture
Feb 08, 2008, 12:27 PM
Those screens cost too much here. The Nokia LCD's were perfect as they are still available and I got 2 free ones.
village_idiot
Feb 08, 2008, 12:52 PM
What about these for displays, they are available and pretty cheap for things like the DOGM, not sure about the graphic displays. I ordered a couple of the 2x16 text displays from the UK for a reasonable amount of money, so I assume the graphic displays would be decent too.
http://www.lcd-module.de/
rmteo
Feb 08, 2008, 01:03 PM
KreAture, free is always GOOD. Have fun and good luck with your project. :D
I am not an AVR user so can't help much.
KreAture
Feb 08, 2008, 01:07 PM
OOOOh!
I found a cute little amp!
http://www.elfa.se/pdf/73/732/07320724.pdf
Basically, it would give me 0,1,2,5,10,20,50 and 100 in gain. Ideally I don't want to use the gain that much as I wanted a bandwidth over 2 MHz but unless I find a better one at Elfa or Farnell I'll have to go fro this one.
My thoughts were to divide down the input signal by 20:1 so 1:1 would require 20x gain.
Then I'd have:
0x = 0-250mV
2x = 0-500mV
5x = 0-1.25V
10x = 0-2.5V
20x = 0-5V
50x = 0-12.5V
100x = 0-25V
This seems like a good "ladder".
It would require another opamp to do the dividing.
When I look at this I see it is not really fesible as I get the same effect as using a dampening coupling on a non programmable opamp without the issues of amplifying.
100x amplification gives very poor bandwidth. (11MHz/gain = 110 KHz at 100x!)
If I control the dampening (inverting amplifier setup) instead I can get full bandwidth.
The problem becomes how to control the feedback resistor using the AVR...
http://ourworld.compuserve.com/homepages/Bill_Bowden/opamp.gif
andrewm1973
Feb 08, 2008, 02:56 PM
Bilateral analog switches to control resistors ?
Deffnitly don't use digital pots.
For the low bandwidth (2Mhz) you could just use an InAmp. Would solve a few problems.
A quick digikey search came up with a cheap 2 channel, single rail, rail to rail, 2.5MHZ GBP in amp from texas that is in stock. INA2332.
Probably lots more to choose from if you widen the search (I think a scope needs 2 channels minimum to be useful)
KreAture
Feb 08, 2008, 03:09 PM
2.5MHz GBP is not enough. Remember, I want to be able to view 400 kHz signals (5x 400khz = 2MHz aka 2Msps for 5 samples/cycle). Since I sample at 2 Msps I'd like it to be able to go rail/rail in that time. This means 10V/µs minimum.
I think I'll use a 50 or 100 MHz GBP amp atleast.
KreAture
Feb 09, 2008, 07:57 AM
andrew, there isn't time to do the triggering properly for 2 channels, let alone the sampling.With 2 channels, I'd also either have to multiplex the memory or use 2 banks. The ammount of electronics that need to fit my tiny box would grow very fast.
mjsas
Feb 09, 2008, 04:17 PM
The Vantage Pro scope sold by Snapon has a simple user interface. It also has the usual multimeter functions and is auto ranging. Of course it is way over priced but nice to work with. See www.snapon.com.
quax
Feb 09, 2008, 04:29 PM
KreAture, please stay on earth ;)
I would prefer a little, cheap and useful DSO, that I can fetch out of my trouser pocket like a sourcerer his wand and solve invisible problems.
cul
quax
andrewm1973
Feb 09, 2008, 04:33 PM
Kreature, using an FPGA would make life a lot easier but I can understand your reason for not wanting too.
However triggering on the two channels and multiplexing a single RAM should be fine as long as you use an AVR with external address bus and run at 20Mhz. Let A0 be the select to the ADC channels and use the upper Address Lines as pseudo DMA. You then have 10 clock cycles per sample for a loop-and-compare.
Problem I see here is that you may want to use an AVR without an address bus for another reason.
jeffs555
Feb 09, 2008, 09:34 PM
KreAture,
The 3rd article on this page shows a high bandwidth amp with 8 digitally controlled gain steps.
http://www.edn.com/contents/images/81700di.pdf
It uses six MAX4258 video amps that have 2-1 mux on the input. It would work, but would be expensive and take a lot of board space.
However, I ran across this video amp that looks interesting and might be used along the lines of the article above.
http://focus.ti.com/lit/ds/symlink/ths7353.pdf
It has 3 amps with gain up to 5 and gain-bandwidth product of 150mHz. Each amp has a 2-1 mux on input that is controlled by I2C bus. Gain for each amp is controlled by external resistor. Haven't really looked at it in detail, but looks like by controlling the mux inputs and cascading the amps, you could get 8 levels of gain controlled by I2C. Farnell has it listed as in stock. Price is about the same as LTC6910.
Jeff
KreAture
Feb 09, 2008, 10:41 PM
I've seen a lot of alternatives but for me it seems like using a inverting reducing amp first, with 1M input matching followed by another non-inverting amp where I can activate dividers for the feedback using FET's might work ok. The problem is the non-inverting amp needs the lower side of the divider to reference v/2 not ground as I will be powering this singlesided. Since it is within 5v I might get away with it. I think my favourite tiny mosfet (FDV303) can handle -5v for Vgs.
2 resistors would allow me to do a 1:1 as well as 3 other gains.
10k feedback with a 60k and 120k divider would give me 1,5,7,13 as multipliers selectable with only 2 pinns.
KreAture
Feb 09, 2008, 10:58 PM
Here's what I had in mind...
I can use a SO8 packaged dual opamp.
village_idiot
Feb 09, 2008, 11:08 PM
Here is a feature request... I have to do a lot of stuff with audio equipment, and all the measurements are in db (decibells), would you be able to work that into the features of this scope? For unbalanced signals it is typically -2db along the bus. For balanced signals it is usually +4db between the positive and negative signal lines (sometimes terminated into 600 ohms, but not always).
KreAture
Feb 09, 2008, 11:15 PM
If it can be calculated and the calculations fit the memory I guess it can be done.
There will have to be a calculation to display the signals and divisions correctly. A diff formulae could be chosen at that point to show dB instead of V.
Isn't dB relative though? If so, relative to what?
jeffs555
Feb 10, 2008, 06:01 AM
Kreature,
To get a gain of 13, you would need R1 to be 120k and RGB to be 10k.
Also, the relatively high value resistors and the high output capacitance of the mosfets would probably significantly affect the frequency response. In the off state, source to drain capacitance of that mosfet would be more than 20pf, and at just 1mHz the reactance of 20pf is less than 10k.
This might be a better choice for a switch. It has only 2pf output capacitance. http://www.maxim-ic.com/quick_view2.cfm/qv_pk/1352
Don't know if you have seen this, but it uses the MAX4052 switch. It doesn't switch the feedback network, but switches in different dividers off the output of the first stage. http://www.bitscope.com/design/hardware/ (sheet 4)
Jeff
KreAture
Feb 10, 2008, 09:34 AM
jeffs, thanks. I mixed up R1/R2 hehe.
I will be simulating this with my chosen opamp before I build anything.
This is ofcource how I ment it...
I am having issues stabelizing the opamp though. Not from the FET but it seems my chosen amp for the first sims doesn't like non-inverting mode at all.
Edit:
Oh, and ofcource I ment to reference the source of the fet's to v/2 not gnd...
This still won't work though as my v/2 ref is too high impedance vs the resistors I use for pulldown.
jeffs555
Feb 11, 2008, 02:34 AM
What amp are you using? Many op amps are unstable if the gain is below a certain value.
I see no end of problems trying to use those mosfets in the feedback circuit like that. Even if you get a unity gain stable amp, when both mosfets are off, you will get a gain of 1 for DC, but the gain for AC will rise with frequency up to 10x or more at 1mHz because of the source-drain capacitance. Even with one mosfet on and one off, there will be a significant rise in gain as frequency increases. Also, with the mosfets off, there will be a non-linear gain step when the output goes far enough below center to forward bias the substrate diode.
BTW, what analog sim are you using? I use this free one from Linear Technology. The UI for the schematic entry is a little strange, but once you get used to it the simulator works great. It also installs a library of all the LT components, and you can't beat the price. http://www.linear.com/designtools/software/switchercad.jsp
KreAture
Feb 11, 2008, 10:46 AM
I use the one from Linear too.
The amp I was simulating was the LT1028A.
You are ofcource right regarding the fets. I was just clinging to hope, trying to solve one problem at a time. hehe...
I guess what's needed is something like LTC6911-2 except with better GBP. Like LTC6912-2 only that one isn't available in the cad! Probably because it's SPI or I2C.
jeffs555
Feb 11, 2008, 12:30 PM
Here are a couple of relatively inexpensive high speed variable gain amps.
http://cache.national.com/ds/LM/LMH6505.pdf
http://www.analog.com/UploadedFiles/Data_Sheets/AD8337.pdf
They have much better bandwidth than the LTC6912, and bandwidth is independent of the gain. In other words, they spec a bandwidth, not a GBP. The gain control is a DC voltage so you would need to drive it with some kind of D/A, but you could possibly even use a well filtered PWM out of the AVR.
Didn't see a spice model for the AD8337, but there is one for the LMH6505. http://www.national.com/models/spice/LM/LMH6505.MOD
KreAture
Feb 11, 2008, 01:14 PM
Not an option jeffs.
I saw those, and the voltage controlled gain is although linear, very sensitive to the control voltage. Most of the gain is adjusted around 1v with 1 to 1.5 meaning a jump in 30x. Not very practical at all.
The 2 or 3 bit input ones are fine. Either that or SPI/I2C.
gigelus2k3
Feb 11, 2008, 02:06 PM
Kreature,
First of all, why don't you put the divider before the first amp? Dividing unconditionally by 5 will degrade the SNR for small signals.
Also, changing scales could be done by using the old and trusty reed relays; they are very small, reliable (no current significant flowing through them) and do not "color" the signal passing through.
As for the gain amplifier, have you looked into the current feedback ones? They have no internal slew rate limitation (up to a certain degree) and would keep the signal bandwidth more or less constant regardless of the voltage gain. I've seen quite a few made by NatSemi and others, but you could build one too from scratch.
Cheers,
Serban
KreAture
Feb 11, 2008, 06:57 PM
gigelus, that is exactly why I was trying to avoid it. I did not want to degrade the small signal SNR. I think it will have to be done though. To get both high and low ranges.
The LTC6912-2 looks to be up for the job actually.
Atleast not too bad.
I could divide by some default factor like 8:1 to create the 1 M input and then amp that from 1x to 64x via 2,4,8,16 and 32. That would give me /8, /4, /1, x2, x4 and x8 relative to my 3.3 or 5v reference.
The LCD needs 3.3v so I might run with that. It would also make it easier for the battery as I could run a single LiPo.
gigelus2k3
Feb 11, 2008, 07:24 PM
My point was that for the most sensitive range you could avoid dividing the input signal altogether. Because of the direct coupling, the input impedance would be crappy but I guess that you don't care that much about it.
The Linear part seems nice; I would still use an amplifier with the gain set so that the 250mV range would resolve in full scale, all other ranges being done through resistor division.
Serban
KreAture
Feb 12, 2008, 01:20 AM
Theproblem was the setting of the gain vs the division. FETs don't work as they are not really switches and I will not use real switches as that removes the control from the AVR. Reed switches and thelike are too mechanical and big so they won't readily fit in the box, nor do I want to use them.
dburley
Feb 12, 2008, 03:10 AM
You might try the NLAS4684 analog switch by ON Semiconductor. It is very small, 2 SPDT switches in one 3mm square package. ON Semi is good for getting samples also.
thomasscherrer
Feb 15, 2008, 11:13 AM
see this :
http://www.webx.dk/XMON/
it took me 8 mins to write the STM32 code to make me a scope :-)
ok it will take a few more mins to handle the timers and interface so I can change the timebase and so on.
The XMON PC sw can be used by anyone to display stuff from any microcontroller.
The STM32 I use can handle MHZ sampling in 12 bits !!
and even make two channels in 100% the same sampling time,
no chopper needed as normal :-)
oh they also have USB and tons of flash and are halve price of normal microcontrollers.
KreAture
Feb 15, 2008, 12:19 PM
It doesn't change the need for analog input circuitry. This is still the most important part. I won't waste time changing my platform though, as I have development tools and parts for AVR's.
Edit:
Ok. I admit. The STM32 is a fantastic platform.
I looked into it and 1 Msps at 12 bit is fantastic. In fact, it might be worth it. It would however not be an AVRscope anymore...
I will see if I can get devtools and samples via work. I like the large memory available in theese. Even the tiny 5x5mm one can deliver up to 20k sram for a much deeper capture buffer and using both ADC's interleaved would deliver 2Msps.
vBulletin® Copyright ©2000-2009, Jelsoft Enterprises Ltd.