2 Replies Latest reply on May 27, 2019 5:53 PM by RoFr_4201436

    Can you help with this problem with the temperature sensor?

    RoFr_4201436

      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:

      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.