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.
  • 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
                                      • I idstone

                                        @gohan

                                        any news?

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

                                        @idstone

                                        No, I tried different ways without success and I am waiting for new arduino boards to arrive and start testing from there, probably my MEGA isn't the right platform for these tests

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

                                          So I've returned to this thread after 2 months, as I finally found the time to test the workaround @Yveaux suggested on Januari 8th. In the mean time I had updated my library to the latest version (2.1.1).
                                          When I run my sketch now, it never goes to sleep. Actually it does, but wakes up immediately. I use int testInt = sleep(0xff, 0x00, 0xff, 0x00, 0);, testInt returns -1, as in; MCU woke by timer. That is both with and without the workaround, and I am not sure that it's caused by the interrupt definitions. Up to 2.0 that worked fine (I rolled back yesterday to try).

                                          Now I found this other thread where @tekka stated that he corrected some stuff that as out of line with the datasheet for the 328(p).

                                          So what would be the correct way to make a node sleep forever without using the ExternalInterrupts (INT_0 and INT_1)? I am in no rush to get this going, because my first nodes are going to be mains powered, so they will be happily looping along without sleeping. But as this node has 4 buttons, PinChange is a route I'd like to go.

                                          (Now I have to go and retract my statements in another thread, because they are null and void now.)

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


                                          11

                                          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