6 Replies Latest reply on May 22, 2018 2:34 PM by DaMa_3386091

    Bidirectional Pin for SHT75 Sensor

    DaMa_3386091

      Hi all,

       

      I'm attempting to use a PSOC 5LP to read data from a SHT75 Temperature & Humidity sensor (https://www.sensirion.com/en/environmental-sensors/humidity-sensors/pintype-digital-humidity-sensors/).

       

      In order to read data from the sensor, I need two pins (clock and data). At the moment, I configured my clock pin as a Digital Output (Strong Drive), and my data pin as a Bidirectional Pin (Open Drain Drives Low). The clock pin is working fine with the functions I created, while the data pin is not working as expected: do I need to dynamically change the configuration of the data pin whenever I need to write/read from it? How should I connect the bidirectional pin (pull-up resistor?)?

       

      Thanks,

       

      Davide

        • 1. Re: Bidirectional Pin for SHT75 Sensor
          JoMe_264151

          See datasheet of SHT75:

          To avoid signal contention the microcontroller must  only drive DATA low. An external pull-up resistor

          (e.g. 10 kΩ) is required to pull the signal high – it should be noted that pull-up resistors may be included in I/O circuits of microcontrollers.

           

          So best would be to configure the pin as "Resistive pull up" initial drive high. Then you may write low to the sensor and while written high you may read from the pin.

           

          Happy coding

          Bob

          • 2. Re: Bidirectional Pin for SHT75 Sensor
            DaMa_3386091

            Hi Bob,

             

            thanks for your kind reply.

             

            In the configuration you suggested me, would the data line of the sensor be able to pull the PSoC pin down to 0 when required? As per the datasheet, after a command is sent to the sensor (8 clock pluses with 8 data bits), a ninth clock pulse should be issued and the data line should go down to 0.

             

            Thanks,

             

            Davide

            • 3. Re: Bidirectional Pin for SHT75 Sensor
              JoMe_264151

              would the data line of the sensor be able to pull the PSoC pin down to 0 when required?

              Yes, sure.

               

              Bob

              • 4. Re: Bidirectional Pin for SHT75 Sensor
                DaMa_3386091

                Hi Bob,

                 

                thank you for your answer. I did some tests this morning with the following setup:

                • clock line as output pin - strong drive
                • data line as bidirectional pin, resistive pull up and initial state as HIGH.

                I did some tests looking at the data and clock signals during some basic procedures (start transmission and reset communications), and the signals are as expected. When I send a command to the sensor (start transmission procedure + command sent as per datasheet specs), I expect the sensor to push the data line low after the ninth clock pulse. But what happens, as you can see from the attached image, is that the data line goes down after receiving the 8 bits of the command, but then at the clock pulse, goes up (not to Vdd, but a little lower): do you have any suggestions about what could cause this problem?

                 

                Thank you very much in advance,

                 

                Davide

                 

                IMG_20180522_115700.jpg

                • 5. Re: Bidirectional Pin for SHT75 Sensor
                  JoMe_264151

                  According to the datasheet the data line should not stay low, but will be low after the measure is done (80ms).

                   

                  Bob

                  • 6. Re: Bidirectional Pin for SHT75 Sensor
                    DaMa_3386091

                    Yes, it will be low after the measurement is complete. But according to the datasheet it should be low also at the end of the command for the acknowledgment bit, as visible in the attached image.

                     

                    Schermata 2018-05-22 alle 23.32.28.png