Shop OBEX P1 Docs P2 Docs Learn Events
Exponential formula — Parallax Forums

Exponential formula

metron9metron9 Posts: 1,100
edited 2005-10-17 17:17 in BASIC Stamp
I am working on a project that uses PWM to power a Tachometer Guage.
The movement requires 200 mv to read 8,000 RPM, and 100mv to read 4000 RPM so the voltage is linear

I have experimented with PWM using a 4.7k resistor and a .01mf capacitor

I use 12,500 us on time and 10 mS off time to get 200 ma and a reading of 8,000 RPM
at 4000 us on time and 10 mS off time I get 100 ma and a reading of 4000 RPM

So to sum up I am using a constant off time of 10mS on time from 0 to 12500 us for voltage readings 0f 0 to 200 ma

What is the math formula to calculate any voltage from 0 to 200 ma for the on time value?

0=0
4000=4000
12500=8000

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2005-10-17 16:24
    Hi,

    For ease of calculation, assume the graph really is a straight line.

    Then rpm = (m * "on time") + offset

    where m = 0.47 (by calculation)
    offset = 2000 ( by drawing a graph, rpm on x-axis, "on-time" on horizontal)

    example: when on-time = 8000 uS

    rpm = (0.47 * 8000) + 2000
    = 3760 + 2000
    = 5760

    when on-time = 10000

    rpm = (0.47 * 10000) + 2000
    = 6700

    If the curve really is non-linear from 0 to 4000 uS, the calcs for curve fitting may be beyond the Stamp. But, you may be able to use a lookup table.

    Cheers

    Tom
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-10-17 17:17
    Metron,

    You might want to take some more readings to find the true nature of your system. Curve fitting can be tricky with a BASIC Stamp, but as our pal Tracy Allen has shown severall times, it's not impossible.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.