Shop OBEX P1 Docs P2 Docs Learn Events
Anyone interested in analyzing a system's response with a bode plot? — Parallax Forums

Anyone interested in analyzing a system's response with a bode plot?

HannoHanno Posts: 1,130
edited 2012-05-07 05:33 in Propeller 1
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
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
Developer of ViewPort, the premier visual debugger for the Propeller (read the review here, thread here),
12Blocks, the block-based programming environment (thread here)
and PropScope, the multi-function USB oscilloscope/function generator/logic analyzer

Comments

  • BRBR Posts: 92
    edited 2009-12-24 04:13
    Now I'm confused...I thought you were going to be busy for a while working on publishing the propscope communication protocol.
  • HannoHanno Posts: 1,130
    edited 2009-12-24 06:01
    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
    Developer of ViewPort, the premier visual debugger for the Propeller (read the review here, thread here),
    12Blocks, the block-based programming environment (thread here)
    and PropScope, the multi-function USB oscilloscope/function generator/logic analyzer
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2009-12-24 06:58
    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

    IC Layout Engineer
    Parallax, Inc.
  • mikestefoymikestefoy Posts: 84
    edited 2009-12-24 08:10
    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
  • HannoHanno Posts: 1,130
    edited 2009-12-24 09:25
    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
    Developer of ViewPort, the premier visual debugger for the Propeller (read the review here, thread here),
    12Blocks, the block-based programming environment (thread here)
    and PropScope, the multi-function USB oscilloscope/function generator/logic analyzer
  • tdlivingstdlivings Posts: 437
    edited 2009-12-24 16:47
    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 LoweShawn Lowe Posts: 635
    edited 2009-12-24 20:11
    I think its a great idea.

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


    When all else fails.....procrastinate!
  • turbosupraturbosupra Posts: 1,088
    edited 2009-12-25 00:07
    <-- 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?
  • HannoHanno Posts: 1,130
    edited 2009-12-25 02:49
    Hi Turbosupra,
    I'll answer the virtual breadboard request in the other thread, let's keep this one about bode plots [noparse]:)[/noparse] (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
    Developer of ViewPort, the premier visual debugger for the Propeller (read the review here, thread here),
    12Blocks, the block-based programming environment (thread here)
    and PropScope, the multi-function USB oscilloscope/function generator/logic analyzer
  • DroneDrone Posts: 433
    edited 2009-12-25 16:36
    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
  • HannoHanno Posts: 1,130
    edited 2009-12-26 02:33
    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
    Developer of ViewPort, the premier visual debugger for the Propeller (read the review here, thread here),
    12Blocks, the block-based programming environment (thread here)
    and PropScope, the multi-function USB oscilloscope/function generator/logic analyzer
  • DroneDrone Posts: 433
    edited 2009-12-26 13:37
    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
  • hover1hover1 Posts: 1,929
    edited 2009-12-26 14:08
    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
  • DroneDrone Posts: 433
    edited 2009-12-26 15:08
    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
  • CenlasoftCenlasoft Posts: 265
    edited 2009-12-26 18:50
    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
  • HannoHanno Posts: 1,130
    edited 2009-12-26 19:52
    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
    Developer of ViewPort, the premier visual debugger for the Propeller (read the review here, thread here),
    12Blocks, the block-based programming environment (thread here)
    and PropScope, the multi-function USB oscilloscope/function generator/logic analyzer
  • DroneDrone Posts: 433
    edited 2009-12-28 14:26
    Hi Hanno,

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

    Regards, David
  • lnielsenlnielsen Posts: 72
    edited 2009-12-28 14:45
    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
  • HannoHanno Posts: 1,130
    edited 2009-12-28 19:59
    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
    Developer of ViewPort, the premier visual debugger for the Propeller (read the review here, thread here),
    12Blocks, the block-based programming environment (thread here)
    and PropScope, the multi-function USB oscilloscope/function generator/logic analyzer
  • eblanckeeblancke Posts: 26
    edited 2009-12-31 00:14
    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
  • hover1hover1 Posts: 1,929
    edited 2009-12-31 00:40
    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
    1600 x 900 - 216K
  • HannoHanno Posts: 1,130
    edited 2009-12-31 01:24
    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
    More videos here: 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
    Developer of ViewPort, the premier visual debugger for the Propeller (read the review here, thread here),
    12Blocks, the block-based programming environment (thread here)
    and PropScope, the multi-function USB oscilloscope/function generator/logic analyzer
    822 x 742 - 67K
  • hover1hover1 Posts: 1,929
    edited 2009-12-31 02:07
    Hanno,
    Enjoy the children, wife and time with them. It goes so fast.

    We don't expect to hear from you until then!! [noparse]:)[/noparse]

    Jim
  • dalewisdalewis Posts: 1
    edited 2011-01-28 09:57
    I am very much interested in a Bode plot addition. What is the current status

    dale
  • erer44erer44 Posts: 2
    edited 2012-03-30 06:17
    Any update on the Bode plotter Hanno? I'd love to have this functionality with my new Propscope.
  • HannoHanno Posts: 1,130
    edited 2012-04-02 21:32
    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
  • erer44erer44 Posts: 2
    edited 2012-05-07 05:33
    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.
Sign In or Register to comment.