PDA

View Full Version : RC-Time Question...

jblaven
06-07-2005, 09:41 AM
On page 146 of the "What's a Microcontroller" book,·it has me measuring the time of voltage decay of various resistors... it then wants me to write in the measured time in the table for each resistor listed.

I noticed for the 2K resistor, I get different readings for voltage decay (when I run the program more than once)...

4.9, 5.0, 5.1, 5.1, 5.1, 5.2, 5.1, 5.3 (in seconds)

If there is no constant, what purpose is there of measuring it?· I don't yet fully understand the purpose of how RC-Time applies to a circuit design.· I can't wrap my mind around it.

Help me understand!http://forums.parallax.com/images/smilies/freaked.gif

Thanks,

Joe

DukeEgr93
06-07-2005, 10:02 AM
The values you are getting are constant...to within the precision limitations of the device - it's really not all smoke and mirrors http://forums.parallax.com/images/smilies/jumpin.gif· (sorry; said that TOTALLY to be able to use the icon).·

The idea behind using an RC circuit can be somewhat explained if you think of a capacitor as a bucket and a resistor as the size of a hole on the bucket (this analogy mainly holds for the "drain" portion of the RC show).· During the fill portion, the bucket (capacitor) is filled with water (electrons) and when the filling is done,·the water (energy)·starts to drain out onto the ground (erm, ground) by virtue of the hole (resistor).· The larger the hole, the more quickly the bucket drains.

The·IO pins on the microcontroller can only measure two states on the bucket - full and empty - which are delineated as "more than 1.3V" and "not more than 1.3V."·The nice part is, for a constant RC pair, you can determine how full the bucket was (from 1.3V to 5V) based on how long it takes to get to 1.3V (again, within the precision of the measuring device) OR if you fill the bucket completely and know either R or C, you can determine the other value based on the same time.·

Does that help?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
__________________________________________________ __________
Dr. Michael R. Gustafson II (mrg@duke.edu)
Lieutenant Commander, Civil Engineer Corps, USNR

jblaven
06-07-2005, 10:19 AM
DukeEgr93 said...

The values you are getting are constant...to within the precision limitations of the device - it's really not all smoke and mirrors http://forums.parallax.com/images/smilies/jumpin.gif· (sorry; said that TOTALLY to be able to use the icon).·

The idea behind using an RC circuit can be somewhat explained if you think of a capacitor as a bucket and a resistor as the size of a hole on the bucket (this analogy mainly holds for the "drain" portion of the RC show).· During the fill portion, the bucket (capacitor) is filled with water (electrons) and when the filling is done,·the water (energy)·starts to drain out onto the ground (erm, ground) by virtue of the hole (resistor).· The larger the hole, the more quickly the bucket drains.

The·IO pins on the microcontroller can only measure two states on the bucket - full and empty - which are delineated as "more than 1.3V" and "not more than 1.3V."·The nice part is, for a constant RC pair, you can determine how full the bucket was (from 1.3V to 5V) based on how long it takes to get to 1.3V (again, within the precision of the measuring device) OR if you fill the bucket completely and know either R or C, you can determine the other value based on the same time.·

Does that help?

Thanks!

It helps a little...

So.... another way to put it, is the resistor has a tolerance +/- some value, and the capacitor has a tolerance +/- some value.· Is this right?·

If it is, does it mean that you have two items that work together (within tolerance), but combined it can·still give different values (within the overall tolerance)?

Lastly, what kind of application would benifit from me knowing the voltage decay?· I am just glad it has not exploded http://forums.parallax.com/images/smilies/jumpin.gif ...yet).

Thanks,

Joe

DukeEgr93
06-07-2005, 10:27 AM
While the resistor and capacitor do have tolerances, that doesn't explain getting a range of values - after all, regardless of their tolerance, a single RC pair has a single time constant. The things that might cause different timing for the same RC pair inlclude the temperature of the room and also the precision of filling and emptying of the bucket. It looks like the readings you got were all within 5% of some mean.

