i am using a 10kOhm thermistor using the following code wich works fine
/*
ReadThermistorLLAP
Reads the temperature via a Thermistor set up
Switches the LED on when the temperature goes over 20C
Sends the value periodically over the radio in an LLAP message
Thermistor NTCLE100E3103JB0; 10kOhm at 25C or 298.15K, Beta value 3977K
Connections:
Thermistor connected between 5V and Analog 0 (A0)
10kOhm resistor connected between Analog 0 and ground
*/
#include <math.h>
#define deviceID1 'X' // first character of device identifier
#define deviceID2 'X' // second character of device identifier
String hdr = ""; // message header
void setup()
{
pinMode(13, OUTPUT); // initialize pin 13 as digital output (LED)
pinMode(8, OUTPUT); // initialize pin 8 to control the radio
digitalWrite(8, HIGH); // select the radio
Serial.begin(115200); // start the serial port at 115200 baud (correct for XinoRF and RFu, if using XRF + Arduino you might need 9600)
hdr = hdr + "a" + deviceID1 + deviceID2; // message header
Serial.print(hdr + "STARTED");// transmit started packet
}
float Thermistor(int ADCvalue)
{
// calculate the temperature from an ADC value
float T; // temperature
int Beta = 3977; // beta value for the thermistor
float Rtemp = 25.0 + 273.15; // reference temperature (25C)
float Rresi = 90.0; // reference resistance at reference temperature - adjust to calibrate
float Rtherm = (1024.0/ADCvalue - 1)*10000; // value of the resistance of the thermistor
T = Rtemp*Beta/(Beta+Rtemp*(log(Rtherm/Rresi)));
// see http://en.wikipedia.org/wiki/Thermistor for an explanation of the formula
T = T - 273.15; // convert from Kelvin to Celsius
return T;
}
void loop()
{
static char tempbuffer[4]; // to store the ASCII chars for temp
double temp = Thermistor(analogRead(0)); // read sensor and convert to temperature
if (temp < 10) {
digitalWrite(13, HIGH); // turn LED ON
}
else digitalWrite(13, LOW);
dtostrf(temp,4,2,tempbuffer); // convert double to string
Serial.println(hdr + "TMPA" + tempbuffer); // send message
delay(2000);
}
and when i open the serial windows and RF com port i get a good output like so
...TMPA20.86
...TMPA20.86
...TMPA20.86
...TMPA20.86
...TMPA20.86
...TMPA20.86
...TMPA20.86
...TMPA20.86
but once i unplug it from the usb then plug it back into either the same USB socket or a External battery i get a jumbled mess of just random letters and numbers
i have tried reloading and the same