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. Battery powered PIR

Battery powered PIR

Scheduled Pinned Locked Moved Hardware
18 Posts 11 Posters 21.3k Views 14 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
    therik
    wrote on last edited by
    #1

    This post outlines how to run a PIR sensor with 2xAA batteries and use interrupts to sleep a 3V3 8 MHz Arduino between both tripped and not-tripped states. This seems pretty straight forward, however there are a couple subtleties.

    1. The stock PIR is outfitted with a voltage regulator that requires ~4V5.
    2. Voltage ripple from the voltage booster (2xAA boost to 3V3) can cause certain sensitive sensors to reset and oscillate. Especially when entering sleep (SLEEP_MODE_PWR_DOWN), because of the large change in operating current. The reduction of the operating current, when entering sleep, will cause the booster to change frequency and magnitude of the output voltage ripple.

    Here, I will describe how I overcame this problem by modifying the PIR to work at 3V0.

    Steps:

    PIR PCB modification

    1. Remove the voltage regulator and diode from the PIR PCB
    2. Solder a wire (red wire in the photo) from the VCC pin to the former location of the output pin of the voltage regulator

    The board should look like the photo shown below

    PIR.jpg

    Prepare the power source for the PIR

    1. The voltage from the 2xAA batteries (in my case) are boosted by a XC9140 low quiescent current 3V3 voltage regulator to power the Arduino pro mini. The radio is powered directly from the 2xAA batteries as it has its own regulator and can operate down to 1V9.
    2. The PIR sensor is based on the BISS0001 which as a supply voltage range of ~3-5 V. The modification done in earlier makes the module very sensitive to voltage ripple. In fact, the voltage ripple that occurs when switching from an awake to sleeping Arduino is enough, I believe, to cause the BISS0001 to reset and either oscillate or freeze.
    3. I investigated a couple of solutions, but the best is to use a low-drop-out-voltage high-ripple-rejection-ratio regulator (FT531IA, 3V0, 36 µA supply current) to reduce the 3V3 boosted high-ripple supply to a steady 3V0. I know this seems silly to boost and then regulate down to another voltage but the data speaks for itself, below.

    booster_vs_LDO.png
    Figure 1. Comparison of the output of the 3V3 booster and the LDO 3V0 regulator while the Arduino is sleeping. AC coupled scope termination. Note: the LDO is multiplied by 100 and offset for clarity.

    wake_up.png
    Figure 2. Motion at around 1100 ms causes the PIR output to go high and the Arduino to wake up. Note the output from the booster quiets down and the output from the LDO is smooth. PIR and LDO outputs are offset for clarity.

    sleep.png
    Figure 3. Entering sleep once the PIR goes from tripped to non-tripped state. Once the Arduino starts to sleep, the output from the booster becomes noisy, while the LDO is smooth. PIR and LDO outputs are offset for clarity.

    Here is my example code (nothing fancy and much of it is borrowed from various places).

    //This program will test the PIR using interrupts 
    #include <avr/sleep.h>
    #include <avr/interrupt.h>
    
    
    void setup() 
    { 
    Serial.begin(115200);
    pinMode(3,INPUT);
    digitalWrite(3, LOW);
    pinMode(4,OUTPUT);
    //Signal PIR startup by flashing an LED 
    digitalWrite(4,HIGH);
    delay(5000);
    digitalWrite(4,LOW);
    delay(200);
    }
    
    void loop() 
    {
      //Come out of sleep and read state of PIR pin
      bool flag = digitalRead(3);
      if (flag == true)
      {
        Serial.println("tripped");
        digitalWrite(4,HIGH);
      }
      else
      {
        Serial.println("not tripped");
        digitalWrite(4,LOW);
      }
      delay(100);
      sleepNow();
    }
    
    void sleepNow()
    {
        Serial.println("Entering Sleep");
        // Set pin 3 as interrupt and attach handler:
            attachInterrupt(1, wakeUp, CHANGE);
            delay(100);
            // Choose our preferred sleep mode:
            set_sleep_mode(SLEEP_MODE_PWR_DOWN);
           
        // Set sleep enable (SE) bit:
        sleep_enable();
    
    // Put the device to sleep:
    sleep_mode();
    
    // Upon waking up, sketch continues from this point.
    sleep_disable();
    }
    
    void wakeUp(void)
    {
        detachInterrupt(1);
    }
    

    One last thing, it is necessary to attach a pull-down resistor on the PIR output pin in order to help the signal line go low when transitioning to the non-tripped state.

    1 Reply Last reply
    3
    • A Offline
      A Offline
      Andreas Maurer
      wrote on last edited by
      #2

      You dont Need to Strip the voltage Regulator from the board. Just use the marked solder pad to feed the board with 3.3. This works fine for me.09-03-2015 15-33-34.jpg

      1 Reply Last reply
      1
      • M Offline
        M Offline
        Mrlynx
        Hardware Contributor
        wrote on last edited by
        #3

        What is downside to instead using 3xAA and a good LDO regulator with a modified sensor?
        This way you dont get any ripple and dont need any step up booster.

        http://www.sa2avr.se

        1 Reply Last reply
        0
        • T Offline
          T Offline
          therik
          wrote on last edited by
          #4

          @mrlynx
          Downside to using 3xAA would be size.

          @Andreas-Maurer
          I would prefer to use the 3 pin header and not have wires coming from multiple places, but you are correct.

          1 Reply Last reply
          0
          • m26872M Offline
            m26872M Offline
            m26872
            Hardware Contributor
            wrote on last edited by
            #5

            @therik
            Nice work! Do you know the overall sleep mode power/current? And what battery life time one can expect from a real application?
            @Andreas-Maurer
            If you leave the regulator, isn't there the a power draw from the reverse feeding like with the Arduino pro minis?
            @Mrlynx
            Which LDO do you have in mind? Maybe the battery economy would be a little worse as well. At least with 3AAs and >500mV drop-out..

            1 Reply Last reply
            0
            • D Offline
              D Offline
              darazs
              wrote on last edited by
              #6

              So, I'm quite a rookie when it comes to electronics, but I made the 3.3V modification to this PIR sensor too. I had trouble with stability as well when I removed the voltage regulator and the diode, so I removed the two capacitors from the bottom (one 47uF, and the other 22uF) that I assumed are the buffers on both sides of the voltage regulator. Now the sensor is fed directly from my 3.3V step-up converter (based on NCP1402SN33T1) and it's very reliable and stable.

              I have 2 of these sensors connected to the two interrupt pins and my sensor is going strong since 2 weeks on a single AAA NiMH battery (750mAh). I think it has at least another 2 weeks in it.

              I'm using these to trigger the lights in my entrance room, so I'd notice if they wouldn't work. The board also wakes up every minute to send the battery voltage and I don't see unusual wakeups or unresponsiveness.

              T 1 Reply Last reply
              0
              • D darazs

                So, I'm quite a rookie when it comes to electronics, but I made the 3.3V modification to this PIR sensor too. I had trouble with stability as well when I removed the voltage regulator and the diode, so I removed the two capacitors from the bottom (one 47uF, and the other 22uF) that I assumed are the buffers on both sides of the voltage regulator. Now the sensor is fed directly from my 3.3V step-up converter (based on NCP1402SN33T1) and it's very reliable and stable.

                I have 2 of these sensors connected to the two interrupt pins and my sensor is going strong since 2 weeks on a single AAA NiMH battery (750mAh). I think it has at least another 2 weeks in it.

                I'm using these to trigger the lights in my entrance room, so I'd notice if they wouldn't work. The board also wakes up every minute to send the battery voltage and I don't see unusual wakeups or unresponsiveness.

                T Offline
                T Offline
                therik
                wrote on last edited by
                #7

                @darazs Good to know. I think the output of the booster is very dependent on the current draw and, of course, every booster is a little different.

                D 1 Reply Last reply
                0
                • T therik

                  @darazs Good to know. I think the output of the booster is very dependent on the current draw and, of course, every booster is a little different.

                  D Offline
                  D Offline
                  darazs
                  wrote on last edited by
                  #8

                  @therik Yeah, now that I've read through your "Efficiency of Voltage Boosters" topic, I understand things a little better, and I really have no clue why removing the caps made the PIR more stable. BUT your topic helped me solve my packet loss/acks not arriving problem by adding a bigger capacitor to my radio, so what I want to say is that you're awesome, thanks! :)

                  M 1 Reply Last reply
                  0
                  • D darazs

                    @therik Yeah, now that I've read through your "Efficiency of Voltage Boosters" topic, I understand things a little better, and I really have no clue why removing the caps made the PIR more stable. BUT your topic helped me solve my packet loss/acks not arriving problem by adding a bigger capacitor to my radio, so what I want to say is that you're awesome, thanks! :)

                    M Offline
                    M Offline
                    Mrlynx
                    Hardware Contributor
                    wrote on last edited by
                    #9

                    @m26872 I am looking at xc6206 and tc2117 that have a low quiescent current and a dropout of 50-100 mV at low currents.

                    http://www.sa2avr.se

                    YveauxY 1 Reply Last reply
                    0
                    • M Mrlynx

                      @m26872 I am looking at xc6206 and tc2117 that have a low quiescent current and a dropout of 50-100 mV at low currents.

                      YveauxY Offline
                      YveauxY Offline
                      Yveaux
                      Mod
                      wrote on last edited by
                      #10

                      @therik I recently observed the same behaviour with a step-up regulator based on a 2108A.
                      The strange thing is that the sensor behaves erratic when powered from 2 fresh AA alkaline batteries (approx. 3.2V input to the regulator) but works just fine when powered by some older AA alkaline batteries (approx. 2.6V input).
                      I quickly inspected the output of the regulator with a scope, but saw no clear differences between the two. Maybe the output was less stable at 3.2V input.
                      Next I'll try using a diode to lower the voltage a little, either before or after the regulator.

                      http://yveaux.blogspot.nl

                      1 Reply Last reply
                      0
                      • riaan003R Offline
                        riaan003R Offline
                        riaan003
                        wrote on last edited by
                        #11

                        I am trying to figure out if running this modification from 3 AAs at 4.5V will work (it is for a setup with a attiny85 that I want to run from 4.5 down to 3.3v - it currently works well from 5 down to 4.5 with exactly the erratic behaviour explained above from about 4.4v and down). When looking at the datasheet for the BIS0001 then it seems like it will fine? What am I missing? :)

                        1 Reply Last reply
                        0
                        • T Offline
                          T Offline
                          therik
                          wrote on last edited by
                          #12

                          A couple of questions.

                          1. Did you remove the voltage regulator from the PIR?
                            a. if not, I would suspect that the voltage regulator on the PIR drops out and cannot supply the voltage for the PIR IC below 4V5.
                          2. Where do you derive the power for the PIR?
                            a. If it is from the µC, the µC may be adding noise on the voltage supply to the PIR and with the PIR voltage regulator removed the supply voltage may be too noisy.
                          1 Reply Last reply
                          0
                          • riaan003R Offline
                            riaan003R Offline
                            riaan003
                            wrote on last edited by
                            #13

                            The regulator was not removed yet, no, the behaviour was with my unmodified sensor. I have actually now started looking at an alternative power setup so that i can use this mod at 3.3v and drop the requiment for it to run from 4.5v (which was based on running it upregulated from 3 AAs with an attiny85 woken up from sleep mode - which worked well and consumed ~0.1mA overall). Back to the drawing board :)

                            1 Reply Last reply
                            0
                            • Igor KatkovI Offline
                              Igor KatkovI Offline
                              Igor Katkov
                              wrote on last edited by
                              #14

                              How did you produce that nice ripple charts? Oscilloscope connected to a computer? What is the model?

                              1 Reply Last reply
                              0
                              • HaakonH Offline
                                HaakonH Offline
                                Haakon
                                wrote on last edited by
                                #15

                                Thanks for sharing, @therik. Where can I get the high-ripple-rejection-ratio regulator you are describing? I cannot find an FT531IA on Ebay. (Or if therik is no longer following the topic: Anyone else know a specific regulator I gan get from Ebay?)

                                Thanks in advance.

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

                                  It's still on aliexpress. Could a AMS1117 work too though? It's ripple rejection isn't bad for what I have read. Although I don't get the part of the specs.. if you use a fixed version do you still need a capacitor on the GND (adj) pin for the ripple rejection?

                                  HaakonH 1 Reply Last reply
                                  0
                                  • L LastSamurai

                                    It's still on aliexpress. Could a AMS1117 work too though? It's ripple rejection isn't bad for what I have read. Although I don't get the part of the specs.. if you use a fixed version do you still need a capacitor on the GND (adj) pin for the ripple rejection?

                                    HaakonH Offline
                                    HaakonH Offline
                                    Haakon
                                    wrote on last edited by
                                    #17

                                    Thanks, @LastSamurai! I have ordered a few to try them out. (Not sure about the question about AMS1117, hopefully there are someone here who are.)

                                    1 Reply Last reply
                                    0
                                    • n1ck1355N Offline
                                      n1ck1355N Offline
                                      n1ck1355
                                      wrote on last edited by
                                      #18

                                      Hi :)
                                      does anyone know where i actually find the FT531IA? on aliexpress there are only FT531EA with output of 2.5V :(

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


                                      18

                                      Online

                                      11.7k

                                      Users

                                      11.2k

                                      Topics

                                      113.0k

                                      Posts


                                      Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                      • Login

                                      • Don't have an account? Register

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • MySensors
                                      • OpenHardware.io
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular