rcTime with the javelin and AD592 temp sensor
I have this program running
import stamp.core.*;
public class Temperature {
· static int dischargeTime;
· static int chargeTime;
public static void main() {
while(true){
· CPU.writePin(CPU.pins[noparse][[/noparse]8],false);
· CPU.delay(10);
· dischargeTime = CPU.rcTime(32767,CPU.pins[noparse][[/noparse]8],true);
· System.out.println("RC rise time is: ");
· System.out.println(String.valueOf(dischargeTime));
· CPU.delay(10000);
· }
}
}
with an output of:
RC rise time is:
222
RC rise time is:
222
RC rise time is:
221.....
now i am lost a to what this number means interms of temperature and how to convert and calibrate the temperature sensor program wise, i have looked at the documentation and the applied sesnors chapter on this issue, but i see no examples with the javelin stamp. i'm not exactly the greatest in interpreting the bsaic stamp code to javelin code. so if you have any code examples you could share using this device to set it up right, it would be much appreciated since this is one step of many for my project i'm constructing.
import stamp.core.*;
public class Temperature {
· static int dischargeTime;
· static int chargeTime;
public static void main() {
while(true){
· CPU.writePin(CPU.pins[noparse][[/noparse]8],false);
· CPU.delay(10);
· dischargeTime = CPU.rcTime(32767,CPU.pins[noparse][[/noparse]8],true);
· System.out.println("RC rise time is: ");
· System.out.println(String.valueOf(dischargeTime));
· CPU.delay(10000);
· }
}
}
with an output of:
RC rise time is:
222
RC rise time is:
222
RC rise time is:
221.....
now i am lost a to what this number means interms of temperature and how to convert and calibrate the temperature sensor program wise, i have looked at the documentation and the applied sesnors chapter on this issue, but i see no examples with the javelin stamp. i'm not exactly the greatest in interpreting the bsaic stamp code to javelin code. so if you have any code examples you could share using this device to set it up right, it would be much appreciated since this is one step of many for my project i'm constructing.
Comments
I calculated the constant for C=0.1uF
No fractions are calculated for the temperature so resolution is 1 degree celsius or 1 kelvin.
regards peter
Requires the Format class, UnsignedIntMath class.
http://tech.groups.yahoo.com/group/JavelinCode/files/Javelin%20Stamp%20IDE/lib/stamp/util/text/
http://tech.groups.yahoo.com/group/JavelinCode/files/Javelin%20Stamp%20IDE/lib/stamp/math/
regards peter
It is stored in lib/stamp/peripheral/sensor/temperature/AD592 folder
This class limits the resolution to 0.1 Kelvin units to prevent overflow
and to have a large celsius range (-273.2 to +3003.5)
regards peter
Post Edited (Peter Verkaik) : 9/29/2006 10:19:48 PM GMT
I measured at a measured 108.3 Farenheit:
RCTIME = 208
kelvin = 138.47
celcius = - 135.47
with those values calculating the constant reaches me to a value of 65601.12 which is larger than an integer type. an assumably this value goes in place of the 15300. is there something i'm missing to get the value to read atleast to the correct degree not 180 degrees celcius off.
also if this means anything the vDD is 4.98 and Vcap is 4.08 and its the .22uF rated.
Post Edited (James) : 10/2/2006 5:13:59 PM GMT
The calculation for the constant is based on a 0.1uF capacitor.
If you use a 0.22uF capacitor then RCTIME would be (0.22/0.1)*105 = 231
which is close to your 208. Use a 0.1uF capacitor, not a 0.22uF as in the pbasic
examples.
For the AD592.java class:
Since 0.1uF gives a resolution step of +-2.5 kelvin, I recalculated the constant
for a 2.2uF capacitor. This gives a resolution step of +-0.12 kelvin. (at 273.2K)
The AD592 classes must be stored in a folder AD592 in
folder <installpath>\lib\stamp\peripheral\sensor\temperature
where installpath is your ide·installation path
(default that is c:\program files\parallax inc\javelin stamp ide\)
Note that case is important! Use small and capital letters as above.
I attached a highres version for use with a 0.22uF capacitor.
regards peter
Post Edited (Peter Verkaik) : 10/2/2006 6:05:05 PM GMT