I have a sketch to put to sleep and wake up an Arduino Pro Mini 5V, but the problem is that sometimes when it is moved fast it wakes up itself, thing that I do not want. I have it configure to be waken up in the pin 2 by a rising signal using an interruption:

#define wakePin 2        // pin used for waking up

void wakeUpNow()        // here the interrupt is handled after wakeup
  // execute code here after wake-up before returning to the loop() function
  // timers and code using timers (serial.print and more...) will not work here.
  // we don't really need to execute any special functions here, since we
  // just want the thing to wake up

void setup() 

  pinMode(wakePin, INPUT);

  attachInterrupt(0, wakeUpNow, RISING );

void sleepNow()         // here we put the arduino to sleep

    set_sleep_mode(SLEEP_MODE_PWR_DOWN);   // sleep mode is set here

    sleep_enable();          // enables the sleep bit in the mcucr register  // so sleep is possible. just a safety pin

    attachInterrupt(0,wakeUpNow, RISING); // use interrupt 0 (pin 2) and run function  // wakeUpNow when pin 2 gets LOW

    sleep_mode();            // here the device is actually put to sleep!! // THE PROGRAM CONTINUES FROM HERE AFTER WAKING UP

    sleep_disable();         // first thing after waking from sleep: // disable sleep...

    detachInterrupt(0);      // disables interrupt 0 on pin 2 so the // wakeUpNow code will not be executed  // during normal running time.


void loop() 
    digitalWrite(GLEDPIN, HIGH); //set green led high
    digitalWrite(BLEDPIN, HIGH); //set blue led high
    digitalWrite(RLEDPIN, HIGH); //set red led high

  times = millis();

    digitalWrite(GLEDPIN, LOW); //Reset the LED's
    digitalWrite(BLEDPIN, LOW);
    digitalWrite(RLEDPIN, LOW);

I think the problem is that it has a bit of rising signal while moving, so a solution could be to have a threshold in the reception of the signal, can it be done?

  • Do you mean when physically moving the Arduino? Are you using a breadboard with jumper wires or is everything soldered?
    – Wildman
    Nov 21, 2017 at 20:12
  • @Wildman Yes, when I move the whole thing very fast it restart. It is soldered with cables. Nov 22, 2017 at 11:35

1 Answer 1


You should add pull-down resistors generally of 10k on the interrupt pin, this will resist the unwanted signals on that pin.

  • Please explain how you conclude this? May 27, 2019 at 9:35
  • Pull-up and Pull-down resistors are used to correctly bias the inputs of digital gates to stop them from floating about randomly when there is no input condition.
    – Vaibhav
    May 27, 2019 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.