Shop OBEX P1 Docs P2 Docs Learn Events
Wheatstone Bridge and the Basic Stamp — Parallax Forums

Wheatstone Bridge and the Basic Stamp

Anthony240Anthony240 Posts: 24
edited 2006-03-10 13:53 in BASIC Stamp
All,

I am trying to get measurements of salinity and pH of a saltwater fish tank.· I have decided not to use the 555 timer to measure freq. but to go with the wheatstone bridge.· The bridge will enable me to measue small changes of resistance in the water.· I have made a few charts of resistance vs salinity and resistance vs pH.· I am trouble hooking the bridge up to the basic stamp and making the basic stamp display the changes in resistance.· Anybody got any ideas on how to make this work?

Thank You
Anthony

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,557
    edited 2006-03-02 16:06
    What resistance ranges are you looking at with the salinity and pH?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Anthony240Anthony240 Posts: 24
    edited 2006-03-02 17:27
    Beau,

    Im looking at resistance values from 40-100K

    These resistance values give salinity values from 0 - 250ppt
    and pH values from 1 - 10

    Anthony
  • Beau SchwabeBeau Schwabe Posts: 6,557
    edited 2006-03-02 18:42
    Those are huge values, I was expecting just a few ohms.
    Do these values have a linear correspondence?
    What sort of resolution are you hoping for?
    How are you currently measuring the resistance? (<--Any worries about false readings due to an unwanted galvanic effect?)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Anthony240Anthony240 Posts: 24
    edited 2006-03-02 19:36
    The values of resistance are linear to the corresponding values of salinity and pH. I'm needing a resolution of at least 1K ohm. Currently I'm measuring resistance using the 555 timer circuit in the Applied Sensors V1.3 Book. I have tried the RCTIME command but could not get the values I needed. When I use the RCTIME command, what is the number that is read on the debug terminal? I think that it is the amount of time it takes to reach the 1.3V threshold. If so how do I use that command to determine a resistance value?
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-03-03 19:21
    · Why does it have to be a part of a Wheatstone Bridge?
    · Why can't you hook up your sensor as a Resistor in an "A circuit" (see RCTIME in PBASIC Help)?
    · You will have to know the value of the Capacitor used.· The RCtime units returned = 635 * R(kohms) * C(uF).· As in the example, using a 10K and a 0.1uF it is RCTIMEunits = 635*10*0.1.· That example uses those values because the actual RCTIMEunits are 635.
    · So, 635 = 635*10*0.1
    ······· 1 = 10 * 0.1
    · So, what if you KNEW that you had a 0.1uF and your RCTIME units came back consistently with 675?· What would the resistance be (if you didn't know it)?
    ····· 675 = 635 * x * 0.1
    ··· 1.063 = x * 0.1
    ····10.63 =·x

    · So, the unknown resistance then was/is 10.63kohms.
    ··

    Post Edited (PJ Allen) : 3/3/2006 10:33:18 PM GMT
  • Anthony240Anthony240 Posts: 24
    edited 2006-03-06 17:51
    Allen

    Im not familiar with how the A Circuit works and I could not find much on the net about it. Could you explain how I could use that circuit to get my measurements?

    Thanks
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-03-06 18:52
    Yessir, the example is in PBASIC Help.· Type in RCTIME and it takes you there and maybe 1/2 down the page there are examples of two circuits: "A" and "B".· Use "A".· All the details are there.

    Post Edited (PJ Allen) : 3/6/2006 6:57:35 PM GMT
    248 x 183 - 6K
  • Anthony240Anthony240 Posts: 24
    edited 2006-03-06 20:11
    thanks

    I'll try it tonight.
  • Anthony240Anthony240 Posts: 24
    edited 2006-03-08 13:55
    I have been using the "A" Circuit and the RCTIME command in to measure changes in resistance. I have ran into a problem. The circuit and code works great for higher values of R. But when I put in values of R less than 1K the RCTIME result does not correspond with what I calculate should come out. For example: I used a .1uF cap and a 240ohm resistor where my probe would be. I figure with the RCTIME formula that:
    RCTIME units returned = 600 * R (Kohms) * C (uF)
    = 600 * .240Kohms * .1uF
    = 14

    I'm getting 1 as a result of RCTIME. This is just an example with a 240ohm resistor but the same applies for all small resistances. The way I figure, if I get 1 as a result of RCTIME then I should have a 16ohm resistor where my probe would be. This indicates that I should be able to measure very small resistances. Anybody got any ideas why my numbers are not working out right? When I put my probes in the circuit and put the probes in water I get 1 as a result of RCTIME which is why I believe that I need to be able to measure small resistances. I would appreciate any help on this subject.
    Thanks
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-03-08 14:40
    Anthony -

    I can't answer your question directly, but I'm reasonably sure you can find the answer here in these extended applications notes on RCTIME:
    http://www.emesystems.com/BS2rct.htm

    My guess is you may be reaching the limits of the RCTIME command. These limits will vary based on which PBASIC Stamp you are using.

    Thanks go to Dr. Tracy Allen for all of those excellent Stamp Applications Notes.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-03-08 17:02
    I agree, maybe RCTIME isn't good for all values of R, values so low, with any given C.·
    I'd suggest padding up the sensor with a metal-film resistor, in series,·to keep it from bottoming out.·
    1K, 2K?
    Metal-films are·least subject to change with temperature.
  • Anthony240Anthony240 Posts: 24
    edited 2006-03-08 18:17
    Thanks for the tip. I'll try it tonight.

    Anthony
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2006-03-09 06:02
    Anthony,

    The formula you are using to calculate the time assumes that the capacitor is first charged all the way up to 5 volts, but that is not true when you have a low value resistor. Look at the circuit:
    attachment.php?attachmentid=40734

    When the I/O pin is high, the 220 ohm resistor and your sensor form a voltage divider, and the voltage at the junction will be 5 * (R / (R+220)) volts. If R=220 ohms, that is only 2.5 volts. That is the starting voltage on the capacitor, and when the I/O pin becomes an input, it discharges down to the 1.4 volt Stamp threshold much faster than your formula predicts. If your resistance is less than 85 ohms, the voltage is already less than the threshold and the RCTIME will time out immediately (and return a value of 1).

    You might be tempted to remove the 220 ohm resistor. That will help a little bit, but you won't be home free. The output of the Stamp has an internal resistance that is nonlinear, but effectively around 50 ohms.

    The upshot is that you have to stick with higher values of resistance for RCTIME, or do some extra tricks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Anthony240Anthony240 Posts: 24
    edited 2006-03-09 15:00
    I got it to work!!!! But I still have a problem. To solve my problem of low resistance values I just added a 10K resistor in series with my probe. I ran the basic stamp to see what value of RCTIME I got and subtracted that number from my formula to solve for R. I have got the program to solve for values of R in ohms and in Kohms when I put my probe in the salt water. My next problem however is that I need to take the value of R and take the inverse of it to solve for conductance. (G=1/R) I need to be able to take 1/R for any vaue of R from 1 to 1000. I then need to put the answer into milli to get a number in milli Siemens.
    Example:
    I put my probe in the water and BS puts out a value of 31ohm for R.
    G=1/R
    =1/31
    =0.03225
    =32.25mS
    In this case I don't really care about the .25 so I just need the BS to read out 32mS

    I have looked all throught the BShelp and could not find any operation to do this type of math. I even tried to to 31^-1 but could not get that to work either. Could anybody explain how to do this type of math?

    Thanks
  • Beau SchwabeBeau Schwabe Posts: 6,557
    edited 2006-03-09 15:26
    So why not define G as a word and make your equation...

    G = 1000/R

    ...to get your answer in mS?

    You could even do...

    G = 10000/R

    ...to at least get the tenths place.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 3/9/2006 3:29:00 PM GMT
  • Kaos KiddKaos Kidd Posts: 614
    edited 2006-03-09 18:44
    Anthony240
    If you could, please, post your code and layout. I would find it VERY helpful in a few things I'v poked my head into. And I'm sure I wouldn't be the only one. That is, if you get a chance to.

    THanks!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Just tossing my two bits worth into the bit bucket


    KK
    ·
  • Anthony240Anthony240 Posts: 24
    edited 2006-03-10 13:53
    KK

    I'm not quite done with the code yet. When I get it done and fully working then I will post it.

    Anthony
Sign In or Register to comment.