Announcement

Collapse
No announcement yet.

reading from an Analogue to Digital Convertor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • reading from an Analogue to Digital Convertor

    Hi,
    Bear with me on this I have to fill in some background information
    so that you can understand the type of help I need.

    I am about to embark on a project, which will do the following


    A plasma deposition oven will coat a material with a compound
    such as Silicon Dioxide and for arguments sake the material is
    metal which has a high refractive index.

    the material will be scanned by a laser interferometer
    which will produce a diminishing sine wave output as the metal/material
    gets coated (in other words it starts to become more and more opaque)
    which in turn it's output will be fed to an Analogue to Digital convertor.
    this AD convertor will be read by a PC104 computers (small footprint)
    serial port which in turn will monitor the process and send a stop signal once
    the process is complete.

    before the process starts it is critical to log the start point of the plasma
    deposition cycle and to log one complete sine wave.

    bearing in mind that the start point could be negative or positive
    depending on the refractive index of the material, so we could be
    starting at plus or minus zero on the sine wave or indeed zero, but
    that would be considered the "start point"

    this would then have to be monitored and at the 90 degree point ignored
    (half sine wave) until reaching the 180 degree point (full sine wave)
    and then an allowance of say 10% (or whatever you set it to) of the total
    sine wave time/distance added.

    the extra bit on the end is to make sure that the whole surface is
    uniformly covered with the coating.

    the sine wave would complete it's 180 degrees in a minimum of 30 seconds
    or at a maximum of 2 to 3 hours, depending on the coating and
    the material to be coated.

    What makes this project interesting is that the PC104 doesn't have
    disk space but is 100% IBM compatible, so magnetic file data storage
    is out of the window and although
    it emulates disk space by using flash memory
    I would prefer to process all this in it's RAM as flash memory is
    finite in the amount of times you can flash it, and this would have
    to run reliably for years at a time.

    Now that you have some background, I would like to ask for some help
    in getting this started on the right foot in the first place
    I intend to develop it in PB 3.5 for DOS, as a Windows environment
    is out of the question because of stability and reliablity.

    Any pointers to some ready made code/routines that could be modified
    would be helpful if only to get the project off the starting blocks,
    and of course any sage advice on PB 3.5 and comm port usage would be helpful
    let's see what you guys can come back with !!!

    if you would prefer to email me directly or have any further
    questions to clarify the project then please feel free
    using the following email address

    [email protected]


    Regards

    Derek Brabrook



  • #2
    Originally posted by Derek Brabrook:
    I intend to develop it in PB 3.5 for DOS, as a Windows environment
    is out of the question because of stability and reliablity.
    That is an extremely intelligent decision on somebodys part. Stability
    and reliability is not one of windows strong points.

    It sounds to me that your main problem is determinining the "starting
    point" value of the process.

    Since the physical starting point on the sine wave can be anywhere
    along the curve, you may want to consider getting the average value
    of the first sine wave and then build in a "sliding scale" to make
    adjustments.

    For example, suppose the starting point is -5. Adjust it to zero, get
    the average value of the first sine wave then add 5 to it.

    I hope this makes sense. It sounds perfect to me but...

    ------------------


    [This message has been edited by Mel Bishop (edited June 23, 2002).]
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

    Comment


    • #3
      "this would then have to be monitored
      and at the 90 degree point ignored
      (half sine wave) until reaching the 180
      degree point (full sine wave) ..."
      * * *

      Unless I'm missing something here 180
      degrees would be the half sine wave
      point in a true sinewave ... 360 degrees
      would be the full-cycle point.
      -Karl

      ------------------

      Comment


      • #4
        Yes sorry your right, late night last night
        180 degrees would be the half way point
        360 degrees being the full sine wave
        ........whoops

        thanks for pointing it out

        Regards
        Derek



        Unless I'm missing something here 180
        degrees would be the half sine wave
        point in a true sinewave ... 360 degrees
        would be the full-cycle point.
        -Karl

        [/B][/QUOTE]



        ------------------

        Comment


        • #5
          Why thank you for that vote of confidence on reliability <grin>

          Unfortunately we can't get an average value on the first sine
          wave because that would mean that the first lump of material
          (actually it's for a silicon wafer fab plant) would be wasted and if the
          coating took 2 - 3 hours then that would be 2 - 3 hours blown away
          along with the coated wafer, so the wastage would be unacceptable
          unfortunately it would have to be done in real time rather than an
          average, mainly because each wafer going through the plasma deposition
          oven would be different from the last.

          Regards

          Derek


          Originally posted by Mel Bishop:
          That is an extremely intelligent decision on somebodys part. Stability
          and reliability is not one of windows strong points.

          It sounds to me that your main problem is determinining the "starting
          point" value of the process.

          Since the physical starting point on the sine wave can be anywhere
          along the curve, you may want to consider getting the average value
          of the first sine wave and then build in a "sliding scale" to make
          adjustments.

          For example, suppose the starting point is -5. Adjust it to zero, get
          the average value of the first sine wave then add 5 to it.

          I hope this makes sense. It sounds perfect to me but...



          ------------------

          Comment


          • #6
            Derek -

            This is a fun problem. But the fun part is not in coding, it's in
            selecting and tuning your algorithm.

            There are 2 items you first need to consider: how fast is the A/D
            running, and how much noise is present on the data?

            And, as a 3rd consideration, is it possible to input a reasonable guess
            as to the expected process duration? 2 orders of magnitude variation is a
            lot to have to work blindly with.

            Assuming a decent SNR and a fast A/D process, I'd be tempted to work as
            follows:

            1) Prefilter the data. As an example: upon receipt of a data value, use
            it as the latest update in a boxcar integrator. Use the timing guess to
            set the length of the integration window.

            2) Using the filter output,look either for a max or min.

            3) If either a max or a min has been found, look for the other.

            4) If both have been found, wait until you hit the original value.

            5) Now, in theory, you've made a complete 360 degrees. You can compute
            how many samples you need for your extra 10%.

            Depending on how noisy your data is, any number of complications may
            present themselves, like

            a) how do you deal with a start point that is at 90 or 270 degrees?

            b) step 4 is tricky, since it implicitly assumes the data forms a
            pure sine wave, rather than a decaying one. My guess would be
            that, after detecting the 2nd max/min, you would have to do some
            sort of correlation analysis to determine an approximate decay
            factor (such as an inverse exponential), and factor that in. That
            is, after detecting the 2nd max/min, you've determined the period
            of the nominal sine wave. You can assume various decay factors and
            see which one gives the best fit to your observed data. But you have
            to be damned sure your data is good, or any simple algorithm will
            wander off into hyperspace under some conditions. Murphy's Law
            applies rigorously.

            c) You _really_ need some sort of estimate on each run's duration, in order
            to properly set up your prefilter. If you have too wide a bandwidth (in
            the case of a boxcar integrator, too short a summation sequence) you get
            too much noise with resulting false peaks. Too narrow a bandwidth and your
            peak-to-peak amplitude gets hammered, and you can't accurately find the
            peaks.

            d) Nonlinear processes like max and min can really get you in trouble. You
            might do well to set you max and min conditionally, to be overridden if
            another, better value is detected near the first.

            All of these difficulties I leave as an exercise to the reader. The heart of the
            process is almost trivial, but there are these undefined areas like the prefilter
            and the correlation process. Keep in mind the Gary Larson cartoon which
            shows a typical Gary Larson science lab with a big blackboard. At the top and
            bottom of the blackboard are these masses of symbols, and in the middle is a line
            that says, "And then a miracle occurs".

            Do enjoy yourself.

            Comment


            • #7
              I'm not so sure I'd do a blanket buy-in to the "DOS is more stable than Windows" argument <U>if</U> you limit Windows to Win/NT or Windows 2000.

              I use 98 here, and that has some problems; but at all my client sites I work on either NT or 2K and none of those machines have ever hiccuped, leave alone burped.

              Just another point of view...

              MCM
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                [QUOTE]Originally posted by Jim Martin:
                [B]Derek -

                This is a fun problem. But the fun part is not in coding, it's in
                selecting and tuning your algorithm.


                I totally agree Jim, it is a bit of a stinker because the data although
                pretty clean and fast coming from the ADC, it is never the same
                so I am going to have to put a lot of thought into it

                Regards

                Derek


                ------------------

                Comment


                • #9
                  Hy,
                  Try using a data filter.
                  For instance, read in 5 units of data, see if they are within
                  a narrow percentage of each others value, discard the data that
                  is out of range, sum the valid units and devide by the number
                  of units accepted as valid.

                  I use an algorithim sismilar to this one in a laser scanner,
                  with exelent results.

                  Arthur Kohl
                  [email protected] www.moldaco.com

                  ------------------



                  Arthur Kohl

                  Comment


                  • #10
                    Howdy, Derek -

                    Well, a little mature reflection can certainly help, particularly
                    when one has over-complicated a problem.

                    My steps 1 - 3 stand.

                    However, once you've identified the max and min (nominally 90 and
                    270 degrees), you now know the duration of 180 degrees. Multiply
                    by 2.2 for total duration and Bob's your uncle. No correlation or
                    curve fitting. (If you think about it, the problem of handling
                    a start point at either critical point falls out).

                    Just be careful to get clean peaks.

                    Jim

                    ------------------

                    Comment


                    • #11
                      Well, a little mature reflection can certainly help, particularly
                      when one has over-complicated a problem.

                      My steps 1 - 3 stand.

                      However, once you've identified the max and min (nominally 90 and
                      270 degrees), you now know the duration of 180 degrees. Multiply
                      by 2.2 for total duration and Bob's your uncle. No correlation or
                      curve fitting. (If you think about it, the problem of handling
                      a start point at either critical point falls out).


                      Points taken on board BUT, not only does the sine wave diminish over time
                      but also the timebase between peaks can become either longer or shorter
                      depending on the process being run and the refractive index of the material
                      so your first half sine wave maybe say 1 hour and the second half of the sine wave
                      could be 45 minutes, so not only do I have to cope with a diminishing signal
                      but a non linear time base, so using a calculation of 2.2 on the 180 degree mark
                      would be fatal to the process because it could either pass through
                      the full sine wave before or after that, so the process has to be monitored
                      from start to finish and once it see's a full sine wave add a user variable
                      percentage and then send the stop signal to the PLC. I have pondered your
                      method some weeks ago but found it flawed and unable to take into account
                      the true non linear progression of this sine wave, The other alternative
                      is for me to do some wave shaping and quantitisation on the signal
                      to make it linear and make up the lost area's of the sine wave and timebase
                      but that requires more hardware, the most elegant way would be to monitor it
                      realtime and make decisions in logic at that point,

                      ie/ is it going up or down, if it's going up wait until it is
                      coming down, watch it go through the start point (at 180 Deg) and wait for it to
                      go up again etc etc, I could push the variables into an array
                      I suppose and make decisions by reading the array, an array also
                      appeals because I can make some pretty graphs on the screen showing
                      the sine wave's progress and estimate it's endpoint by say a timing loop
                      which will sample the data and re-calculate the endpoint in realtime

                      I also think some fuzzy logic is going to have to be implemented
                      to make an informed decision as to where the start point, mid point and end point
                      are bearing in mind that the AD convertor probably won't give me
                      a truly accurate picture with only 12 bits of resolution


                      Keep it coming many minds are better than one !!!
                      once I get the AD hardware here along with the pretty
                      HP Signal Generator, I can dump some data up from
                      the AD convertor for those interested


                      Regards

                      Derek


                      ------------------

                      Comment


                      • #12
                        I'm not so sure I'd do a blanket buy-in to the "DOS is more stable than Windows" argument <U>if</U> you limit Windows to Win/NT or Windows 2000.
                        I use 98 here, and that has some problems; but at all my client sites I work on either NT or 2K and none of those machines have ever hiccuped, leave alone burped.
                        Just another point of view...

                        Windows is pretty, but thats about it.

                        this program will be running on a Transmeta PC 3x3 inches
                        at 600Mhz so booting windows of whatever flavour would
                        just take too long and life is short.

                        I would much rather flash the compiled basic program
                        into eeprom and boot up and be running in about 100 msecs
                        much better than waiting for 5 minutes don't ya think ?.....hehe

                        And Windows is about as stable as California isn't going
                        to be shaken to bits and fall into the sea, nobody knows when
                        or how big the next GPF is, but they know it's coming and soon !!

                        did you know that Windows 98 and ME
                        has a bug that if it runs for more than 49 days it crashes
                        Microsofts response to this bug was "Well who runs their pc
                        for longer than 49 days most of our users aren't effected by
                        this bug !!!"

                        and that Windows 2000 has 635,000 KNOWN bugs service pack 2
                        went some way to fixing a few thousand but probably introduced
                        another couple of thousand in the process.

                        Don't get me wrong Windoze has it uses but not for ANYTHING
                        critical, if you put a Windoze PC in a critical area of PLC
                        you would have a disaster waiting to happen.

                        Just an observation and another point of view......<grin>

                        it's no use starting a flame war I have asbestos underwear on
                        and a kevlar coated keyboard......<grin>


                        Regards

                        Derek


                        ------------------

                        Comment

                        Working...
                        X