3 Replies Latest reply on Mar 17, 2020 11:31 PM by DheerajK_81

    CY8CPROTO-062-4343W Thermistor strangeness

    AlRo_1301416

      I've been working on a simple demo project, and in order to gather some data I decided to use the attached thermistor. Using the mbed library, I created an AnalogIn on P10_1, and DigitalOut on P10_3 and P10_0 to get power to the circuit. However, the values that I am getting back seem to be incorrect. I measured 1.48V from P10_1 to GND, which should give an AnalogIn value of about 0.45. However, I am getting between 0.68-0.72 for the same range. I actually removed R37 (the zero ohm link from THERM_OUT to P10_2) just in case the impedance of P10_2 was somehow affecting it, but it made no difference.

       

      When I came to post this thread, I noticed another thread that mentioned the thermistor: CY8CPROTO-062-4343W - SPI Flash error without thermistor portion  In that thread, he mentions:

      I'll look into the thermistor pins. I vaguely remember when I was initially

      implementing the board it seemed like they were swapped in the schematic

      after I did some testing with a voltmeter.

      So I thought, maybe they are swapped. So I just flipped the outputs on P10_3 and P10_0. This gave me results which were closer to the correct values, but still out by a fairly big margin. Even ignoring my code to calculate the resistance and then temperature, the AnalogIn values I am getting simply do not seem to match what I am measuring with my multimeter. Is the internal ADC using a different voltage reference than 3.3V? If so, why are P10_3 and P10_0 being used to power the thermistor? This is the only plausible line of thinking I can come up with -- other than I have a faulty board/chip.

       

      To replicate:

      Simply create an AnalogIn(P10_1), DigitalOut(P10_0) and DigitalOut(P10_3). Set P10_3 to 1, and P10_0 to 0. Then read the analog input (and multiply by 3.3 to get actual volts). Compare this to voltage measurements from P10_1 to ground.

       

      Any advice would be greatly appreciated!

        • 1. Re: CY8CPROTO-062-4343W Thermistor strangeness
          DheerajK_81

          Please refer to this tutorial which explains how to interface the thermistor in detail in Mbed ecosystem: https://iotexpert.com/2019/12/09/mouser-psoc-6-wifi-bt-mbed-l4-temperature-thread/

           

          Let me know if you still the same issue.

           

          Regards,

          Dheeraj

          2 of 2 people found this helpful
          • 2. Re: CY8CPROTO-062-4343W Thermistor strangeness
            AlRo_1301416

            So the ref voltage is 1.2V? That's confusing, how is the ADC able to measure up to 3.3V?

            float refVoltage = thermOut.read() * 2.4; // Range of ADC 0->2*Vref
            float refCurrent = refVoltage  / 10000.0; // 10k Reference Resistor
            float thermVoltage = 3.3 - refVoltage;    // Assume supply voltage is 3.3v
            

            I am just confused why they are scaling the input from the ADC by 2.4? That seems to be 2*Vref, but that would imply that it can only measure up to 2.4V, which would be strange for measuring a system that is driven by 3.3V. I guess in this case we can assume the voltage will never go above 2.4V... I just need some clarification on what Vref is, and what mbed is scaling its AnalogIn to.

            • 3. Re: CY8CPROTO-062-4343W Thermistor strangeness
              DheerajK_81

              Please note that when you call read() it calls the HAL layers for the ADC block and we have some default configurations there due to which the range is (0 to 2*Vref) as shown below:

              mbed_adc.PNG

               

              You can refer to the PDL documentation to understand what each of the macros mean.

              sar_ctrl.PNG

               

              We have explained more about the different configurations and how they affect the range in the component datasheet. You can refer that to understand more.

               

              You can then modify the macros as per the requirement to get the desired range in the file "cyhal_adc.c"

               

              Regards,

              Dheeraj

              1 of 1 people found this helpful