Shop OBEX P1 Docs P2 Docs Learn Events
Different styles of RC circuit for analog conversion. — Parallax Forums

Different styles of RC circuit for analog conversion.

Martin_HMartin_H Posts: 4,051
edited 2011-11-29 06:49 in General Discussion
While reading about analog to digital conversion using the RC time decay, I've noticed two distinct variations on the RC circuit. I'm wondering if one has some advantage over the other, or if this is just a matter of style. There's the style used in the "What's a Microcontroller" book, and the style on the Arduino Wiki. While the circuit styles differ, the programs that use them have essentially the same structure.

What's a Microcontroller style:
         220 ohm
Sig----/\/\/\/\----+----+
                   |    |
                   /    |
               cds \   == .1 uF
                   /    |
                   |    |
Gnd----------------+----+

Arduino Wiki Style
        5v
         |
         /
         \ cds
         /
         \
         |
Sig------+
         |
        == .1 uF
         |
        Gnd

The Arduino style uses one less part, but does require a 5 volt input into the circuit, while the other style uses an additional 220 ohm resistor. But are these two circuits functionally identical?

Comments

  • ercoerco Posts: 20,259
    edited 2011-11-29 01:07
    From http://arduino.cc/en/Tutorial/RCtime , it not only includes the 220 ohm resistor missing from your schema, but also:

    "Duplicates the functionality of the Basic Stamp's RCtime"

    Looks like the same basic function to me. Not sure what 'Duino's high/low voltage threshold is; PicAxes have selectable Schmitt or TTl trigger inputs with software-selectable pullup resistors, so you can play around with the trigger point.

    The Stamp's threshold is fixed at ~1.4V. Supposedly you get a more accurate (although longer time-wise) by discharging from 5V down to 1.4V.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-11-29 03:21
    Stylistically, Parallax began putting a 220 ohm resistor on I/O to protect the Basic Stamp, but in this context it might limit the rate of charge of the capacitor in an inconvenient manner.

    If one investigates the real in-rush current, you just might omit it or reduce its size - but it is wiser to just let it be. It is also there in case your variable resistor drops to zero as that would destroy the I/O. Much depends on what actual size capacitor you choose and specific timing requirements or how your variable resistor manages to limit current demand.

    There is more than one way to do do RC timing. One can time discharge or one can time charge. As erco mentions, the top-down approach offers more precision as going from logic 1 to logic 0 occurs at 1.4 volts.

    I'd have to say that Parallax provided a solution that is likely to save the microcontroller from damage due to a noob just copying the circuit. Many of the Arduino solutions are just inspired cut and paste of generalizations that have been on the web for a long time. After all, there is no one company to ask for a refund for bad advice.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-11-29 04:44
    Just an added thought,
    if you feel that our answers were not quite clear enough, why not take a look at RCTIME in the Basic Stamp Manual. The book is encyclopedic in what it covers and is free. Also, it is extremely well-indexed.
  • TymkrsTymkrs Posts: 539
    edited 2011-11-29 04:53
    Thought I'd put my two cents in:

    I know they have parallel and series versions of RC configurations for things such as RCTime, I believe both parallel and serial work in the same manner (not meaning the two you were asking about). I went into it a little here: http://tymkrs.tumblr.com/post/9959076041/rctime-for-potentiometers
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-11-29 06:15
    The two differ in the direction that the timing is measured for. Pages 363-368 of the Basic Stamp Manual are very clear.
  • Martin_HMartin_H Posts: 4,051
    edited 2011-11-29 06:49
    erco wrote: »
    From http://arduino.cc/en/Tutorial/RCtime , it not only includes the 220 ohm resistor missing from your schema, but also:

    "Duplicates the functionality of the Basic Stamp's RCtime"

    Looks like the same basic function to me. Not sure what 'Duino's high/low voltage threshold is; PicAxes have selectable Schmitt or TTl trigger inputs with software-selectable pullup resistors, so you can play around with the trigger point.

    The Stamp's threshold is fixed at ~1.4V. Supposedly you get a more accurate (although longer time-wise) by discharging from 5V down to 1.4V.

    Hmm, it looks like they have more than one schematic on their wiki!
    The two differ in the direction that the timing is measured for. Pages 363-368 of the Basic Stamp Manual are very clear.

    Thanks for the pointer. I'll read through that information.
    Tymkrs wrote: »
    Thought I'd put my two cents in:

    I know they have parallel and series versions of RC configurations for things such as RCTime, I believe both parallel and serial work in the same manner (not meaning the two you were asking about). I went into it a little here: http://tymkrs.tumblr.com/post/9959076041/rctime-for-potentiometers

    Thanks I will look through that tonight.
Sign In or Register to comment.