Here is my code:
Code: Select all
#include "HardwareSerial.h"
HardwareSerial SIMSerial2(2);
unsigned long previousM = 0;
const long resetBurst = 13000;
void setup() {
Serial.begin(9600);
SIMSerial2.begin(9600,SERIAL_8N1, 18,19);
Serial.println("Starting");
delay(3000);
ReceiveMode();
}
void loop(){
unsigned long currentMillis = millis();
if(currentMillis - previousM >= resetBurst){
previousM = currentMillis;
Serial.println("Getting in Receive Mode");
ReceiveMode();
}
}
void ReceiveMode() {
Serial.println("Inside Receive Mode");
SIMSerial2.write("AT");
delay(3000);
Serial.print(SIMSerial2.read());
SIMSerial2.write("AT+CGSN");
delay(3000);
Serial.print(SIMSerial2.read());
delay(3000);
}
SIM900a GND to ESP GND
SIM900a 5VT to ESP RX
SIM900a 5VR to ESP TX
SIM900a is powered by a separate Buck Converter providing 4.7V at 2A.
Using Arduino IDE and this is what I get in serial monitor:
I also tried 3VT and 3VR of SIM900a. I tried the DB9-2 and DB9-3 headers on the other end of the board but same result. No SIM is inserted yet.Starting
Getting in Receive Mode
Inside Receive Mode
-1-1Getting in Receive Mode
Inside Receive Mode
-1-1
SIM900a works fine with NodeMCU ESP8266.
Kindly help me out