PDA

View Full Version : Anyone interested in analyzing a system's response with a bode plot?



Hanno
12-24-2009, 09:52 AM
ViewPort already includes several simulated instruments- digital oscilloscope, logic analyzer, spectrum analyzer, xy plot. To analyze a system's frequency response engineers look at bode plots: en.wikipedia.org/wiki/Bode_plot (http://en.wikipedia.org/wiki/Bode_plot)
Bode plots help people optimize servos, feedback circuits and more. Any interest in such a view? I'm also working on the I2C/SPI/RS232 serial decoder/trigger, need multiple projects to keep me busy...
Hanno

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Co-author of the official Propeller Guide- available at Amazon (http://www.amazon.com/Programming-Customizing-Multicore-Propeller-Parallax/dp/0071664505)
Developer of ViewPort (http://hannoware.com/viewport), the premier visual debugger for the Propeller (read the review here (http://www.parallax.com/Portals/0/Downloads/docs/article/ROBOT_ViewPort.pdf), thread here (http://forums.parallax.com/showthread.php?p=760083)),
12Blocks (http://12blocks.com), the block-based programming environment (thread here (http://forums.parallax.com/showthread.php?p=819680))
and PropScope (http://hannoware.com/propscope), the multi-function USB oscilloscope/function generator/logic analyzer

BR
12-24-2009, 11:13 AM
Now I'm confused...I thought you were going to be busy for a while working on publishing the propscope communication protocol.

Hanno
12-24-2009, 01:01 PM
Mostly finished on the protocol document. It's written, just have to confirm everything is right. I like switching between multiple projects- frequently I get good ideas when I'm working on something other than the project I have the ideas for.
Hanno

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Co-author of the official Propeller Guide- available at Amazon (http://www.amazon.com/Programming-Customizing-Multicore-Propeller-Parallax/dp/0071664505)
Developer of ViewPort (http://hannoware.com/viewport), the premier visual debugger for the Propeller (read the review here (http://www.parallax.com/Portals/0/Downloads/docs/article/ROBOT_ViewPort.pdf), thread here (http://forums.parallax.com/showthread.php?p=760083)),
12Blocks (http://12blocks.com), the block-based programming environment (thread here (http://forums.parallax.com/showthread.php?p=819680))
and PropScope (http://hannoware.com/propscope), the multi-function USB oscilloscope/function generator/logic analyzer

Beau Schwabe (Parallax)
12-24-2009, 01:58 PM
Hanno,

I for one would love to see a Bode Plot... also good for visually detecting the resonant frequency of an LC circuit. Were your thoughts to show Phase as well as Magnitude... If so, I would like to request the option to super impose the two so that you see Phase and Magnitude on top of one another.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

mikestefoy
12-24-2009, 03:10 PM
I would also love to see Bode plots.

A Network Analyser(zer) is a valuable piece of test kit.

I sometimes design SMPS's, and need to check the control loop.

have a look at http://www.powermanagementdesignline.com/208404037?printableArticle=true

and this http://www.ridleyengineering.com/analyzer.htm

Mike

Hanno
12-24-2009, 04:25 PM
Great to see interest- I think this, coupled with extending the digital filtering capabilities of the Propeller will be a nice addition to the Propeller's repertoire.

Yes, I would show both phase and magnitude in db's versus logarithmic frequency.
This would be a view within ViewPort where you could specify start, stop frequency, an output variable and and input variable. ViewPort would sweep the output variable and measure the input for phase and magnitude. By using the QuickSample object (capable of 80Msps), top frequency could be up to the tens of MHz. So, this could be used for:
- measuring mechanical systems like motor controllers where frequencies would be ~0..10hz
- measuring audio systems- simplest would be microphone+speaker characterization, 10-20khz
- analog circuit filters- 1-~20MHz
- digital filters (using the Propeller as a flexible DSP) 1-100kHz

The view could look like the existing "All" view which currently shows the oscilloscope on top and spectrum analyzer on bottom. I would replace the spectrum analyzer with the bode plot. This would let you watch the signals as the bode plot is taken in real time.

Yes, I can graph both magnitude+phase on top of each other. Default would be magnitude on top, phase on bottom- that's how I've typically used it. If anyone has other wishes, let me know asap... Pictures say a 1000 words, so if you like a certain setup- show me! Would also like to hear about other possible applications people would use this for.
Hanno

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Co-author of the official Propeller Guide- available at Amazon (http://www.amazon.com/Programming-Customizing-Multicore-Propeller-Parallax/dp/0071664505)
Developer of ViewPort (http://hannoware.com/viewport), the premier visual debugger for the Propeller (read the review here (http://www.parallax.com/Portals/0/Downloads/docs/article/ROBOT_ViewPort.pdf), thread here (http://forums.parallax.com/showthread.php?p=760083)),
12Blocks (http://12blocks.com), the block-based programming environment (thread here (http://forums.parallax.com/showthread.php?p=819680))
and PropScope (http://hannoware.com/propscope), the multi-function USB oscilloscope/function generator/logic analyzer

tdlivings
12-24-2009, 11:47 PM
Sounds like a good idea.

For Viewport I visualize it as Viewport supplying only the plotting capability with

the user supplying the frequency as an already measured value in a variable or a

sq wave on a pin to be measured and· a higher bit·A/D to give measurement dynamic

range.

Adding bode plot to propscope is another idea. It already has the signal generator on the

external card and a 10 bit convertor. Would work for the low frequency things .



Tom

Shawn Lowe
12-25-2009, 03:11 AM
I think its a great idea.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe


When all else fails.....procrastinate!

turbosupra
12-25-2009, 07:07 AM
<-- To new to even know how a bode plot could be applicable to any of my projects

I would on the other hand like to see viewport interface with basic hardware devices as a virtual breadboard, any chance of that Hanno?

Hanno
12-25-2009, 09:49 AM
Hi Turbosupra,
I'll answer the virtual breadboard request in the other thread, let's keep this one about bode plots :) (Short answer, yes- just give me an idea of what you want...- in the mean time check out http://12blocks.com for an easy to use tool for graphically program the Propeller)
Hanno

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Co-author of the official Propeller Guide- available at Amazon (http://www.amazon.com/Programming-Customizing-Multicore-Propeller-Parallax/dp/0071664505)
Developer of ViewPort (http://hannoware.com/viewport), the premier visual debugger for the Propeller (read the review here (http://www.parallax.com/Portals/0/Downloads/docs/article/ROBOT_ViewPort.pdf), thread here (http://forums.parallax.com/showthread.php?p=760083)),
12Blocks (http://12blocks.com), the block-based programming environment (thread here (http://forums.parallax.com/showthread.php?p=819680))
and PropScope (http://hannoware.com/propscope), the multi-function USB oscilloscope/function generator/logic analyzer

Drone
12-25-2009, 11:36 PM
Hi Hanno,

I can envision a propeller-controlled audio network analyzer that has one sine generator output, a resistive bridge and two analog to digital converters, one to measure the incident signal and one to measure the through signal (two port measurement). A switch (or manually moving cables around) can be arranged to allow the second A/D to measure the reflected signal (single port measurement). A manual (or automatic) open-short and terminate with a characteristic impedance would be done for storage of a calibration/normalization table. An inexpensive analog switch IC (74HC4066 comes to mind) could be used to automate the mode selection and calibration procedure.

The frequency and data from the two A/D converters could be sent to a PC's serial port or USB port via the prop-plug. A PC application would then plot the results, and if automated, control the mode and calibration process. The PC's application would handle floating point math and produce Bode plots; or even Nyquist plots. A Smith chart plot would even be possible, but has limited acceptance in the audio realm. Limited maximum serial rate might make the plot rather slow though.

Fairly precise control of the sine wave generator would be required. For that I would recommend a direct digital synthesizer (DDS) running in PASM. I have a PASM DDS coded that provides 8-bit sine output through an R2R ladder digital to analog converter. It works well through about 100kHz and has frequency step control to less than one Hertz. It is alpha code but it works well, but not ready for public consumption. The code is commented enough to get you started. You could probably go a couple-few bits beyond 8-bits with my DDS code, but for speed it uses a sine look-up table in cog RAM; as-is, that's a limitation.

An optimum software arrangement would likely use multiple cogs for DDS sine genertion, A/D control and sampling, mode and calibration switching (if automated), serial I/O etc. So now you're probably going to get into the dark-art of synchronizing cogs. But multiple cogs are what probably makes the propeller a strong candidate for this type of application.

Don't forget the analog considerations. Ideally, the A/D converters are going to need anti-aliasing (Nyquist) filters and the DDS output might benefit from a roofing filter as well (maybe done in the cog with a digital filter, but cog RAM is tight). Again, ideally the A/D converters would have selectable single-ended and differential inputs. The DDS ouput should be buffered and it might be nice to have a differential output available.

You might want to off-load the whole A/D and DDS portions into a PIC or AVR micro; but that wouldn't be very propeller-esq, would it! A carefully selected PIC or AVR micro would likely cost less than a couple of decent stand-alone A/D's. I doubt due to connection lengths and conversion quality the propeller with RC delta-sigma A/D's would work out well - but it's worth a shot.

If you want to look at my DDS code, send me a PM with how to contact you and I'll send it. It may take me a day or two, I'm on holiday break and I'll have to dig-up and dust-off the best-latest working version.

Lastly, for this application I remember seeing a very simple audio network analyzer done on a PC in Windows using some resistors to form the bridge and the PC's sound card for signal generation. A/D sampling is done with the left and right line-input or microphone sound card channels. The link escapes me however; I'll have to dig a lot to find it.

Regards David

Edit: Hey it just dawned on me - doesn't all or most of the hardware required for this already live in the Prop-Scope?

Post Edited (Drone) : 12/25/2009 4:46:14 PM GMT

Hanno
12-26-2009, 09:33 AM
Hi Drone,
Thanks for the analysis. And yes, the hardware and software for much of it already exists in the PropScope and ViewPort- which is why I'm looking into it. The PropScope DAC can output arbitrary 8bit waveforms at 25Msps, so should be fast enough for Bode plots going into MHz.

My focus continues to be making things very easy and general purpose. Ideally, this will let novice users include just a line or two of code into their spin program to optimize some feedback function, but also support the professional audio/video engineer who uses PropScope to fine tune their circuit.
Hanno

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Co-author of the official Propeller Guide- available at Amazon (http://www.amazon.com/Programming-Customizing-Multicore-Propeller-Parallax/dp/0071664505)
Developer of ViewPort (http://hannoware.com/viewport), the premier visual debugger for the Propeller (read the review here (http://www.parallax.com/Portals/0/Downloads/docs/article/ROBOT_ViewPort.pdf), thread here (http://forums.parallax.com/showthread.php?p=760083)),
12Blocks (http://12blocks.com), the block-based programming environment (thread here (http://forums.parallax.com/showthread.php?p=819680))
and PropScope (http://hannoware.com/propscope), the multi-function USB oscilloscope/function generator/logic analyzer

Drone
12-26-2009, 08:37 PM
Hello again Hanno,

What is the frequency resolution of the PropScope's DAC card? I'm very interested in the DAC card functionality but can't seem to find detailed specifications for the PropScope or DAC card. There's no schematic for the DAC card on the Parallax site and it seems you can't buy the DAC card separately. Again for Bode plots I think you would need rather fine control of the output frequency, step size and sweep time.

Regards, David

hover1
12-26-2009, 09:08 PM
David,

There are some peliminary docs posted here:

·http://forums.parallax.com/showthread.php?p=867220

There is a schematic for the DAC card included.

Jim

Drone
12-26-2009, 10:08 PM
Thanks Jim, I remember that thread now. To view the docs and schematics need Open Office and Inkscape - wrestling with that now. Open Office is OK, Inkscape is another matter.

Regards, David

Cenlasoft
12-27-2009, 01:50 AM
Hello,

A Bode plotter seems like a great idea. I am using a homemade Linear Variable Differencial Transformer (LVDT) to produce a change in phase between the secondary coil and primary excite frequency and voltage. I can measure the phase angle difference with a two channel scope and the cursors. How would I translate that methodology to a spin program?

Curtis

Hanno
12-27-2009, 02:52 AM
Hi David,
The PropScope generator can produce precise frequencies- I believe in increments of .1hz from .1hz to 12.5MHz- so for example you could generate a sine wave at 1,234,567.8 Hz. At low frequencies 600 eight bit samples are sent out at the required frequency. At higher frequencies the number of samples is reduced until at 12.5M each cycle only has 2 samples- where it will barely represent the signal. The maximum rate at which samples are sent out is 25Msps.

The signals offset and amplitude can be specified in .01 of Volts, in a range of -1.5 to 1.5 or 0..5v. And the signal can be customized, you can load the 600 samples from different file format including matlab, xls, csv or draw them on-screen with your mouse.

I have an early prototype of the Bode plot working- I specify the start and end frequency- either as a configuration string in my spin program or by right clicking on the graph. Right now I sweep with 100msec/sample and take 100 samples. In real time I can see the frequency change and watch how the input and output signals change on the DSO screen. The bode plot is updated with the magnitude and phase measurements. Frequency goes up logarithmically with lines at 1,2,5... Magnitude in 20db.

I've been analyzing low, high and band pass filters implemented in assembly running in a separate cog. I'll post a video soon- first off to ride steam trains with the kids...
Hanno

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Co-author of the official Propeller Guide- available at Amazon (http://www.amazon.com/Programming-Customizing-Multicore-Propeller-Parallax/dp/0071664505)
Developer of ViewPort (http://hannoware.com/viewport), the premier visual debugger for the Propeller (read the review here (http://www.parallax.com/Portals/0/Downloads/docs/article/ROBOT_ViewPort.pdf), thread here (http://forums.parallax.com/showthread.php?p=760083)),
12Blocks (http://12blocks.com), the block-based programming environment (thread here (http://forums.parallax.com/showthread.php?p=819680))
and PropScope (http://hannoware.com/propscope), the multi-function USB oscilloscope/function generator/logic analyzer

Drone
12-28-2009, 09:26 PM
Hi Hanno,

I would really like to see the code that generates the waveforms as you describe. Is it available?

Regards, David

lnielsen
12-28-2009, 09:45 PM
Hann0,

Just to clarify, the functionality you are discribing, if you build it, will be available on both ViewPort and PropScope? I got my PropScope for Christmas and just started to play around with it...

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
BioProp: Robotics - Powered by Bioloids and controlled by the Propeller (http://www.wideopenwest.com/~lnielsen/BioProp/)

Hanno
12-29-2009, 02:59 AM
Making good progress (even with holiday "distractions"), but will still be a while before release, lots of work to do to make it easy to use for any application.
Yes, I will sell this is a plugin for both ViewPort and PropScope. David, I'll pm you about my code- sorry, it's not open source.

Hanno

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Co-author of the official Propeller Guide- available at Amazon (http://www.amazon.com/Programming-Customizing-Multicore-Propeller-Parallax/dp/0071664505)
Developer of ViewPort (http://hannoware.com/viewport), the premier visual debugger for the Propeller (read the review here (http://www.parallax.com/Portals/0/Downloads/docs/article/ROBOT_ViewPort.pdf), thread here (http://forums.parallax.com/showthread.php?p=760083)),
12Blocks (http://12blocks.com), the block-based programming environment (thread here (http://forums.parallax.com/showthread.php?p=819680))
and PropScope (http://hannoware.com/propscope), the multi-function USB oscilloscope/function generator/logic analyzer

eblancke
12-31-2009, 07:14 AM
Hanno,
Bode plots are a good idea for classical control applications and will be a very valuable feature.
However, please can you (or one of the other Propellor oracles) please consider a Fuzzy Logic module for the Propellor.
To see an example of a wonderful fuzzy logic application look at Juan Pablo's excellent project at Parallax>Resorces>Applications/Contests>Industrial>Tipper

hover1
12-31-2009, 07:40 AM
Hanno already has a Fuzzy Logic module in VeiwPort.

http://hannoware.com/viewport/

Jim


eblancke said...
Hanno,
Bode plots are a good idea for classical control applications and will be a very valuable feature.
However, please can you (or one of the other Propellor oracles) please consider a Fuzzy Logic module for the Propellor.
To see an example of a wonderful fuzzy logic application look at Juan Pablo's excellent project at Parallax>Resorces>Applications/Contests>Industrial>Tipper

Post Edited (hover1) : 12/31/2009 1:12:19 AM GMT

Hanno
12-31-2009, 08:24 AM
Woohoo! One less thing on my todo list- yes, the Fuzzy Logic engine and graphical control panel is already done. So is a video, I'm quite proud of it- check it out here:
www.youtube.com/watch?v=H4ZIElDoU4E (http://www.youtube.com/watch?v=H4ZIElDoU4E)
More videos here: hannoware.com/viewport/videos.php (http://hannoware.com/viewport/videos.php)

I used ViewPort's fuzzy logic to balance my vision-guided balancing robot
Someone else used it to charge batteries
And someone else was working on maintaining a model submarine's depth.

See below for first screenshot of a ViewPort Bode Plot!
Top graph is oscilloscope, blue is input signal being swept from 500..5khz. Red is output of a low-pass filter implemented in pasm.
Bottom graph is bode plot, black line is magnitude, notice it's straight, then drops of near the cut-off frequency.
Top-right shows the resulting lissajouz pattern
Bottom-right let's me control which of 3 filters to analyze and I can manually input a frequency while watching variables in my program.

I'll be spending the next week with my kids and parents at Kaiteriteri- working on my tan and writing up a tutorial on bode plots+filters...
Hanno

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Co-author of the official Propeller Guide- available at Amazon (http://www.amazon.com/Programming-Customizing-Multicore-Propeller-Parallax/dp/0071664505)
Developer of ViewPort (http://hannoware.com/viewport), the premier visual debugger for the Propeller (read the review here (http://www.parallax.com/Portals/0/Downloads/docs/article/ROBOT_ViewPort.pdf), thread here (http://forums.parallax.com/showthread.php?p=760083)),
12Blocks (http://12blocks.com), the block-based programming environment (thread here (http://forums.parallax.com/showthread.php?p=819680))
and PropScope (http://hannoware.com/propscope), the multi-function USB oscilloscope/function generator/logic analyzer

hover1
12-31-2009, 09:07 AM
Hanno,
Enjoy the children, wife and time with them. It goes so fast.

We don't expect to hear from you until then!! :)

Jim

dalewis
01-28-2011, 04:57 PM
I am very much interested in a Bode plot addition. What is the current status

dale

erer44
03-30-2012, 01:17 PM
Any update on the Bode plotter Hanno? I'd love to have this functionality with my new Propscope.

Hanno
04-03-2012, 04:32 AM
Hi,
I haven't touched this code in a long time but I do try to finish all projects I start. Unfortunately I've been very busy lately. What are you looking to do?
Hanno

erer44
05-07-2012, 12:33 PM
Thank you for the follow-up Hanno. I'm needing to plot the frequency response of an audio filter at different settings, from about 20Hz to 20kHz.

The plotter you mentioned sounds perfect. All I need is for the frequency generator to input a sweep, and for the oscilloscope to plot the response curves.