Smart Humidity and Temperature sensor TH02 Library

  • Playing around with Hoperf RFM12B and RFM69 for my wireless sensors, I discovered they also have one interesting sensor for temperature and humidity called TH02. Just look the picture below, this sensor is so small Of course I already looked and… Continue Reading

    Click here to see the full blog post

  • Hello Charles,
    First I'd like to say a big thank you for creating this library, it's been a big help for a capstone project I'm on for my bachelors degree. I've ran into a bit of an issue though and I think I know the cause, but I'm a bit stuck and was hoping you may be able to confirm my suspicion. I'm using this with an Anarduino to pull temps using a hopefm RFM69 chip at 915 mhz. I set the chip up inside and it seems to be measuring ~70F like it's suposed to, then when I move the sensor outside (where it's currently 13F) I watch the temp drop down to 32F, and then it climbs up to 55F I believe that the heater in the Humidity portion is turning on but in my code I'm only starting TempConv and I after looking into the library files I did update that to attempt to keep the heater off by using, "th02.startTempConv(true, false);"

    Can you tell me if I may be missing something, or if there is something else I should be looking into? when I bring it back in, the temps are within range again, so I'm fairly certain that it's not a wiring issue.

  • Also I would like to say I'm very green to this, so please do not rule out the obvious .
    Thank you,

  • @chrisb
    thanks for the comment.

    To be honest, I never tested the heater so I could be not "bug free"

    Could you try this and post serial result ?

    uint8_t cfg;
    th02.startTempConv(true, false);
    if (th02.getConfig(&cfg)==0) {
    } else {
      serial.println("Read error");

  • @Charles
    Here's the output from that bit of code where it drops down to the lowest value and starts to rise back up. Another strange thing I noticed was when I pulled it out of the freezer the temp dropped again like it started reading the temp of the somewhat frozen board again and you could see it warm back up to room temp.

    TH02 Demo
    Scanning I2C bus ...
    I2C device found at address 0x40-> TH02 !
    I2C device found at address 0x6F-> Unknown device !
    Scan done
    TH02 device ID = 0x50
    TH02 device ID match !
    TH02 Status = 0x00
    TH02 Config = 0x30
    //**edited for brevity**
    Start: Config=31: Temp 0.18 C => 0.10 C
    Start: Config=31: Temp 0.06 C => 0.20 C
    Start: Config=31: Temp 0.19 C => 0.30 C
    Start: Config=31: Temp 0.29 C => 0.40 C
    Start: Config=31: Temp 0.41 C => 0.60 C
    Start: Config=31: Temp 0.57 C => 0.70 C
    Start: Config=31: Temp 0.66 C => 0.80 C

  • I'm also seeing issue with sensor not working with temperatures below 0C :(
    I don't think it's heating of the sensor. I think you are loosing negative sign somewhere. Mine shows 6C when it's -6C for example...
    Wrong type of variables somewhere in the library?

  • @Lensdigital
    That would make a lot more sense than what I was thinking with the humidity sensor heater, especially with the way it "drops" when I pull it out of the freezer. -10 C also matches the outdoor temp when I was trying it outside.
    I'm glad you caught this!

  • Guys,

    Humm, that's interesting, I already fixed a problem with negative values in library (see ). As far As I remember this fixed the problem (but may be it's another issue now)
    Are you using the latest version ?