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. Troubleshooting
  3. ATMega328p 8Mhz internal, standalone, mysensors low power problem

ATMega328p 8Mhz internal, standalone, mysensors low power problem

Scheduled Pinned Locked Moved Troubleshooting
atmega328plow powerstand alonenrf24l01+
11 Posts 4 Posters 4.0k Views 3 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.
  • T Offline
    T Offline
    torfinn
    wrote on last edited by
    #1

    Hi ! I have started to upgrade mysensors ( 1.5 ) thats been working for a long time to version 2.1.1 but can't seem to get lowpower working.

    Tried most of the stuff out there like different bootloaders and changing NRF24 chips but I end up with 17mA during transmit and between 2,4 - 3,5mA in sleep mode.

    Tried using other low power libraries like http://www.gammon.com.au/power which works nice but is not compatible with mysensors because some parts are already implemented there I guess. With this library I get sleep mode like 20uA but then again can't get mysensors to work. What's the catch ?

    Anyone else have this problem and hopefully a solution for standalone ATMega 328p ?

    AWIA T 2 Replies Last reply
    0
    • T torfinn

      Hi ! I have started to upgrade mysensors ( 1.5 ) thats been working for a long time to version 2.1.1 but can't seem to get lowpower working.

      Tried most of the stuff out there like different bootloaders and changing NRF24 chips but I end up with 17mA during transmit and between 2,4 - 3,5mA in sleep mode.

      Tried using other low power libraries like http://www.gammon.com.au/power which works nice but is not compatible with mysensors because some parts are already implemented there I guess. With this library I get sleep mode like 20uA but then again can't get mysensors to work. What's the catch ?

      Anyone else have this problem and hopefully a solution for standalone ATMega 328p ?

      AWIA Offline
      AWIA Offline
      AWI
      Hero Member
      wrote on last edited by
      #2

      @torfinn I cannot reproduce this. Can you post your sketch?

      T 1 Reply Last reply
      0
      • AWIA AWI

        @torfinn I cannot reproduce this. Can you post your sketch?

        T Offline
        T Offline
        torfinn
        wrote on last edited by AWI
        #3

        @AWI

        Here is a minimal sketch I am testing with:

        #define MY_RADIO_NRF24
        #include <SPI.h>
        #include <MySensors.h>  
        #include <DHT.h>
        
        #define DHT_DATA_PIN 8
        #define SENSOR_TEMP_OFFSET 0
        
        static const uint64_t UPDATE_INTERVAL = 60000;
        
        #define CHILD_ID_HUM 0
        #define CHILD_ID_TEMP 1
        
        MyMessage msgHum(CHILD_ID_HUM, V_HUM);
        MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
        DHT dht;
        
        void presentation()  
        { 
          sendSketchInfo("TemperatureAndHumidity", "2.2");
          present(CHILD_ID_HUM, S_HUM);
          present(CHILD_ID_TEMP, S_TEMP);
        }
        
        void setup()
        {
         
        }
        
        void loop()      
        {  
          dht.readSensor(true);
          float temperature = dht.getTemperature();
          float humidity = dht.getHumidity();
          send(msgHum.set(humidity, 1));
          
          sleep(10000); 
        }
        
        AWIA 1 Reply Last reply
        0
        • T torfinn

          @AWI

          Here is a minimal sketch I am testing with:

          #define MY_RADIO_NRF24
          #include <SPI.h>
          #include <MySensors.h>  
          #include <DHT.h>
          
          #define DHT_DATA_PIN 8
          #define SENSOR_TEMP_OFFSET 0
          
          static const uint64_t UPDATE_INTERVAL = 60000;
          
          #define CHILD_ID_HUM 0
          #define CHILD_ID_TEMP 1
          
          MyMessage msgHum(CHILD_ID_HUM, V_HUM);
          MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
          DHT dht;
          
          void presentation()  
          { 
            sendSketchInfo("TemperatureAndHumidity", "2.2");
            present(CHILD_ID_HUM, S_HUM);
            present(CHILD_ID_TEMP, S_TEMP);
          }
          
          void setup()
          {
           
          }
          
          void loop()      
          {  
            dht.readSensor(true);
            float temperature = dht.getTemperature();
            float humidity = dht.getHumidity();
            send(msgHum.set(humidity, 1));
            
            sleep(10000); 
          }
          
          AWIA Offline
          AWIA Offline
          AWI
          Hero Member
          wrote on last edited by AWI
          #4

          @torfinn nothing wrong with your sketch it should do the trick. Are you sure it worked with low consumption in v1.5?
          (p.s. I put the sketch in your post between code marks for better reading) 0_1490256228810_upload-e508ae50-3ab8-4f21-872d-31cd6ee9f282

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mortommy
            wrote on last edited by
            #5

            I have 4 sensors (temp/hum and contact switch) powered by 3V coin battery and with the library 1.5.4 they run for a year. I also decided to upgrade them to the library 2.1.1 and I got some issues. For example the binarysqwitchsleepsensor doesn't sleep. I also noticed that the initialization has many messages sending failure and that is a heavy blow for the battery, I went back to the 1.5.4.

            AWIA T 3 Replies Last reply
            0
            • M mortommy

              I have 4 sensors (temp/hum and contact switch) powered by 3V coin battery and with the library 1.5.4 they run for a year. I also decided to upgrade them to the library 2.1.1 and I got some issues. For example the binarysqwitchsleepsensor doesn't sleep. I also noticed that the initialization has many messages sending failure and that is a heavy blow for the battery, I went back to the 1.5.4.

              AWIA Offline
              AWIA Offline
              AWI
              Hero Member
              wrote on last edited by AWI
              #6

              @mortommy that explains something. The 2.x version is more strict in guaranteeing communication is working. There are some tricks to get around it.

              1 Reply Last reply
              0
              • T Offline
                T Offline
                torfinn
                wrote on last edited by
                #7

                Thank's for your feedback.

                Did you use the usual gw.sleep command on 1.5.4 or any other lowpower libraries ?

                1 Reply Last reply
                0
                • M mortommy

                  I have 4 sensors (temp/hum and contact switch) powered by 3V coin battery and with the library 1.5.4 they run for a year. I also decided to upgrade them to the library 2.1.1 and I got some issues. For example the binarysqwitchsleepsensor doesn't sleep. I also noticed that the initialization has many messages sending failure and that is a heavy blow for the battery, I went back to the 1.5.4.

                  T Offline
                  T Offline
                  torfinn
                  wrote on last edited by
                  #8

                  Could it be board related ? I am using Arduino 1.8.1. I tried compiling with Ardino Pro / ATmega 328p 8Mhz as stock setup and now using both bootloader and setup from here: https://github.com/MCUdude/MiniCore/blob/master/README.md#boards-manager-installation

                  I was just thinking that maybe some of the command in the mysensors library are disabled if it detects another board setting ?

                  Also anyone know if the pin 2 / IRQ should be used ? Its not connected in my project could it be that mysensors is awakened by this ?

                  1 Reply Last reply
                  0
                  • T torfinn

                    Hi ! I have started to upgrade mysensors ( 1.5 ) thats been working for a long time to version 2.1.1 but can't seem to get lowpower working.

                    Tried most of the stuff out there like different bootloaders and changing NRF24 chips but I end up with 17mA during transmit and between 2,4 - 3,5mA in sleep mode.

                    Tried using other low power libraries like http://www.gammon.com.au/power which works nice but is not compatible with mysensors because some parts are already implemented there I guess. With this library I get sleep mode like 20uA but then again can't get mysensors to work. What's the catch ?

                    Anyone else have this problem and hopefully a solution for standalone ATMega 328p ?

                    T Offline
                    T Offline
                    torfinn
                    wrote on last edited by
                    #9

                    @torfinn RESOLVED:
                    Hi ! I had problem with properly registering on the gateway ( due to chips was used on old version earlier ). After finding this post I tried the https://www.mysensors.org/build/debug#clearing-eeprom and it fixed problem. Looking at 40uA sleeping now :-)

                    1 Reply Last reply
                    1
                    • M mortommy

                      I have 4 sensors (temp/hum and contact switch) powered by 3V coin battery and with the library 1.5.4 they run for a year. I also decided to upgrade them to the library 2.1.1 and I got some issues. For example the binarysqwitchsleepsensor doesn't sleep. I also noticed that the initialization has many messages sending failure and that is a heavy blow for the battery, I went back to the 1.5.4.

                      T Offline
                      T Offline
                      torfinn
                      wrote on last edited by
                      #10

                      @mortommy Hi ! I decided to go with 2.1.1 on new sensors but still have the old 1.5.4 gw running. Had to change frequency to #define MY_RF24_CHANNEL 125 as the 2.1.1 sensors also registered partialy ( temp not humidity ) on the old 1.5 gw.

                      Also tried out #define MY_REPEATER_FEATURE Disabled this seems to do the opposite what i thought. Radio is never turned off ie. 17mA drain.

                      Added the following to try the lower the init etc. and it improves a little.
                      #define MY_REGISTRATION_FEATURE Disabled
                      #define MY_REGISTRATION_RETRIES 1

                      I think its a serious flaw that if the gw for any case locks up our sensors will drain the battery until it's back online again.

                      tekkaT 1 Reply Last reply
                      1
                      • T torfinn

                        @mortommy Hi ! I decided to go with 2.1.1 on new sensors but still have the old 1.5.4 gw running. Had to change frequency to #define MY_RF24_CHANNEL 125 as the 2.1.1 sensors also registered partialy ( temp not humidity ) on the old 1.5 gw.

                        Also tried out #define MY_REPEATER_FEATURE Disabled this seems to do the opposite what i thought. Radio is never turned off ie. 17mA drain.

                        Added the following to try the lower the init etc. and it improves a little.
                        #define MY_REGISTRATION_FEATURE Disabled
                        #define MY_REGISTRATION_RETRIES 1

                        I think its a serious flaw that if the gw for any case locks up our sensors will drain the battery until it's back online again.

                        tekkaT Offline
                        tekkaT Offline
                        tekka
                        Admin
                        wrote on last edited by
                        #11

                        @torfinn said in ATMega328p 8Mhz internal, standalone, mysensors low power problem:

                        #define MY_REGISTRATION_FEATURE Disabled

                        This has no effect, the correct approach would be to comment this line:

                        https://github.com/mysensors/MySensors/blob/master/MyConfig.h#L146

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


                        15

                        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