Shop OBEX P1 Docs P2 Docs Learn Events
Measuring a +/- 5V analog signal with the Prop? — Parallax Forums

Measuring a +/- 5V analog signal with the Prop?

CHAD.GCHAD.G Posts: 11
edited 2010-06-30 22:06 in Propeller 1
Hi everyone,
First time poster here and new to the propeller world. I have a research project in which I would like to measure a +/- 5VDC analog signal (adjustable to +/- 10V). This analog voltage is a result of an amplified voltage reading from a strain gage. The strain gage signal is being sampled at 1276 samples/sec on a 14 bit resolution system.

Bottom line, I want to take this +/- 5VDC analog signal which is the result of 1276 samples/sec of a strain gage, and send this to my PC for data logging. Can my Propeller do this?!?

Some HELP would be extremely appreciated!!! Thanks!

Comments

  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-06-18 01:59
    You might want to have a look at this for sending and recording data directly to your PC:

    www.parallax.com/tabid/393/Default.aspx

    There are ways of storing data on SD cards, too, which can be plugged into your PC after a test has been run, that way you don't tie up your PC for simple data acquisition. For example, see the following;

    www.rayslogic.com/propeller/Programming/SD_Card/SD_Card.htm

    Other Propeller-based data loggers are also possible.

    I presume you already have an analog-to-digital converter of some kind to handle your +/-5 volt signal, true? If not, there are various ADC capabilities available on the Object Exchange (aka OBEX):

    obex.parallax.com/objects/category/9/
    obex.parallax.com/objects/search/?q=adc

    Maybe one of the forum gurus can point you to the ideal ADC.

    Hope that helps,
    Mark
  • TubularTubular Posts: 4,717
    edited 2010-06-18 02:00
    Welcome to propeller world!

    The prop certainly can do it, have a look at this ADC from the parallax store which is in a convenient DIP package:-
    www.parallax.com/Store/Components/AllComponents/tabid/762/CategoryID/26/List/0/catpageindex/9/Level/a/ProductID/239/Default.aspx?SortField=ProductName,ProductName

    If you need some more resolution, I'm getting some drivers together for MAX1033 (14 bit, 4ch, 115ksps, $10ish) and/or MAX1301 (16 bit, 4ch, 115ksps). Both operate from single 5 volt rail but have input ranges +/- 12v, +/- 6v, +/- 3v as well as some unipolar ranges too

    cheers
    tubular
  • CHAD.GCHAD.G Posts: 11
    edited 2010-06-18 16:47
    I do not have an ADC yet. That is where I start to get lost, as I'm not experienced with ADC's. I was thinking to buy the Analog-to-Digital Basics kit to help get me going.

    Thanks a ton for the quick input you've already provided! Perhaps to help get me started on the surface of things, am I right in thinking that I will need at least a 14 bit ADC or greater since that is the resolution of the signal I'm trying to capture? Secondly, am I also right in thinking that as long as I can sample (with the propeller) at the same sample rate or higher than the signal I'm trying to capture, then I will ensure I don't "lose" data in the process?
  • RaymanRayman Posts: 14,889
    edited 2010-06-18 17:34
    You can also do ADC directly with the Prop using Sigma-delta conversion.

    Here's an applet to help pick resistor values:

    http://www.pulsedpower.net/Applets/Electronics/SigmaDeltaADC/SigmaDelta.html

    Here's example code:

    http://www.rayslogic.com/propeller/Programming/ADC.htm

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Apps:· http://www.rayslogic.com/propeller/Programming/Programming.htm

    My Prop Info: ·http://www.rayslogic.com/propeller/propeller.htm
    My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-06-18 17:42
    CHAD.G said...
    ... Secondly, am I also right in thinking that as long as I can sample (with the propeller) at the same sample rate or higher than the signal I'm trying to capture, then I will ensure I don't "lose" data in the process?

    I think there's something called Nyquist sampling rates or criteria that help decide the best rates for doing that. I'm not sure how to use it, though. I'm sure the forum gurus know all about it. smile.gif
  • CHAD.GCHAD.G Posts: 11
    edited 2010-06-30 17:20
    So, I've been chipping away at learning some of this ADC stuff. Using PLX-DAQ and a BS2, the best sampling rate for a zero to +5V reading (8-bit ADC0831) was approximately 100 samples per second. For me, this is not nearly good enough, but I sort of expected that from the BS2.

    I'm foggy on a few things with regards to this trial I did. First, how much of that slow speed is attributed to the ADC0831 being slow and how much is attributed to the BS2 limitations?

    The real bottom line question I have is: Can I expect to achieve much (much!) faster sampling with the Propeller? e.g. if I connected the ADC0831 to the Prop, would sampling be a lot faster, or is the ADC0831 a big limiting factor?

    For my research, I actually plan on using at least a 12-bit ADC and I understand that will require even further processing time, but I'm trying to understand the basics with what I have for now.

    Thanks again for helping!
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2010-06-30 18:31
    CHAD.G said...
    So, I've been chipping away at learning some of this ADC stuff. Using PLX-DAQ and a BS2, the best sampling rate for a zero to +5V reading (8-bit ADC0831) was approximately 100 samples per second. For me, this is not nearly good enough, but I sort of expected that from the BS2.

    I'm foggy on a few things with regards to this trial I did. First, how much of that slow speed is attributed to the ADC0831 being slow and how much is attributed to the BS2 limitations?

    The real bottom line question I have is: Can I expect to achieve much (much!) faster sampling with the Propeller? e.g. if I connected the ADC0831 to the Prop, would sampling be a lot faster, or is the ADC0831 a big limiting factor?

    For my research, I actually plan on using at least a 12-bit ADC and I understand that will require even further processing time, but I'm trying to understand the basics with what I have for now.

    Thanks again for helping!
    The speed issue is most assuredly a BS2 problem or possibly software. I have an MCP3X0X driver (look at my signature) that communicates with a 12-bit ADC at up to 10MHz, so with some overhead it could get about 600,000 samples per second (ksps). But the IC itself will start giving out at about 100ksps (so my driver slows things down a bit so not to exceed the IC's specs by too much). The ADC0831 has some limit as well, but it is much faster than 0.1ksps.

    There are some ADCs out there that could exceed my driver's capabilities, even at 14-bits. But actually getting precise information at 14-bits of resolution is quite difficult, especially at the speeds you are talking about. Without a bit of engineering, 14-bit precision is lost in the wiring anyway. 12-bits is even a bit dicey without careful layout, but consistent reading should not be a problem.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    April, 2008: when I discovered the answers to all my micro-computational-botherations!

    Some of my objects:
    MCP3X0X ADC Driver - Programmable Schmitt inputs, frequency reading, and more!
    Simple Propeller-based Database - Making life easier and more readable for all your EEPROM storage needs.
    String Manipulation Library - Don't allow strings to be the bane of the Propeller, bend them to your will!
    Fast Inter-Propeller Comm - Fast communication between two propellers (1.37MB/s @100MHz)!
  • rpdbrpdb Posts: 101
    edited 2010-06-30 22:06
    The Nyquist sampling rate states that the sampling rate should be twice the highest frequency you want to sample, and you should use a low pass filter to remove any input signals above the highest·frequency you want to sample.

    For example, a CD player for audio signal 20Hz to 20KHz uses a sampling rate of 40KHz (2 * fIN max)·and an input filter that rolls off sharply at frequencies above 20KHz (low pass filter). If you dont filter out the freqs above 20KHz and sample ie a 41KHz (or 39KHz)·signal at a 40KHz sample rate, you will see a 1KHz signal, clearly not what you intended to see.

    Think of the sample rate as a square wave (40KHz)·superimposed over the input as a sine wave (41KHz). On that superimposistion the ADC does a conversion on each rising edge of the sample rate pulse. Put a dot on each rising edge where it crosses the input wave and you will see an output of 1KHz looking at the dots. The important part is the filter to make sure the unwanted (<2*fIN) don't get into the ADC, and sample at least 2* the max f your looking at.

    The Nyquist rate is the very bare minimum for a DSP (Digital Signal Processor) before you run into problems.

    I hope that makes sense.

    rpdb
Sign In or Register to comment.