Different styles of RC circuit for analog conversion.
Martin_H
Posts: 4,051
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:
Arduino Wiki Style
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?
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
"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.
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.
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.
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
Hmm, it looks like they have more than one schematic on their wiki!
Thanks for the pointer. I'll read through that information.
Thanks I will look through that tonight.