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 Offline
    rsachocR Offline
    rsachoc
    wrote on last edited by
    #44

    OK, so it seems that it was because I was using the dev branch that I'm getting that error. I switched over to stable and the sketch compiles, although I do get a warning.

    WARNING: Category '' in library UIPEthernet is not valid. Setting to 'Uncategorized'
    

    But I also can't upload the sketch above:

    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x18
    

    I noted above that something needed to be changed in terms of the baud rate, mine is set at 115200 in myconfig.h and I can't seem to find a reference in mysensor.h

    m26872M 1 Reply Last reply
    0
    • rsachocR rsachoc

      OK, so it seems that it was because I was using the dev branch that I'm getting that error. I switched over to stable and the sketch compiles, although I do get a warning.

      WARNING: Category '' in library UIPEthernet is not valid. Setting to 'Uncategorized'
      

      But I also can't upload the sketch above:

      avrdude: stk500_recv(): programmer is not responding
      avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x18
      

      I noted above that something needed to be changed in terms of the baud rate, mine is set at 115200 in myconfig.h and I can't seem to find a reference in mysensor.h

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

      @rsachoc I sorry, but there seems to be an error in the sketch in the first post. Baud rate should be 9600 everywhere if you use the common Slim Node fuses and bootloader. Upload (board.txt), MyConfig.h (not MySensor.h since v1.5), Debug-prints and Arduino IDE serial monitor.

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

        Thanks, I've updated the sketch that I downloaded, also myconfig.h so that should be good. What do I need to select in the Arduino IDE for board type? I searched in the slim node thread and didn't see a reference to any changes?

        m26872M 1 Reply Last reply
        0
        • rsachocR rsachoc

          Thanks, I've updated the sketch that I downloaded, also myconfig.h so that should be good. What do I need to select in the Arduino IDE for board type? I searched in the slim node thread and didn't see a reference to any changes?

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

          @rsachoc No changes. It is that boards.txt entry you should use.

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

            Hmmm ok, that's what I thought...still no luck, I've modified the boards.txt with the text from the slim node thread, and now it still has the same error message.

            To confirm, my FTDI adaptor is attached to the board pins as follows:

            FTDI <-> board
            GND <-> first pin (i.e bottom left of board when looking at board laying long side horizontal and NRF radio on the other side)
            CTS <-> board marked GND
            PWR <-> board marked VCC
            TXO <-> next up i.e. 4th pin
            RXI <-> next up i.e. 5th pin
            DTR <-> next up i.e. last pin

            Other than that, I guess it may be something wrong with the way I made the board? If so, what's the best way to troubleshoot? Could it be a bad bootloader flash? Is there a way to check if the ATMega has a bootloader?

            edit in fact, it could be because I don't have the Si7021 connected? Could this be the reason a sketch is not uploading successfully? :worried:

            m26872M 1 Reply Last reply
            0
            • rsachocR rsachoc

              Hmmm ok, that's what I thought...still no luck, I've modified the boards.txt with the text from the slim node thread, and now it still has the same error message.

              To confirm, my FTDI adaptor is attached to the board pins as follows:

              FTDI <-> board
              GND <-> first pin (i.e bottom left of board when looking at board laying long side horizontal and NRF radio on the other side)
              CTS <-> board marked GND
              PWR <-> board marked VCC
              TXO <-> next up i.e. 4th pin
              RXI <-> next up i.e. 5th pin
              DTR <-> next up i.e. last pin

              Other than that, I guess it may be something wrong with the way I made the board? If so, what's the best way to troubleshoot? Could it be a bad bootloader flash? Is there a way to check if the ATMega has a bootloader?

              edit in fact, it could be because I don't have the Si7021 connected? Could this be the reason a sketch is not uploading successfully? :worried:

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

              @rsachoc Start simple. Try on a board without nRF and sensors. Remove everything in the sketch and make it to just print "Hello world" back to serial monitor.

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

                Thanks, I haven't actually built a new node, but have been double checking everything on my current node. One thing I wanted to confirm, the 4.7uf capacitor, does the negative leg have to be on the corner of the board, as this is the way I have it currently? I think looking at the board layout in the main slim node thread, it should be the positive leg on the corner and the negative leg on the side of the board (the short side of the board)?

                m26872M 1 Reply Last reply
                0
                • rsachocR rsachoc

                  Thanks, I haven't actually built a new node, but have been double checking everything on my current node. One thing I wanted to confirm, the 4.7uf capacitor, does the negative leg have to be on the corner of the board, as this is the way I have it currently? I think looking at the board layout in the main slim node thread, it should be the positive leg on the corner and the negative leg on the side of the board (the short side of the board)?

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

                  @rsachoc I don't have it in front of me rigth now... but, there should be an arc and a super-small "+"-sign next to the positive pad. Maybe it just look like a dot.

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

                    Ok so that may be the problem then! Let me solder it the right way and see if that helps otherwise I'm going to create a bare bones slim mode as suggested

                    edit to confirm the positive leg of the capacitor goes to the positive marked plus sign hole on the board?

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

                      OK so I changed the polarity of the 4.7uf capacitor and I'm still receiving the same error. So I built a barebones one without sensor and without NRF. I am still getting the same error when uploading the sketch via the FTDI adaptor. I tried uploading a sketch to a Sensebender I have and it worked fine, so that rules out the FTDI adaptor.

                      Some pics in case someone can spot something obvious.

                      http://i.imgur.com/1SV0qO2.jpg

                      http://i.imgur.com/mUp87hB.jpg

                      http://i.imgur.com/oCqcDpo.jpg

                      So I can only think that it must be related to the ATMega bootloader? In the how to burn a bootloader thread, I received the following when trying to burn the bootloader, so I assumed it uploaded correctly?

                      C:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\tools\avr/bin/avrdude -CC:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM5 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m 
                      
                      avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58
                               Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
                               Copyright (c) 2007-2009 Joerg Wunsch
                      
                               System wide configuration file is "C:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\tools\avr/etc/avrdude.conf"
                      
                               Using Port                    : COM5
                               Using Programmer              : stk500v1
                               Overriding Baud Rate          : 19200
                               AVR Part                      : ATmega328P
                               Chip Erase delay              : 9000 us
                               PAGEL                         : PD7
                               BS2                           : PC2
                               RESET disposition             : dedicated
                               RETRY pulse                   : SCK
                               serial program mode           : yes
                               parallel program mode         : yes
                               Timeout                       : 200
                               StabDelay                     : 100
                               CmdexeDelay                   : 25
                               SyncLoops                     : 32
                               ByteDelay                     : 0
                               PollIndex                     : 3
                               PollValue                     : 0x53
                               Memory Detail                 :
                      
                                                        Block Poll               Page                       Polled
                                 Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
                                 ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
                                 eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
                                 flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
                                 lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                 hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                 efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                 lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                 calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                 signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
                      
                               Programmer Type : STK500
                               Description     : Atmel STK500 Version 1.x firmware
                               Hardware Version: 2
                               Firmware Version: 1.18
                               Topcard         : Unknown
                               Vtarget         : 0.0 V
                               Varef           : 0.0 V
                               Oscillator      : Off
                               SCK period      : 0.1 us
                      
                      avrdude: AVR device initialized and ready to accept instructions
                      
                      Reading | ################################################## | 100% 0.02s
                      
                      avrdude: Device signature = 0x1e950f
                      avrdude: erasing chip
                      avrdude: reading input file "0x3F"
                      avrdude: writing lock (1 bytes):
                      
                      Writing | ################################################## | 100% 0.01s
                      
                      avrdude: 1 bytes of lock written
                      avrdude: verifying lock memory against 0x3F:
                      avrdude: load data lock data from input file 0x3F:
                      avrdude: input file 0x3F contains 1 bytes
                      avrdude: reading on-chip lock data:
                      
                      C:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\tools\avr/bin/avrdude -CC:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM5 -b19200 -Uflash:w:C:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex:i -Ulock:w:0x0F:m 
                      Reading | ################################################## | 100% 0.01s
                      
                      avrdude: verifying ...
                      avrdude: 1 bytes of lock verified
                      avrdude: reading input file "0x05"
                      avrdude: writing efuse (1 bytes):
                      
                      Writing | ################################################## | 100% 0.01s
                      
                      avrdude: 1 bytes of efuse written
                      avrdude: verifying efuse memory against 0x05:
                      avrdude: load data efuse data from input file 0x05:
                      avrdude: input file 0x05 contains 1 bytes
                      avrdude: reading on-chip efuse data:
                      
                      Reading | ################################################## | 100% 0.01s
                      
                      avrdude: verifying ...
                      avrdude: 1 bytes of efuse verified
                      avrdude: reading input file "0xDE"
                      avrdude: writing hfuse (1 bytes):
                      
                      Writing | ################################################## | 100% 0.01s
                      
                      avrdude: 1 bytes of hfuse written
                      avrdude: verifying hfuse memory against 0xDE:
                      avrdude: load data hfuse data from input file 0xDE:
                      avrdude: input file 0xDE contains 1 bytes
                      avrdude: reading on-chip hfuse data:
                      
                      Reading | ################################################## | 100% 0.01s
                      
                      avrdude: verifying ...
                      avrdude: 1 bytes of hfuse verified
                      avrdude: reading input file "0xFF"
                      avrdude: writing lfuse (1 bytes):
                      
                      Writing | ################################################## | 100% 0.01s
                      
                      avrdude: 1 bytes of lfuse written
                      avrdude: verifying lfuse memory against 0xFF:
                      avrdude: load data lfuse data from input file 0xFF:
                      avrdude: input file 0xFF contains 1 bytes
                      avrdude: reading on-chip lfuse data:
                      
                      Reading | ################################################## | 100% 0.01s
                      
                      avrdude: verifying ...
                      avrdude: 1 bytes of lfuse verified
                      
                      avrdude done.  Thank you.
                      
                      
                      avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58
                               Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
                               Copyright (c) 2007-2009 Joerg Wunsch
                      
                               System wide configuration file is "C:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\tools\avr/etc/avrdude.conf"
                      
                               Using Port                    : COM5
                               Using Programmer              : stk500v1
                               Overriding Baud Rate          : 19200
                               AVR Part                      : ATmega328P
                               Chip Erase delay              : 9000 us
                               PAGEL                         : PD7
                               BS2                           : PC2
                               RESET disposition             : dedicated
                               RETRY pulse                   : SCK
                               serial program mode           : yes
                               parallel program mode         : yes
                               Timeout                       : 200
                               StabDelay                     : 100
                               CmdexeDelay                   : 25
                               SyncLoops                     : 32
                               ByteDelay                     : 0
                               PollIndex                     : 3
                               PollValue                     : 0x53
                               Memory Detail                 :
                      
                                                        Block Poll               Page                       Polled
                                 Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
                                 ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
                                 eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
                                 flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
                                 lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                 hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                 efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                 lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                 calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                 signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
                      
                               Programmer Type : STK500
                               Description     : Atmel STK500 Version 1.x firmware
                               Hardware Version: 2
                               Firmware Version: 1.18
                               Topcard         : Unknown
                               Vtarget         : 0.0 V
                               Varef           : 0.0 V
                               Oscillator      : Off
                               SCK period      : 0.1 us
                      
                      avrdude: AVR device initialized and ready to accept instructions
                      
                      Reading | ################################################## | 100% 0.02s
                      
                      avrdude: Device signature = 0x1e950f
                      avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
                               To disable this feature, specify the -D option.
                      avrdude: erasing chip
                      avrdude: reading input file "C:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex"
                      avrdude: writing flash (32768 bytes):
                      
                      Writing | ################################################## | 100% 0.00s
                      
                      avrdude: 32768 bytes of flash written
                      avrdude: verifying flash memory against C:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex:
                      avrdude: load data flash data from input file C:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex:
                      avrdude: input file C:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex contains 32768 bytes
                      avrdude: reading on-chip flash data:
                      
                      Reading | ################################################## | 100% -0.00s
                      
                      avrdude: verifying ...
                      avrdude: 32768 bytes of flash verified
                      avrdude: reading input file "0x0F"
                      avrdude: writing lock (1 bytes):
                      
                      Writing | ################################################## | 100% 0.02s
                      
                      avrdude: 1 bytes of lock written
                      avrdude: verifying lock memory against 0x0F:
                      avrdude: load data lock data from input file 0x0F:
                      avrdude: input file 0x0F contains 1 bytes
                      avrdude: reading on-chip lock data:
                      
                      Reading | ################################################## | 100% 0.01s
                      
                      avrdude: verifying ...
                      avrdude: 1 bytes of lock verified
                      
                      avrdude done.  Thank you.
                      
                      m26872M 1 Reply Last reply
                      0
                      • rsachocR rsachoc

                        OK so I changed the polarity of the 4.7uf capacitor and I'm still receiving the same error. So I built a barebones one without sensor and without NRF. I am still getting the same error when uploading the sketch via the FTDI adaptor. I tried uploading a sketch to a Sensebender I have and it worked fine, so that rules out the FTDI adaptor.

                        Some pics in case someone can spot something obvious.

                        http://i.imgur.com/1SV0qO2.jpg

                        http://i.imgur.com/mUp87hB.jpg

                        http://i.imgur.com/oCqcDpo.jpg

                        So I can only think that it must be related to the ATMega bootloader? In the how to burn a bootloader thread, I received the following when trying to burn the bootloader, so I assumed it uploaded correctly?

                        C:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\tools\avr/bin/avrdude -CC:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM5 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m 
                        
                        avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58
                                 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
                                 Copyright (c) 2007-2009 Joerg Wunsch
                        
                                 System wide configuration file is "C:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\tools\avr/etc/avrdude.conf"
                        
                                 Using Port                    : COM5
                                 Using Programmer              : stk500v1
                                 Overriding Baud Rate          : 19200
                                 AVR Part                      : ATmega328P
                                 Chip Erase delay              : 9000 us
                                 PAGEL                         : PD7
                                 BS2                           : PC2
                                 RESET disposition             : dedicated
                                 RETRY pulse                   : SCK
                                 serial program mode           : yes
                                 parallel program mode         : yes
                                 Timeout                       : 200
                                 StabDelay                     : 100
                                 CmdexeDelay                   : 25
                                 SyncLoops                     : 32
                                 ByteDelay                     : 0
                                 PollIndex                     : 3
                                 PollValue                     : 0x53
                                 Memory Detail                 :
                        
                                                          Block Poll               Page                       Polled
                                   Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
                                   ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
                                   eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
                                   flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
                                   lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                   hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                   efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                   lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                   calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                   signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
                        
                                 Programmer Type : STK500
                                 Description     : Atmel STK500 Version 1.x firmware
                                 Hardware Version: 2
                                 Firmware Version: 1.18
                                 Topcard         : Unknown
                                 Vtarget         : 0.0 V
                                 Varef           : 0.0 V
                                 Oscillator      : Off
                                 SCK period      : 0.1 us
                        
                        avrdude: AVR device initialized and ready to accept instructions
                        
                        Reading | ################################################## | 100% 0.02s
                        
                        avrdude: Device signature = 0x1e950f
                        avrdude: erasing chip
                        avrdude: reading input file "0x3F"
                        avrdude: writing lock (1 bytes):
                        
                        Writing | ################################################## | 100% 0.01s
                        
                        avrdude: 1 bytes of lock written
                        avrdude: verifying lock memory against 0x3F:
                        avrdude: load data lock data from input file 0x3F:
                        avrdude: input file 0x3F contains 1 bytes
                        avrdude: reading on-chip lock data:
                        
                        C:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\tools\avr/bin/avrdude -CC:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM5 -b19200 -Uflash:w:C:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex:i -Ulock:w:0x0F:m 
                        Reading | ################################################## | 100% 0.01s
                        
                        avrdude: verifying ...
                        avrdude: 1 bytes of lock verified
                        avrdude: reading input file "0x05"
                        avrdude: writing efuse (1 bytes):
                        
                        Writing | ################################################## | 100% 0.01s
                        
                        avrdude: 1 bytes of efuse written
                        avrdude: verifying efuse memory against 0x05:
                        avrdude: load data efuse data from input file 0x05:
                        avrdude: input file 0x05 contains 1 bytes
                        avrdude: reading on-chip efuse data:
                        
                        Reading | ################################################## | 100% 0.01s
                        
                        avrdude: verifying ...
                        avrdude: 1 bytes of efuse verified
                        avrdude: reading input file "0xDE"
                        avrdude: writing hfuse (1 bytes):
                        
                        Writing | ################################################## | 100% 0.01s
                        
                        avrdude: 1 bytes of hfuse written
                        avrdude: verifying hfuse memory against 0xDE:
                        avrdude: load data hfuse data from input file 0xDE:
                        avrdude: input file 0xDE contains 1 bytes
                        avrdude: reading on-chip hfuse data:
                        
                        Reading | ################################################## | 100% 0.01s
                        
                        avrdude: verifying ...
                        avrdude: 1 bytes of hfuse verified
                        avrdude: reading input file "0xFF"
                        avrdude: writing lfuse (1 bytes):
                        
                        Writing | ################################################## | 100% 0.01s
                        
                        avrdude: 1 bytes of lfuse written
                        avrdude: verifying lfuse memory against 0xFF:
                        avrdude: load data lfuse data from input file 0xFF:
                        avrdude: input file 0xFF contains 1 bytes
                        avrdude: reading on-chip lfuse data:
                        
                        Reading | ################################################## | 100% 0.01s
                        
                        avrdude: verifying ...
                        avrdude: 1 bytes of lfuse verified
                        
                        avrdude done.  Thank you.
                        
                        
                        avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58
                                 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
                                 Copyright (c) 2007-2009 Joerg Wunsch
                        
                                 System wide configuration file is "C:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\tools\avr/etc/avrdude.conf"
                        
                                 Using Port                    : COM5
                                 Using Programmer              : stk500v1
                                 Overriding Baud Rate          : 19200
                                 AVR Part                      : ATmega328P
                                 Chip Erase delay              : 9000 us
                                 PAGEL                         : PD7
                                 BS2                           : PC2
                                 RESET disposition             : dedicated
                                 RETRY pulse                   : SCK
                                 serial program mode           : yes
                                 parallel program mode         : yes
                                 Timeout                       : 200
                                 StabDelay                     : 100
                                 CmdexeDelay                   : 25
                                 SyncLoops                     : 32
                                 ByteDelay                     : 0
                                 PollIndex                     : 3
                                 PollValue                     : 0x53
                                 Memory Detail                 :
                        
                                                          Block Poll               Page                       Polled
                                   Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
                                   ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
                                   eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
                                   flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
                                   lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                   hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                   efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                   lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                   calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                   signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
                        
                                 Programmer Type : STK500
                                 Description     : Atmel STK500 Version 1.x firmware
                                 Hardware Version: 2
                                 Firmware Version: 1.18
                                 Topcard         : Unknown
                                 Vtarget         : 0.0 V
                                 Varef           : 0.0 V
                                 Oscillator      : Off
                                 SCK period      : 0.1 us
                        
                        avrdude: AVR device initialized and ready to accept instructions
                        
                        Reading | ################################################## | 100% 0.02s
                        
                        avrdude: Device signature = 0x1e950f
                        avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
                                 To disable this feature, specify the -D option.
                        avrdude: erasing chip
                        avrdude: reading input file "C:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex"
                        avrdude: writing flash (32768 bytes):
                        
                        Writing | ################################################## | 100% 0.00s
                        
                        avrdude: 32768 bytes of flash written
                        avrdude: verifying flash memory against C:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex:
                        avrdude: load data flash data from input file C:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex:
                        avrdude: input file C:\Users\James\Desktop\RPi Openhab\arduino-1.6.7-windows\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex contains 32768 bytes
                        avrdude: reading on-chip flash data:
                        
                        Reading | ################################################## | 100% -0.00s
                        
                        avrdude: verifying ...
                        avrdude: 32768 bytes of flash verified
                        avrdude: reading input file "0x0F"
                        avrdude: writing lock (1 bytes):
                        
                        Writing | ################################################## | 100% 0.02s
                        
                        avrdude: 1 bytes of lock written
                        avrdude: verifying lock memory against 0x0F:
                        avrdude: load data lock data from input file 0x0F:
                        avrdude: input file 0x0F contains 1 bytes
                        avrdude: reading on-chip lock data:
                        
                        Reading | ################################################## | 100% 0.01s
                        
                        avrdude: verifying ...
                        avrdude: 1 bytes of lock verified
                        
                        avrdude done.  Thank you.
                        
                        m26872M Offline
                        m26872M Offline
                        m26872
                        Hardware Contributor
                        wrote on last edited by
                        #54

                        @rsachoc Looks like you're missing the R1 resistor?

                        rsachocR 1 Reply Last reply
                        0
                        • m26872M m26872

                          @rsachoc Looks like you're missing the R1 resistor?

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

                          @m26872 well that is probably it! I didn't even realise I needed that, oops! Sorry :disappointed: ! Let me try and get one (I think I have some already) and get soldering

                          rsachocR 1 Reply Last reply
                          0
                          • rsachocR rsachoc

                            @m26872 well that is probably it! I didn't even realise I needed that, oops! Sorry :disappointed: ! Let me try and get one (I think I have some already) and get soldering

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

                            It lives! Well the one node I created does at least! I'll troubleshoot it, but the problem was the R1 resistor, which I (noobishly) forgot about! But very pleased, and thanks to m26872 especially and everyone else who helped.

                            I've updated the lessons learn post too!

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

                              I just received my non-3.3v Si7021, and have now updated the lessons learnt post, as this board is tiny and I managed to mess up the soldering completely. Ordered the 3.3 ready version now, another month wait...

                              1 Reply Last reply
                              0
                              • carlierdC carlierd

                                @ar91 Please find the code I used in 3 different nodes. The good thing with the playground lib is that there is error message if dialog with DHT22 failed.

                                /**
                                 * The MySensors Arduino library handles the wireless radio link and protocol
                                 * between your home built sensors/actuators and HA controller of choice.
                                 * The sensors forms a self healing radio network with optional repeaters. Each
                                 * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                                 * network topology allowing messages to be routed to nodes.
                                 *
                                 * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                                 * Copyright (C) 2013-2015 Sensnology AB
                                 * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                                 *
                                 * Documentation: http://www.mysensors.org
                                 * Support Forum: http://forum.mysensors.org
                                 *
                                 * This program is free software; you can redistribute it and/or
                                 * modify it under the terms of the GNU General Public License
                                 * version 2 as published by the Free Software Foundation.
                                 *
                                 */
                                
                                /**************************************************************************************/
                                /* Temperature, humidity and luminosity measurements.                                 */
                                /*                                                                                    */
                                /* Version     : 1.1.6                                                                */
                                /* Date        : 10/01/2016                                                           */
                                /* Modified by : David Carlier                                                        */
                                /**************************************************************************************/
                                /*                                ---------------                                     */
                                /*                            RST |             |  A5                                 */
                                /*                            RX  |             |  A4                                 */
                                /*                            TX  |   ARDUINO   |  A3                                 */
                                /*     RFM69 (DIO0) --------- D2  |     UNO     |  A2                                 */
                                /*            DHT22 --------- D3  |             |  A1                                 */
                                /*            Power --------- D4  | ATMEGA 328p |  A0 --------- Light dep. resistor   */
                                /*              +3v --------- VCC |             | GND --------- GND                   */
                                /*              GND --------- GND |  8MHz int.  | REF                                 */
                                /*                            OSC |             | VCC --------- +3v                   */
                                /*                            OSC |             | D13 --------- RFM69 (SCK)           */
                                /*                            D5  |             | D12 --------- RFM69 (MISO)          */
                                /*                            D6  |             | D11 --------- RFM69 (MOSI)          */
                                /*                            D7  |             | D10 --------- RFM69 (NSS)           */
                                /*                            D8  |             |  D9                                 */
                                /*                                ---------------                                     */
                                /*                                                                                    */
                                /* Power = Vcc for LDR.                                                               */
                                /* +3v = 2*AA                                                                         */
                                /*                                                                                    */
                                /**************************************************************************************/
                                
                                #include <SPI.h>
                                #include <MySensor.h>
                                #include <dht.h>
                                #include <MyTransportRFM69.h>
                                #include <MySigningAtsha204Soft.h>
                                
                                #define CHILD_ID_HUM 0
                                #define CHILD_ID_TEMP 1
                                #define CHILD_ID_LIGHT 2
                                #define CHILD_ID_VOLTAGE 3
                                #define LIGHT_SENSOR_ANALOG_PIN 0
                                #define HUMIDITY_SENSOR_DIGITAL_PIN 3
                                #define POWER_PIN 4
                                //unsigned long SLEEP_TIME = 850000; // Sleep time between reads (in milliseconds) (close to 15')
                                unsigned long SLEEP_TIME = 275000; // Sleep time between reads (in milliseconds) (close to 5')
                                
                                //Construct MySensors library
                                MySigningAtsha204Soft signer;
                                MyHwATMega328 hw;
                                MyTransportRFM69 transport;
                                MySensor gw(transport, hw, signer);
                                dht DHT;
                                MyMessage msgHum(CHILD_ID_HUM, V_HUM);
                                MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
                                MyMessage msgLum(CHILD_ID_LIGHT, V_LEVEL);
                                MyMessage msgVolt(CHILD_ID_VOLTAGE, V_VOLTAGE);
                                
                                /**************************************************************************************/
                                /* Initialization                                                                     */
                                /**************************************************************************************/
                                void setup()
                                  {
                                  //Get time (for setup duration)
                                  #ifdef DEBUG
                                    unsigned long startTime = millis();
                                  #endif
                                
                                  //Start MySensors
                                  gw.begin();
                                
                                  //Send the Sketch Version Information to the Gateway
                                  gw.sendSketchInfo("GHAS sensor", "1.1.5");
                                
                                  //Register all sensors to gw (they will be created as child devices)
                                  gw.present(CHILD_ID_HUM, S_HUM);
                                  gw.present(CHILD_ID_TEMP, S_TEMP);
                                  gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
                                  gw.present(CHILD_ID_VOLTAGE, S_MULTIMETER);
                                
                                  //Delay for DHT22
                                  delay(1500);
                                
                                  //Print setup debug
                                  #ifdef DEBUG
                                    int duration = millis() - startTime;
                                    Serial.print("[Setup duration: "); Serial.print(duration, DEC); Serial.println(" ms]");
                                  #endif
                                  }
                                
                                /**************************************************************************************/
                                /* Main loop                                                                          */
                                /**************************************************************************************/
                                void loop()
                                  {
                                  //Get time (for a complete loop)
                                  #ifdef DEBUG
                                    unsigned long startTime = millis();
                                  #endif
                                
                                  //Power on
                                  powerOnPeripherals();
                                
                                  //Get DHT22 data
                                  int dht22Result = DHT.read22(HUMIDITY_SENSOR_DIGITAL_PIN);
                                  switch (dht22Result)
                                    {
                                    case DHTLIB_OK:  
                                                //Serial.println("OK,\t");
                                                break;
                                    case DHTLIB_ERROR_CHECKSUM:
                                                #ifdef DEBUG
                                                  Serial.println("Checksum error,\t");
                                                #endif
                                                break;
                                    case DHTLIB_ERROR_TIMEOUT:
                                                #ifdef DEBUG
                                                  Serial.println("Time out error,\t");
                                                #endif
                                                break;
                                    case DHTLIB_ERROR_CONNECT:
                                                #ifdef DEBUG
                                                  Serial.println("Connect error,\t");
                                                #endif
                                                break;
                                    case DHTLIB_ERROR_ACK_L:
                                                #ifdef DEBUG
                                                  Serial.println("Ack Low error,\t");
                                                #endif
                                                break;
                                    case DHTLIB_ERROR_ACK_H:
                                                #ifdef DEBUG
                                                  Serial.println("Ack High error,\t");
                                                #endif
                                                break;
                                    default:
                                                #ifdef DEBUG
                                                  Serial.println("Unknown error,\t");
                                                #endif
                                                break;
                                    }
                                
                                  //Get temperature and humidity
                                  float temperature = 0;
                                  float humidity = 0;
                                  if (dht22Result == DHTLIB_OK)
                                    {
                                    temperature = DHT.temperature;
                                    humidity = DHT.humidity;
                                    }
                                
                                  //Get power before luminosity to use real voltage
                                  float realVoltage = getVoltage() / 100.0;
                                  int batteryPcnt = realVoltage * 100 / 3.0;
                                  if (batteryPcnt > 100) {batteryPcnt = 100;}
                                  int lux = computeIlluminance(realVoltage);
                                
                                  //Power off
                                  powerOffPeripherals();
                                
                                  //Send data to gateway
                                  gw.send(msgHum.set(humidity, 1));
                                  gw.send(msgTemp.set(temperature, 1));
                                  gw.send(msgLum.set(lux));
                                  gw.send(msgVolt.set(realVoltage, 2));
                                  gw.sendBatteryLevel(batteryPcnt);
                                
                                  //Print debug
                                  #ifdef DEBUG
                                    Serial.print(temperature, 1);
                                    Serial.print(" degC");
                                    Serial.print("   ");
                                    Serial.print(humidity, 1);
                                    Serial.print(" %");
                                    Serial.print("   ");
                                    Serial.print(lux);
                                    Serial.print(" lx");
                                    Serial.print("   ");
                                    Serial.print(realVoltage);
                                    Serial.print(" v");
                                    int duration = millis() - startTime;
                                    Serial.print("   ");
                                    Serial.print("["); Serial.print(duration, DEC); Serial.println(" ms]");
                                    Serial.flush();
                                  #endif
                                
                                  //Sleep
                                  gw.sleep(SLEEP_TIME);
                                  }
                                
                                /**************************************************************************************/
                                /* Allows to compute illuminance (in LUX) from LIGHT_SENSOR_ANALOG_PIN.               */
                                /**************************************************************************************/
                                int computeIlluminance(float realVoltage)
                                  {
                                  //Get luminosity
                                  int luminosity = analogRead(LIGHT_SENSOR_ANALOG_PIN);
                                  //Calculating the voltage in the input of the ADC
                                  double voltage = realVoltage * ((double)luminosity / 1024.0);
                                  //Calculating the resistance of the photoresistor in the voltage divider
                                  double resistance = (10.0 * realVoltage) / voltage - 10.0;
                                  //Calculating the intensity of light in lux and return it
                                  int illuminance = 255.84 * pow(resistance, -10/9);
                                  return illuminance;
                                  }
                                
                                /**************************************************************************************/
                                /* Allows to get the real Vcc (return value * 100).                                   */
                                /**************************************************************************************/
                                int getVoltage()
                                  {
                                  const long InternalReferenceVoltage = 1056L;
                                  ADMUX = (0<<REFS1) | (1<<REFS0) | (0<<ADLAR) | (1<<MUX3) | (1<<MUX2) | (1<<MUX1) | (0<<MUX0);
                                  delay(50);  // Let mux settle a little to get a more stable A/D conversion
                                  //Start a conversion  
                                  ADCSRA |= _BV( ADSC );
                                  //Wait for it to complete
                                  while (((ADCSRA & (1<<ADSC)) != 0));
                                  //Scale the value
                                  int result = (((InternalReferenceVoltage * 1023L) / ADC) + 5L) / 10L;
                                  return result;
                                  }
                                
                                /**************************************************************************************/
                                /* Allows to power ON peripherals.                                                    */
                                /**************************************************************************************/
                                void powerOnPeripherals()
                                  {
                                  //Power-up
                                  pinMode (POWER_PIN, OUTPUT);
                                  digitalWrite (POWER_PIN, HIGH);
                                  delay(1);
                                  }
                                
                                /**************************************************************************************/
                                /* Allows to power OFF peripherals.                                                   */
                                /**************************************************************************************/
                                void powerOffPeripherals()
                                  {
                                  //Power off
                                  digitalWrite (HUMIDITY_SENSOR_DIGITAL_PIN, LOW);
                                  digitalWrite (POWER_PIN, LOW);
                                  pinMode (HUMIDITY_SENSOR_DIGITAL_PIN, INPUT);
                                  pinMode (POWER_PIN, INPUT);
                                  }
                                

                                Hope it helps !

                                David.

                                siodS Offline
                                siodS Offline
                                siod
                                wrote on last edited by
                                #58

                                @carlierd said:

                                @ar91 Please find the code I used in 3 different nodes. The good thing with the playground lib is that there is error message if dialog with DHT22 failed.

                                /**
                                 * The MySensors Arduino library handles the wireless radio link and protocol
                                 * between your home built sensors/actuators and HA controller of choice.
                                 * The sensors forms a self healing radio network with optional repeaters. Each
                                 * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                                 * network topology allowing messages to be routed to nodes.
                                 *
                                 * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                                 * Copyright (C) 2013-2015 Sensnology AB
                                 * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                                 *
                                 * Documentation: http://www.mysensors.org
                                 * Support Forum: http://forum.mysensors.org
                                 *
                                 * This program is free software; you can redistribute it and/or
                                 * modify it under the terms of the GNU General Public License
                                 * version 2 as published by the Free Software Foundation.
                                 *
                                 */
                                
                                /**************************************************************************************/
                                /* Temperature, humidity and luminosity measurements.                                 */
                                /*                                                                                    */
                                /* Version     : 1.1.6                                                                */
                                /* Date        : 10/01/2016                                                           */
                                /* Modified by : David Carlier                                                        */
                                /**************************************************************************************/
                                /*                                ---------------                                     */
                                /*                            RST |             |  A5                                 */
                                /*                            RX  |             |  A4                                 */
                                /*                            TX  |   ARDUINO   |  A3                                 */
                                /*     RFM69 (DIO0) --------- D2  |     UNO     |  A2                                 */
                                /*            DHT22 --------- D3  |             |  A1                                 */
                                /*            Power --------- D4  | ATMEGA 328p |  A0 --------- Light dep. resistor   */
                                /*              +3v --------- VCC |             | GND --------- GND                   */
                                /*              GND --------- GND |  8MHz int.  | REF                                 */
                                /*                            OSC |             | VCC --------- +3v                   */
                                /*                            OSC |             | D13 --------- RFM69 (SCK)           */
                                /*                            D5  |             | D12 --------- RFM69 (MISO)          */
                                /*                            D6  |             | D11 --------- RFM69 (MOSI)          */
                                /*                            D7  |             | D10 --------- RFM69 (NSS)           */
                                /*                            D8  |             |  D9                                 */
                                /*                                ---------------                                     */
                                /*                                                                                    */
                                /* Power = Vcc for LDR.                                                               */
                                /* +3v = 2*AA                                                                         */
                                /*                                                                                    */
                                /**************************************************************************************/
                                
                                #include <SPI.h>
                                #include <MySensor.h>
                                #include <dht.h>
                                #include <MyTransportRFM69.h>
                                #include <MySigningAtsha204Soft.h>
                                
                                #define CHILD_ID_HUM 0
                                #define CHILD_ID_TEMP 1
                                #define CHILD_ID_LIGHT 2
                                #define CHILD_ID_VOLTAGE 3
                                #define LIGHT_SENSOR_ANALOG_PIN 0
                                #define HUMIDITY_SENSOR_DIGITAL_PIN 3
                                #define POWER_PIN 4
                                //unsigned long SLEEP_TIME = 850000; // Sleep time between reads (in milliseconds) (close to 15')
                                unsigned long SLEEP_TIME = 275000; // Sleep time between reads (in milliseconds) (close to 5')
                                
                                //Construct MySensors library
                                MySigningAtsha204Soft signer;
                                MyHwATMega328 hw;
                                MyTransportRFM69 transport;
                                MySensor gw(transport, hw, signer);
                                dht DHT;
                                MyMessage msgHum(CHILD_ID_HUM, V_HUM);
                                MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
                                MyMessage msgLum(CHILD_ID_LIGHT, V_LEVEL);
                                MyMessage msgVolt(CHILD_ID_VOLTAGE, V_VOLTAGE);
                                
                                /**************************************************************************************/
                                /* Initialization                                                                     */
                                /**************************************************************************************/
                                void setup()
                                  {
                                  //Get time (for setup duration)
                                  #ifdef DEBUG
                                    unsigned long startTime = millis();
                                  #endif
                                
                                  //Start MySensors
                                  gw.begin();
                                
                                  //Send the Sketch Version Information to the Gateway
                                  gw.sendSketchInfo("GHAS sensor", "1.1.5");
                                
                                  //Register all sensors to gw (they will be created as child devices)
                                  gw.present(CHILD_ID_HUM, S_HUM);
                                  gw.present(CHILD_ID_TEMP, S_TEMP);
                                  gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
                                  gw.present(CHILD_ID_VOLTAGE, S_MULTIMETER);
                                
                                  //Delay for DHT22
                                  delay(1500);
                                
                                  //Print setup debug
                                  #ifdef DEBUG
                                    int duration = millis() - startTime;
                                    Serial.print("[Setup duration: "); Serial.print(duration, DEC); Serial.println(" ms]");
                                  #endif
                                  }
                                
                                /**************************************************************************************/
                                /* Main loop                                                                          */
                                /**************************************************************************************/
                                void loop()
                                  {
                                  //Get time (for a complete loop)
                                  #ifdef DEBUG
                                    unsigned long startTime = millis();
                                  #endif
                                
                                  //Power on
                                  powerOnPeripherals();
                                
                                  //Get DHT22 data
                                  int dht22Result = DHT.read22(HUMIDITY_SENSOR_DIGITAL_PIN);
                                  switch (dht22Result)
                                    {
                                    case DHTLIB_OK:  
                                                //Serial.println("OK,\t");
                                                break;
                                    case DHTLIB_ERROR_CHECKSUM:
                                                #ifdef DEBUG
                                                  Serial.println("Checksum error,\t");
                                                #endif
                                                break;
                                    case DHTLIB_ERROR_TIMEOUT:
                                                #ifdef DEBUG
                                                  Serial.println("Time out error,\t");
                                                #endif
                                                break;
                                    case DHTLIB_ERROR_CONNECT:
                                                #ifdef DEBUG
                                                  Serial.println("Connect error,\t");
                                                #endif
                                                break;
                                    case DHTLIB_ERROR_ACK_L:
                                                #ifdef DEBUG
                                                  Serial.println("Ack Low error,\t");
                                                #endif
                                                break;
                                    case DHTLIB_ERROR_ACK_H:
                                                #ifdef DEBUG
                                                  Serial.println("Ack High error,\t");
                                                #endif
                                                break;
                                    default:
                                                #ifdef DEBUG
                                                  Serial.println("Unknown error,\t");
                                                #endif
                                                break;
                                    }
                                
                                  //Get temperature and humidity
                                  float temperature = 0;
                                  float humidity = 0;
                                  if (dht22Result == DHTLIB_OK)
                                    {
                                    temperature = DHT.temperature;
                                    humidity = DHT.humidity;
                                    }
                                
                                  //Get power before luminosity to use real voltage
                                  float realVoltage = getVoltage() / 100.0;
                                  int batteryPcnt = realVoltage * 100 / 3.0;
                                  if (batteryPcnt > 100) {batteryPcnt = 100;}
                                  int lux = computeIlluminance(realVoltage);
                                
                                  //Power off
                                  powerOffPeripherals();
                                
                                  //Send data to gateway
                                  gw.send(msgHum.set(humidity, 1));
                                  gw.send(msgTemp.set(temperature, 1));
                                  gw.send(msgLum.set(lux));
                                  gw.send(msgVolt.set(realVoltage, 2));
                                  gw.sendBatteryLevel(batteryPcnt);
                                
                                  //Print debug
                                  #ifdef DEBUG
                                    Serial.print(temperature, 1);
                                    Serial.print(" degC");
                                    Serial.print("   ");
                                    Serial.print(humidity, 1);
                                    Serial.print(" %");
                                    Serial.print("   ");
                                    Serial.print(lux);
                                    Serial.print(" lx");
                                    Serial.print("   ");
                                    Serial.print(realVoltage);
                                    Serial.print(" v");
                                    int duration = millis() - startTime;
                                    Serial.print("   ");
                                    Serial.print("["); Serial.print(duration, DEC); Serial.println(" ms]");
                                    Serial.flush();
                                  #endif
                                
                                  //Sleep
                                  gw.sleep(SLEEP_TIME);
                                  }
                                
                                /**************************************************************************************/
                                /* Allows to compute illuminance (in LUX) from LIGHT_SENSOR_ANALOG_PIN.               */
                                /**************************************************************************************/
                                int computeIlluminance(float realVoltage)
                                  {
                                  //Get luminosity
                                  int luminosity = analogRead(LIGHT_SENSOR_ANALOG_PIN);
                                  //Calculating the voltage in the input of the ADC
                                  double voltage = realVoltage * ((double)luminosity / 1024.0);
                                  //Calculating the resistance of the photoresistor in the voltage divider
                                  double resistance = (10.0 * realVoltage) / voltage - 10.0;
                                  //Calculating the intensity of light in lux and return it
                                  int illuminance = 255.84 * pow(resistance, -10/9);
                                  return illuminance;
                                  }
                                
                                /**************************************************************************************/
                                /* Allows to get the real Vcc (return value * 100).                                   */
                                /**************************************************************************************/
                                int getVoltage()
                                  {
                                  const long InternalReferenceVoltage = 1056L;
                                  ADMUX = (0<<REFS1) | (1<<REFS0) | (0<<ADLAR) | (1<<MUX3) | (1<<MUX2) | (1<<MUX1) | (0<<MUX0);
                                  delay(50);  // Let mux settle a little to get a more stable A/D conversion
                                  //Start a conversion  
                                  ADCSRA |= _BV( ADSC );
                                  //Wait for it to complete
                                  while (((ADCSRA & (1<<ADSC)) != 0));
                                  //Scale the value
                                  int result = (((InternalReferenceVoltage * 1023L) / ADC) + 5L) / 10L;
                                  return result;
                                  }
                                
                                /**************************************************************************************/
                                /* Allows to power ON peripherals.                                                    */
                                /**************************************************************************************/
                                void powerOnPeripherals()
                                  {
                                  //Power-up
                                  pinMode (POWER_PIN, OUTPUT);
                                  digitalWrite (POWER_PIN, HIGH);
                                  delay(1);
                                  }
                                
                                /**************************************************************************************/
                                /* Allows to power OFF peripherals.                                                   */
                                /**************************************************************************************/
                                void powerOffPeripherals()
                                  {
                                  //Power off
                                  digitalWrite (HUMIDITY_SENSOR_DIGITAL_PIN, LOW);
                                  digitalWrite (POWER_PIN, LOW);
                                  pinMode (HUMIDITY_SENSOR_DIGITAL_PIN, INPUT);
                                  pinMode (POWER_PIN, INPUT);
                                  }
                                

                                Hope it helps !

                                David.

                                So the DHT22 works at 1MHz with 2 AAs and your code you´ve posted? No physical differnces?

                                still learning...

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

                                  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 1 Reply Last reply
                                  0
                                  • 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
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          26

                                          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