Shop OBEX P1 Docs P2 Docs Learn Events
Reading Analog Input — Parallax Forums

Reading Analog Input

CumQuaTCumQuaT Posts: 156
edited 2009-11-16 11:20 in Propeller 1
Hi all,

I'm trying to use the propeller to read an analogue input between 0V and 3.3VDC and am having troubles. Can the propeller read analogue values with some sort of internal ADC? Or do I need to hook it up to something like the LTC1286? If so, does anyone have an idea of how to code the reading of that? I know that the counter modules can be used for ADC work, but I have no idea how...

Thanks in advance...

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Who are you, and why are you reading my signature?

Post Edited (CumQuaT) : 11/15/2009 11:09:24 AM GMT

Comments

  • Jim FouchJim Fouch Posts: 395
    edited 2009-11-15 13:13
    Goto http://www.parallax.com/tabid/442/Default.aspx·and download the appnote AN001. It shows how to read an analog value.

    I've used the MCP3204 and there's an object for that. (I better be careful using·that phrase, or AT&T·may sue me...lol)





    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jim Fouch

    FOUCH SOFTWARE
  • CumQuaTCumQuaT Posts: 156
    edited 2009-11-16 00:49
    haha thanks for the pointer. I'll have a read. I saw the objects at the ObEx for ADC communication but I wanted to try and avoid using an external ADC if I could.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Who are you, and why are you reading my signature?
  • LeonLeon Posts: 7,620
    edited 2009-11-16 01:16
    You could use the sigma-delta ADC, which just uses two Rs, two Cs, and two pins. They need to be close to the chip for it to work properly, which might be awkward.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
  • CumQuaTCumQuaT Posts: 156
    edited 2009-11-16 03:30
    Thanks Leon. Can you please explain that more? I'm still quite new to the Propeller.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Who are you, and why are you reading my signature?
  • Mike GreenMike Green Posts: 23,101
    edited 2009-11-16 03:34
    The Propeller application note (AN001) from the Propeller downloads page discusses how to do ADC using the Propeller and includes sample code.
  • CumQuaTCumQuaT Posts: 156
    edited 2009-11-16 04:08
    Yeah, I got linked to that. Looking forward to getting home tonight to try it out. Thanks!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Who are you, and why are you reading my signature?
  • CumQuaTCumQuaT Posts: 156
    edited 2009-11-16 04:31
    Does anyone know what sort of sampling rate the internal ADC can get?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Who are you, and why are you reading my signature?
  • Mike GreenMike Green Posts: 23,101
    edited 2009-11-16 04:43
    Look at the comments in the source code for the ADC routines. There's a table with the values you want.
  • CumQuaTCumQuaT Posts: 156
    edited 2009-11-16 06:15
    Fantastic. Thank you!

    Realistically speaking, do you think that 5 bit resolution at 2.5MHz would be fast enough to detect quick, sharp impacts in an impact-sensor project?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Who are you, and why are you reading my signature?
  • ErNaErNa Posts: 1,752
    edited 2009-11-16 11:06
    When talking about sampling rate and resolution, one can define a figure of merit by multiplying sample rate be resolution. The propeller uses a 80 MHz clock and so generates 80 MBits per second. From that, resolution is just the invers of the sampling rate. As the propeller ADC is a integrating ADC, it can not be used to sample data in a short time like a s&h adc.
    "real" signals normally are of such an integrating character. For example: speed is the time integrated acceleration. Information like speech or even noise is best characterized by sample points. Then the sampling rate only has to be 1/2 of the highest frequency to measured. A integrating adc must have more then 10 times the speed to show a good signal. But, on the other hand, integration automatically suppresses high frequencies and therefore the original signal is filtered with only little disturbance.
    ErNa
    Add: And, prop-adc gives you another advantage: if you sample with high speed you see fast changing signals within a short time. But if you add a number of samples in a register, you do the integration internally, which normally is down by the adc itself. So you have high speed low resolution and low speed high resolution in one converter!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    cmapspublic3.ihmc.us:80/servlet/SBReadResourceServlet?rid=1181572927203_421963583_5511&partName=htmltext
    Hello Rest Of The World
    Hello Debris
    Install a propeller and blow them away wink.gif

    Post Edited (ErNa) : 11/16/2009 11:12:20 AM GMT
  • CumQuaTCumQuaT Posts: 156
    edited 2009-11-16 11:20
    Very thorough! thank you!

    I just hooked the whole thing up on my Propeller demo board (my favourite toy) and it seems to work pretty well!

    Thanks for all the help!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Who are you, and why are you reading my signature?
Sign In or Register to comment.