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. Wakeup on Interrupt not working

Wakeup on Interrupt not working

Scheduled Pinned Locked Moved Troubleshooting
5 Posts 3 Posters 2.1k Views 2 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.
  • HenryWhiteH Offline
    HenryWhiteH Offline
    HenryWhite
    wrote on last edited by HenryWhite
    #1

    Hi,

    I have an external system which outputs a signal (~2.5V) on one of its pins under certain circumstances. So I hooked up this output pin to the digital pin 3 on my arduino pro mini (and obviously GND from the external system to GND from the arduino), so that the arduino can tell me whether the external system triggered or not.

    Now, when I don't put gw.sleep() in my code, everything works as aspected.
    But when I put gw.sleep() in my code and tell it to wake on interrupt, it doesn not work (the arduino doesn't wake up when I trigger the external system)

    Does somebody has an idea why this is the case? Here's my code:

    #include <MySensor.h>  
    #include <SPI.h>
    
    //unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
    #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your sensor.  (Only 2 and 3 generates interrupt!)
    #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
    #define CHILD_ID 1   // Id of the sensor child
    
    MySensor gw;
    // Initialize motion message
    MyMessage msg(CHILD_ID, V_TRIPPED);
    
    void setup()  
    {  
      gw.begin(NULL,35,false,AUTO);   //Henry Node-ID anpassen!
    
      // Send the sketch version information to the gateway and Controller
      gw.sendSketchInfo("SmokeRF", "1.0");
    
      pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the  sensor digital pin as input
      // Register all sensors to gw (they will be created as child devices)
      gw.present(CHILD_ID, S_DOOR);
      
    }
    
    void loop()     
    {     
      if (digitalRead(DIGITAL_INPUT_SENSOR)==HIGH) {
        Serial.println("Alarm");
        gw.send(msg.set(1));  // Send value to gw 
      }
     
      // Sleep until interrupt comes in on sensor. Send update every two minute. 
      gw.sleep(INTERRUPT,CHANGE,SLEEP_TIME);
    }
    
    1 Reply Last reply
    0
    • NickB149N Offline
      NickB149N Offline
      NickB149
      wrote on last edited by
      #2

      Did you already try applying 5V on the interrupt pin manually?
      Maybe the 2.5V is not enough to trigger the interrupt.

      HenryWhiteH 1 Reply Last reply
      0
      • NickB149N NickB149

        Did you already try applying 5V on the interrupt pin manually?
        Maybe the 2.5V is not enough to trigger the interrupt.

        HenryWhiteH Offline
        HenryWhiteH Offline
        HenryWhite
        wrote on last edited by
        #3

        @NickB149 said:

        Did you already try applying 5V on the interrupt pin manually?
        Maybe the 2.5V is not enough to trigger the interrupt.

        I'm using a 3.3v arduino pro mini, so the 2.5v should be enough i think?

        1 Reply Last reply
        0
        • L Offline
          L Offline
          Lemme
          wrote on last edited by
          #4

          Try this:
          gw.sleep(1, CHANGE, 0);

          1 Reply Last reply
          0
          • HenryWhiteH Offline
            HenryWhiteH Offline
            HenryWhite
            wrote on last edited by
            #5

            Problem solved!
            First, I forgot to activate the internal Pullup:
            digitalWrite(DIGITAL_INPUT_SENSOR, HIGH);
            Besides that, every signal greater than 0.5V is recognized as interrupt, BUT digitalRead only recognizes signals greater than 1.5V!

            When my external system triggers, it starts to slowly increase the voltage from 0.5V up to 3.3V. It reaches 1.5V after 5 seconds triggering. I cancelled the test every time after 3-4 seconds, so that's the problem why nothing worked.

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


            21

            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