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. Hardware
  3. 1mhz hardware

1mhz hardware

Scheduled Pinned Locked Moved Hardware
27 Posts 8 Posters 7.6k Views 5 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.
  • Nca78N Offline
    Nca78N Offline
    Nca78
    Hardware Contributor
    wrote on last edited by
    #4

    Hello, no idea with the wake up time, I didn't check it at 1MHz, but it should not vary as it's based on the watchdog timer which is always at 128KHz, and not related to the main clock frequency and multiplier.

    For the battery level do you use a divider ? That's useful if you have a booster, but for a CR2032 directly connected to Vcc the most simple way is to measure the supply voltage. Please note that my measurement is not exact as value should be adjusted to the exact voltage of the "1.1V" reference voltage of the atmega.

    #include <SystemStatus.h>
    // Parameters for VCC measurement
    const int VccMin        = 2000;  // Minimum expected Vcc level, in Volts. At 2V the cell should be dead
    const int VccMax        = 2900;  // Maximum expected Vcc level, in Volts.
    SystemStatus vcc();
    int LastBatteryPercent = 200; // so we are sure to send the battery level at first check
    
        int currentBatteryPercent = SystemStatus().getVCCPercent(VccMin, VccMax);
        if (currentBatteryPercent != LastBatteryPercent) {
            LastBatteryPercent = currentBatteryPercent;
            sendBatteryLevel(currentBatteryPercent);
        }
    
    
    CrankyCoderC 1 Reply Last reply
    0
    • T TimO

      Did you change the board definition within the Arduino IDE so that the code is compiled for 1 MHz? If not, the timing wont match. :)

      According battery:

      100 % = Vmax = 3.44 Volts
      0 % = 0 V

      CrankyCoderC Offline
      CrankyCoderC Offline
      CrankyCoder
      wrote on last edited by
      #5

      @TimO Here is my definition in my boards.txt

      ## Arduino Pro or Pro Mini (1.8V, 1 MHz) w/ ATmega328
      ## --------------------------------------------------
      pro.menu.cpu.1MHzatmega328=ATmega328 (1.8V, 1 MHz)
      
      pro.menu.cpu.1MHzatmega328.upload.maximum_size=30720
      pro.menu.cpu.1MHzatmega328.upload.maximum_data_size=2048
      pro.menu.cpu.1MHzatmega328.upload.speed=9600
      
      pro.menu.cpu.1MHzatmega328.bootloader.low_fuses=0x62
      pro.menu.cpu.1MHzatmega328.bootloader.high_fuses=0xD4
      pro.menu.cpu.1MHzatmega328.bootloader.extended_fuses=0x06
      pro.menu.cpu.1MHzatmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_1MHz.hex
      
      pro.menu.cpu.1MHzatmega328.build.mcu=atmega328p
      pro.menu.cpu.1MHzatmega328.build.f_cpu=1000000L
      

      Home Automation Tinkerer
      www.CrankyCoder.net

      Controller: HomeAssistant in Kubernetes
      Gateway: MQTTClientGateway
      MySensors: 2.3

      1 Reply Last reply
      0
      • Nca78N Nca78

        Hello, no idea with the wake up time, I didn't check it at 1MHz, but it should not vary as it's based on the watchdog timer which is always at 128KHz, and not related to the main clock frequency and multiplier.

        For the battery level do you use a divider ? That's useful if you have a booster, but for a CR2032 directly connected to Vcc the most simple way is to measure the supply voltage. Please note that my measurement is not exact as value should be adjusted to the exact voltage of the "1.1V" reference voltage of the atmega.

        #include <SystemStatus.h>
        // Parameters for VCC measurement
        const int VccMin        = 2000;  // Minimum expected Vcc level, in Volts. At 2V the cell should be dead
        const int VccMax        = 2900;  // Maximum expected Vcc level, in Volts.
        SystemStatus vcc();
        int LastBatteryPercent = 200; // so we are sure to send the battery level at first check
        
            int currentBatteryPercent = SystemStatus().getVCCPercent(VccMin, VccMax);
            if (currentBatteryPercent != LastBatteryPercent) {
                LastBatteryPercent = currentBatteryPercent;
                sendBatteryLevel(currentBatteryPercent);
            }
        
        
        CrankyCoderC Offline
        CrankyCoderC Offline
        CrankyCoder
        wrote on last edited by
        #6

        @Nca78 yes currently using a voltage divider. if i go to measuring the supply voltage alone that will get rid of the extra components I may not be needing atleast for this node.

        I will try your example. Thanks!

        Home Automation Tinkerer
        www.CrankyCoder.net

        Controller: HomeAssistant in Kubernetes
        Gateway: MQTTClientGateway
        MySensors: 2.3

        1 Reply Last reply
        0
        • YveauxY Yveaux

          @Jason-Brunk said:

          It does wake up, but not quite on the hour

          Can you be more explicit? How much time is there inbetween wakeups? The watchdog will always be a bit off, but it should only be a few %

          CrankyCoderC Offline
          CrankyCoderC Offline
          CrankyCoder
          wrote on last edited by
          #7

          @Yveaux Ok. so it checked in at 3:17am this morning. it did not check in again until 1:58 this afternoon. :)

          Home Automation Tinkerer
          www.CrankyCoder.net

          Controller: HomeAssistant in Kubernetes
          Gateway: MQTTClientGateway
          MySensors: 2.3

          mfalkviddM 1 Reply Last reply
          0
          • CrankyCoderC CrankyCoder

            @Yveaux Ok. so it checked in at 3:17am this morning. it did not check in again until 1:58 this afternoon. :)

            mfalkviddM Online
            mfalkviddM Online
            mfalkvidd
            Mod
            wrote on last edited by mfalkvidd
            #8

            @Jason-Brunk that's almost 10 hours. My guess is that the timer is 8x off (if the code expects 8Mhz but is running at 1Mhz). Try recompiling with 1MHz board settings or divide the time by 8 in the sketch)

            CrankyCoderC 1 Reply Last reply
            0
            • mfalkviddM mfalkvidd

              @Jason-Brunk that's almost 10 hours. My guess is that the timer is 8x off (if the code expects 8Mhz but is running at 1Mhz). Try recompiling with 1MHz board settings or divide the time by 8 in the sketch)

              CrankyCoderC Offline
              CrankyCoderC Offline
              CrankyCoder
              wrote on last edited by
              #9

              @mfalkvidd Ill reflash it. Just wondering if there is something in the code I should change to tell it it's running at 1mhz or if that's something that is supposed to just work based on the clock timing

              Home Automation Tinkerer
              www.CrankyCoder.net

              Controller: HomeAssistant in Kubernetes
              Gateway: MQTTClientGateway
              MySensors: 2.3

              mfalkviddM m26872M 2 Replies Last reply
              0
              • CrankyCoderC CrankyCoder

                @mfalkvidd Ill reflash it. Just wondering if there is something in the code I should change to tell it it's running at 1mhz or if that's something that is supposed to just work based on the clock timing

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

                @Jason-Brunk I think the Arduino IDE is supposed to handle all that if the correct board is selected. I know that timings are off if I select 16MHz pro mini in the IDE and then flash to a 8MHz Arduino. It is also easily noticeable on the serial monitor, which will require a setting of twice the baud rate set in Serial.begin. I have never built a 1MHz node though.

                1 Reply Last reply
                0
                • scalzS Offline
                  scalzS Offline
                  scalz
                  Hardware Contributor
                  wrote on last edited by scalz
                  #11

                  @Jason-Brunk why not falsh your node for internal 8mhz for instance, and then use 1Mhz in sketch ? On my side, I prefer this way..and it works for me at least.
                  when the node is not sleeping, and radio is not sleeping in RX mode for instance, there is no big saving to do this, only atmel consumption is low, radio is not..but if your radio is sleeping, yep it's interesting but I don't really see advantage to start node at 1Mhz as the radio does not sleep at startup and does the protocol stuff.

                  1 Reply Last reply
                  0
                  • CrankyCoderC CrankyCoder

                    @mfalkvidd Ill reflash it. Just wondering if there is something in the code I should change to tell it it's running at 1mhz or if that's something that is supposed to just work based on the clock timing

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

                    @Jason-Brunk said:

                    Just wondering if there is something in the code I should change to tell it it's running at 1mhz or if that's something that is supposed to just work based on the clock timing

                    Clock settings are determined by the"fuses". What's your tool for fuses and bootloader programming? Are you sure you programmed the fuses as in your "boards.txt" above?

                    Nca78N 1 Reply Last reply
                    0
                    • m26872M m26872

                      @Jason-Brunk said:

                      Just wondering if there is something in the code I should change to tell it it's running at 1mhz or if that's something that is supposed to just work based on the clock timing

                      Clock settings are determined by the"fuses". What's your tool for fuses and bootloader programming? Are you sure you programmed the fuses as in your "boards.txt" above?

                      Nca78N Offline
                      Nca78N Offline
                      Nca78
                      Hardware Contributor
                      wrote on last edited by
                      #13

                      @m26872 said:

                      @Jason-Brunk said:

                      Just wondering if there is something in the code I should change to tell it it's running at 1mhz or if that's something that is supposed to just work based on the clock timing

                      Clock settings are determined by the"fuses". What's your tool for fuses and bootloader programming? Are you sure you programmed the fuses as in your "boards.txt" above?

                      My understanding was that the "burn bootloader" function of the Arduino IDE will also write the fuses, no ?

                      From Arduino website :
                      "How does it work?

                      The "Burn Bootloader" commands in the Arduino environment use an open-source tool, avrdude. There are four steps: unlocking the bootloader section of the chip, setting the the fuses on the chip, uploading the bootloader code to the chip, and locking the bootloader section of the chip"

                      m26872M 1 Reply Last reply
                      0
                      • Nca78N Nca78

                        @m26872 said:

                        @Jason-Brunk said:

                        Just wondering if there is something in the code I should change to tell it it's running at 1mhz or if that's something that is supposed to just work based on the clock timing

                        Clock settings are determined by the"fuses". What's your tool for fuses and bootloader programming? Are you sure you programmed the fuses as in your "boards.txt" above?

                        My understanding was that the "burn bootloader" function of the Arduino IDE will also write the fuses, no ?

                        From Arduino website :
                        "How does it work?

                        The "Burn Bootloader" commands in the Arduino environment use an open-source tool, avrdude. There are four steps: unlocking the bootloader section of the chip, setting the the fuses on the chip, uploading the bootloader code to the chip, and locking the bootloader section of the chip"

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

                        @Nca78 True. And I suppose you've also double checked the verbose output from that process.
                        Can't help you further. I would try soft 1MHz instead then, as @scalz suggested.

                        Nca78N 1 Reply Last reply
                        0
                        • CrankyCoderC Offline
                          CrankyCoderC Offline
                          CrankyCoder
                          wrote on last edited by
                          #15

                          Ok. So I got back in town and reflashed my bootloader. Claims it's running 1mhz now. No regulator, no leds. Even in sleep mode I am sitting at about 1.66ma. Which in deep sleep mode that seems really high. Considering the capacity of a coin cell i am looking at changing out about once every 2 weeks with no use.

                          Any thoughts? Recommendations? Just can't seem to get this running low power enough. Not sure if my hardware is junk or what. But i would take any recommendations or tests to see how to get this working since i have a small stack of these pro minis

                          Home Automation Tinkerer
                          www.CrankyCoder.net

                          Controller: HomeAssistant in Kubernetes
                          Gateway: MQTTClientGateway
                          MySensors: 2.3

                          1 Reply Last reply
                          0
                          • Nca78N Offline
                            Nca78N Offline
                            Nca78
                            Hardware Contributor
                            wrote on last edited by
                            #16

                            There's obviously a problem, I'm at about 1/1000 of that in sleep mode, you're sure your multimeter is not mistaking the unit ? ;)
                            I have cheap pro minis too, the < 2$ kind.

                            1mA+ in sleep mode sounds like a voltage regulator still connected, or the IC not sleeping, at least not in power down mode like when using the MySensors function. Are you sure you didn't leave a #define by mistake (like activating the repeater function with #define MY_REPEATER_FEATURE) that would prevent the atmega from sleeping ?

                            1 Reply Last reply
                            0
                            • CrankyCoderC Offline
                              CrankyCoderC Offline
                              CrankyCoder
                              wrote on last edited by
                              #17

                              I checked, no REPEATER on.

                              Here is the code for my loop()

                              int whichbutton = 0;
                              
                              whichbutton = sleep(digitalPinToInterrupt(2),LOW,digitalPinToInterrupt(3),LOW,86400000);
                              
                              switch (whichbutton) {
                                case digitalPinToInterrupt(2):
                                    {//off
                                    send(msg_light.set(0),true);
                                    wait(300);
                                    break;
                                    }
                                case digitalPinToInterrupt(3):
                                    {//on
                                    send(msg_light.set(1),true);
                                    wait(300);
                                    break;
                                    }
                                  
                                } 
                              sleep(250);
                              CheckBattery();
                              

                              It's not running that over and over for sure. Otherwise I would see the battery value publishing regularly to the broker.

                              I broke the regulator off and the LEDs.
                              This is the one I have.
                              https://www.sparkfun.com/products/11114

                              I don't think the multimeter is misreading it. I can see the battery percentage dropping over the course of a day so it definitely seems like it's pulling more mA than it should sleeping.

                              Home Automation Tinkerer
                              www.CrankyCoder.net

                              Controller: HomeAssistant in Kubernetes
                              Gateway: MQTTClientGateway
                              MySensors: 2.3

                              1 Reply Last reply
                              0
                              • m26872M m26872

                                @Nca78 True. And I suppose you've also double checked the verbose output from that process.
                                Can't help you further. I would try soft 1MHz instead then, as @scalz suggested.

                                Nca78N Offline
                                Nca78N Offline
                                Nca78
                                Hardware Contributor
                                wrote on last edited by
                                #18

                                @m26872 said:

                                @Nca78 True. And I suppose you've also double checked the verbose output from that process.

                                In case someone doesn't believe the Arduino docs ;)
                                This is at the beginning of the bootloader writing process in Arduino IDE:

                                Writing | ################################################## | 100% 0.01s
                                
                                avrdude: 1 bytes of efuse written
                                avrdude: verifying efuse memory against 0x06:
                                avrdude: load data efuse data from input file 0x06:
                                avrdude: input file 0x06 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 "0x62"
                                avrdude: writing lfuse (1 bytes):
                                
                                Writing | ################################################## | 100% 0.00s
                                
                                avrdude: 1 bytes of lfuse written
                                avrdude: verifying lfuse memory against 0x62:
                                avrdude: load data lfuse data from input file 0x62:
                                avrdude: input file 0x62 contains 1 bytes
                                avrdude: reading on-chip lfuse data:
                                
                                m26872M 1 Reply Last reply
                                0
                                • Nca78N Nca78

                                  @m26872 said:

                                  @Nca78 True. And I suppose you've also double checked the verbose output from that process.

                                  In case someone doesn't believe the Arduino docs ;)
                                  This is at the beginning of the bootloader writing process in Arduino IDE:

                                  Writing | ################################################## | 100% 0.01s
                                  
                                  avrdude: 1 bytes of efuse written
                                  avrdude: verifying efuse memory against 0x06:
                                  avrdude: load data efuse data from input file 0x06:
                                  avrdude: input file 0x06 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 "0x62"
                                  avrdude: writing lfuse (1 bytes):
                                  
                                  Writing | ################################################## | 100% 0.00s
                                  
                                  avrdude: 1 bytes of lfuse written
                                  avrdude: verifying lfuse memory against 0x62:
                                  avrdude: load data lfuse data from input file 0x62:
                                  avrdude: input file 0x62 contains 1 bytes
                                  avrdude: reading on-chip lfuse data:
                                  
                                  m26872M Offline
                                  m26872M Offline
                                  m26872
                                  Hardware Contributor
                                  wrote on last edited by
                                  #19

                                  @Nca78
                                  The docs won't tell you if the process fails. The verbose output will. :wink:

                                  1 Reply Last reply
                                  0
                                  • CrankyCoderC Offline
                                    CrankyCoderC Offline
                                    CrankyCoder
                                    wrote on last edited by
                                    #20

                                    hmmm. ok so I have verified I am writing the 1mhz boot loader.

                                    My multimeter says when it's sleeping i am still running at 1.5mah

                                    I have my openhab system tracking the battery usage. IN 6 days I have lost 30% of the battery and it's been in sleep mode.

                                    || *Time* || *Value* ||
                                    || 2016-08-14 19:29:27 || 100 ||
                                    || 2016-08-15 19:07:57 || 80 ||
                                    || 2016-08-15 19:11:18 || 81 ||
                                    || 2016-08-15 19:12:48 || 83 ||
                                    || 2016-08-15 19:13:14 || 76 ||
                                    || 2016-08-15 19:13:17 || 84 ||
                                    || 2016-08-15 19:13:56 || 80 ||
                                    || 2016-08-15 19:16:48 || 78 ||
                                    || 2016-08-19 15:07:57 || 76 ||
                                    || 2016-08-19 15:10:09 || 80 ||
                                    || 2016-08-19 15:12:43 || 79 ||
                                    || 2016-08-19 15:13:49 || 82 ||
                                    || 2016-08-19 15:14:20 || 84 ||
                                    || 2016-08-20 11:44:01 || 69 ||
                                    || 2016-08-20 11:44:23 || 48 ||
                                    || 2016-08-20 11:44:31 || 71 ||
                                    
                                    
                                    

                                    Any thoughts? Any recommendations on maybe a replacement pro mini that will for sure run at <1mah?

                                    Home Automation Tinkerer
                                    www.CrankyCoder.net

                                    Controller: HomeAssistant in Kubernetes
                                    Gateway: MQTTClientGateway
                                    MySensors: 2.3

                                    1 Reply Last reply
                                    0
                                    • cimba007C Offline
                                      cimba007C Offline
                                      cimba007
                                      wrote on last edited by cimba007
                                      #21

                                      remove the power led (1-2mA), remove the voltage regulator if possible (1mA)

                                      CrankyCoderC 1 Reply Last reply
                                      0
                                      • cimba007C cimba007

                                        remove the power led (1-2mA), remove the voltage regulator if possible (1mA)

                                        CrankyCoderC Offline
                                        CrankyCoderC Offline
                                        CrankyCoder
                                        wrote on last edited by
                                        #22

                                        @cimba007 Led was already removed. :(

                                        Home Automation Tinkerer
                                        www.CrankyCoder.net

                                        Controller: HomeAssistant in Kubernetes
                                        Gateway: MQTTClientGateway
                                        MySensors: 2.3

                                        1 Reply Last reply
                                        0
                                        • cimba007C Offline
                                          cimba007C Offline
                                          cimba007
                                          wrote on last edited by
                                          #23

                                          I would only imagine that the VoltageRegulator might be the culprit.

                                          As you said you use a "3v battery" so there is no need for the VoltageRegulator at all. Where do you apply the power? RAW or VCC? To power your Arduino with higher voltages you connect them to RAW which leads to the regulator.

                                          On most of my projects I use 2x AA Battery which are connected directly to VCC .. even with the VoltageRegulator intact I am at 66% for the last 7 days .. not loosing a single %.

                                          PS: Sry .. I missed that you have already removed the voltage regulator + the led.
                                          The library states to use RISING, FALLING, CHANGE as the interrupt mode but you use LOW .. I don't know to which of the 3 this mapps.

                                          But my guess is you are using FALLING .. thus waking your node up if you connect pin 2 or 3 to ground .. which means you have some kind of pull up don't you?

                                          Do you have anything connected to the Arduino ProMini? If so maybe try an empty sketch and remove all connected peripherals. Maybe even you can find some inspiration on this link: http://electronics.stackexchange.com/questions/49182/how-can-i-get-my-atmega328-to-run-for-a-year-on-batteries

                                          Another really good test on the powerdown current is here:

                                          http://www.rocketscream.com/blog/2011/07/04/lightweight-low-power-arduino-library/

                                          with this library (not compatible with mysensor so dont't use at the same time)

                                          https://github.com/rocketscream/Low-Power

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


                                          16

                                          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