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. New nrf24l01+ smd

New nrf24l01+ smd

Scheduled Pinned Locked Moved Hardware
39 Posts 9 Posters 19.5k Views 9 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.
  • SweebeeS Offline
    SweebeeS Offline
    Sweebee
    wrote on last edited by
    #28

    ordered the pro mini shields and I'm not disappointed :) As small as you can get:




    Y 1 Reply Last reply
    2
    • SweebeeS Sweebee

      ordered the pro mini shields and I'm not disappointed :) As small as you can get:




      Y Offline
      Y Offline
      Yveaux
      Mod
      wrote on last edited by
      #29

      @Sweebee Very nice indeed!
      I'm very surprised btw that you're using 2xAA to power the PIR. Will it work reliably (no false detections), even when the batteries are running out?
      I use 2xAA to power Pro Mini + nRF and an extra AA to power the PIR. This way the supply to the PIR will stay > 3V over time.

      http://yveaux.blogspot.nl

      SweebeeS 1 Reply Last reply
      0
      • Y Yveaux

        @Sweebee Very nice indeed!
        I'm very surprised btw that you're using 2xAA to power the PIR. Will it work reliably (no false detections), even when the batteries are running out?
        I use 2xAA to power Pro Mini + nRF and an extra AA to power the PIR. This way the supply to the PIR will stay > 3V over time.

        SweebeeS Offline
        SweebeeS Offline
        Sweebee
        wrote on last edited by
        #30

        @Yveaux the pirs work fine if you only have interrupts with CHANGE. I don't use a sleep timer. If you wake it up every minute or so its unreliable yes. but only with interrupts from the pir it works fine. I have 10 pirs like this. Oldest one is from march 2015 and still running.

        Y alexsh1A 2 Replies Last reply
        1
        • SweebeeS Sweebee

          @Yveaux the pirs work fine if you only have interrupts with CHANGE. I don't use a sleep timer. If you wake it up every minute or so its unreliable yes. but only with interrupts from the pir it works fine. I have 10 pirs like this. Oldest one is from march 2015 and still running.

          Y Offline
          Y Offline
          Yveaux
          Mod
          wrote on last edited by
          #31

          @Sweebee Consider yourself lucky then! I have the same issues decribed here when powering using 2xAA.
          I ditched the step-up converter as it introduces too much noise and reduces battery life. The 3xAA solution seems to work reliably though.

          http://yveaux.blogspot.nl

          1 Reply Last reply
          0
          • SweebeeS Sweebee

            @Yveaux the pirs work fine if you only have interrupts with CHANGE. I don't use a sleep timer. If you wake it up every minute or so its unreliable yes. but only with interrupts from the pir it works fine. I have 10 pirs like this. Oldest one is from march 2015 and still running.

            alexsh1A Offline
            alexsh1A Offline
            alexsh1
            wrote on last edited by
            #32

            @Sweebee

            You have an excellent setup - I ordered those adapter as well at oshpark.
            @Yveaux has got a point - I have been struggle to build a reliable PIR on 2xAA batteries. I have just started building it now. 1 year battery life and counting is impressive.

            @Sweebee Would you care to share your code? Maybe there is anything there which gives us some clues though I believe this is more a hardware issue.

            Y 1 Reply Last reply
            0
            • alexsh1A alexsh1

              @Sweebee

              You have an excellent setup - I ordered those adapter as well at oshpark.
              @Yveaux has got a point - I have been struggle to build a reliable PIR on 2xAA batteries. I have just started building it now. 1 year battery life and counting is impressive.

              @Sweebee Would you care to share your code? Maybe there is anything there which gives us some clues though I believe this is more a hardware issue.

              Y Offline
              Y Offline
              Yveaux
              Mod
              wrote on last edited by
              #33

              @alexsh1 said:

              Would you care to share your code? Maybe there is anything there which gives us some clues though I believe this is more a hardware issue.

              Agree. Apparently @Sweebee made modifications to the PIR (mainly to move some capacitors, judging from the photos) but maybe you did some more to improve battery life/stability?

              http://yveaux.blogspot.nl

              1 Reply Last reply
              0
              • SweebeeS Offline
                SweebeeS Offline
                Sweebee
                wrote on last edited by
                #34

                I removed the left capacitor since it's not needed in 3.3v hack. And I moved the right one because otherwise it didn't fit into the case.

                My sketch:

                #include <MySensor.h>
                #include <SPI.h>
                #include <readVcc.h>
                
                // ********** CONFIG **********************************
                
                    #define NODE_ID AUTO          // ID of node
                    #define CHILD_ID 1            // ID of sensor
                    #define PIR_PIN 3             // Pin connected to the PIR
                    
                    #define MIN_V 2000            // empty voltage (0%)
                    #define MAX_V 3200            // full voltage (100%)
                
                // ****************************************************
                
                MyMessage msg(CHILD_ID, V_TRIPPED);
                MySensor node;
                
                int oldBatteryPcnt;
                int sentValue;
                int forceSend = 0;
                
                void setup()
                {
                  node.begin(NULL, NODE_ID, false);
                  node.sendSketchInfo("PIR Sensor", "1.2");
                  node.present(CHILD_ID, S_MOTION);
                  pinMode(PIR_PIN, INPUT);
                  digitalWrite(PIR_PIN, HIGH);
                }
                
                void loop()
                {
                  
                  // Get PIR
                  int value = digitalRead(PIR_PIN); // Get value of PIR
                  if (value != sentValue) { // If status of PIR has changed
                    resend(msg.set(value), 5); // Send PIR status to gateway
                    sentValue = value;
                  }
                
                  // Send batterylevel
                  sendBattery(); 
                
                  // Sleep until something happens with the sensor
                  node.sleep(PIR_PIN-2, CHANGE); 
                }
                
                // FUNCTIONS
                
                void sendBattery() // Send battery percentage to GW
                {
                  forceSend++;
                  int batteryPcnt = min(map(readVcc(), MIN_V, MAX_V, 0, 100), 100); // Get VCC and convert to percentage      
                  if (batteryPcnt != oldBatteryPcnt || forceSend >= 20) { // If battery percentage has changed
                    node.sendBatteryLevel(batteryPcnt); // Send battery percentage to gateway
                    oldBatteryPcnt = batteryPcnt; 
                    forceSend = 0;
                  }
                }
                
                void resend(MyMessage &msg, int repeats) // Resend messages if not received by GW
                {
                  int repeat = 0;
                  int repeatDelay = 0;
                  boolean ack = false;
                
                  while ((ack == false) and (repeat < repeats)) {
                    if (node.send(msg)) {
                      ack = true;
                    } else {
                      ack = false;
                      repeatDelay += 100;
                    } 
                    repeat++;
                    delay(repeatDelay);
                  }
                }
                
                Y M 2 Replies Last reply
                0
                • SweebeeS Sweebee

                  I removed the left capacitor since it's not needed in 3.3v hack. And I moved the right one because otherwise it didn't fit into the case.

                  My sketch:

                  #include <MySensor.h>
                  #include <SPI.h>
                  #include <readVcc.h>
                  
                  // ********** CONFIG **********************************
                  
                      #define NODE_ID AUTO          // ID of node
                      #define CHILD_ID 1            // ID of sensor
                      #define PIR_PIN 3             // Pin connected to the PIR
                      
                      #define MIN_V 2000            // empty voltage (0%)
                      #define MAX_V 3200            // full voltage (100%)
                  
                  // ****************************************************
                  
                  MyMessage msg(CHILD_ID, V_TRIPPED);
                  MySensor node;
                  
                  int oldBatteryPcnt;
                  int sentValue;
                  int forceSend = 0;
                  
                  void setup()
                  {
                    node.begin(NULL, NODE_ID, false);
                    node.sendSketchInfo("PIR Sensor", "1.2");
                    node.present(CHILD_ID, S_MOTION);
                    pinMode(PIR_PIN, INPUT);
                    digitalWrite(PIR_PIN, HIGH);
                  }
                  
                  void loop()
                  {
                    
                    // Get PIR
                    int value = digitalRead(PIR_PIN); // Get value of PIR
                    if (value != sentValue) { // If status of PIR has changed
                      resend(msg.set(value), 5); // Send PIR status to gateway
                      sentValue = value;
                    }
                  
                    // Send batterylevel
                    sendBattery(); 
                  
                    // Sleep until something happens with the sensor
                    node.sleep(PIR_PIN-2, CHANGE); 
                  }
                  
                  // FUNCTIONS
                  
                  void sendBattery() // Send battery percentage to GW
                  {
                    forceSend++;
                    int batteryPcnt = min(map(readVcc(), MIN_V, MAX_V, 0, 100), 100); // Get VCC and convert to percentage      
                    if (batteryPcnt != oldBatteryPcnt || forceSend >= 20) { // If battery percentage has changed
                      node.sendBatteryLevel(batteryPcnt); // Send battery percentage to gateway
                      oldBatteryPcnt = batteryPcnt; 
                      forceSend = 0;
                    }
                  }
                  
                  void resend(MyMessage &msg, int repeats) // Resend messages if not received by GW
                  {
                    int repeat = 0;
                    int repeatDelay = 0;
                    boolean ack = false;
                  
                    while ((ack == false) and (repeat < repeats)) {
                      if (node.send(msg)) {
                        ack = true;
                      } else {
                        ack = false;
                        repeatDelay += 100;
                      } 
                      repeat++;
                      delay(repeatDelay);
                    }
                  }
                  
                  Y Offline
                  Y Offline
                  Yveaux
                  Mod
                  wrote on last edited by Yveaux
                  #35

                  @Sweebee Only real difference I see compared to my sketch is that I'm using a timeout when sleeping, so the watchdog stays enabled while sleeping.
                  According to the datasheet, the AtMega power consumption is roughly 4.7uA vs 0.6uA in powerdown mode with/without watchdog enabled:

                  0_1458297879428_Naamloos.png

                  This is a significant difference, but when including the PIR & nRF in the total power consumption it is only a small part.

                  http://yveaux.blogspot.nl

                  1 Reply Last reply
                  0
                  • SweebeeS Sweebee

                    I removed the left capacitor since it's not needed in 3.3v hack. And I moved the right one because otherwise it didn't fit into the case.

                    My sketch:

                    #include <MySensor.h>
                    #include <SPI.h>
                    #include <readVcc.h>
                    
                    // ********** CONFIG **********************************
                    
                        #define NODE_ID AUTO          // ID of node
                        #define CHILD_ID 1            // ID of sensor
                        #define PIR_PIN 3             // Pin connected to the PIR
                        
                        #define MIN_V 2000            // empty voltage (0%)
                        #define MAX_V 3200            // full voltage (100%)
                    
                    // ****************************************************
                    
                    MyMessage msg(CHILD_ID, V_TRIPPED);
                    MySensor node;
                    
                    int oldBatteryPcnt;
                    int sentValue;
                    int forceSend = 0;
                    
                    void setup()
                    {
                      node.begin(NULL, NODE_ID, false);
                      node.sendSketchInfo("PIR Sensor", "1.2");
                      node.present(CHILD_ID, S_MOTION);
                      pinMode(PIR_PIN, INPUT);
                      digitalWrite(PIR_PIN, HIGH);
                    }
                    
                    void loop()
                    {
                      
                      // Get PIR
                      int value = digitalRead(PIR_PIN); // Get value of PIR
                      if (value != sentValue) { // If status of PIR has changed
                        resend(msg.set(value), 5); // Send PIR status to gateway
                        sentValue = value;
                      }
                    
                      // Send batterylevel
                      sendBattery(); 
                    
                      // Sleep until something happens with the sensor
                      node.sleep(PIR_PIN-2, CHANGE); 
                    }
                    
                    // FUNCTIONS
                    
                    void sendBattery() // Send battery percentage to GW
                    {
                      forceSend++;
                      int batteryPcnt = min(map(readVcc(), MIN_V, MAX_V, 0, 100), 100); // Get VCC and convert to percentage      
                      if (batteryPcnt != oldBatteryPcnt || forceSend >= 20) { // If battery percentage has changed
                        node.sendBatteryLevel(batteryPcnt); // Send battery percentage to gateway
                        oldBatteryPcnt = batteryPcnt; 
                        forceSend = 0;
                      }
                    }
                    
                    void resend(MyMessage &msg, int repeats) // Resend messages if not received by GW
                    {
                      int repeat = 0;
                      int repeatDelay = 0;
                      boolean ack = false;
                    
                      while ((ack == false) and (repeat < repeats)) {
                        if (node.send(msg)) {
                          ack = true;
                        } else {
                          ack = false;
                          repeatDelay += 100;
                        } 
                        repeat++;
                        delay(repeatDelay);
                      }
                    }
                    
                    M Offline
                    M Offline
                    Maciej Kulawik
                    wrote on last edited by
                    #36

                    @Sweebee I see in the sketch, that you are enabling internal pull-up on PIR input. This means, that if PIR is not detecting movement and its output is set to zero, this pull-up resistor consumes 60uA (in the best case).

                    SweebeeS 1 Reply Last reply
                    0
                    • M Maciej Kulawik

                      @Sweebee I see in the sketch, that you are enabling internal pull-up on PIR input. This means, that if PIR is not detecting movement and its output is set to zero, this pull-up resistor consumes 60uA (in the best case).

                      SweebeeS Offline
                      SweebeeS Offline
                      Sweebee
                      wrote on last edited by
                      #37

                      @Maciej-Kulawik in my calculations it is 6uA. The pirs use around 15-20 uA in sleep.

                      M 1 Reply Last reply
                      0
                      • SweebeeS Sweebee

                        @Maciej-Kulawik in my calculations it is 6uA. The pirs use around 15-20 uA in sleep.

                        M Offline
                        M Offline
                        Maciej Kulawik
                        wrote on last edited by
                        #38

                        @Sweebee Depending on value of these pull-up resistors. I have read that they have about 50k, so with vcc=3v you will get 60u.

                        SweebeeS 1 Reply Last reply
                        0
                        • M Maciej Kulawik

                          @Sweebee Depending on value of these pull-up resistors. I have read that they have about 50k, so with vcc=3v you will get 60u.

                          SweebeeS Offline
                          SweebeeS Offline
                          Sweebee
                          wrote on last edited by
                          #39

                          @Maciej-Kulawik removed the pull-up and they are all working fine :) Don't know why i have added it, in one of my oldest sketches i havent enabled it.

                          1 Reply Last reply
                          0

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better 💗

                          Register Login
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          11

                          Online

                          12.0k

                          Users

                          11.2k

                          Topics

                          113.4k

                          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