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. My Project
  3. Slim Node Si7021 sensor example

Slim Node Si7021 sensor example

Scheduled Pinned Locked Moved My Project
137 Posts 18 Posters 64.8k Views 20 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.
  • rsachocR rsachoc

    So I think I've finally got everything up and running! This is what I'm getting at the serial monitor in the IDE:

    Serial started
    Voltage: 3359 mV
    send: 132-132-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:0
    send: 132-132-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=ok:1.5.4
    send: 132-132-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
    read: 0-0-132 s=255,c=3,t=15,pt=0,l=2,sg=0:
    sensor started, id=132, parent=0, distance=1
    send: 132-132-0-0 s=255,c=3,t=11,pt=0,l=15,sg=0,st=ok:EgTmpHumBat5min
    send: 132-132-0-0 s=255,c=3,t=12,pt=0,l=10,sg=0,st=ok:1.0 151106
    send: 132-132-0-0 s=0,c=0,t=6,pt=0,l=0,sg=0,st=ok:
    send: 132-132-0-0 s=1,c=0,t=7,pt=0,l=0,sg=0,st=ok:
    Node and 2 children presented.
    

    What I'm trying to figure out is where the temp and humidity reading are so I can get them into MQTT/OpenHab. Looking at the output, I can't see which one is the temp, humidity or battery level?

    m26872M Offline
    m26872M Offline
    m26872
    Hardware Contributor
    wrote on last edited by
    #60

    @rsachoc Is that all you get? Please also set sleep_time to 15000 for debug, if you haven't already done it.

    rsachocR 1 Reply Last reply
    0
    • m26872M m26872

      @rsachoc Is that all you get? Please also set sleep_time to 15000 for debug, if you haven't already done it.

      rsachocR Offline
      rsachocR Offline
      rsachoc
      wrote on last edited by rsachoc
      #61

      @m26872 thanks, I've set that, no change even after more than 15seconds and debug set.

      Could it be the way I've connected the si7021? I've got it as follows:

      1. A4 to SDA
      2. A5 to SCL
      3. GND to GND
      4. VCC to 3.3v
      rsachocR 1 Reply Last reply
      0
      • rsachocR rsachoc

        @m26872 thanks, I've set that, no change even after more than 15seconds and debug set.

        Could it be the way I've connected the si7021? I've got it as follows:

        1. A4 to SDA
        2. A5 to SCL
        3. GND to GND
        4. VCC to 3.3v
        rsachocR Offline
        rsachocR Offline
        rsachoc
        wrote on last edited by rsachoc
        #62

        Maybe I need to add that I'm running the 2.0 MQTT controller? Not sure if that makes a difference? GatewayW5100MQTTClient

        Just had a look what's going on on the controller side, this is what I see

        0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0-beta)
        0;255;3;0;9;Radio init successful.
        0;255;3;0;9;Init complete, id=0, parent=0, distance=0
        0;255;3;0;9;Attempting MQTT connection...
        0;255;3;0;9;MQTT connected
        0;255;3;0;9;read: 132-132-0 s=255,c=3,t=15,pt=2,l=2,sg=0:0
        0;255;3;0;9;send: 0-0-132-132 s=255,c=3,t=15,pt=0,l=2,sg=0,st=ok:
        0;255;3;0;9;read: 132-132-0 s=255,c=0,t=17,pt=0,l=5,sg=0:1.5.4
        0;255;3;0;9;Sending message on topic: mygateway1-out/132/255/0/0/17
        0;255;3;0;9;read: 132-132-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
        0;255;3;0;9;Sending message on topic: mygateway1-out/132/255/3/0/6
        0;255;3;0;9;read: 132-132-0 s=255,c=3,t=11,pt=0,l=15,sg=0:EgTmpHumBat5min
        0;255;3;0;9;Sending message on topic: mygateway1-out/132/255/3/0/11
        0;255;3;0;9;read: 132-132-0 s=255,c=3,t=12,pt=0,l=10,sg=0:1.0 151106
        0;255;3;0;9;Sending message on topic: mygateway1-out/132/255/3/0/12
        0;255;3;0;9;read: 132-132-0 s=0,c=0,t=6,pt=0,l=0,sg=0:
        0;255;3;0;9;Sending message on topic: mygateway1-out/132/0/0/0/6
        0;255;3;0;9;read: 132-132-0 s=1,c=0,t=7,pt=0,l=0,sg=0:
        0;255;3;0;9;Sending message on topic: mygateway1-out/132/1/0/0/7
        m26872M 1 Reply Last reply
        0
        • rsachocR rsachoc

          Maybe I need to add that I'm running the 2.0 MQTT controller? Not sure if that makes a difference? GatewayW5100MQTTClient

          Just had a look what's going on on the controller side, this is what I see

          0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0-beta)
          0;255;3;0;9;Radio init successful.
          0;255;3;0;9;Init complete, id=0, parent=0, distance=0
          0;255;3;0;9;Attempting MQTT connection...
          0;255;3;0;9;MQTT connected
          0;255;3;0;9;read: 132-132-0 s=255,c=3,t=15,pt=2,l=2,sg=0:0
          0;255;3;0;9;send: 0-0-132-132 s=255,c=3,t=15,pt=0,l=2,sg=0,st=ok:
          0;255;3;0;9;read: 132-132-0 s=255,c=0,t=17,pt=0,l=5,sg=0:1.5.4
          0;255;3;0;9;Sending message on topic: mygateway1-out/132/255/0/0/17
          0;255;3;0;9;read: 132-132-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
          0;255;3;0;9;Sending message on topic: mygateway1-out/132/255/3/0/6
          0;255;3;0;9;read: 132-132-0 s=255,c=3,t=11,pt=0,l=15,sg=0:EgTmpHumBat5min
          0;255;3;0;9;Sending message on topic: mygateway1-out/132/255/3/0/11
          0;255;3;0;9;read: 132-132-0 s=255,c=3,t=12,pt=0,l=10,sg=0:1.0 151106
          0;255;3;0;9;Sending message on topic: mygateway1-out/132/255/3/0/12
          0;255;3;0;9;read: 132-132-0 s=0,c=0,t=6,pt=0,l=0,sg=0:
          0;255;3;0;9;Sending message on topic: mygateway1-out/132/0/0/0/6
          0;255;3;0;9;read: 132-132-0 s=1,c=0,t=7,pt=0,l=0,sg=0:
          0;255;3;0;9;Sending message on topic: mygateway1-out/132/1/0/0/7
          m26872M Offline
          m26872M Offline
          m26872
          Hardware Contributor
          wrote on last edited by
          #63

          @rsachoc
          My initial guess would be that you get stuck at this line:

           si7021_env data = humiditySensor.getHumidityAndTemperature();
          

          Did you try your Si7021 on some plain arduino first? Just with some simple example code.

          rsachocR 1 Reply Last reply
          0
          • m26872M m26872

            @rsachoc
            My initial guess would be that you get stuck at this line:

             si7021_env data = humiditySensor.getHumidityAndTemperature();
            

            Did you try your Si7021 on some plain arduino first? Just with some simple example code.

            rsachocR Offline
            rsachocR Offline
            rsachoc
            wrote on last edited by
            #64

            @m26872 thanks, yes, I guessed that something might be wrong with the sensor, I checked continuity between the board and the sensor and all seemed fine.

            To test on an Arduino, I've honestly very little clue how to do this. Could I utilise the breadboard and Arduino I used to flash the AtMega?

            m26872M 1 Reply Last reply
            0
            • rsachocR rsachoc

              @m26872 thanks, yes, I guessed that something might be wrong with the sensor, I checked continuity between the board and the sensor and all seemed fine.

              To test on an Arduino, I've honestly very little clue how to do this. Could I utilise the breadboard and Arduino I used to flash the AtMega?

              m26872M Offline
              m26872M Offline
              m26872
              Hardware Contributor
              wrote on last edited by m26872
              #65

              @rsachoc The "very little clue" is a good reason to play around and learn some. :smiley:
              You should not use a 5V Uno directly to sensor without voltage regulator and logic level converter. The Si7021 spec is 1.9-3.6V.
              If you don't have a Arduino Pro Mini 3.3V, I suppose your best option is the SlimNode you already got. Try it at least at 8MHz (use suitable fuse settings, bootloader and baud rate), of course external crystal if you have.

              1 Reply Last reply
              1
              • rollercontainerR Offline
                rollercontainerR Offline
                rollercontainer
                wrote on last edited by
                #66

                The most SI7021 coming from ebay are with voltage regulator and level shifter. I searched for a raw version and there are only very few... If you are not sure, post a link or a foto.

                m26872M 1 Reply Last reply
                1
                • rollercontainerR rollercontainer

                  The most SI7021 coming from ebay are with voltage regulator and level shifter. I searched for a raw version and there are only very few... If you are not sure, post a link or a foto.

                  m26872M Offline
                  m26872M Offline
                  m26872
                  Hardware Contributor
                  wrote on last edited by
                  #67

                  @rollercontainer Thanks! You're absolutely right. I feel rather stupid not thinking of this. :(

                  So @rsachoc, if you're have some GY-21 like boards still not yet modded like described in first post of this thread, then they should work excellent with your Uno.

                  1 Reply Last reply
                  0
                  • rsachocR Offline
                    rsachocR Offline
                    rsachoc
                    wrote on last edited by
                    #68

                    Thanks both, I have the "pre-modded" si7021, so it's the one that should operate at between the 1.9 and 3.3v. I the Arduino I used to burn the Atmega is a knockoff, so it has both 3.3v and 5v. Let me do some research and see if I can test the si7021 using it.

                    1 Reply Last reply
                    0
                    • rsachocR Offline
                      rsachocR Offline
                      rsachoc
                      wrote on last edited by
                      #69

                      Some pictures anyway!

                      alt text

                      alt text

                      alt text

                      alt text

                      m26872M 1 Reply Last reply
                      1
                      • rsachocR rsachoc

                        Some pictures anyway!

                        alt text

                        alt text

                        alt text

                        alt text

                        m26872M Offline
                        m26872M Offline
                        m26872
                        Hardware Contributor
                        wrote on last edited by m26872
                        #70

                        @rsachoc Great with pictures! It looks like you haven't enabled the pull-up resistors by filling the solder jumpers in the middle of the board? Like this: https://cdn.sparkfun.com/assets/3/f/6/5/a/52855764757b7f06478b4567.jpg

                        rsachocR 1 Reply Last reply
                        0
                        • m26872M m26872

                          @rsachoc Great with pictures! It looks like you haven't enabled the pull-up resistors by filling the solder jumpers in the middle of the board? Like this: https://cdn.sparkfun.com/assets/3/f/6/5/a/52855764757b7f06478b4567.jpg

                          rsachocR Offline
                          rsachocR Offline
                          rsachoc
                          wrote on last edited by
                          #71

                          @m26872 oh! I didn't realise I needed to do that, could that be the problem? Do I just need to fill with solder the bit just below where the DA and "-" is?

                          m26872M 1 Reply Last reply
                          0
                          • rsachocR rsachoc

                            @m26872 oh! I didn't realise I needed to do that, could that be the problem? Do I just need to fill with solder the bit just below where the DA and "-" is?

                            m26872M Offline
                            m26872M Offline
                            m26872
                            Hardware Contributor
                            wrote on last edited by
                            #72

                            @rsachoc It's probably it. And yes, it's rigth there. Make sure all of the three small pads interconnect.

                            rsachocR 1 Reply Last reply
                            1
                            • m26872M m26872

                              @rsachoc It's probably it. And yes, it's rigth there. Make sure all of the three small pads interconnect.

                              rsachocR Offline
                              rsachocR Offline
                              rsachoc
                              wrote on last edited by
                              #73

                              @m26872 thanks! No time tonight, but a job for testing tomorrow.

                              1 Reply Last reply
                              0
                              • D Offline
                                D Offline
                                DavidZH
                                wrote on last edited by
                                #74

                                You could also use the 328 pullups! I had an unwilling Chinese light sensor (MAX44099) that drew a lot of power either with the VCC on or off. Since it's battery powered that is undesireable.

                                I used digitalWrite(SDA, LOW); digitalWrite(SCL, LOW); to tie the bus to ground. When the sensor wakes up, it writes HIGH to those pins and the bus is back online. Used a 500ms wait after this to let the sensors stabilise.

                                That sensor is now on a 6µA sleep current and a average 128µA over 2 hours measured with a 2 minute sleep cycle.

                                m26872M 1 Reply Last reply
                                0
                                • rsachocR Offline
                                  rsachocR Offline
                                  rsachoc
                                  wrote on last edited by
                                  #75

                                  Tried it this evening, still no luck, let me see what I can get up to over the weekend.

                                  m26872M 1 Reply Last reply
                                  0
                                  • D DavidZH

                                    You could also use the 328 pullups! I had an unwilling Chinese light sensor (MAX44099) that drew a lot of power either with the VCC on or off. Since it's battery powered that is undesireable.

                                    I used digitalWrite(SDA, LOW); digitalWrite(SCL, LOW); to tie the bus to ground. When the sensor wakes up, it writes HIGH to those pins and the bus is back online. Used a 500ms wait after this to let the sensors stabilise.

                                    That sensor is now on a 6µA sleep current and a average 128µA over 2 hours measured with a 2 minute sleep cycle.

                                    m26872M Offline
                                    m26872M Offline
                                    m26872
                                    Hardware Contributor
                                    wrote on last edited by
                                    #76

                                    @DavidZH True, internal pull-ups (20k?) should probably be enough for the normal i2c use (short wires, low speed, etc). But I wonder if pull-ups are consuming any significant power during passive state like sleeping sensor. Of course it's a good solution in case there're issues preventing the bus from beeing silent. Or worse, pulled down continuously.
                                    What was your current before the change?
                                    I think 500ms awake is a lot.

                                    1 Reply Last reply
                                    0
                                    • rsachocR rsachoc

                                      Tried it this evening, still no luck, let me see what I can get up to over the weekend.

                                      m26872M Offline
                                      m26872M Offline
                                      m26872
                                      Hardware Contributor
                                      wrote on last edited by
                                      #77

                                      @rsachoc Crap. Maybe it's something else then.:disappointed:

                                      1 Reply Last reply
                                      0
                                      • D Offline
                                        D Offline
                                        DavidZH
                                        wrote on last edited by
                                        #78

                                        I switch them off with a LOW write before the sensor goes to sleep and you're absolutely right about the wait time being very long. In this case I didn't mind because the sensor is powered by a solar panel.
                                        I can't really remember what the exact value but it was an order of magnitude... I also used the voltage divider way to measure voltage because the Moteino has a regulator on board, so that upped the sleep current a little (10M resistor to keep the current low).

                                        I went searching because the current went UP when I switched the power to the sensor off before sleep. Gammon.co.au is a very useful source, but I can't remember where I dug this hack up.
                                        I will be making other battery sensors for inside with a HTU21d and I will post more on those in a 'My Project' mega gallery including measurements. (And dig around in the HTU datasheet for the start up time....)

                                        1 Reply Last reply
                                        0
                                        • rollercontainerR Offline
                                          rollercontainerR Offline
                                          rollercontainer
                                          wrote on last edited by
                                          #79

                                          According to the datasheet the absolute maximum time to get ready is 80ms.

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


                                          10

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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