I have connected a KY-028 digital temperature sensor for measurement of body temperature . I have interfaced but I'm not getting proper output even though I adjusted with potentiometer values. it reads the environmental temperature but when I place my hand on thermistor my value is getting decreased. what should I do? how should I rectify this issue? I need this help.
I have connected the LED for external observation.
Thank you.
Here's the code:
int led = 12; // define the LED pin
int digitalPin = 2; // KY-028 digital interface
int analogPin = A0; // KY-028 analog interface
int digitalVal; // digital readings
int v_input; //analog readings
void setup()
{
pinMode(led, OUTPUT);
pinMode(digitalPin, INPUT);
pinMode(analogPin, INPUT);
Serial.begin(9600);
}
void loop()
{
// Read the digital interface
digitalVal = digitalRead(digitalPin);
if(digitalVal == HIGH) // if temperature threshold reached
{
digitalWrite(led, HIGH); // turn ON Arduino's LED
}
else
{
digitalWrite(led, LOW); // turn OFF Arduino's LED
}
Serial.print("Digital Value : ");
Serial.println(digitalVal);
// Read the analog interface
int v_input = analogRead(analogPin);//1024 VALUE
float b = 10000*(1024.0/(float)v_input-1.0);
float c = (1.0/(0.001129148+(0.000234125*log(b)) + 0.0000000876741*log(b)*log(b)*log(b)))-273.15;
//b = b - 273.15;
//b=(b − 32.0) * 5.0/9.0;
//b = (b * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit
Serial.print("temperature in celsius :");
Serial.println(c);
delay(2000);
}
//Temp = log(10000.0*((1024.0/RawADC-1)));
// Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
// Temp = Temp - 273.15; // Convert Kelvin to Celcius
//Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit
Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
In your code can you also print the raw data from the analog input pin?
int led = 12; // define the LED pin
int digitalPin = 2; // KY-028 digital interface
int analogPin = A0; // KY-028 analog interface
int digitalVal; // digital readings
int v_input; //analog readings
void setup()
{
pinMode(led, OUTPUT);
pinMode(digitalPin, INPUT);
pinMode(analogPin, INPUT);
Serial.begin(9600);
}
void loop()
{
// Read the digital interface
digitalVal = digitalRead(digitalPin);
if(digitalVal == HIGH) // if temperature threshold reached
{
digitalWrite(led, HIGH); // turn ON Arduino's LED
}
else
{
digitalWrite(led, LOW); // turn OFF Arduino's LED
}
Serial.print("Digital Value : ");
Serial.println(digitalVal);
// Read the analog interface
int v_input = analogRead(analogPin);//1024 VALUE
float temp = 125.315-0.175529*v_input-2.5;
//float b = 10000*(1024.0/(float)v_input-1.0);
//float c = (1.0/(0.001129148+(0.000234125*log(b)) + 0.0000000876741*log(b)*log(b)*log(b)))-273.15;
//b = b - 273.15;
//b=(b − 32.0) * 5.0/9.0;
//b = (b * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit
Serial.print("temperature in celsius :");
Serial.println(temp);
delay(2000);
@jim-p I connected again today . my values started increasing and i made some changes in program so that it comes with the accurate values when I checked with standard device.