As for applications, the various modules have awesome examples, including: determining the light level based on the measured decay time to find resistance of a photoresistor given a particular fill voltage and capacitor and determining the light level based on the measured decay time to find input current given an RC circuit filled by a photodiode.

Essentially, using an RC circuit and the RCTIME lets you measure an analog value by timing a digital transition from high to low or low to high (conecpt covered in What Is a Microcontroller and Renewable Energy modules as well as some others)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
__________________________________________________ __________
Dr. Michael R. Gustafson II (mrg@duke.edu)
Lieutenant Commander, Civil Engineer Corps, USNR

jblaven
06-07-2005, 10:36 AM
Thanks Michael! I will need to review that section again in What is a Microcontroller.

Regards,

Joe

Andy Lindsay (Parallax)
06-08-2005, 04:41 AM
After taking a few more measurements, I would expect an average time value to appear for that 2 k resistor. As DukeEgr93 said, "... within 5% of some mean." Your time measurements should average around half that time for a 1 k resistor and five times as long for a 10 k resistor.

The main point of the activity is to see that you can infer what the resistance of a resistor is by measuring how long it takes a capacitor to discharge into it. After filling in the chart, you could be handed a resistor with the color bars covered up (or erased) and you could use your RC circuit to figure out what the approximate resistance is by measuring the time it takes for the capacitor to discharge through it. Since there are lots of sensors out there that tell you what they are measuring by giving you a resistance value, this time measurement technique becomes really important, and it's the basis for the BASIC Stamp's RCTIME command.

Capacitors can be charged and discharged, kind of like small rechargeable batteries. The main difference is that a rechargeable battery's voltage stays pretty much the same until it's dead, but a capacitor's voltage decays continuously as it delivers current to a circuit. Since a resistor "resists" current, it stands to reason that a capacitor will loose its charge quickly through a small resistor and slowly through a large resistor.

What's a Microcontroller only scratches the surface of RCTIME. There's more about it in the following documents:

Applied Sensors (http://www.parallax.com/detail.asp?product_id=28153) - Chapter 3
Understanding Signals (http://www.parallax.com/detail.asp?product_id=28119) - Chapter 4
Basic Analog and Digital (http://www.parallax.com/detail.asp?product_id=28155) - Chapter 8
The BASIC Stamp Manual (http://www.parallax.com/detail.asp?product_id=27218) - Chapter 5

Post Edited (Andy Lindsay (Parallax)) : 6/7/2005 9:56:22 PM GMT

jblaven
06-08-2005, 08:12 AM
Andy Lindsay (Parallax) said...
After taking a few more measurements, I would expect an average time value to appear for that 2 k resistor. As DukeEgr93 said, "... within 5% of some mean." Your time measurements should average around half that time for a 1 k resistor and five times as long for a 10 k resistor.

The main point of the activity is to see that you can infer what the resistance of a resistor is by measuring how long it takes a capacitor to discharge into it. After filling in the chart, you could be handed a resistor with the color bars covered up (or erased) and you could use your RC circuit to figure out what the approximate resistance is by measuring the time it takes for the capacitor to discharge through it. Since there are lots of sensors out there that tell you what they are measuring by giving you a resistance value, this time measurement technique becomes really important, and it's the basis for the BASIC Stamp's RCTIME command.

Capacitors can be charged and discharged, kind of like small rechargeable batteries. The main difference is that a rechargeable battery's voltage stays pretty much the same until it's dead, but a capacitor's voltage decays continuously as it delivers current to a circuit. Since a resistor "resists" current, it stands to reason that a capacitor will loose its charge quickly through a small resistor and slowly through a large resistor.

What's a Microcontroller only scratches the surface of RCTIME. There's more about it in the following documents:
m
Applied Sensors (http://www.parallax.com/detail.asp?product_id=28153) - Chapter 3
Understanding Signals (http://www.parallax.com/detail.asp?product_id=28119) - Chapter 4
Basic Analog and Digital (http://www.parallax.com/detail.asp?product_id=28155) - Chapter 8
The BASIC Stamp Manual (http://www.parallax.com/detail.asp?product_id=27218) - Chapter 5