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. OpenHardware.io
  3. 💬 AM612 Passive Infrared Sensor Breakout Board

💬 AM612 Passive Infrared Sensor Breakout Board

Scheduled Pinned Locked Moved OpenHardware.io
41 Posts 12 Posters 5.0k 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.
  • W waspie

    does anyone have a sample sketch for this. i don't understand the whole pin assignment thing well enough to know what the heck i'm doing.

    I grabbed the sketch from the 10 year pir but this seems much more geared to the nrf52

    O Offline
    O Offline
    Omemanti
    wrote on last edited by Omemanti
    #17

    @waspie you might want to look at one of my projects on openhardware. It has a sketch on it. It also uses the am612

    1 Reply Last reply
    0
    • W Offline
      W Offline
      waspie
      wrote on last edited by
      #18

      Thanks.
      I'm really not too good at writing arduino code but I did come across this library:
      https://github.com/mristau/Arduino_nRF5x_lowPower

      Is this something that could be incorporated into the sketch and then use "normal" interrupts?

      1 Reply Last reply
      0
      • nagelcN Offline
        nagelcN Offline
        nagelc
        wrote on last edited by nagelc
        #19

        Don't cut your trace just yet. You can use normal interrupts with MySensors and NRF5, at least if you are sleeping the node. I have used the normal Mysensors sleep statement, with interrupts for buttons, and not had to use the LPCOMP. The motion sensor should work similarly. I have used interrupts on P0.27 for a button interupt, which is regular GPIO pin and not an analog pin. I have also used 2 interrupts in the sleep statement, which means the MySensors NRF5 code probably uses GPIOTE instead of LPCOMP for interrupts. Might not be as low power as LPCOMP, but it seems to be more flexible.
        I used an NRF52832, haven't tried with a NRF51 board.

        O 1 Reply Last reply
        0
        • nagelcN nagelc

          Don't cut your trace just yet. You can use normal interrupts with MySensors and NRF5, at least if you are sleeping the node. I have used the normal Mysensors sleep statement, with interrupts for buttons, and not had to use the LPCOMP. The motion sensor should work similarly. I have used interrupts on P0.27 for a button interupt, which is regular GPIO pin and not an analog pin. I have also used 2 interrupts in the sleep statement, which means the MySensors NRF5 code probably uses GPIOTE instead of LPCOMP for interrupts. Might not be as low power as LPCOMP, but it seems to be more flexible.
          I used an NRF52832, haven't tried with a NRF51 board.

          O Offline
          O Offline
          Omemanti
          wrote on last edited by Omemanti
          #20

          @nagelc I also use normal interrupts. No problems here. Up to 22uA while sleeping, that's fine by me. (3 AAA will last a long time)

          1 Reply Last reply
          0
          • W Offline
            W Offline
            waspie
            wrote on last edited by
            #21

            yeah well i got a few nrf51822 which was evidently a big mistake

            O 1 Reply Last reply
            0
            • W waspie

              yeah well i got a few nrf51822 which was evidently a big mistake

              O Offline
              O Offline
              Omemanti
              wrote on last edited by
              #22

              @waspie why?

              1 Reply Last reply
              0
              • W Offline
                W Offline
                waspie
                wrote on last edited by
                #23

                They don't seem to play well and seems like most or any of you guys messing with NRF5x are preferring nrf52.

                I have however figured out one problem. Whenever my nrf51 was sleeping i was seeing 1ma current which is a deal killer. I accidentally discovered that disconnecting the st link and replugging it got sleep current to ~5ua. Something about uploading the program puts it in some state whereby it won't sleep properly.

                So, I can get it to sleep all the way down now and I'm starting to understand the psel refsel stuff. And, I can make it trigger on p0.03 (an4 or 5, whatever) but its not particularly reliable. I need to get this section right:

                void activateLpComp() {
                  NRF_LPCOMP->PSEL=4; // monitor AIN0 (i.e. pin P0.02 on nRF52832 PIR Motion Sensor v607).
                  while (!(NRF_LPCOMP->PSEL==4)) {} //wait until confirmed
                  NRF_LPCOMP->REFSEL=2;  // choose 1/2 VDD as the reference voltage
                  while (!(NRF_LPCOMP->REFSEL==2)) {} //wait until confirmed
                  NRF_LPCOMP->ANADETECT=0;  //detect CROSS events on PIR detection pin
                  while (NRF_LPCOMP->ANADETECT!=0) {} //wait until confirmed
                  NRF_LPCOMP->INTENSET=B1000;  //Enable interrupt for CROSS event
                  while (!(((NRF_LPCOMP->INTENSET)&B1000)==B1000)) {} //wait until confirmed
                  NRF_LPCOMP->ENABLE=1;  //Enable LPCOMP
                  while (!(NRF_LPCOMP->ENABLE==1)) {} //wait until confirmed
                  NRF_LPCOMP->TASKS_START=1;  //start the LPCOMP
                  while (!(NRF_LPCOMP->EVENTS_READY)) {}  //wait until ready
                  
                  NVIC_SetPriority(LPCOMP_IRQn, 15);
                  NVIC_ClearPendingIRQ(LPCOMP_IRQn);
                  NVIC_EnableIRQ(LPCOMP_IRQn);
                }```
                1 Reply Last reply
                0
                • W Offline
                  W Offline
                  waspie
                  wrote on last edited by
                  #24

                  It's looking more and more like the code is fine and its the sensors i'm using that are the problem.

                  I got some BM612 (cheaper) from ali supposedly the same as am612 but they don't seem to work right. It's like they trigger once and then never again. Can't find a data sheet for them...

                  I hooked up a 312 just for kicks and it seems to be working. I doubt I'll deploy any 312s due to what seems to be a VERY narrow range and plus it doesn't match the profile of the round board etc...

                  Anyway, wanted to say that i think this is all working as its supposed to I just got a bad batch of sensors or they're slightly different in some way

                  M 1 Reply Last reply
                  1
                  • W Offline
                    W Offline
                    waspie
                    wrote on last edited by
                    #25

                    For anyone looking to use @NeverDie 's nrf51 circular board (v9) with this breakout - I'm using the sketch as linked from @Nca78 in this post: https://forum.mysensors.org/topic/6961/nrf5-action/1542
                    in conjunction with the edit to the file as described in this post:
                    https://forum.mysensors.org/topic/6961/nrf5-action/1514 (the edit to WInterrupt.c and I'm using version 0.6.0 from sandeep)

                    with just a few minor edits to the sketch from Nca (setting the pin to 10 (sda marked on the circular board).

                    14ua idle current btw, working like a charm. so far i'm just using a 2032. Trying to figure out a way to strap a cr2450 or 2477 on the back :)
                    0_1552482150101_20190311_093638.jpg

                    nithinoN 1 Reply Last reply
                    1
                    • W waspie

                      For anyone looking to use @NeverDie 's nrf51 circular board (v9) with this breakout - I'm using the sketch as linked from @Nca78 in this post: https://forum.mysensors.org/topic/6961/nrf5-action/1542
                      in conjunction with the edit to the file as described in this post:
                      https://forum.mysensors.org/topic/6961/nrf5-action/1514 (the edit to WInterrupt.c and I'm using version 0.6.0 from sandeep)

                      with just a few minor edits to the sketch from Nca (setting the pin to 10 (sda marked on the circular board).

                      14ua idle current btw, working like a charm. so far i'm just using a 2032. Trying to figure out a way to strap a cr2450 or 2477 on the back :)
                      0_1552482150101_20190311_093638.jpg

                      nithinoN Offline
                      nithinoN Offline
                      nithino
                      wrote on last edited by
                      #26

                      @waspie Apologies for resurrecting this thread after two years. I have quite a few NRF51822 boards with me. I would like to put it to use. Can you please share your code as following these links did not help me compile the sketch. Too many errors. Thanks in advance.

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        gulsimsur
                        Banned
                        wrote on last edited by
                        #27

                        I grabbed the sketch from the 10 year pir but this seems much more geared to the nrf52

                        G 1 Reply Last reply
                        0
                        • G gulsimsur

                          I grabbed the sketch from the 10 year pir but this seems much more geared to the nrf52

                          G Offline
                          G Offline
                          gulsimsur
                          Banned
                          wrote on last edited by mfalkvidd
                          #28

                          @gulsimsur said in 💬 AM612 Passive Infrared Sensor Breakout Board:

                          I grabbed the sketch from the 10 year pir but this seems much more geared to the nrf52
                          i don't understand the whole pin assignment thing well enough to know what the heck i'm doing.

                          E 1 Reply Last reply
                          0
                          • G gulsimsur

                            @gulsimsur said in 💬 AM612 Passive Infrared Sensor Breakout Board:

                            I grabbed the sketch from the 10 year pir but this seems much more geared to the nrf52
                            i don't understand the whole pin assignment thing well enough to know what the heck i'm doing.

                            E Offline
                            E Offline
                            ejlane
                            wrote on last edited by
                            #29

                            @gulsimsur Why are there links to surveyzop in your reply?

                            1 Reply Last reply
                            1
                            • M Offline
                              M Offline
                              MasterCATZ
                              wrote on last edited by
                              #30

                              Thanks for the breakout board, but would it be too much to ask for a revision that can have potentiometers mounted?
                              so resistors do not need to be changed when tinkering with 15x settings? either SMD or Through-Hole Trimmer

                              0-300k None?,0-1M

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                MasterCATZ
                                wrote on last edited by
                                #31

                                Or a 12x DIP switch and a Jumper

                                Jumper for the shortest and longest Time settings
                                Then pads for installing the 12 Resistors for Time in Seconds the LED / Relay etc is activated for ?

                                also, how were you mounting these boards with no screw holes? just something for the lens cover to clip into

                                NeverDieN 1 Reply Last reply
                                0
                                • M MasterCATZ

                                  Or a 12x DIP switch and a Jumper

                                  Jumper for the shortest and longest Time settings
                                  Then pads for installing the 12 Resistors for Time in Seconds the LED / Relay etc is activated for ?

                                  also, how were you mounting these boards with no screw holes? just something for the lens cover to clip into

                                  NeverDieN Offline
                                  NeverDieN Offline
                                  NeverDie
                                  Hero Member
                                  wrote on last edited by NeverDie
                                  #32

                                  @MasterCATZ That's a reasonable request. In the future whenever I post a board to openhardware.io, I'll endeavor to include the complete set of KiCAD 6 files needed to make simple changes like this, so then I'm not the bottleneck. However, I did this work, and most of my other work to date, in Diptrace, which AFAIK doesn't allow that kind of easy change by other people.

                                  Meanwhile, if anyone wants to re-do the board and post it with the asked-for change, feel free. Because I don't have that need myself, I won't be doing it, because it involves also spending time finding files in some forgotten archive from 5 years ago in order to resurrect it even before making the change.

                                  In any case, I'm glad that at least some people have found it useful, which is why I posted it in the first place. :-)

                                  1 Reply Last reply
                                  1
                                  • M Offline
                                    M Offline
                                    MasterCATZ
                                    wrote on last edited by
                                    #33

                                    all good at least I can steal your sensor hole placements and can stumble along modding in KiCAD

                                    tho unsure why the board size is smaller when I converted it it seems to trim along where the cover's holes are and not leaving any meat behind

                                    did you come across any other sensors better than this for the price?

                                    NeverDieN 1 Reply Last reply
                                    0
                                    • W waspie

                                      It's looking more and more like the code is fine and its the sensors i'm using that are the problem.

                                      I got some BM612 (cheaper) from ali supposedly the same as am612 but they don't seem to work right. It's like they trigger once and then never again. Can't find a data sheet for them...

                                      I hooked up a 312 just for kicks and it seems to be working. I doubt I'll deploy any 312s due to what seems to be a VERY narrow range and plus it doesn't match the profile of the round board etc...

                                      Anyway, wanted to say that i think this is all working as its supposed to I just got a bad batch of sensors or they're slightly different in some way

                                      M Offline
                                      M Offline
                                      MasterCATZ
                                      wrote on last edited by
                                      #34

                                      @waspie

                                      https://robu.in/wp-content/uploads/2020/09/Pir-BM612.pdf

                                      planning on switching over to these as well

                                      sensitivity setting and better times

                                      NeverDieN 1 Reply Last reply
                                      1
                                      • M MasterCATZ

                                        all good at least I can steal your sensor hole placements and can stumble along modding in KiCAD

                                        tho unsure why the board size is smaller when I converted it it seems to trim along where the cover's holes are and not leaving any meat behind

                                        did you come across any other sensors better than this for the price?

                                        NeverDieN Offline
                                        NeverDieN Offline
                                        NeverDie
                                        Hero Member
                                        wrote on last edited by NeverDie
                                        #35

                                        @MasterCATZ said in 💬 AM612 Passive Infrared Sensor Breakout Board:

                                        did you come across any other sensors better than this for the price?

                                        I vaguely recollect having since come across a newer aliexpress sensor with an even lower power consumption, but I can't say for sure. If that matters to you, it may be worth checking. It wouldn't surprise me, as there is constant progress, and 5 years is a long time.

                                        1 Reply Last reply
                                        0
                                        • M MasterCATZ

                                          @waspie

                                          https://robu.in/wp-content/uploads/2020/09/Pir-BM612.pdf

                                          planning on switching over to these as well

                                          sensitivity setting and better times

                                          NeverDieN Offline
                                          NeverDieN Offline
                                          NeverDie
                                          Hero Member
                                          wrote on last edited by NeverDie
                                          #36

                                          @MasterCATZ and anyone else: If you come across a comparable PIR sensor at a comparable price but with a meaningfully lower current drain, please do post an update to this thread letting us know what it is. I do recollect there being at least one, but by now there may be even more. I could possibly create a new breakout board for it. As I just recently discovered, for a small board of this size, you can order 30 custom PCBs for under ~$5. The first five PCB's would cost $4, but after that the marginal cost is just pennies each. AFAIK, that kind of discounted pricing for hobbyists didn't exist 5 years ago. Either it's the new normal or else it's a temporary thing because of the pandemic or a grab for market share. Not sure which.

                                          E 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.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