Trouble with temp probe and accelerometer
The Lazy Destroyer
Posts: 21
Hi guys have a little problem w/ a project I'm finishing up this weekend. I got the ad592 temperature probe (read using RCTIME) from Parallax and it is acting wierd when coded with the Memsic 2125 GMeter. After playing around with the program I'm thinking that timing, even from different subroutines, affects the readings I get. For example, here is the code I use to read the sensor:
I get the proper readings from the code above. When I copy/pasted it into my working project source code I got a very offset number. The main section of the code is:
I started cutting the program down and changing some things around and I came to the conclusion that time, even in a different subroutine, will affect the output of the TempMain subroutine. For example, if I increase or decrease the amount of times that the GForceMain subroutine gets looped, the readings change. The smaller the times the loop gets run, the closer the TempMain subroutine comes to getting an accurate number. If I put "PAUSE 500" before or after the "GOSUB TempMain" line it will affect it significantly, but if I put "PAUSE 50" it will be offset by only 5 or so degrees much less than pausing it for longer amounts of time.
I'm also thinking that the different readings the accelerometer get take either longer or shorter amounts of time to process, because if I run the two subroutines in a 1 to 1 ratio (ei, take out GForceMain's loop), then the readings I get from the accelerometer also change the readings that RCTIME gives me for the 592 probe
LINK: Here's a video example,
here you can see how the gforces are also affecting the temp readings. I'm figuring the more forces the gmeter is seeing, the longer it takes to process maybe. Just assuming from what I've seen with toying w/ the timing.
Is this something that you all have seen before? I've never used RCTIME before, but wouldn't think it would get affected like this.
Even if I go back to the original TempMain subroutine and take out the "Pause 50" I'm getting different readings. I'm thinking if I code everything up for my project to include EVERYTHING I'm using and then re-calibrate the sensor, maybe that will get me proper readings but still doesn't change how the accelerometer is affecting it, since its values will change often.
What else can I do????
Please let me know if there is more info in particular you guys need.
Kal CON 31530'<-consant from calibration program, resistor/capacitor specific Tempf VAR Word DO LOW 8 RCTIME 8, 0, Tempf Tempf = (((Kal/Tempf*10 + (Kal//Tempf*10/Tempf))-273)*18) + 320 DEBUG TAB, DEC2 Tempf/10, ".", DEC1 Tempf, %11011111, 1 PAUSE 50 LOOP
I get the proper readings from the code above. When I copy/pasted it into my working project source code I got a very offset number. The main section of the code is:
Main: GOSUB TempMain FOR Genx = 0 TO 500 GOSUB GForceMain NEXT GOTO Main
I started cutting the program down and changing some things around and I came to the conclusion that time, even in a different subroutine, will affect the output of the TempMain subroutine. For example, if I increase or decrease the amount of times that the GForceMain subroutine gets looped, the readings change. The smaller the times the loop gets run, the closer the TempMain subroutine comes to getting an accurate number. If I put "PAUSE 500" before or after the "GOSUB TempMain" line it will affect it significantly, but if I put "PAUSE 50" it will be offset by only 5 or so degrees much less than pausing it for longer amounts of time.
I'm also thinking that the different readings the accelerometer get take either longer or shorter amounts of time to process, because if I run the two subroutines in a 1 to 1 ratio (ei, take out GForceMain's loop), then the readings I get from the accelerometer also change the readings that RCTIME gives me for the 592 probe
LINK: Here's a video example,
here you can see how the gforces are also affecting the temp readings. I'm figuring the more forces the gmeter is seeing, the longer it takes to process maybe. Just assuming from what I've seen with toying w/ the timing.
Is this something that you all have seen before? I've never used RCTIME before, but wouldn't think it would get affected like this.
Even if I go back to the original TempMain subroutine and take out the "Pause 50" I'm getting different readings. I'm thinking if I code everything up for my project to include EVERYTHING I'm using and then re-calibrate the sensor, maybe that will get me proper readings but still doesn't change how the accelerometer is affecting it, since its values will change often.
What else can I do????
Please let me know if there is more info in particular you guys need.
Comments
The mesmic is a thermal device, and has a thermal output, so why do you have a temp probe? The answer is probably timing. Could you send a complete code file and the schematic? That would help a lot.
When I get back home later tonight I'll try and get the full code and schematic for you guys.
A couple points:
-Changing any of the pause lengths that are in any part of the main routine change the output of the sensor, generally the longer the overall pause the higher the value it gets from RCTIME and it's following calculation. This also includes the GMeters loop.
-Right now everything (Stamp, backlit LCD, clock/EEPROM/compass/GMeter) are all being powered by the demo board, but I haven't had any issues with this other than some flickering on the LCD screen that I figure is just from noise.
-Sensor is calibrated
Just ran this program, the basic one in the Applied Sensors text I got from Parallax:
The last line, "Pause 50". If I run it I get the value 1057, but if I change it to pause for say 750, I get 1041 returned as my value, both run within a minute of each other.
So, looking at the program above instead of the whole code I gave a minute ago... is there a reason this is happening? I thought maybe I'm not giveing it enough time to "settle back down" to read RCTIME but the original code (posted above) only has a 50 for a PAUSE value and it loops constantly. Should I look into something else other than RCTIME? This is just odd.
I was in near the same situation when trying to insert in a project multiple items, some of them working in local continuosly and being interrogated on needing.
the solution in some cases was to switch of temporarily the items not necessary (think of a reading from an ADC 12 or more bit of resolution near a switching regulator for a backligth), i solved this switching off the regulator backlight for the few milliseconds it takes to get the reading properly and safely stored in memory).
Perharps this helps.........
Stefano Caruso
By putting the LOW 8 instruction immediately following the RCTIME command, that allows a big expanse of time for the capacitor to discharge and it shouldn't matter if you substitute 750 for the 50 millisecond PAUSE. Most of the RCTIME programs in Applied Sensors have the LOW rcPin instruction immediately after completion of the RCTIME command.
Your program (and the Applied Sensors example) has the following snippet
There is not enough time after the LOW for the capacitor to discharge completely, particularly when you are using the much faster BS2p. With a original BS2, there was around 300 microseconds, but with the fast BS2p there is only 1/3 of that. The reason the timing in the rest of the program affects it is that the voltage on the capacitor continues to rise after execution of the RCTIME command, so
Another way to fix it would be,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com