I finished my project but i have a little problem.
I somekind solved the problem but i dont know if i faced the source of the problem (good) or just faced the result of the problem (not good)
The circuit is simple.
1 set of batteries powering arduino and the red of battery goes to a relay and the NC of the relay goes to SIM800L VCC.
So that when arduino triggers the relay ,,,the SIM800L is powered and be capable of communicating with arduino.
Now the problem is that if i just trigger the relay my arduino resets.
The relay has not flyback diode but i dont think this is the problem because ...even if i put diode...again reseting.... (But may i am wrong on this)
And i found the solution to write HIGH in the RX and TX pins of SIM800L (JUST 2 seconds before i trigger the relay) [u]so that the VCC of SIM800L goes to 2.24 Volt[/u] NOT from the original battery source , but via the arduino !!!!
And if its like this then its ok...no reseting.
Maybe the big yellow capacitor on sim ?...i really dont know.
But the problem is not only that i dont understand the WHY but...i dont know if this solution is going to damage (in the long run) my arduino or my sim800l !!!!
Can anyone please advise ?
Thank you in advance .
Below you see the code.... and the 3 lines of SALVATION code!
....
const uint8_t PinRelay = 4; //
const uint8_t PinSimTx = 6; // our Rx ,SoftwareSerial INPUT_PULLUP
const uint8_t PinSimRx = 5; // our Tx ,SoftwareSerial OUTPUT (making LOW when finish job?)
#include
SoftwareSerial sim(PinSimTx, PinSimRx);
....
void loop() {
blinc(2);//simulate sleeping
pinMode(PinSimTx,OUTPUT);
digitalWrite(PinSimTx,LOW);//put all LOW just for ...saving power
digitalWrite(PinSimRx,LOW);
delay(2000);//end simulate sleeping some hours
blinc(3);//now wake up ,take measurements and send them to the network
digitalWrite(PinSimTx,HIGH);//1)1st line of SALVATION CODE
digitalWrite(PinSimRx,HIGH);//2)2nd line of SALVATION CODE
//3)3rd line of SALVATION CODE
delay(3000);//just for SIM VCC to clamp at 2.24 volt !!! critical for when relay triggered(1000 is ok ...but...)
digitalWrite(PinRelay,HIGH);//ok..now trigger relay to open
pinMode(PinSimTx, INPUT_PULLUP);//back to the pullup mode for softwareserial
delay(7000);///...for sim to be ok for question
execAndReadATBattery();///do what ever here....
delay(1000);
digitalWrite(PinRelay,LOW);//ok..done...close relay and go for sleep
}