Can you help with this problem with the temperature sensor?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
RoFr_4201436
Level 3
Level 3
50 sign-ins 25 sign-ins 10 replies posted

Hello everyone, i'm trying to run this program, i don't know why, but i can't see none number in relation the temperature sensor. Someone help me!!!

Look at the image:

pastedImage_0.png

I'm trying to do this exercise:

The KIT GROVE temperature sensor is a thermistor (LM358 - a semiconductor

temperature sensitive) that can be used to measure temperature. The range of

The operation of the LM358 is -40 - 125 ° C with a sensitivity of ± 1.5 ° C.

  Read the signal provided by the thermistor using an ADC and use the code below to map the

value in degrees Celsius. Send the result by serial

int an_read;

int VREFplus = 4095; // Voltage value VREF + => 2 ^ n - 1

float temperature;

int B = 3975; // constant B for resistance

// do the Analog Reading here and put the result in an_read

// get the resistance of the sensor

resistance = (float) (VREFplus-an_read) * 10000 / an_read;

// convert to temperature via datasheet

temperature = 1 / (log (resistance / 10000) /B+1/298.15) -273.15;

In the above code, "an_read" is the value read from the ADC and B is a constant obtained from the datasheet of

sensor.

0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

Would you read my post?

printf and float rhapsody (aka, yet another printf and floating topic)

moto

P.S.

> sprintf(strTEMP, "Temperature: %f \n\n", temperature);

< sprintf(strTEMP, "Temperature: %f \r\n", temperature);

View solution in original post

2 Replies
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

Would you read my post?

printf and float rhapsody (aka, yet another printf and floating topic)

moto

P.S.

> sprintf(strTEMP, "Temperature: %f \n\n", temperature);

< sprintf(strTEMP, "Temperature: %f \r\n", temperature);

Thanks Moto

0 Likes