Tracy, math question
Archiver
Posts: 46,084
Hi Tracy, All,
I am making a hot tub controller, using an LM34 sensor, a LTC1298 ADC and a
B2sx. I need help (as usual!) with the math. I want to be able to display
the temp on an LCD, so I need to convert the ADC output to degrees. How do I
do this using "stamp math"?
Let's say my tub is at 78 degrees, input is 0.788mV. So the ADC yields
.788/5.0*4095= 645. How can I convert this?
Thanks!
Jonathan
I am making a hot tub controller, using an LM34 sensor, a LTC1298 ADC and a
B2sx. I need help (as usual!) with the math. I want to be able to display
the temp on an LCD, so I need to convert the ADC output to degrees. How do I
do this using "stamp math"?
Let's say my tub is at 78 degrees, input is 0.788mV. So the ADC yields
.788/5.0*4095= 645. How can I convert this?
Thanks!
Jonathan
Comments
>
>I am making a hot tub controller, using an LM34 sensor, a LTC1298 ADC and a
>B2sx. I need help (as usual!) with the math. I want to be able to display
>the temp on an LCD, so I need to convert the ADC output to degrees. How do I
>do this using "stamp math"?
>
>Let's say my tub is at 78 degrees, input is 0.788mV. So the ADC yields
>.788/5.0*4095= 645. How can I convert this?
>
>Thanks!
>
>Jonathan
ADCresult=645
degF = ADCresult */ 313
debug "degrees F = ", dec degF/10,".".dec1 degF
' displays 78.8
OR, for a little better precision in the 1/10ths digit:
ADCresult=645
degF = ADCresult */ 3125 + 5 / 10 ' with roundoff
debug "degrees F = ", dec degF/10,".".dec1 degF
' displays 78.7
OR, another way, using ** instead of */
ADCresult=645
degF = ADCresult ** 14464 +ADCresult
debug "degrees F = ", dec degF/10,".".dec1 degF
' displays 78.7
The factors to use in */ come from the ratio, 5000/4096=1.2207.
You multiply that times 256 to get, 1.2207*256 = 312.5. That is the
factor. Notice that 3125/2560 = 5000/4096, they are the same ratio.
The Stamp */ command automatically does the division by 256.
-- Tracy
I found your web site, - very nice!
I want to put together a soil moisture sensor, and I was wondering if
you sell your ac - dc conditioner/ amplifier, or whatever it is exactly?
I could not find this on your web page. Thanks.
Original Message
From: "Tracy Allen" <tracy@e...>
To: <basicstamps@yahoogroups.com>
Sent: Thursday, November 21, 2002 11:10 AM
Subject: Re: [noparse][[/noparse]basicstamps] Tracy, math question
> >Hi Tracy, All,
> >
> >I am making a hot tub controller, using an LM34 sensor, a LTC1298 ADC and
a
> >B2sx. I need help (as usual!) with the math. I want to be able to display
> >the temp on an LCD, so I need to convert the ADC output to degrees. How
do I
> >do this using "stamp math"?
> >
> >Let's say my tub is at 78 degrees, input is 0.788mV. So the ADC yields
> >.788/5.0*4095= 645. How can I convert this?
> >
> >Thanks!
> >
> >Jonathan
>
> ADCresult=645
> degF = ADCresult */ 313
> debug "degrees F = ", dec degF/10,".".dec1 degF
> ' displays 78.8
>
> OR, for a little better precision in the 1/10ths digit:
>
> ADCresult=645
> degF = ADCresult */ 3125 + 5 / 10 ' with roundoff
> debug "degrees F = ", dec degF/10,".".dec1 degF
> ' displays 78.7
>
> OR, another way, using ** instead of */
>
> ADCresult=645
> degF = ADCresult ** 14464 +ADCresult
> debug "degrees F = ", dec degF/10,".".dec1 degF
> ' displays 78.7
>
> The factors to use in */ come from the ratio, 5000/4096=1.2207.
> You multiply that times 256 to get, 1.2207*256 = 312.5. That is the
> factor. Notice that 3125/2560 = 5000/4096, they are the same ratio.
> The Stamp */ command automatically does the division by 256.
>
> -- Tracy
>
>
> 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/
>
>
>
Sure wish I wasn't so math impaired. Thanks a ton for the help. I have more
questions though.
I just changed the supply voltage to the LM34, which changed my output. The
ADC now reads 715 at 104 degrees. Still using a 5.0 supply to the ADC. Since
I may have to change power supplies again, and I expect that the added wire
length to the sensor when it is actually installed is also going to change
the output, how does someone as math challenged as I am recalibrate this
system? Aside from bothering you ;-)
Also, I find the LM34 doesn't really do 10mV/degree as advertised. I am
going to test it to establish what it really does.
Thanks again,
Jonathan
Original Message
From: "Tracy Allen" <tracy@e...>
To: <basicstamps@yahoogroups.com>
Sent: Thursday, November 21, 2002 9:10 AM
Subject: Re: [noparse][[/noparse]basicstamps] Tracy, math question
> >Hi Tracy, All,
> >
> >I am making a hot tub controller, using an LM34 sensor, a LTC1298 ADC and
a
> >B2sx. I need help (as usual!) with the math. I want to be able to display
> >the temp on an LCD, so I need to convert the ADC output to degrees. How
do I
> >do this using "stamp math"?
> >
> >Let's say my tub is at 78 degrees, input is 0.788mV. So the ADC yields
> >.788/5.0*4095= 645. How can I convert this?
> >
> >Thanks!
> >
> >Jonathan
>
> ADCresult=645
> degF = ADCresult */ 313
> debug "degrees F = ", dec degF/10,".".dec1 degF
> ' displays 78.8
>
> OR, for a little better precision in the 1/10ths digit:
>
> ADCresult=645
> degF = ADCresult */ 3125 + 5 / 10 ' with roundoff
> debug "degrees F = ", dec degF/10,".".dec1 degF
> ' displays 78.7
>
> OR, another way, using ** instead of */
>
> ADCresult=645
> degF = ADCresult ** 14464 +ADCresult
> debug "degrees F = ", dec degF/10,".".dec1 degF
> ' displays 78.7
>
> The factors to use in */ come from the ratio, 5000/4096=1.2207.
> You multiply that times 256 to get, 1.2207*256 = 312.5. That is the
> factor. Notice that 3125/2560 = 5000/4096, they are the same ratio.
> The Stamp */ command automatically does the division by 256.
>
> -- Tracy
>
>
> 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/
>
>
>
>
>ADC now reads 715 at 104 degrees. Still using a 5.0 supply to the ADC. Since
>I may have to change power supplies again, and I expect that the added wire
>length to the sensor when it is actually installed is also going to change
>the output, how does someone as math challenged as I am recalibrate this
>system? Aside from bothering you ;-)
>
>Also, I find the LM34 doesn't really do 10mV/degree as advertised. I am
>going to test it to establish what it really does.
Hi Jonathan,
Changing the power supply should _not_ affect the signal voltage.
LM34 output should be 10 millivolts per deg. F,, so long as the power
supply is anywhere within the allowed range. If not, something is
wrong with the wiring.
I have been using LM34 for years, and have always found them to be
very close to spec. Even on a 100 foot cable, the error due to
ground loop current is less than 0.1 degree F, because the supply
current is only 70 microamps. Are you checking it with a voltmeter?
Look for a bad ground connection. Also, the output signal can
oscillate wildly if the chip has to drive a cable in the range of
inches to feet. That will make the readings appear whacko. You can
isolate the chip from the cable with a 3kohm resistor or with an RC
snubber.
regards,
-- Tracy
>
>Thanks again,
>
>Jonathan
>
>
>
Original Message
>From: "Tracy Allen" <tracy@e...>
>To: <basicstamps@yahoogroups.com>
>Sent: Thursday, November 21, 2002 9:10 AM
>Subject: Re: [noparse][[/noparse]basicstamps] Tracy, math question
>
>
> > >Hi Tracy, All,
> > >
> > >I am making a hot tub controller, using an LM34 sensor, a LTC1298 ADC and
>a
> > >B2sx. I need help (as usual!) with the math. I want to be able to display
> > >the temp on an LCD, so I need to convert the ADC output to degrees. How
>do I
> > >do this using "stamp math"?
> > >
> > >Let's say my tub is at 78 degrees, input is 0.788mV. So the ADC yields
> > >.788/5.0*4095= 645. How can I convert this?
> > >
> > >Thanks!
> > >
> > >Jonathan
> >
> > ADCresult=645
> > degF = ADCresult */ 313
> > debug "degrees F = ", dec degF/10,".".dec1 degF
> > ' displays 78.8
> >
> > OR, for a little better precision in the 1/10ths digit:
> >
> > ADCresult=645
> > degF = ADCresult */ 3125 + 5 / 10 ' with roundoff
> > debug "degrees F = ", dec degF/10,".".dec1 degF
> > ' displays 78.7
> >
> > OR, another way, using ** instead of */
> >
> > ADCresult=645
> > degF = ADCresult ** 14464 +ADCresult
> > debug "degrees F = ", dec degF/10,".".dec1 degF
> > ' displays 78.7
> >
> > The factors to use in */ come from the ratio, 5000/4096=1.2207.
> > You multiply that times 256 to get, 1.2207*256 = 312.5. That is the
> > factor. Notice that 3125/2560 = 5000/4096, they are the same ratio.
> > The Stamp */ command automatically does the division by 256.
> >
> > -- Tracy
> >
> >
> > 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/
> >
> >
> >
> >
>
>
>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/
Could you elaborate on the 3k isolation resistor and the RC snubber
for the LM34.
Thanks,
Marylou
___________________________
>
> Hi Jonathan,
>
> Changing the power supply should _not_ affect the signal voltage.
> LM34 output should be 10 millivolts per deg. F,, so long as the
power
> supply is anywhere within the allowed range. If not, something is
> wrong with the wiring.
>
> I have been using LM34 for years, and have always found them to be
> very close to spec. Even on a 100 foot cable, the error due to
> ground loop current is less than 0.1 degree F, because the supply
> current is only 70 microamps. Are you checking it with a
voltmeter?
> Look for a bad ground connection. Also, the output signal can
> oscillate wildly if the chip has to drive a cable in the range of
> inches to feet. That will make the readings appear whacko. You
can
> isolate the chip from the cable with a 3kohm resistor or with an RC
> snubber.
>
> regards,
> -- Tracy
> >
> >
> >To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@y...
> >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/
>
>Could you elaborate on the 3k isolation resistor and the RC snubber
>for the LM34.
>
>Thanks,
>Marylou
>___________________________
view with monospace font
--- isolation resistor ---
;---
+6 volts
|
cable 3 kohm |
signal ---/\/\
| LM34
common
|
`---
The resistor has to go right next to the LM34, not at the far end of
the cable! There is more on construction of cables at
<http://www.emesystems.com/BS2index.htm>
--- snubber ---
+6 volts
|
signal
o--| LM34
;--||--/\/\--' |
| 1uf 100 |
common -o
|
X7R
OR (this is the one I usually use)
+6 volts
|
signal ----;
/\/\---| LM34
=== 390 |
| 1uf |
common -o--'
|
I usually put a resistor (~390 ohm) in series with the +5 volt lead
also when it is cable mounted, because sooner or later someone is
going to hook it up backwards.
showing how to make the LM34/35 cable - or you can even purchase pre-made
ones from there. The site may be plain looking but its a veritable treasure
trove of information! Wolf in sheep's clothing so to speak [noparse]:D[/noparse]
Original Message
From: "astumpf999" <astumpf999@y...>
To: <basicstamps@yahoogroups.com>
Sent: Friday, November 22, 2002 9:49 AM
Subject: [noparse][[/noparse]basicstamps] Re: Tracy, math question
> Tracy,
>
> Could you elaborate on the 3k isolation resistor and the RC snubber
> for the LM34.
>
> Thanks,
> Marylou
> ___________________________
> >
> > Hi Jonathan,
> >
> > Changing the power supply should _not_ affect the signal voltage.
> > LM34 output should be 10 millivolts per deg. F,, so long as the
> power
> > supply is anywhere within the allowed range. If not, something is
> > wrong with the wiring.
> >
> > I have been using LM34 for years, and have always found them to be
> > very close to spec. Even on a 100 foot cable, the error due to
> > ground loop current is less than 0.1 degree F, because the supply
> > current is only 70 microamps. Are you checking it with a
> voltmeter?
> > Look for a bad ground connection. Also, the output signal can
> > oscillate wildly if the chip has to drive a cable in the range of
> > inches to feet. That will make the readings appear whacko. You
> can
> > isolate the chip from the cable with a 3kohm resistor or with an RC
> > snubber.
> >
> > regards,
> > -- Tracy
>
> > >
> > >
> > >To UNSUBSCRIBE, just send mail to:
> > > basicstamps-unsubscribe@y...
> > >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/
>
>
> 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/
>
>
What is the address?
[noparse][[/noparse]Non-text portions of this message have been removed]
>
>What is the address?
As to my sight, not everything you hear is true! I definitely need
Dr. Dean reading glasses!
but as to the web site URL:
http://www.emesystems.com
enjoy!
- Tracy