Shop OBEX P1 Docs P2 Docs Learn Events
Measuring millivolts — Parallax Forums

Measuring millivolts

Greg LaPollaGreg LaPolla Posts: 323
edited 2009-03-31 19:32 in Propeller 1
I have been trying to get a ph sensor to work on a ds2760 module with no success. So I am looking for a different solution.

The ph sensor already has an amplifier built in.

I need to measure millivolts from the ph sensor. It produces 59.16 millivolts for every ph increment from 0 to 14.

The max output would be 828.24 millivolts.

Could this be done with simple one wire analog to digital converter attached to the ph sensor ? or is there another way to do this without too many components, The PCB is already very crowded.

Thanks


Greg
«1

Comments

  • AleAle Posts: 2,363
    edited 2009-03-22 20:38
    You could use a tiny A/D converter, something like an ADS1100 with I2C (pakage SOT23-6). A sigma delta ADC with 2 pins (from the propeller) may also work but you may have to boost the voltage a bit (so 1 op amp may be needed, again a SOT23-5 version can be found).
  • mosquito56mosquito56 Posts: 387
    edited 2009-03-22 21:47
    · I use 8 opamps in my project. I have had good luck with the lm358n. It is a dual op amp that uses a very small voltage from a thermcouple. Look at http://www.nhsouth.com/crafts/workbench/thermocpl.htm for the wiring of the opamp. You can put a variable resistor in series with R2 to adjust the gain of the opamp to get the voltages in line for the adc.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·······

    ······· "What do you mean, it doesn't have any tubes?"
    ······· "No such thing as a dumb question" unless it's on the internet
    ········
  • Greg LaPollaGreg LaPolla Posts: 323
    edited 2009-03-23 01:49
    I don't think I need an op amp since the ph sensor already has an amplifier in it. the ADS1100 looks like a possible solution, however I would like to keep with one wire if possible.
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2009-03-23 02:18
    Greg LaPolla,

    Because of the relatively small voltages involved, I would consider using a differential input ADC. This would help reduce the noise floor and increase your signal to noise ratio. Does the Ph sensor provide a differential output? If not you may be able to create a pseudo differential signal with a whetstone bridge configuration or a voltage divider reference on the inverting input of a dual input differential ADC. What this effectively does is create a common mode rejection to any electrical noise in your system. What kind of PH sensor are you using?

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

    IC Layout Engineer
    Parallax, Inc.
  • Greg LaPollaGreg LaPolla Posts: 323
    edited 2009-03-23 03:04
    I picked this up off ebay for 20 bucks. I think the company is now defunct. I have tested the sensor out with a multimeter and it appears to work. Attached is the spec sheet that I have. It is the model 11.


    Greg
  • AleAle Posts: 2,363
    edited 2009-03-23 06:21
    Greg, I do not see where it says that a built-in amplifier is included. The ~ 60 mV/pH unit is normal for a Ag/AgCl glass electrode. You need a very high impedance differential amplifier (2 op amps as followers driving a third as diff amp) and then an ADC. Maybe MAXIM has an ADC with one-wire interface. You may be want to use the I2C interface in the EEPROM for that.
  • virtuPICvirtuPIC Posts: 193
    edited 2009-03-23 06:48
    You have 59.16 mV pre pH increase. What resolution do you require? Probably it wouldn't make sense to go finer than .1 pH step. So you need a voltage resolution of some 6 mV or a bit more than 7 bit for the whole range. A simple sigma-delta-ADC as on the demo board should suffice. Schematic is on the Parallax site. This ADC only requires a few passive components (space and money saving). If you need higher impedance you can decouple with an op amp or a transistor.

    If this ADC doesn't fulfill your needs you can use a small, simple serial output ADC with resolution of 10 bit or 12 bit like Microchip's MCP3001 and drop some bits. Typically 8 pins for some two dollars.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Airspace V - international hangar flying!
    www.airspace-v.com/ggadgets for tools & toys
  • Greg LaPollaGreg LaPolla Posts: 323
    edited 2009-03-23 12:23
    The PH sensor has 2 BNC connectors, one for the signal and one for power.

    ALE, take a look at the spec sheet again under options. the full part number of the unit I have is M-11-10KTC-AMP-4DY.


    virtuPIC,

    I assume you are talking about the TV interface, I will take a look in the OBEX and see if there is any sample code.
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2009-03-23 15:41
    Ale,

    "...You need a very high impedance differential amplifier (2 op amps as followers driving a third as diff amp) and then ..." - What you are describing is an instrumentation amplifier, and these are offered in a single package.· But I agree, with the voltage level involved, to expect any degree of repeatability and precision, this sensor should be read in a differential mode that is at least common mode to the power supply noise if the sensor itself does not provide a differential output of it's own. (see schematic)

    Greg LaPolla,

    "The PH sensor has 2 BNC connectors, one for the signal and one for power." - It sound like your sensor might already provide a differential output, since each BNC connector has two conductors.· In that case, the "output" BNC connector would·directly interface to the instrumentation amplifier.




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

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 3/23/2009 3:54:16 PM GMT
    763 x 553 - 130K
  • RaymanRayman Posts: 14,826
    edited 2009-03-23 16:45
    If the sensor already has an amplified output, then just use a ADC chip.· You'd probably want to find a 1-V reference and an ADC with a REF input....
  • virtuPICvirtuPIC Posts: 193
    edited 2009-03-23 16:56
    Beau: Your schematic shows a Wheatstone bridge coupled to a comparator. This is essentially a single bit ADC giving digital signal if the pH goes through a threshold. As Rayman says, Greg, you can simply connect to an ADC with reference voltage. Correct: With arbitrary reference voltage, as long as it is in a useful range. If your ADC does not generate its own reference voltage you can produce it externally with a resistor and a Z-diode or 78L05 or so. If your ADC uses power supply as reference you can just give it stabilized power. Well, you probably have such a stabilized power supply voltage anyway.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Airspace V - international hangar flying!
    www.airspace-v.com/ggadgets for tools & toys
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2009-03-23 19:16
    So this probe has a unity gain amplifier built in, but what about offset? Natively pH output is +/- 59 mV centered at pH=7, which is full scale +/- 413 mV, not 0 to 826 mV. A unity gain amplifier would normally mean that it passes through the +/- 423mV without gain or offset. What power supply does the device require? It could be that it generates a negative power for the unity gain amplifier internally. The first thing to do is to hook it up to a voltmeter and a proper power supply, and verify the signal that comes out at, say, pH=4, pH=7 and pH=11.

    I see no reason why you can't use the DS2760. The DS2760 current sense input is bipolar with a resolution of 15.625 microVolts, but the range is only +/- 64 milliVolts. To use it with the pH sensor would require a voltage divider.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Greg LaPollaGreg LaPolla Posts: 323
    edited 2009-03-23 22:39
    Tracy,

    Maybe I don't understand it well enough then. I have a ds2760 from parallax, and the reading is all over the place. I have used a volt meter with the sensor and it appears to work, it is never a constant reading though. I have it attached to the 5 volt power on my pe board. I will look into the code again tonight.


    Greg
  • Greg LaPollaGreg LaPolla Posts: 323
    edited 2009-03-23 23:20
    Tracy,

    So placing the sensor in test solution 4.00 yields a reading on the multimeter ~165 mV
    placing the sensor in test solution 7.00 yields a reading on the multimeter ~30 mV

    Placing the sensor in a glass of tap water PH ~ 7.22 according to my hand help ph probe yields a reading of ~ 7.0 mV

    So if I understand you correctly, at 4.0 the reading should be ~ -236.64
    and at 7.0 it should be ~0


    Greg
  • TreeLabTreeLab Posts: 138
    edited 2009-03-24 12:56
    Greg;
    pH sensors (glass electrodes) are extremely high impedance devices, and they are very sensitive to noise pickup (like an antenna). In older units the readout was an analog meter and/or a strip-chart recorder, and the mechanical movements tended to dampen out the noise oscillations for us like a low-pass filter.
    In my experience with reading these devices with an ADC, you have to do some pretty heavy averaging to get rid of this noise. SInce pH is usually not changing rapidly (is it in your app?) this doesn't pose too much of a problem. An exponentially weighted moving average code is easy to do in spin and does not waste memory by keeping a large array of old data in ram.

    Cheers!
    Paul Rowntree
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2009-03-24 17:42
    Greg,

    From the spec sheet, your part number (M-11-10KTC-AMP-4DY) means the probe has an integral 10kOhm thermistor, and an integral unity gain preamplifier. The spec sheet doesn't indicate what 4DY might be. Any guesses? The option for an integral unity gain pre-amplifier implies that it has low output impedance.

    You said it has two BNC connectors, one for signal and one for power. How did you determine that, and what power is required? More documentation? It is puzzling, because it seems it would require bipolar power for the amplifier, and also a means to read the thermistor, which you would then use for temperature compensation. Two BNC connectors would not be enough.

    The millivolt output of 165 - 30 mV span from pH4 to pH7 does not jive well with 59mV/pH unit. It should be more like a 180 mV span, but at least it is in the right ball park. Can you try it with a pH11 buffer, or a weak alkaline solution?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • dossicdossic Posts: 38
    edited 2009-03-24 18:21
    Hi!

    the 59.16mV/pH value is at 25°C, you need to change it if measuring pH at different temperatures, the thermisor is added, I guess, for reading the actual temperature of the solution and compensating the pH reading by software.
    Moreover, a beta coefficient between 0.85 and 1.05 is always added, for compensating the nernstian deviations of the glass membrane. In fact, pH calibration is usually done with two buffer solutions at 7 and 4 or 7 and 10.
    The high impedance of opamp input is mandatory for pH measurement, since it is a thermodynamic measure and no current should flow in the glass electrode. If input impedance is not correct, severe deviations from Nernstian behavior can occur.

    I would suggest using a JFET voltage follower with dual supply as first stage between glass electrode and ADC.

    Yours carlo
  • Greg LaPollaGreg LaPolla Posts: 323
    edited 2009-03-24 20:45
    Tracy,

    I wasn't sure about the 4DY either. One of the BNC connectors is a coax cable, this one is marked as PH. The other BNC connector has 2 wires (red,white), no markings.

    I called the company today and spoke with there tech department.

    The Coax marked PH is the millivolt reading from the PH sensor. The other connector that I appled power to turns out to be the the thermistor connector.

    The amp is passive and doesn't require any power according to there tech and the thermister should read 10K ad 25 C. So I need to find an ADC that can read +- 414.12.


    Greg
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2009-03-24 21:51
    Greg,

    I don't quite believe that about the "passive" amplifier. My guess would be that there are one or two lithium primary cells potted inside, and those power the amplifier for the expected life of the probe, maybe 3 years. There are some great CMOS op-amps that can run off of a microamp or two.

    What pH do you need to measure?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Greg LaPollaGreg LaPolla Posts: 323
    edited 2009-03-25 00:27
    Tracy,

    I did some more testing, the thermistor works perfectly, but the PH is still way off. I have buffer mixture that will make any water 5.2 PH. I mixed of a little and tried to get a ready and it was still way off. I think I am going to write this sensor off and pick up another.

    I do have a question about the TLC2543. I saw on your website you used this chip. Can this work with the propeller ? if so will it also work for thermocouples? If I can use this chip, I can save a lot of space on my PCB as I have 3 ds2760's.

    Would this chip use the i2c interface?


    I think I am going to opt for a basic PH sensor and build an amplifier. Does the amplifier have to be close to the sensor or can it be on the PCB with everything else?


    Greg
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2009-03-25 17:35
    The TLC2543 is not good with the propeller. Look instead at the TLV2543, with a "V" instead of a "C". Digikey has them in PDIP. It is SPI, not I2C. If you are using surface mount, you have a lot more options. I like the ADS1100 mentioned above, which is a single channel 16 bit converter with a PGA (programmable gain amplifier) built in. It is ratiometric, so it is good for bridge circuits. Microchip has a nice one like it with a built in reference for absolute measurements. Those are in SOT23 surface mount packages and have the I2C interface with 8 different addresses available, so they don't take up much board real estate can can slip in very close to the measurement point.

    A 12 bit converter is not suitable directly for thermocouples, without an amplifier and cold junction compensation. If you want direct to digital conversion of thermocouples, including the cold juction compensation, the MAX6674 or MAX6675 might do what you want.

    The pH probe usually has a coaxial cable and you can put a good amplifier right at the end of the cable. pH probes intrinsically have to be in electrical contact with the measurement point, and interference can enter through that contact. It is one thing to do the measurement in a lab beaker, and quite another in a vat or a lake that has a large physical extent (antenna) and other connections to the outside world.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Greg LaPollaGreg LaPolla Posts: 323
    edited 2009-03-25 17:57
    Actually, I was thinking about switching to a thermistor instead of the thermocouples then I could just use the adc only. I am going to pick up a TLV2543 and give it a shot. Stay tuned . . . I am sure I will have more questions!


    Greg
  • JonathanJonathan Posts: 1,023
    edited 2009-03-25 22:04
    Tracy,

    I'm curious why the TLC isn't good with the Prop. I have used one and it worked fine.

    Thanks!

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • Greg LaPollaGreg LaPolla Posts: 323
    edited 2009-03-26 04:36
    Tracy,

    I ordered 2 TLV2543 from digikey, should have them on Friday. Can I attach a thermistor directly or do I need an opamp ? I have reviewed the spec sheet for the TLV2543 and it appears that it measures voltage not resistance. I am not sure how to get the correct reading from the TLV2543. Can you shed some light or point me in the right direction?


    Greg
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2009-03-26 05:06
    Hi Jonathan,

    The TLC2543 is rated for 4.5 to 5.5 volts, while the TLV2543 is 3 to 3.6 volts. Were you operating it at 5 volts with level shifting for the SPI? Otherwise they are very similar, identical pinouts and logic protocol for the whole TLxx5xx family with 11 external channels.

    The most recent member of the family is the TLV2556, with a wider range of 2.7 to 5.5 volt. It has an extra register to control an external or internal 2.048/4.096 volt reference. But it does not seem to be available in DIP, only soic20 and tssop20. I also like the MAX1239, 12 channels, optionally differential, I2C, reference and sampling options, tssop20.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Greg LaPollaGreg LaPolla Posts: 323
    edited 2009-03-29 00:31
    I got my digikey delivery this morning. 2 TLV2543's.
    I have been working most of the day on this and I can't seem to get anything working, I tried the SPI and I wrote my own driver(attached)

    Using SPI I can get a reading of 4096 from register $0D and nothing else

    Using my driver I can get a reading of 31 out of register $0B

    I have a thermistor attached to AIN0 ($00) I get nothing from this. I have also applied 3.3 volts with 220 ohm resistor to AIN1 ($01) and still get no readings with SPI or my driver.

    Checking Above connections with a multimeter shows that everything is working.

    Anyone have any ideas?
  • Greg LaPollaGreg LaPolla Posts: 323
    edited 2009-03-30 23:24
    I have finally gotten some data from the chip. I had the data in and data out lines crossed. I have set up a voltage divider with my thermistor. The thermistor is 30K at 25C. I have used a 10K resistor in my divider. the voltage supply is 3.3 volts. Measuring the divider vout with a multimeter I get .897 volts. The TLV2543 is reporting back 1117. Not sure why these don't match

    Register B reports 2039 which is Vref+ - Vref- / 2
    Register C reports 0 which is Vref -
    Register D reports 4083 which is vref+


    I think I am missing something here, but not sure what.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2009-03-31 03:38
    Those values are close, with a 3.3 volt reference, 0.897 volts input should give a count of 1113, but you are getting 1117. Given the other results, I might suspect an issue of power supply or reference filtering. Are there good bypass capacitors right next to the chip?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Greg LaPollaGreg LaPolla Posts: 323
    edited 2009-03-31 03:46
    I have a .1 cap on the voltage divider, I don't have one on the pwr to the chip or the ref line. I can put one on there. I am using a bread board and I have a 5v regulator and a 3.3v regulator to power everything.


    Greg

    Post Edited (Greg LaPolla) : 3/31/2009 4:05:00 AM GMT
  • Greg LaPollaGreg LaPolla Posts: 323
    edited 2009-03-31 19:32
    I have made more progress. I think i am at the last hurdle. All reading coming from the TLV2543 are now correct. Adding the caps fixed the problem. However, now when I hold the thermistor in my hand, the Voltage goes down and the resistance goes up. Shouldn't this be reversed?

    
    repeat
        vout := ADC.GetData(0) * 81 + 2 / 100   ' Thermistor pin
        vref := ADC.GetData(13) * 81 + 2 / 100  ' vref + pin
        ohms := 10000 * (vref - vout) / vout
        updateLcd(ohms , vout)
        waitcnt(clkfreq / 5 + cnt)
    
    
    



    I am using the tlv2543 object by Tim Moore from obex.
Sign In or Register to comment.