Shop OBEX P1 Docs P2 Docs Learn Events
Using a cog as an ADC — Parallax Forums

Using a cog as an ADC

Technic-R-CTechnic-R-C Posts: 117
edited 2009-10-13 02:19 in Propeller 1
Hello Folks,

On page 95 of the propeller manual it states that a cog can be configured to do Analog-to-Digital Conversions (ADC).
How would one go about reading values from an external sensor and then configuring a cog to act as a 12 bit A/D converter?
Is this possible, or would I be better of just purchasing an 12 bit A/D converter from parallax?

Thank you

Technic-R-C

Post Edited (Technic-R-C) : 10/13/2009 12:36:09 AM GMT

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-10-13 00:43
    There are a number of ways that the cog can be used as an ADC but all with limitations, it just depends upon your application. If you are looking to convert DC to 12-bits then I would recommend the MCP3208 or similar instead.

    There are simple RC circuits for sigma-delta which do a nice job on voice band AC signals and you could of course use the old RC timing circuit in a variety of ways as well. The Prop however lacks a comparator so it's switching threshold is process and temperature dependent and also sensitive to noise.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Technic-R-CTechnic-R-C Posts: 117
    edited 2009-10-13 01:53
    Thank you for the replies,

    After·reading here and there about·A/D conversions using just one cog, I have sadly come to the conclusion that I am, at the moment, "incapable" of understanding the complexities of this·problem due to my lack of overall electronics experience (terminology, equations, etc..)
    The number of problems that would arise when attempting to·process a 15 kHz signal through a 12 bit A/D cog converter seem to be numerous and I think I'd be better off purchasing an 12 bit A/D converter...· but if someone has detailed instructions on how to accomplish this.... then we can talk!·smile.gif

    Basically all I comprehended from my research was:
    -put capacitors on ground and positive (VDD and VSS) to filter power coming in and out (cleaner signal)
    -use a resistor in line with the input signal...

    Technic-R-C

    Post Edited (Technic-R-C) : 10/13/2009 1:59:25 AM GMT
  • BradCBradC Posts: 2,601
    edited 2009-10-13 02:01
    Technic-R-C said...

    The number of problems that would arise when attempting to process a 15 kHz signal through a 12 bit A/D cog

    Here is your first hurdle.
    At 12 bits, the Propeller A/D samples at about 19.6Khz. Nyquist limits you to a signal bandwidth of about 9.8Khz, so you can't practically process a 15Khz signal with it in any case.

    I'm using an MCP3301 to do audio processing with the Propeller. I sample it at 80Khz, low pass filter that effective sample rate of 20Khz and use it to process 10Khz of audio bandwidth.
    That part itself works quite nicely.

    The MCP3301 has 13 bits of resolution. Between the oversampling and reducing the res down to 12 bits it provides very clean samples.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lt's not particularly silly, is it?
  • Technic-R-CTechnic-R-C Posts: 117
    edited 2009-10-13 02:19
    That cleared things up.· At minimum I would need to process a 12 kHz signal at 12 bits so that still wouldn't work.

    I looked at the datasheet and from your remarks the MCP3301·looks like a very nice A/D converter, especially for my application.
    I found one for $2.40 at $5.21 shipping at Mouser.com, pretty good deal smile.gif

    Thank you

    Technic-R-C

    Post Edited (Technic-R-C) : 10/13/2009 2:27:53 AM GMT
Sign In or Register to comment.