Shop OBEX P1 Docs P2 Docs Learn Events
Understanding Signals Ch4 Act2 Math Problem — Parallax Forums

Understanding Signals Ch4 Act2 Math Problem

tmatma Posts: 27
edited 2004-12-30 21:42 in Learn with BlocklyProp
Hi All

Understanding Signals Chapter 4 Activity 2
Measuring discharge·time of an RC network using the Optascope
and comparing to the value calculated by the Stamps RCTIME command

I worked thru this activity and got consistant results from the scope display and the debug readout.
The time constants measured from the scope·are very close to the ones calculated by the Stamp program.
From these TC's, 12mS for bright and 94mS for dark on the photoresistor, I calculate 1200 and 9200 ohms using the formula R = TC/C.
So far I think I understand.

But then I get to Page 62 and I'm lost.
The constant e is introduced in table 4-1 and a new formula for calculating R is given
( R = t/C * 1n * Vdd/Vp15)

Where does the constant (e) apply to this example?

Where did the term (1n) come from?

Is the (t) used in the formula the the Stamps count in uS mentioned in the table?

I have found most of the examples in this and other Parallax publication's to have excellent explanations for the various problems but this one goes over my head.

Can someone help me·understand this part please.

tma

Comments

  • Tracy AllenTracy Allen Posts: 6,656
    edited 2004-12-30 08:45
    I don't have that book in front of me, but I'll take a stab at an answer.

    The constant "e" and the factor "ln" that have you worried come from the natural exponential and logarithms, which are closely related. "e" is the constant 2.718282.... You can raise that number to a power, like y = e^x, sometimes written as y = exp(x). The natural logarithm is the inverse, for example, ln(y) = x.

    The capacitor is first charged to the full power supply voltage, ··"Vdd". Then it is allowed to discharge through the resistor. The voltage on the pin, "Vp15" decreases.· It follows an exponential curve, given by the exponential:

    Vp15 = Vdd * exp(-t/RC)

    That comes about from solving a differential equation that describes the circuit. The number "e" has a way of popping up everywhere when rates like this are concerned. At time t=0 the number in parentheses is zero, and any number raised to the zero power is one. So at t=0, the equation is simply, Vp15 = Vdd. As time increases, the number exp(-t/RC) decreases, due to the minus sign. Kind of like the series 1, 1/2, 1/4, 1/8, ... When t=RC, the value of exp(-t/RC) becomes 1/e, which is known in the trade as "one time constant".
    After one time constant, the voltage has dropped to 1/e of its starting value.

    Now it is possible to solve the above equation and get R over to the left hand side. To do that, one takes the logarithm of both sides and moves things around. What you end up with is the formula you may be seeing in the book:

    R = t/C * ln(Vdd / Vp15)

    I say "may" because the way you have transcribed it is a little different. You need to be aware that "ln" is a function, that is, the logarithm base e of (Vdd / Vp15). To solve for R, you have to substitute Vp15 = 1.3 volts, Vdd = 5 volts, C = the capacitance used in microfarads, and t = the time calculated by the RCTIME command in microseconds.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • tmatma Posts: 27
    edited 2004-12-30 18:30
    Thanks Tracy

    It has been too many years since high school and I had forgotten about· natural logarithms.

    However I am still confused.

    For the example given the RCTIME command returns 6000 2uS increments using an unknown R and C=10uF.

    From the formula Tc = RC or R = Tc/C I can calculate the resistance is 1200 ohms.

    Where or why ·does the constant e and the natural logarithm need to be introduced?

    tma
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2004-12-30 20:07
    Hi tma--

    You don't need e and natural logarithms (luckily!?) in order to calculate the resistance from the RCTIME value. You just have to plug in the numbers in the formula, T = K * R * C. I threw in the constant K because it is needed to account for variations in the capacitor value and the actual stamp switching threshold (see below). You do need the e and the ln if you want a deeper understanding of what is going on. The shape of the curve that you see on the optoscope is an exponential decay curve. The formula T = K*R*C comes from solving for exactly how long is takes for that curve to fall to a certain percent of its starting value. Maybe Aristides can jump in with more about the context and pedagogical intent in "Understanding Signals".


    A more accurate formula is,
    Tc = 1.35 * R * C
    with the constant 1.35 coming from the fact that the BASIC Stamp switching threshold is lower than the 1/e value of 1.84 volts. (5 volts Vdd * 1/e = 1.84 volts). The time constant is the time it would take for the voltage to fall from 5 volts down to 1.84 volts, but on the Stamp, the RCTIME command actually measures how long it takes the voltage to fall down to 1.3 volts, which takes a little longer.

    Be aware that the value of a nominal 10 microfarad capacitor will be as much as +/-20% or more off from 10 microfarads.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • tmatma Posts: 27
    edited 2004-12-30 21:42
    Hi Tracy

    Thank you! - Now I understand.

    I went back in my notes to the begining of Chapter 4 and I had made note of the 1.85V vs 1.4 volt thing.

    At that time I concluded that the error must not be significant since no mention was made in the manual.

    Now I can continue on in peace (until I run into a waveshaping problem).

    t(thickhead)ma





Sign In or Register to comment.