Shop OBEX P1 Docs P2 Docs Learn Events
Liquid level ,code help — Parallax Forums

Liquid level ,code help

ArchiverArchiver Posts: 46,084
edited 2004-05-19 02:16 in General Discussion
I am using a basic stamp 2 to measure depth of liquid in a tank
using an a/d converter and pressure sensor i need to know how to
convert the voltages to gallons example .5 volts is empty 3 volts
is full . I need to convert and read out gallons to a lcd display 0
gallon at .5 volt to 30 gallons at 3 volts thanks mike

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-04-24 23:16
    The basic starting point is an equation that converts voltage to gallons. The
    equation is y = mx+b where y = gallons, m is a constant, x is the voltage and
    b is also a constant.

    For .5 volts = 0 gallons and 3 volts = 30 gallons, the equation is

    gallons = 12*volts - 6

    example: 0 = 12*0.5 - 6 and

    30 = 12*3 - 6

    Except in your case, the basic stamp does not directly read analog voltage
    from a transducer, hence you are using an A/D converter.

    What D value gives you 0.5 volts and what D value gives you 3 volts? This
    information is needed to modify the equation gallons = 12*volts - 6

    ken
    ================
    I AM USING A BASIC STAMP 2 TO MEASURE DEPTH OF LIQUID IN A TANK
    USING AN A/D CONVERTER AND PRESSURE SENSOR I NEED TO KNOW HOW TO
    CONVERT THE VOLTAGES TO GALLONS EXAMPLE .5 VOLTS IS EMPTY 3 VOLTS
    IS FULL . I NEED TO CONVERT AND READ OUT GALLONS TO A LCD DISPLAY 0
    GALLON AT .5 VOLT TO 30 GALLONS AT 3 VOLTS THANKS MIKE


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-25 04:19
    How exact do these measurements have to be?

    Wouldn't the pressure reading of the tank change with the atmoshpheric
    change in pressure (I'm thinking when it's full....it obviously will when
    empty)....
    If you need exact readings then you'd have to set up an external pressure
    sensor to monitor atmoshpheric changes (IF, it's the amount you're
    measuring)...

    If you just want to know when it's empty/half-full/full (ballpark levels)
    then you won't need it.


    Original Message
    From: <smartdim@a...>
    To: <basicstamps@yahoogroups.com>
    Sent: Saturday, April 24, 2004 6:16 PM
    Subject: Re: [noparse][[/noparse]basicstamps] LIQUID LEVEL ,CODE HELP


    > The basic starting point is an equation that converts voltage to gallons.
    The
    > equation is y = mx+b where y = gallons, m is a constant, x is the voltage
    and
    > b is also a constant.
    >
    > For .5 volts = 0 gallons and 3 volts = 30 gallons, the equation is
    >
    > gallons = 12*volts - 6
    >
    > example: 0 = 12*0.5 - 6 and
    >
    > 30 = 12*3 - 6
    >
    > Except in your case, the basic stamp does not directly read analog voltage
    > from a transducer, hence you are using an A/D converter.
    >
    > What D value gives you 0.5 volts and what D value gives you 3 volts? This
    > information is needed to modify the equation gallons = 12*volts - 6
    >
    > ken
    > ================
    > I AM USING A BASIC STAMP 2 TO MEASURE DEPTH OF LIQUID IN A TANK
    > USING AN A/D CONVERTER AND PRESSURE SENSOR I NEED TO KNOW HOW TO
    > CONVERT THE VOLTAGES TO GALLONS EXAMPLE .5 VOLTS IS EMPTY 3 VOLTS
    > IS FULL . I NEED TO CONVERT AND READ OUT GALLONS TO A LCD DISPLAY 0
    > GALLON AT .5 VOLT TO 30 GALLONS AT 3 VOLTS THANKS MIKE
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    > Yahoo! Groups Links
    >
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-26 17:52
    > The basic starting point is an equation that converts voltage to gallons. The
    > equation is y = mx+b where y = gallons, m is a constant, x is the voltage and
    > b is also a constant.
    >
    > For .5 volts = 0 gallons and 3 volts = 30 gallons, the equation is
    >
    > gallons = 12*volts - 6
    >
    > example: 0 = 12*0.5 - 6 and
    >
    > 30 = 12*3 - 6
    >
    > Except in your case, the basic stamp does not directly read analog voltage
    > from a transducer, hence you are using an A/D converter.
    >
    > What D value gives you 0.5 volts and what D value gives you 3 volts? This
    > information is needed to modify the equation gallons = 12*volts - 6

    Actually, it's not quite that simple ether. You're assuming linear behavior
    between pressure and volume which is only true if the tank is rectangular.
    if the tank is round then the top & bottom parts of the tank hold less
    volume than the middle. The pressure is only related to depth, not volume.

    The problem isn't unsolvable thou. With a few more data points you can
    "curve fit" the results into an equation that will approximate a "close
    enough" answer.

    --
    Enjoy,
    George Warner,
    Schizophrenic Optimization Scientists
    Apple Developer Technical Support (DTS)
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-26 18:55
    So for more precises measurements...would you weigh the tank? You still get
    wind affects (wind buffetting!).

    At work we use strain gauges on a scale like container.
    the problem here is that the gauge changes with temperature....but we're
    only looking for .5mm accuracy (I think!).
    Another method we use is a 'vibrating wire'. A wire is vibrated at a
    certain frequency.
    The container is connected to the string and as it fills up with fluids the
    frequency increases. There's a frequency correlation wrt the volume. This
    too is affected by temperature, but we monitor that and make adjustments.

    Is this water level calm? I was thinking....there are easier ways to do
    this no doubt....but...
    If you were to put a little laser diode in the bottom corner of the
    tank....could you aim it up on a angle and try to detect the reflected light
    pulse off the undersurface of the water level.
    Of course you'd have to have either the transmitter or receiver on a little
    lever with angle detection (servo?).

    Ya ok....I've got the flu today and have taken too much cough medicine and
    am babbling!!


    Original Message
    From: "George Warner" <geowar@a...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, April 26, 2004 12:52 PM
    Subject: [noparse][[/noparse]basicstamps] Re: LIQUID LEVEL ,CODE HELP


    > > The basic starting point is an equation that converts voltage to
    gallons. The
    > > equation is y = mx+b where y = gallons, m is a constant, x is the
    voltage and
    > > b is also a constant.
    > >
    > > For .5 volts = 0 gallons and 3 volts = 30 gallons, the equation is
    > >
    > > gallons = 12*volts - 6
    > >
    > > example: 0 = 12*0.5 - 6 and
    > >
    > > 30 = 12*3 - 6
    > >
    > > Except in your case, the basic stamp does not directly read analog
    voltage
    > > from a transducer, hence you are using an A/D converter.
    > >
    > > What D value gives you 0.5 volts and what D value gives you 3 volts?
    This
    > > information is needed to modify the equation gallons = 12*volts - 6
    >
    > Actually, it's not quite that simple ether. You're assuming linear
    behavior
    > between pressure and volume which is only true if the tank is rectangular.
    > if the tank is round then the top & bottom parts of the tank hold less
    > volume than the middle. The pressure is only related to depth, not volume.
    >
    > The problem isn't unsolvable thou. With a few more data points you can
    > "curve fit" the results into an equation that will approximate a "close
    > enough" answer.
    >
    > --
    > Enjoy,
    > George Warner,
    > Schizophrenic Optimization Scientists
    > Apple Developer Technical Support (DTS)
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    > Yahoo! Groups Links
    >
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2004-05-18 22:09
    The strain gauge is probably the best but the most accurate method I have
    seen, you don't want to use. That was a radioactive Beta source aimed in a
    column through the liquid or whatever you wanted to measure. As the level changes
    so does the density of material between the Beta source and the radiation
    detector across from it. We used this method in several applications for the
    Military when I worked at the Lockheed Nuclear Research Lab.

    Of course, no one here would want to play with radioactive materials, just
    thought I would mention it. :-)

    However, on a more practical note, the strain gauges do seem to work pretty
    well. I have used them on a number of projects for dispensing things from lime
    to liquids and measuring the amount dispensed based on how much was left in
    the containment vessel. Another way is to use a simple float system with a
    variable resistor/potentionmeter attached to it. Of course that is not quite as
    accurate.

    Randy Abernathy
    4626 Old Stilesboro Road NW
    Acworth, GA 30101-4066
    Phone / Fax: 770-974-5295
    Cell: 678-772-4113
    E-mail: Cnc002@a...

    I furnish technical support, repair, and other related services for your
    industrial woodworking machinery. My background as Senior Service Engineer for the
    SCMI Group for nearly fifteen years with factory training, combines with my
    extensive background in electronics, mechanics, pneumatics, electrical and CNC
    machinery to offer you needed support for your machinery.


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-05-19 01:55
    I don't necessarily reccomend this, but a friend of mine works in a shop that makes level gauges. One of the low tech methods they is a magnetic float to operate reed switches that close/ open sequentially, each onr switching in/out a resistor stack. On the other hand, .5mm accuracy seems a stretch by any standard.

    SB <steve.brady@r...> wrote:So for more precises measurements...would you weigh the tank? You still get
    wind affects (wind buffetting!).

    At work we use strain gauges on a scale like container.
    the problem here is that the gauge changes with temperature....but we're
    only looking for .5mm accuracy (I think!).
    Another method we use is a 'vibrating wire'. A wire is vibrated at a
    certain frequency.
    The container is connected to the string and as it fills up with fluids the
    frequency increases. There's a frequency correlation wrt the volume. This
    too is affected by temperature, but we monitor that and make adjustments.

    Is this water level calm? I was thinking....there are easier ways to do
    this no doubt....but...
    If you were to put a little laser diode in the bottom corner of the
    tank....could you aim it up on a angle and try to detect the reflected light
    pulse off the undersurface of the water level.
    Of course you'd have to have either the transmitter or receiver on a little
    lever with angle detection (servo?).

    Ya ok....I've got the flu today and have taken too much cough medicine and
    am babbling!!


    Original Message
    From: "George Warner"
    To:
    Sent: Monday, April 26, 2004 12:52 PM
    Subject: [noparse][[/noparse]basicstamps] Re: LIQUID LEVEL ,CODE HELP


    > > The basic starting point is an equation that converts voltage to
    gallons. The
    > > equation is y = mx+b where y = gallons, m is a constant, x is the
    voltage and
    > > b is also a constant.
    > >
    > > For .5 volts = 0 gallons and 3 volts = 30 gallons, the equation is
    > >
    > > gallons = 12*volts - 6
    > >
    > > example: 0 = 12*0.5 - 6 and
    > >
    > > 30 = 12*3 - 6
    > >
    > > Except in your case, the basic stamp does not directly read analog
    voltage
    > > from a transducer, hence you are using an A/D converter.
    > >
    > > What D value gives you 0.5 volts and what D value gives you 3 volts?
    This
    > > information is needed to modify the equation gallons = 12*volts - 6
    >
    > Actually, it's not quite that simple ether. You're assuming linear
    behavior
    > between pressure and volume which is only true if the tank is rectangular.
    > if the tank is round then the top & bottom parts of the tank hold less
    > volume than the middle. The pressure is only related to depth, not volume.
    >
    > The problem isn't unsolvable thou. With a few more data points you can
    > "curve fit" the results into an equation that will approximate a "close
    > enough" answer.
    >
    > --
    > Enjoy,
    > George Warner,
    > Schizophrenic Optimization Scientists
    > Apple Developer Technical Support (DTS)
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    > Yahoo! Groups Links
    >
    >
    >
    >
    >



    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and Body of the message will be ignored.

    Yahoo! Groups Links







    Do you Yahoo!?
    SBC Yahoo! - Internet access at a great low price.

    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-05-19 02:16
    Actually, at work we use a shaft encoder and a strain/weighing gauge. very
    balanced system (uses miniture leaf springs -- flextures).

    We measure up to 500mm of precip but usually have transformer oil in it in
    the summer and antifreeze in the winter (oil stops evaporation).
    Anyhow, we measure for 0.2mm of rain.

    It's called a Fisher Porter weighing gauge...honestly don't know if the
    company is still around...most meterological equipment/companies are being
    bought up by Vaisala of Finland!



    Original Message
    From: "Philip Gmblin" <pipeguy3153@y...>
    To: <basicstamps@yahoogroups.com>
    Sent: Tuesday, May 18, 2004 8:55 PM
    Subject: Re: [noparse][[/noparse]basicstamps] Re: LIQUID LEVEL ,CODE HELP


    > I don't necessarily reccomend this, but a friend of mine works in a shop
    that makes level gauges. One of the low tech methods they is a magnetic
    float to operate reed switches that close/ open sequentially, each onr
    switching in/out a resistor stack. On the other hand, .5mm accuracy seems a
    stretch by any standard.
    >
    > SB <steve.brady@r...> wrote:So for more precises
    measurements...would you weigh the tank? You still get
    > wind affects (wind buffetting!).
    >
    > At work we use strain gauges on a scale like container.
    > the problem here is that the gauge changes with temperature....but we're
    > only looking for .5mm accuracy (I think!).
    > Another method we use is a 'vibrating wire'. A wire is vibrated at a
    > certain frequency.
    > The container is connected to the string and as it fills up with fluids
    the
    > frequency increases. There's a frequency correlation wrt the volume. This
    > too is affected by temperature, but we monitor that and make adjustments.
    >
    > Is this water level calm? I was thinking....there are easier ways to do
    > this no doubt....but...
    > If you were to put a little laser diode in the bottom corner of the
    > tank....could you aim it up on a angle and try to detect the reflected
    light
    > pulse off the undersurface of the water level.
    > Of course you'd have to have either the transmitter or receiver on a
    little
    > lever with angle detection (servo?).
    >
    > Ya ok....I've got the flu today and have taken too much cough medicine and
    > am babbling!!
    >
    >
    >
    Original Message
    > From: "George Warner"
    > To:
    > Sent: Monday, April 26, 2004 12:52 PM
    > Subject: [noparse][[/noparse]basicstamps] Re: LIQUID LEVEL ,CODE HELP
    >
    >
    > > > The basic starting point is an equation that converts voltage to
    > gallons. The
    > > > equation is y = mx+b where y = gallons, m is a constant, x is the
    > voltage and
    > > > b is also a constant.
    > > >
    > > > For .5 volts = 0 gallons and 3 volts = 30 gallons, the equation is
    > > >
    > > > gallons = 12*volts - 6
    > > >
    > > > example: 0 = 12*0.5 - 6 and
    > > >
    > > > 30 = 12*3 - 6
    > > >
    > > > Except in your case, the basic stamp does not directly read analog
    > voltage
    > > > from a transducer, hence you are using an A/D converter.
    > > >
    > > > What D value gives you 0.5 volts and what D value gives you 3 volts?
    > This
    > > > information is needed to modify the equation gallons = 12*volts - 6
    > >
    > > Actually, it's not quite that simple ether. You're assuming linear
    > behavior
    > > between pressure and volume which is only true if the tank is
    rectangular.
    > > if the tank is round then the top & bottom parts of the tank hold less
    > > volume than the middle. The pressure is only related to depth, not
    volume.
    > >
    > > The problem isn't unsolvable thou. With a few more data points you can
    > > "curve fit" the results into an equation that will approximate a "close
    > > enough" answer.
    > >
    > > --
    > > Enjoy,
    > > George Warner,
    > > Schizophrenic Optimization Scientists
    > > Apple Developer Technical Support (DTS)
    > >
    > >
    > >
    > > To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@yahoogroups.com
    > > from the same email address that you subscribed. Text in the Subject and
    > Body of the message will be ignored.
    > >
    > > Yahoo! Groups Links
    > >
    > >
    > >
    > >
    > >
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    > Yahoo! Groups Links
    >
    >
    >
    >
    >
    >
    >
    >
    > Do you Yahoo!?
    > SBC Yahoo! - Internet access at a great low price.
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    > Yahoo! Groups Links
    >
    >
    >
    >
    >
Sign In or Register to comment.