Input data to LTC1298
Archiver
Posts: 46,084
Hello Stampers,
my project requires pH measurement of water to the PC via a BS2, I have
aquired a pH electrode and the LTC1298 ADC for the purpose. I have
completed the tutorial on the LTC and now I am trying to decide how these
will go together...Obviously I am looking at the analog + and - inputs on
the 1298 for connecting my pH electrode. I am assuming that from this
connection the ADC will respond with a value the stamp can show me via the
debug screen.
Also the sample code, to the best of my ability to judge, seems to be
"dummy code" that will demonstrate functionality for those who dont have a
analog signal handy....I cant really determine if the changing values were
just for show or significant.
Anyways, I have tried poking around in the code some ( which I understand
very little ) and trying some different circuit ideas...I dont think I
have hurt anything yet...( It still works the same when returned to the
original circuit/code.
Can someone help me read the data from my electrode, at this point Im not
sure if the circuit, code or both, need to change.
Here is the sample code from the tutorial
CS con 0 ' Chip select; 0 = active
CLK con 1 ' Clock to ADC; out on rising, in on falling edge.
DIO_n con 2 ' Data I/O pin _number_.
config var nib ' Configuration bits for ADC.
AD var word ' Variable to hold 12-bit AD result.
startB var config.bit0 ' Start bit for comm with ADC.
sglDif var config.bit0 ' Single-ended or differential mode.
oddSign var config.bit1 ' Channel selection.
msbf var config.bit3 ' Output 0s after data xfer complete.
high CS ' Deactivate ADC to begin.
high DIO_n ' Set data pin for first start bit.
again: ' Main loop.
for oddSign = 0 to 1 ' Toggle between input channels.
gosub convert ' Get data from ADC.
debug "channel ",DEC oddSign, ": ",DEC AD,cr ' Display data.
pause 500 ' Wait a half second.
next ' Change channels.
goto again ' Endless loop.
convert:
config = config | %1011 ' Set all bits except oddSign.
low CS ' Activate the ADC.
shiftout DIO_n,CLK,lsbfirst,[noparse][[/noparse]config\4] ' Send config bits.
shiftin DIO_n,CLK,msbpost,[noparse][[/noparse]AD\12] ' Get data bits.
high CS ' Deactivate the ADC.
return ' Return to program.
Thanks
Dave
my project requires pH measurement of water to the PC via a BS2, I have
aquired a pH electrode and the LTC1298 ADC for the purpose. I have
completed the tutorial on the LTC and now I am trying to decide how these
will go together...Obviously I am looking at the analog + and - inputs on
the 1298 for connecting my pH electrode. I am assuming that from this
connection the ADC will respond with a value the stamp can show me via the
debug screen.
Also the sample code, to the best of my ability to judge, seems to be
"dummy code" that will demonstrate functionality for those who dont have a
analog signal handy....I cant really determine if the changing values were
just for show or significant.
Anyways, I have tried poking around in the code some ( which I understand
very little ) and trying some different circuit ideas...I dont think I
have hurt anything yet...( It still works the same when returned to the
original circuit/code.
Can someone help me read the data from my electrode, at this point Im not
sure if the circuit, code or both, need to change.
Here is the sample code from the tutorial
CS con 0 ' Chip select; 0 = active
CLK con 1 ' Clock to ADC; out on rising, in on falling edge.
DIO_n con 2 ' Data I/O pin _number_.
config var nib ' Configuration bits for ADC.
AD var word ' Variable to hold 12-bit AD result.
startB var config.bit0 ' Start bit for comm with ADC.
sglDif var config.bit0 ' Single-ended or differential mode.
oddSign var config.bit1 ' Channel selection.
msbf var config.bit3 ' Output 0s after data xfer complete.
high CS ' Deactivate ADC to begin.
high DIO_n ' Set data pin for first start bit.
again: ' Main loop.
for oddSign = 0 to 1 ' Toggle between input channels.
gosub convert ' Get data from ADC.
debug "channel ",DEC oddSign, ": ",DEC AD,cr ' Display data.
pause 500 ' Wait a half second.
next ' Change channels.
goto again ' Endless loop.
convert:
config = config | %1011 ' Set all bits except oddSign.
low CS ' Activate the ADC.
shiftout DIO_n,CLK,lsbfirst,[noparse][[/noparse]config\4] ' Send config bits.
shiftin DIO_n,CLK,msbpost,[noparse][[/noparse]AD\12] ' Get data bits.
high CS ' Deactivate the ADC.
return ' Return to program.
Thanks
Dave
Comments
Is your pH device a 2-wire or 3-wire device?
Sid
The LTC1298 is capable of processing one differential
or two single-ended inputs on pins 2 and 3.
Differential treats pins 2 and 3 as + and - signals;
it is a good choice for finer granularity or for
accuracy over longer cable runs.
Single-ended treats pins 2 and 3 as separate inputs,
channel 0 and channel 1, and compares them to
reference ground on pin 4. This is ideal when the
equipment is relatively close to the chip.
Your code uses single-ended inputs with oddSign
selecting channel 0 or 1 in turn. See the source
document for an explanation of which config bytes
matter if you want to use differential.
Bob Pence
--- samhell@s... wrote:
> Hello Stampers,
>
> my project requires pH measurement of water to the
> PC via a BS2, I have
> aquired a pH electrode and the LTC1298 ADC for the
> purpose. I have
> completed the tutorial on the LTC and now I am
> trying to decide how these
> will go together...Obviously I am looking at the
> analog + and - inputs on
> the 1298 for connecting my pH electrode. I am
> assuming that from this
> connection the ADC will respond with a value the
> stamp can show me via the
> debug screen.
>
> Also the sample code, to the best of my ability to
> judge, seems to be
> "dummy code" that will demonstrate functionality
> for those who dont have a
> analog signal handy....I cant really determine if
> the changing values were
> just for show or significant.
>
> Anyways, I have tried poking around in the code
> some ( which I understand
> very little ) and trying some different circuit
> ideas...I dont think I
> have hurt anything yet...( It still works the same
> when returned to the
> original circuit/code.
>
> Can someone help me read the data from my electrode,
> at this point Im not
> sure if the circuit, code or both, need to change.
>
> Here is the sample code from the tutorial
>
> CS con 0 ' Chip select; 0 = active
> CLK con 1 ' Clock to ADC; out on rising, in on
> falling edge.
> DIO_n con 2 ' Data I/O pin _number_.
> config var nib ' Configuration bits for ADC.
> AD var word ' Variable to hold 12-bit AD result.
>
> startB var config.bit0 ' Start bit for comm with
> ADC.
> sglDif var config.bit0 ' Single-ended or
> differential mode.
> oddSign var config.bit1 ' Channel selection.
> msbf var config.bit3 ' Output 0s after data xfer
> complete.
> high CS ' Deactivate ADC to begin.
> high DIO_n ' Set data pin for first start bit.
> again: ' Main loop.
> for oddSign = 0 to 1 ' Toggle between input
> channels.
> gosub convert ' Get data from ADC.
> debug "channel ",DEC oddSign, ": ",DEC AD,cr '
> Display data.
>
> pause 500 ' Wait a half second.
> next ' Change channels.
> goto again ' Endless loop.
> convert:
> config = config | %1011 ' Set all bits except
> oddSign.
> low CS ' Activate the ADC.
> shiftout DIO_n,CLK,lsbfirst,[noparse][[/noparse]config\4] ' Send config
> bits.
> shiftin DIO_n,CLK,msbpost,[noparse][[/noparse]AD\12] ' Get data bits.
> high CS ' Deactivate the ADC.
> return ' Return to program.
>
>
> Thanks
>
> Dave
>
>
> 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.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
>
>my project requires pH measurement of water to the PC via a BS2, I have
>aquired a pH electrode and the LTC1298 ADC for the purpose. I have
>completed the tutorial on the LTC and now I am trying to decide how these
>will go together...Obviously I am looking at the analog + and - inputs on
>the 1298 for connecting my pH electrode.
Hi Dave,
pH electrodes are like little batteries. The full scale output is
about +/- 0.4 volts for the full +/- 7 pH range. If you want to
cover both acid and base, you will need the converter to respond to
both + and - voltages.
The kicker is that the output impedance of pH electrodes is extremely
high. They act like a little battery, but with a 10 to 50 megaohm
resistor in series. The voltmeter that measures the output of a pH
electrode has to have extremely high input impedance, 1 teraohm or
more. Even many digital multimeters, which have 10 or 20 megaohms of
input resistance, will load down a pH electrode and give a reading
that is much lower than it should be.
While the LTC1298 has high impedance inputs, they recommend using a
source resistance of 1 kohm or less.That is a long way below 10
megaohms. It might be possible to make it work by putting a
capacitor across the pH output, to absorb the charge that the LTC1298
kicks out when it makes each reading. But that current would have to
settle out through the pH electrode, which would mean a long settling
time between readings, and a shortened lifetime for the pH electrode
itself.
The usual approach to pH electrodes is to amplify and buffer the
signal, with an MOS or CMOS input operational amplifier. There is an
example circuit in the CMOS cookbook, if you can get your hands on a
copy of that.
-- regards,
Tracy Allen
electronically monitored ecosystems
mailto:tracy@e...
http://www.emesystems.com
It is a 2 wire device, connected via a BNC connector......it is the
"economy electrode" at http://www.appliedanalytical.com/
I have played around with it with a meter , and discovered that, like Tracy
said, it outputs both + and - values depending on the fluid its soaked
it....( ie. acidic CocaCola....or something alkaline like Texas tap water )
Tracy,
in my searching, I stumbled across this page...to me it sortof descibes
the type of of amp circuit that may help me....
http://seniord.ee.iastate.edu/may9918/design_review.html ...but just for my
knowledge.....you're saying that because of the impedence,
I must amplify and buffer the signal before the LTC1298 will respond with
useful data? I have a few questions ( If you dont mind )
1. would another ADC give better results? ( ie a MAX1287 or some other
part?_)
2. do the pH mini testers that are commercially available, use op-amp
circuitry to alleviate the problems Im having?
3. I also would like to add a disolved solids meter (ppm) to measure the
consumption of nutrients by plants....has anyone had any experience with
these sensors? would they seem to be "easy" sensors like the DS1620 or
AD590 or more like what Im fighting now?
4. heres a really dumb question....... what exactly is the data the goes
acrosss the debug screen at the conclusion of the LTC1298 APP kit? The
comments say "sampling of channel 1 and 2" it makes plently of stuff even
though no inputs are connected.....
Thanks for your help everyone
Dave
////////////////////
Is your pH device a 2-wire or 3-wire device?
Sid
/////////////////////////
pH electrodes are like little batteries. The full scale output is
about +/- 0.4 volts for the full +/- 7 pH range. If you want to
cover both acid and base, you will need the converter to respond to
both + and - voltages.
> The kicker is that the output impedance of pH electrodes is extremely
> high. They act like a little battery, but with a 10 to 50 megaohm
> resistor in series. The voltmeter that measures the output of a pH
> electrode has to have extremely high input impedance, 1 teraohm or
> more. Even many digital multimeters, which have 10 or 20 megaohms of
> input resistance, will load down a pH electrode and give a reading
> that is much lower than it should be.
>
> While the LTC1298 has high impedance inputs, they recommend using a
> source resistance of 1 kohm or less.That is a long way below 10
> megaohms. It might be possible to make it work by putting a
> capacitor across the pH output, to absorb the charge that the LTC1298
> kicks out when it makes each reading. But that current would have to
> settle out through the pH electrode, which would mean a long settling
> time between readings, and a shortened lifetime for the pH electrode
> itself.
>
> The usual approach to pH electrodes is to amplify and buffer the
> signal, with an MOS or CMOS input operational amplifier. There is an
> example circuit in the CMOS cookbook, if you can get your hands on a
> copy of that.
>"economy electrode" at http://www.appliedanalytical.com/
>I have played around with it with a meter , and discovered that, like Tracy
>said, it outputs both + and - values depending on the fluid its soaked
>it....( ie. acidic CocaCola....or something alkaline like Texas tap water )
>
>
>Tracy,
>
>in my searching, I stumbled across this page...to me it sortof descibes
>the type of of amp circuit that may help me....
>http://seniord.ee.iastate.edu/may9918/design_review.html
> ...but just for my
>knowledge.....you're saying that because of the impedence,
>I must amplify and buffer the signal before the LTC1298 will respond with
>useful data? I have a few questions ( If you dont mind )
The amplifier is really essential to match the impedance of the pH probe.
>1. would another ADC give better results? ( ie a MAX1287 or some other
>part?_)
No, they are all about the same. The pH electrode is exceptional in
its need for a high input impedance. In a good pH electrode
amplifier, the input pin of the operational amplifier is not soldered
to a circuit board, but instead is lifted up off of the board and
soldered directly to the center pin of the BNC connector. This is so
as not to degrade the impedance.
>2. do the pH mini testers that are commercially available, use op-amp
>circuitry to alleviate the problems Im having?
Probably so. This amplifier is not an expensive circuit. It should
not cost more than a couple of dollars if you build it yourself.
>3. I also would like to add a disolved solids meter (ppm) to measure the
>consumption of nutrients by plants....has anyone had any experience with
>these sensors? would they seem to be "easy" sensors like the DS1620 or
>AD590 or more like what Im fighting now?
I am not sure what sensor you mean. Turbidity? Have you looked at
the Vernier site? Very nice people.
http://www.vernier.com/probes/
>4. heres a really dumb question....... what exactly is the data the goes
>acrosss the debug screen at the conclusion of the LTC1298 APP kit? The
>comments say "sampling of channel 1 and 2" it makes plently of stuff even
>though no inputs are connected....
The ADC reads whatever it finds at the inputs, and if nothing is
attached the inputs "float" to voltage levels that depend on things
like the position of your hand and the leakage paths to nearby
voltages. If you pin those inputs to ground or to +5 volts you
should see them respond instantly. Then when you detach them and let
them "float" again, they will drift up an down with no apparent
pattern.