Sim808 wakes up "randomly"

Hello,

i'm trying to build a car tracking system with an arduino and a SIM808 module: the system has two states
state 0 = arduino and sim808 in low power consumption mode
state 1 = normal operations (get GPS location, send SMS)
the system switches between the two states after receiving a call (from state 0 to 1 using an interrupt pin, from state 1 to 0 from known numbers).
When the system is not moving it works as expected, but when i use it on my car and it moves, if it is in state 0, for some reason it wakes up by itself without any call.
Why does it happen?
I thought this two things:

  • perhaps SIM808 wakes when it is shaken, but i don't think it has a gyroscope/accelerometer
  • perhaps sim808 continues to get GPS data also in low power consumption mode and after calling detachGPS function and this can wake the module

This is my code for state0 and Going_to_sleep function

if (state == 0){
    Serial.println(state);
   
   //delay(5000);
    //Serial.println("ciao");
    la = 0.00;
    lo = 0.00;
    delay(500);
    sim808.detachGPS();
    delay(1000);

    Going_To_Sleep();
   }
void Going_To_Sleep(){
    
    set_sleep_mode(SLEEP_MODE_PWR_DOWN); // Sets the sleep mode
    cli();
    sleep_enable(); // set sleep bit    
    attachInterrupt(0, wakeUp, LOW); // attach interrupt to wake CPU after sleep.    
    digitalWrite(LED_BUILTIN, LOW); // turn off LED to show sleep mode
    sei();
    delay(500);
    mySerial.print("AT+CSCLK=2\r");
    sleep_cpu(); // put to sleep - will wake up here.
    sleep_disable();
    detachInterrupt(0); //Removes the interrupt from pin 2;
    Serial.println("woke up"); // first line of code executed after sleep.
    mySerial.print("AT+CSCLK=0\r");
    delay(1500);
    sim808.hangup();
    delay(1000);
    state = 1;
    sim808.attachGPS();
    digitalWrite(LED_BUILTIN, HIGH);//turning LED on
  }

void wakeUp(){
  //Serial.println("Interrrupt stop");//Print message to serial monitor
  delay(500);
  //Serial.println("Interrrupt Fired");//Print message to serial monitor
  //detachInterrupt(digitalPinToInterrupt(2)); //Removes the interrupt from pin 2;
  // sleep_disable();//Disable sleep mode
  //detachInterrupt(0); //Removes the interrupt from pin 2;
}

Thanks for your advices!

Need the whole code ...

Does the system work if it is mounted in the car and the car stands still, with engine running?

Thanks for your reply, sincerely I haven't noticed if it wakes when the car stands still but the engine is running, I'll try...

Please check it up.
Engine running or not might give clues about basic electrical noise problems.
If that can be ruled out it looks like either software problems or circuit design.

I will, it seems strange to me because the system is not powered by the car battery but it has its own power system (2s2p 18650 battery pack) and the car battery is not near the system...

Okey. I still think the test, from the still standing car, is worth doing.

You were right! When I crank the engine, also if the car is not moving and the system is far away from the car battery, the module wakes up! perhaps it is really an electromagnetic interference!

How are the electrical connections done? Soldered, breadboard.....?

Only with dupont cables inside arduino and sim808 pins...

I don't recall what dupont is.
Those simple experiment sets use on breadboard are not very reliable plugging into controller females. They easily get bent, give intermittent contact etc.
Can You strenghten the power and signal cables that might cause the start up triggering?

These are dupont cables.
Yes, I only stick male headers inside the female pins, how should I strengthen the connections? What could I use?

I use angled pins that are made for the female connectors of the Arduino boards. I solder that angled pin to a strip of perf board and solder the cable to the perf board. Primitive but it makes a very reliable contact.