Shop OBEX P1 Docs P2 Docs Learn Events
Solution Concentration — Parallax Forums

Solution Concentration

JDog12JDog12 Posts: 5
edited 2010-06-02 21:53 in Accessories
So we have these large tubs of Copper Sulfate solution (very blue, for you non chemists) and I would like to be able to determine the concentration of these tubs using the TCS230 and a 2PE board.

I was looking for ideas of the best way to do this, I've tried shining a light through the solution toward the sensor and using the LED's on the sensor itself to obtain the color of reflection also. We have a standard % concentration and we want to be able to compare the values obtained from the standard solution to others and compute a different percent concentration, though this is difficult because the blue output values of these solutions are very close (about 40) and we're looking for a way to make the sensor more sensitive to blue light, making it easier to compare very similar colors. Different, light frequency or wavelength, anything?

Anything will help. Thanks.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-05-27 21:54
    1. Definitely use the transmissive color technique, rather than reflective. And make sure the thickness of the sample you're looking through is the same every time.

    2. For every sample take two readings: one with the illumination on, another with it off. Subtract the second from the first to get your reading. This will cancel any effects from ambient light.

    3. And always do a white balance (i.e. with distilled water), and take the ratio of the sample reading to the white balance reading.

    4. Try increasing the sample time for blue. That will give you more bits of precision to work with.

    BTW, aren't the fumes from a CuSO4 bath rather reactive? Are you taking any steps to protect the electronics from corrosion?

    -Phil
  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2010-05-27 21:57
    JDog12,

    just a little bit of opposite thinking out loud here ... The fact that you can 'see' blue means that that wavelength is allowed to pass, meaning that the substance you are measuring 'Copper Sulfate' is blocking all other wave forms. Although the variations of blue may seem very close to one another between different concentrations, looking at another color such as red might show a more dramatic difference. In other words a more measurable difference. Also, assuming that your solution is evenly mixed, you may only need to look at a small portion of the whole solution... <- less 'blue' or less of a 'filter' to look through.

    What happens when you shine a red laser (or green laser) through the solution at the sensor?

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

    IC Layout Engineer
    Parallax, Inc.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-05-28 01:13
    Just be aware that a lot of other molecules bobbing around in your tank can also affect the transmission spectrum.
    For example, quoting wikipedia:

    "The colour of metal ion solutions is strongly affected by the presence of other species, such as certain anions or ligands. For instance, the colour of a dilute solution of copper sulfate is a very light blue; adding ammonia intensifies the colour and changes the wavelength of maximum absorption (λmax)."

    en.wikipedia.org/wiki/Ultraviolet-visible_spectroscopy

    smile.gif
  • zoopydogsitzoopydogsit Posts: 174
    edited 2010-05-31 13:13
    I like the tech solutions and the use·of light is quite innovative.·Using absorbtion of light through the material aka absorbtion spectra is certainly worth the try, though it maybe mor tricky than you think.·Having a consistent sample thickness by·using a square tube/chamber to get a consistent thickness.·You may also want to try different chamber material types as they too will have different properties for different frequencies of light (I remember the old·UV erasable eproms used quartz windows as·glass absorbs the UV).·You may want to consider placing·the device·in a black plastic box so you do not get any external light interference.·Certainly as others have mentioned different colored lights sources will give a different result passing through the blue colour.

    When you·experiment with this, try having different known concentrations to use over the different colors so that you can correlate the result to find the best match. It may turn our that you may need a mix of colours. Beware of RGB LEDs, I've found in the past that·although they produce Red, Blue and Green, these can be at different intensities, thus requiring callibration. One way is to use 3 variable resistors,·and then·adjust all·3 to give a white light (reflect it off a card).·Then measure the resistence·of the·POTs·to determine the actual resistence needed for·driving the intensity, though this is assuming a linear response of the same gradient for all 3 colors (unlikely).·Again experimentation would be required.

    If the temperature is likely to change between samples then you may want to factor that too. If you don't require immersing the sensor in the sample then a thermister with RC time may do the job nicely. Again, you should calibrate this in a glass of ice water and then a glass of boiling water to get the upper and lower ranges then assuming it's linear over the range (I don't know, but I'd hope it is over the standard ranges).

    Though I would have thought the easiest way to measure the concentration would be a hygrometer. You could place it in a tube to restrict it to just vertical movement as long as you could have a repeatable sample volume. And then measure that. You could do that with a range of different methods, the choice would depend on the amount of movement variation and the desired sensitivity. Some examples: An arm to a POT (measuring the resitance (you could do this with RC time or an A-D), A magnet and one or more hall effect sensors to measure the change in the magnetic field, a metal tube within a tube to measure capacitance. etc.·

    Depending on what you are actually trying to achieve (sensitivity, reliability, predictability) you may want to consider using a couple of different sampling techniques and then use the data from each group of sensors for your final outcome.

    It certainly sounds like a lot of fun! I'd be really curious as to what you find out.

    It would be great if you could post your progress.
  • John R.John R. Posts: 1,376
    edited 2010-06-01 00:42
    zoopydogsit said...


    Depending on what you are actually trying to achieve (sensitivity, reliability, predictability) you may want to consider using a couple of different sampling techniques and then use the data from each group of sensors for your final outcome.


    That paragraph is the most significant thing to consider. I've been working on some research and development on how to test various parameters in fish tanks. There are two inverse questions:

    * How accurate to you NEED to be?
    * Mow much money do you have to spend?

    Finding where these two lines cross will tell you what sensor(s) you need.

    zoopydogsit (and others) also hit on one of the things to help with your search. Think about all the ways to test what you're after (specific gravity, color, conductivity, pH, etc.) and look into how each could be measured. Some are easier/cheaper/more accurate than others.

    Based on my work, think carefully "how good is good enough", and conversely, how "bad" can it be before it's "worthless". Just as good as "how accurate can I get", is "I can do this easily, but will the results be worth the effort".

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.
    Click here to see my Nomad Build Log
  • JDog12JDog12 Posts: 5
    edited 2010-06-02 13:16
    So far I've been using acrylic glass to make the sample containers for the solution. We've discovered that the thinner the container for the solution is, the better response we get from the sensor. Our sample container is 10/1000 of an inch thick and covers the eye of the sensor. We are using the transmittance effect for this experiment because it will be much easier to analyze the data once we have some solid numbers.

    We want this to be fairly accurate and produce reproducible results fairly quickly. As we increase the sample time for blue, the sensor puts out higher readings, making the results easier to compare @ close concentrations, though when at these higher levels, the sensor starts out reading off numbers and over time the numbers continue to decrease and decrease making it very difficult to get a good reading at all.

    Any thoughts?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-06-02 15:19
    If you're extracting the sample and putting it in a container to measure, there are cells designed just for that purpose:

    www.starnacells.com/

    I'm not sure why you're seeing a time-varying response. Could you post your code?

    -Phil
  • JDog12JDog12 Posts: 5
    edited 2010-06-02 16:07
    The code is just a demo downloaded from the site. The only thing I've been tinkering with is the sample time for each color in attempts of calibrating it. This is my first experience with any programing and don't really have much knowledge on the topic.

    '
    [noparse][[/noparse] I/O Definitions ]

    #DEFINE Socket = "B" 'Define a MoBo socket for the TCS230-DB.

    #SELECT Socket

    #CASE "A", "a"

    S3 PIN 8 '
    S2 PIN 9
    LED PIN 12
    Owio PIN 10
    Out PIN 11

    #CASE "B", "b"

    S3 PIN 0 '
    S2 PIN 1
    LED PIN 5
    Owio PIN 6
    Out PIN 7

    #CASE #ELSE

    #ERROR "Value for 'Socket' must be either 'A' or 'B'."

    #ENDSELECT

    '
    [noparse][[/noparse] Constants ]

    pRED CON 50 'Red reading period.
    pGREEN CON 8 'Green reading period.
    pBLUE CON 50 'Blue reading period.

    '
    [noparse][[/noparse] Variables ]

    RED VAR Word 'Red color reading.
    GREEN VAR Word 'Green color reading.
    BLUE VAR Word 'Blue color reading.

    '
    [noparse][[/noparse] Initialization ]

    PAUSE 10 'Wait for AVR to reset.
    OWOUT Owio, 1, [noparse][[/noparse]$05, $15] 'Maximum output rate.
    HIGH LED 'Turn on LED.

    '
    [noparse][[/noparse] Program Code ]

    DO
    GOSUB Color 'Get the color data, and output to DEBUG.
    DEBUG "R", DEC3 RED
    DEBUG " G", DEC3 GREEN
    DEBUG " B", DEC3 BLUE
    DEBUG CR
    PAUSE 1000
    LOOP

    '
    [noparse][[/noparse] Subroutines ]

    ' Color: Read all three color components.

    Color:
    LOW S2 'Address the red output.
    LOW S3
    COUNT OUT, pRED, RED 'Read the red component.
    HIGH S3 'Address the blue output.
    COUNT OUT, pBLUE, BLUE 'Read the blue component.
    HIGH S2 'Address the green output.
    COUNT OUT, pGREEN, GREEN 'Read the green component.
    RETURN





    --Thanks for your help!
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-06-02 17:03
    I see you're still using the LED output command. Have you replaced the onboard LEDs with wiring to a backlight? If not, what are you using for illumination?

    -Phil
  • JDog12JDog12 Posts: 5
    edited 2010-06-02 17:49
    Sorry to not include that part, I have the LED's off and we're experimenting on what outside source to use. We have yet gotten our hands on a laser, we've tried single LED's, we've also used a multiple LED flashlight, but it seemed to be too intense for the sensor and we never got a solid reading.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-06-02 18:32
    I think a diffuse backlight source that you can turn on and off from the Stamp is your best bet. Here's how I would set it up (top view):

    attachment.php?attachmentid=70806

    The sample container is a Sarna Cell, as I pointed out above. The diffusers can be either ground glass or milk-white Plexiglas. The idea is to get as even and diffuse a backlight as possible. Don't skimp on the physical setup and lighting if you want any kind of precision. If you don't get that part right, no amount of clever programming is going to help you.

    -Phil
    600 x 482 - 17K
  • JDog12JDog12 Posts: 5
    edited 2010-06-02 21:53
    Phil, thank you so much for all of your help. I will have to let you know how it turns out and might ask another question or two if I run into trouble. THANKS!!
Sign In or Register to comment.