Shop OBEX P1 Docs P2 Docs Learn Events
Sht11 config issue — Parallax Forums

Sht11 config issue

I'm trying to use an SHT11 with a prop mini and sensirion_full code from the object exchange. Both my temp and Rh are reading high (10+ deg temp and 30+% Rh). The code seems optimized for a 3.3V circuit but I am using a 5V circuit. I changed the voltage call out in the SHT config line to 50, but that didn't seem to affect anything. I did try bringing the voltage down to 3.3V and managed to get an acceptable temp reading but the Rh reading was still way high. I think I am missing some other variables that need to be changed, but I don't understand the code enough to know which ones. I was going to try Thomas Allen's sensirion_integer code since it looks simpler but the notes say that it assumes 3.3V and I didn't see where it change that. Can anybody point me to what I need to change to use this in a 5V circuit?

Comments

  • If you haven't done so already, try adding a capacitor (0.1µF) across the sensor power supply. Is the sensor mounted out away from the Propeller? If so, it needs a stronger pullup on the data line, and a weak pulldown on the clock line.

    There is not much difference between operating on 3.3V vs 5V. It only affects the temperature offset. In sensirion_integer, you will see constants defined at the top.
      T_OFFSET_5V0 = 4000
      T_OFFSET_3V3 = 3964
      T_OFFSET_3V0 = 3960
    
      T_OFFSET = T_OFFSET_3V3       ' <---- simply change this to the 5V0 value.
    
  • I haven't tried the capacitor yet. The sensor is about an inch from the Propeller. What is your definition of a stronger pullup resistor, more or less resistance?
  • Hmm, one inch shouldn't be a problem, but do try a 0.1µF capacitor really close to the chip. If it is mounted like the DIP module that Parallax used to sell or one of Andrew's twigs, it will already have a capacitor on board. A 3.3kΩ pullup should be fine. Also include a 10kΩ to 100kΩ pulldown on the clock line. Most of the time it will work without that, but occasionally it will fail to initialize properly if the power comes up dirty. The SHT11 protocol is sort of like i2c, but not, one thing is that the clock rests low instead of high.
  • Grant, did you get this figured out? I will be updating some code on an SHT15 based project I made this week and can play with some of the config settings to try and replicate your issue.
  • I was unable to get the sensirion_integer code to output in Fahrenheit, so I went back to working with the sensirion_full code. I ended up finding multiple issues. There are multiple places in the code where the voltage config is set, If you don't change them all to the same your readings will jump around. The code was originally set for 3.3V. This causes a conflict with the math from the SHT11 look up chart for d1 and d2. The chart does not have a value for using 3.3V. It moves in 0.5V steps from 2.5v to 5V. The actual voltage, the config voltage, and the math values all need to agree. To top it off your independent reference needs to be accurate. I had been using a home weather station as a reference when I noticed that it was reading low during a rainstorm. I bought a couple of small temp and humidity meters at HD and checked them all against a calibrated source I have at my day job. My original reference was way low which was part of the reason my readings were high. I'm now working through different voltage and hardware configurations and running long term drift checks to see what config will give the best accuracy.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2020-07-15 20:03
    Don’t worry too much about the voltage dependence. It only affects the temperature offset, and that only by a fraction of a degree, and has no effect on the temperature scale factor. It has only a small effect on the humidity reading, 0.12%RH per °C at 25°C, 50%RH. To get started, those effects would be negligible and certainly wouldn't explain the large errors you reported in your first post. A good reference is indispensible!

    What problem did you have in making sensirion_integer.spin give readings in Fahrenheit?
    °F = °C *9/5 + 3200.
    In units of 0.01F.


Sign In or Register to comment.