Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Announcements
  3. 💬 Air Humidity Sensor - Si7021

💬 Air Humidity Sensor - Si7021

Scheduled Pinned Locked Moved Announcements
temperaturehumiditysi7021
28 Posts 13 Posters 1.8k Views 12 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • BearWithBeardB BearWithBeard

    @Sebex The Si7021 guide mentions that you have to install the Arduino VCC library (link to GitHub) if you want to use this feature:

    Example

    This example uses the Si7021 library, which is included in the MySensors external examples. If you choose to report battery level to the gateway (by defining REPORT_BATTERY_LEVEL at the top of the sketch) the Vcc library is also required. Please install the librarie(s) and restart the Arduino IDE before trying to compile.

    It might be a good idea to add a link to the library in the article itself, since it doesn't make clear which library is required for this.

    mfalkviddM Offline
    mfalkviddM Offline
    mfalkvidd
    Mod
    wrote on last edited by
    #10

    @BearWithBeard the Vcc library is present in MySensorsArduinoExamples, so if MySensorsArduinoExamples is installed, Vcc will be available.

    Dependencies is a mess, which is why MySensorsArduinoExamples is in a separate repo. We (the community) has not yet found a good way to handle dependencies.

    1 Reply Last reply
    1
    • SebexS Offline
      SebexS Offline
      Sebex
      wrote on last edited by
      #11

      Yea that solved it, I copied the file in the library. Thanks!

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bebr
        wrote on last edited by
        #12

        Hi there,

        I've a pro mini 3.3V with a si7021 and a Li-ion 3.7V battery.
        I'm using the VCC library, but the reported values are weird: the remaining battery value drops a lot, and if I reset the board, it jumps back to a more normal value.

        The battery is connected to the VCC pin on the arduino.
        A regulator (LM2936) powers the si7021 and the nrf24.

        Here is a graph of the battery level. Pikes appear when I reset the arduino.

        f66813cf-f528-406d-9171-a645dc4f931b-image.png

        Isn't the 2 resistors method more accurate?

        Thanks!

        YveauxY 1 Reply Last reply
        0
        • B bebr

          Hi there,

          I've a pro mini 3.3V with a si7021 and a Li-ion 3.7V battery.
          I'm using the VCC library, but the reported values are weird: the remaining battery value drops a lot, and if I reset the board, it jumps back to a more normal value.

          The battery is connected to the VCC pin on the arduino.
          A regulator (LM2936) powers the si7021 and the nrf24.

          Here is a graph of the battery level. Pikes appear when I reset the arduino.

          f66813cf-f528-406d-9171-a645dc4f931b-image.png

          Isn't the 2 resistors method more accurate?

          Thanks!

          YveauxY Offline
          YveauxY Offline
          Yveaux
          Mod
          wrote on last edited by
          #13

          @bebr well, it can depend on a number of things: where in the sketch do you read the vcc level (eg before or after sending), what voltage levels did you configure in your sketch, did you remove the voltage regulator from the pro mini?

          http://yveaux.blogspot.nl

          1 Reply Last reply
          0
          • B Offline
            B Offline
            bebr
            wrote on last edited by
            #14

            @Yveaux thanks for your answer.

            I used the sketch on the Mysensors'si7021 page, so the vcc level is read at the end of the loop, before going to sleep and after sending the temp/hum values.
            The only modification I made are setting up the voltage values.
            As my 3.7V Li-Ion battery is at 4.2V when fully charged and at 3V when almost completed discharged, this how I configured it in the sketch:

            #ifdef REPORT_BATTERY_LEVEL
            #include <Vcc.h>
            static uint8_t oldBatteryPcnt = 200;  // Initialize to 200 to assure first time value will be sent.
            const float VccMin        = 3.0;      // Minimum expected Vcc level, in Volts: Brownout at 1.8V    -> 0%
            const float VccMax        = 4.2;  // Maximum expected Vcc level, in Volts: 2xAA fresh Alkaline -> 100%
            const float VccCorrection = 1.0;      // Measured Vcc by multimeter divided by reported Vcc
            static Vcc vcc(VccCorrection); 
            #endif
            

            I didn't apply any correction because read and reported VCC was very close, and I'm just testing this for now.

            I didn't removed the onboard regulator nor the power led for now. Isn't the regulator only used when applying voltage to the RAW pin?

            YveauxY 1 Reply Last reply
            1
            • B bebr

              @Yveaux thanks for your answer.

              I used the sketch on the Mysensors'si7021 page, so the vcc level is read at the end of the loop, before going to sleep and after sending the temp/hum values.
              The only modification I made are setting up the voltage values.
              As my 3.7V Li-Ion battery is at 4.2V when fully charged and at 3V when almost completed discharged, this how I configured it in the sketch:

              #ifdef REPORT_BATTERY_LEVEL
              #include <Vcc.h>
              static uint8_t oldBatteryPcnt = 200;  // Initialize to 200 to assure first time value will be sent.
              const float VccMin        = 3.0;      // Minimum expected Vcc level, in Volts: Brownout at 1.8V    -> 0%
              const float VccMax        = 4.2;  // Maximum expected Vcc level, in Volts: 2xAA fresh Alkaline -> 100%
              const float VccCorrection = 1.0;      // Measured Vcc by multimeter divided by reported Vcc
              static Vcc vcc(VccCorrection); 
              #endif
              

              I didn't apply any correction because read and reported VCC was very close, and I'm just testing this for now.

              I didn't removed the onboard regulator nor the power led for now. Isn't the regulator only used when applying voltage to the RAW pin?

              YveauxY Offline
              YveauxY Offline
              Yveaux
              Mod
              wrote on last edited by Yveaux
              #15

              @bebr said in 💬 Air Humidity Sensor - Si7021:
              Your setup looks allright.

              Isn't the regulator only used when applying voltage to the RAW pin?

              Yes it is, but I'm not sure what will happen if you source 3v3 via its output pin.
              Anyway, I doubt if this could cause the effect you're seeing.

              http://yveaux.blogspot.nl

              1 Reply Last reply
              0
              • B Offline
                B Offline
                bebr
                wrote on last edited by
                #16

                Ok, do you need my schematic, to make it clearer?

                I've planned to removed the onboard regulator (and power led) on my production board. But this one is for testing so I leave it untouched.

                So currently the regulator, is obiously external.

                Thanks again, any help appreciated, otherwise I'll use the 2 resistors method.

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  bebr
                  wrote on last edited by
                  #17

                  And now, without resetting, the battery level has jumped from 23% to 47%. This last seems to be correct according to the measure of 3.673V, directly taken on the battery.

                  mfalkviddM 1 Reply Last reply
                  0
                  • B bebr

                    And now, without resetting, the battery level has jumped from 23% to 47%. This last seems to be correct according to the measure of 3.673V, directly taken on the battery.

                    mfalkviddM Offline
                    mfalkviddM Offline
                    mfalkvidd
                    Mod
                    wrote on last edited by
                    #18

                    @bebr could it be temperature related? I have noticed that the voltage in my nodes increase when the sun is shining on them.

                    B 1 Reply Last reply
                    0
                    • mfalkviddM mfalkvidd

                      @bebr could it be temperature related? I have noticed that the voltage in my nodes increase when the sun is shining on them.

                      B Offline
                      B Offline
                      bebr
                      wrote on last edited by bebr
                      #19

                      @mfalkvidd I thought of this too, but I opened the windows this morning, 11°C here this morning, and the battery level stayed around 50%.

                      Here are some graphs showing it's not temperature related:
                      Screenshot_2020-03-30 MySensors testing - Grafana.png

                      1 Reply Last reply
                      1
                      • B Offline
                        B Offline
                        bebr
                        wrote on last edited by bebr
                        #20

                        I noticed I used a 10uF/50V capacitor instead of a 0.1uF/5V for LM2936 regulator.
                        Could it be the source of my problem?
                        I change it last evening, and now the reported battery level seems ok.
                        Sorry, I'm noob in electronics :)

                        skywatchS 1 Reply Last reply
                        0
                        • B bebr

                          I noticed I used a 10uF/50V capacitor instead of a 0.1uF/5V for LM2936 regulator.
                          Could it be the source of my problem?
                          I change it last evening, and now the reported battery level seems ok.
                          Sorry, I'm noob in electronics :)

                          skywatchS Offline
                          skywatchS Offline
                          skywatch
                          wrote on last edited by
                          #21

                          @bebr Yes, that would make a big difference. Good that you spotted it though!

                          1 Reply Last reply
                          0
                          • B Offline
                            B Offline
                            bebr
                            wrote on last edited by bebr
                            #22

                            Even with the 0.1uF capacitor, I had wrong values.
                            So, I've gone with the voltage divider method, and it seems more reliable, at least for my case.
                            4.7V max to VCC, R1 1M, R2 330k, another 0.1uF capacitor in parallel with R2.
                            I don't need a very good accuracy, just a trend in order to know when to change my batteries.
                            Thanks for your help.

                            1 Reply Last reply
                            1
                            • H Offline
                              H Offline
                              hoggin
                              wrote on last edited by
                              #23

                              Anyone know why when the temp goes below 32F it jumps all the way down to -100? I have followed this configuration to the T but cannot figure this out. Watching serial output shows the temp at -100 or so whenever the temp is below 32F. As if the conversion is off or something.

                              mfalkviddM 1 Reply Last reply
                              0
                              • H hoggin

                                Anyone know why when the temp goes below 32F it jumps all the way down to -100? I have followed this configuration to the T but cannot figure this out. Watching serial output shows the temp at -100 or so whenever the temp is below 32F. As if the conversion is off or something.

                                mfalkviddM Offline
                                mfalkviddM Offline
                                mfalkvidd
                                Mod
                                wrote on last edited by
                                #24

                                @hoggin interesting that nobody has had problems with this before. I checked the code, and the problem is caused by treating a signed integer as unsigned. https://github.com/mysensors/MySensorsArduinoExamples/blob/master/libraries/SI7021/SI7021.cpp#L41

                                I think it will work properly if you change unsigned int to int in SI7021.cpp.

                                1 Reply Last reply
                                1
                                • mfalkviddM Offline
                                  mfalkviddM Offline
                                  mfalkvidd
                                  Mod
                                  wrote on last edited by
                                  #25

                                  Suggested fix is available at https://github.com/mysensors/MySensorsArduinoExamples/pull/51

                                  1 Reply Last reply
                                  1
                                  • H Offline
                                    H Offline
                                    hoggin
                                    wrote on last edited by
                                    #26

                                    FIXED!!! Thanks. I have been struggling.

                                    1 Reply Last reply
                                    1
                                    • P Offline
                                      P Offline
                                      pahe
                                      wrote on last edited by
                                      #27

                                      Hello , I have a problem with this shetch . I get from sensor in serial monitor - Temp 128.86C Hum 118.99 ,
                                      Can someone help me ? Thanks

                                      1 Reply Last reply
                                      0
                                      • H Offline
                                        H Offline
                                        hoggin
                                        wrote on last edited by
                                        #28

                                        My next issue is the humidity seems to be off. It has read as high as 115% humidity. Is this normal or should I be considering a correction? If so, how would I enter a correction. Its a little odd considering it states that the accuracy is much tighter than that.

                                        1 Reply Last reply
                                        0
                                        Reply
                                        • Reply as topic
                                        Log in to reply
                                        • Oldest to Newest
                                        • Newest to Oldest
                                        • Most Votes


                                        14

                                        Online

                                        11.7k

                                        Users

                                        11.2k

                                        Topics

                                        113.1k

                                        Posts


                                        Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                        • Login

                                        • Don't have an account? Register

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • MySensors
                                        • OpenHardware.io
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular