Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Pin change interrupt not firing with MySensors

Pin change interrupt not firing with MySensors

Scheduled Pinned Locked Moved Troubleshooting
39 Posts 7 Posters 11.3k 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.
  • scalzS scalz

    okay!
    you're right, i misread because of the title "pin change" lol . So you're using D3, clear :)
    quickly checked the lib, but i don't see anything fancy for the moment. if i find time, perhaps i'll try to reproduce but i've not heard others having this issue. Do you have this problem without doing any changes in the Motion sketch?

    elysionE Offline
    elysionE Offline
    elysion
    wrote on last edited by
    #5

    What I am currently uploading is the unmodified version of MotionSensor.ino linked above. I have previously build a motion sensor using a 3.3V pro mini with the same code. The only difference that I can think of with my current setup is that I am using the internal RC oscillator instead of the external and have changed the fuses accordingly by using the bootloader upload in Arduino IDE. I used the following board configuration:

    atmega328PstandaloneInt8MHz.name=Standalone ATmega328P (ATmega boot, internal 8MHz)
    
    atmega328PstandaloneInt8MHz.upload.tool=arduino:avrdude
    atmega328PstandaloneInt8MHz.upload.protocol=arduino
    atmega328PstandaloneInt8MHz.upload.maximum_size=30720
    atmega328PstandaloneInt8MHz.upload.maximum_data_size=2048
    atmega328PstandaloneInt8MHz.upload.speed=57600
    
    atmega328PstandaloneInt8MHz.bootloader.tool=arduino:avrdude
    atmega328PstandaloneInt8MHz.bootloader.low_fuses=0xE2
    atmega328PstandaloneInt8MHz.bootloader.high_fuses=0xDA
    atmega328PstandaloneInt8MHz.bootloader.extended_fuses=0xFD
    atmega328PstandaloneInt8MHz.bootloader.unlock_bits=0x3F
    atmega328PstandaloneInt8MHz.bootloader.lock_bits=0x0F
    atmega328PstandaloneInt8MHz.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex
    atmega328PstandaloneInt8MHz.build.mcu=atmega328p
    atmega328PstandaloneInt8MHz.build.f_cpu=8000000L
    atmega328PstandaloneInt8MHz.build.board=AVR_PRO
    atmega328PstandaloneInt8MHz.build.core=arduino
    atmega328PstandaloneInt8MHz.build.variant=standard```
    1 Reply Last reply
    0
    • I Offline
      I Offline
      idstone
      wrote on last edited by idstone
      #6

      Hi.
      Perhaps I ran into a similar issue?
      I created a new node with older 1.5.x version of my sensors-library.
      But I was not able to get a door-contact working via interrupt on pin 3 with a sketch I used more than 5 times before.
      Last change I can remember, was updating Arduino IDE for MacOS Sierra....

      How can I get back a working interrupt controlled door-switch?!

      elysionE 1 Reply Last reply
      0
      • I idstone

        Hi.
        Perhaps I ran into a similar issue?
        I created a new node with older 1.5.x version of my sensors-library.
        But I was not able to get a door-contact working via interrupt on pin 3 with a sketch I used more than 5 times before.
        Last change I can remember, was updating Arduino IDE for MacOS Sierra....

        How can I get back a working interrupt controlled door-switch?!

        elysionE Offline
        elysionE Offline
        elysion
        wrote on last edited by
        #7

        @idstone: Have you tried passing another mode (e.g. LOW) to gw.sleep method? The issue I am having is that with LOW the interrupt fires, but with CHANGE (which is the default in the sketches) it does not.

        YveauxY I 2 Replies Last reply
        0
        • elysionE elysion

          @idstone: Have you tried passing another mode (e.g. LOW) to gw.sleep method? The issue I am having is that with LOW the interrupt fires, but with CHANGE (which is the default in the sketches) it does not.

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

          @elysion Issues were fixed in the 2.1 beta of the MySensors library, so you'd better have a look at this code to see how to wake from interrupt.
          Furthermore, you're using the ATmega out of spec when trying to wake from CHANGE; see http://forum.mysensors.org/topic/250/how-do-i-use-the-interrupt/5

          http://yveaux.blogspot.nl

          1 Reply Last reply
          0
          • elysionE elysion

            @idstone: Have you tried passing another mode (e.g. LOW) to gw.sleep method? The issue I am having is that with LOW the interrupt fires, but with CHANGE (which is the default in the sketches) it does not.

            I Offline
            I Offline
            idstone
            wrote on last edited by
            #9

            @elysion

            Hi. It seems, that the problem is related to complete charge of my 3,3V arduino pro's.
            Reaction on interrupt while closing a door-switch on pin 3 works on an older 5V arduino.
            I've read about problems at a customer-evalutation (amazon), especially with arduino pro clones and their interrupt-function.
            Bought some more over store from mysensors on ebay... hope these will work correctly :(

            YveauxY 1 Reply Last reply
            0
            • I idstone

              @elysion

              Hi. It seems, that the problem is related to complete charge of my 3,3V arduino pro's.
              Reaction on interrupt while closing a door-switch on pin 3 works on an older 5V arduino.
              I've read about problems at a customer-evalutation (amazon), especially with arduino pro clones and their interrupt-function.
              Bought some more over store from mysensors on ebay... hope these will work correctly :(

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

              @idstone said:

              I've read about problems at a customer-evalutation (amazon), especially with arduino pro clones and their interrupt-function.

              Can you quote your source please?

              http://yveaux.blogspot.nl

              I 1 Reply Last reply
              0
              • YveauxY Yveaux

                @idstone said:

                I've read about problems at a customer-evalutation (amazon), especially with arduino pro clones and their interrupt-function.

                Can you quote your source please?

                I Offline
                I Offline
                idstone
                wrote on last edited by
                #11

                @Yveaux
                https://www.amazon.de/Aukru-Redesign-atmega328-ATmega128-Compatible/dp/B00PLD3E1S

                5.0 von 5 SternenWunderbar!
                Von Ludwig Enfield am 19. Juli 2015

                Bei den Arduino Remakes gibt es immer wieder kleine Abweichungen im Pinout. Also aufpassen - das betrifft hier insbeondere die Interrupt-Pins 0 und 1 bzw. die Pins A6/A7 (u.a. Analog-Ports).

                YveauxY 1 Reply Last reply
                0
                • I idstone

                  @Yveaux
                  https://www.amazon.de/Aukru-Redesign-atmega328-ATmega128-Compatible/dp/B00PLD3E1S

                  5.0 von 5 SternenWunderbar!
                  Von Ludwig Enfield am 19. Juli 2015

                  Bei den Arduino Remakes gibt es immer wieder kleine Abweichungen im Pinout. Also aufpassen - das betrifft hier insbeondere die Interrupt-Pins 0 und 1 bzw. die Pins A6/A7 (u.a. Analog-Ports).

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

                  @idstone thanks!
                  If I understand it correctly, the feedback states the pinout of arduino pro mini clones is often slightly different, especially on interrupt pins and analog.
                  For analog pins this is certainly true, for interrupt pins I have not experienced this myself (yet).

                  http://yveaux.blogspot.nl

                  I 1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    DavidZH
                    wrote on last edited by
                    #13

                    In one sketch I am using pin change interrupt. But that is a node I built from scratch. I have the feeling the issues arise with the MyS function "sleep()" in combination with a set time. As long as I call sleep(0xff,0x00, 0xff, 0x00, 0);
                    pin change interrupts work. As soon as I change any of the parameters, the node will not wake up anymore.

                    That was on 2.0 I have yet to convert and try it on 2.1.

                    As soon as I have done that, I will post the code .

                    YveauxY 1 Reply Last reply
                    0
                    • D DavidZH

                      In one sketch I am using pin change interrupt. But that is a node I built from scratch. I have the feeling the issues arise with the MyS function "sleep()" in combination with a set time. As long as I call sleep(0xff,0x00, 0xff, 0x00, 0);
                      pin change interrupts work. As soon as I change any of the parameters, the node will not wake up anymore.

                      That was on 2.0 I have yet to convert and try it on 2.1.

                      As soon as I have done that, I will post the code .

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

                      @DavidZH Just a shot in the dark, but could you try @tekka workaround from https://github.com/mysensors/MySensors/issues/725 and see if it still crashes ?

                      http://yveaux.blogspot.nl

                      D 1 Reply Last reply
                      0
                      • YveauxY Yveaux

                        @DavidZH Just a shot in the dark, but could you try @tekka workaround from https://github.com/mysensors/MySensors/issues/725 and see if it still crashes ?

                        D Offline
                        D Offline
                        DavidZH
                        wrote on last edited by
                        #15

                        @Yveaux I will try that as soon as I'm back from my winter sports vacation (as far as you can call lush green Alpine meadows that. At least the slopes are well maintained!). I have no access to a node and gateway now.

                        For me it worked for that sketch as it's main function is reading momentary switches, either on mains power or on battery. As soon as I want to add a sensor that needs to send it's info on a set interval I needed it to be on mains power.

                        But like I said, I will convert the sketch to 2.1 this week, and next week I'll give the workaround a shot.
                        Keep you posted!

                        1 Reply Last reply
                        1
                        • YveauxY Yveaux

                          @idstone thanks!
                          If I understand it correctly, the feedback states the pinout of arduino pro mini clones is often slightly different, especially on interrupt pins and analog.
                          For analog pins this is certainly true, for interrupt pins I have not experienced this myself (yet).

                          I Offline
                          I Offline
                          idstone
                          wrote on last edited by idstone
                          #16

                          @Yveaux

                          Hey!
                          Got some news... the new charge of Arduino Pros arrived, but the problem persists. So I started more trail ' n error and got something:

                          I installed the Arduino-IDE and mysensors-1.5.4-library on an manjaro-based notebook. I had to do some symlinking to get a newer version of avrdude working and now the same sketch I used before works now!

                          Back to my Mac, flashing the same sketch, the node doesn't work correctly?!
                          So problem seems to be the version of avrdude, which is offered by the arduino-ide?!


                          I finally downgraded to IDE 1.6.8 and especially AVR Boards 1.6.8.
                          Now everything works as expected .... :D

                          1 Reply Last reply
                          0
                          • gohanG Offline
                            gohanG Offline
                            gohan
                            Mod
                            wrote on last edited by
                            #17

                            So it was just a bug in the latest updates of the ide and boards? I'm having probably the same problem on a mega2560

                            I 1 Reply Last reply
                            0
                            • gohanG gohan

                              So it was just a bug in the latest updates of the ide and boards? I'm having probably the same problem on a mega2560

                              I Offline
                              I Offline
                              idstone
                              wrote on last edited by
                              #18

                              @gohan

                              I'm not familiar with your problem, but mine was, that the interrupt on pin3 didn't work as expected. So I was not able to use my new sensor as watchdog for my windows/doors. With downgrade of the Arduino-IDE AND especially AVR Boards 1.6.8 my problem is solved now and every change on that interrupt-pin is correctly recognised and send to gateway.

                              gohanG 1 Reply Last reply
                              0
                              • I idstone

                                @gohan

                                I'm not familiar with your problem, but mine was, that the interrupt on pin3 didn't work as expected. So I was not able to use my new sensor as watchdog for my windows/doors. With downgrade of the Arduino-IDE AND especially AVR Boards 1.6.8 my problem is solved now and every change on that interrupt-pin is correctly recognised and send to gateway.

                                gohanG Offline
                                gohanG Offline
                                gohan
                                Mod
                                wrote on last edited by
                                #19

                                @idstone if you don't mind, please take a look at last line of my code https://forum.mysensors.org/topic/5807/interrupt-and-sleep

                                I 1 Reply Last reply
                                0
                                • gohanG gohan

                                  @idstone if you don't mind, please take a look at last line of my code https://forum.mysensors.org/topic/5807/interrupt-and-sleep

                                  I Offline
                                  I Offline
                                  idstone
                                  wrote on last edited by
                                  #20

                                  @gohan

                                  Hi again. I can confirm, that I got similar problems... the state of the interrupt pin wasn't correctly recognized, too.
                                  May be You could try downgrading Arduino-IDE and (very important) avr boards (1.6.8) ?!

                                  elysionE gohanG 2 Replies Last reply
                                  0
                                  • I idstone

                                    @gohan

                                    Hi again. I can confirm, that I got similar problems... the state of the interrupt pin wasn't correctly recognized, too.
                                    May be You could try downgrading Arduino-IDE and (very important) avr boards (1.6.8) ?!

                                    elysionE Offline
                                    elysionE Offline
                                    elysion
                                    wrote on last edited by
                                    #21

                                    I'll see if I can find time today or tomorrow to try this. Also might be interesting to see whether it would be possible to get around the issue using Platform.io.

                                    1 Reply Last reply
                                    0
                                    • I idstone

                                      @gohan

                                      Hi again. I can confirm, that I got similar problems... the state of the interrupt pin wasn't correctly recognized, too.
                                      May be You could try downgrading Arduino-IDE and (very important) avr boards (1.6.8) ?!

                                      gohanG Offline
                                      gohanG Offline
                                      gohan
                                      Mod
                                      wrote on last edited by
                                      #22

                                      @idstone
                                      I'll give it a try maybe on another computer just to be safe

                                      I 1 Reply Last reply
                                      0
                                      • gohanG gohan

                                        @idstone
                                        I'll give it a try maybe on another computer just to be safe

                                        I Offline
                                        I Offline
                                        idstone
                                        wrote on last edited by
                                        #23

                                        @gohan

                                        any news?

                                        gohanG 1 Reply Last reply
                                        0
                                        • elysionE Offline
                                          elysionE Offline
                                          elysion
                                          wrote on last edited by
                                          #24

                                          I updated my sensors to use v2 of the MySensors library and this issue went away. Used the same board with same fuses and same Arduino IDE and boards file version. Imho this would suggest that there is an issue in MySensors.

                                          Before migrating to v2 I ran some tests using a button in place of the PIR sensor and it seemed that using a short timeout for the gw.sleep would work, but a longer would not. Did not dig deeper into this though, so might be that it just seemed to work better.

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


                                          13

                                          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