GSM SIM900a wont initialized

blynk proj
Im trying to make this project. Im using gsm sim900a and 433 Mhz Rf module.
Sensor node code:

#include <VirtualWire.h>
#include <DataCoder.h>
#include <DHT.h>
#define DHTPIN 5

#define DHTTYPE DHT11
DHT dht (DHTPIN, DHTTYPE);
int TX_PIN = 10;
void setup() {
  dht.begin();
  Serial.begin(115200);
  vw_set_tx_pin(TX_PIN);
  vw_setup(4000); 
}

void loop() {
  int soilM = analogRead(A1);
  float t, h, sm;
  sm = soilM;
  h = dht.readHumidity();
  t = dht.readTemperature();

  float data[RF_DATA_ARRAY_SIZE];
  data[0] = t;
  data[1] = h;
  data[2] = sm;

  union RFData outDataSeq;

  EncodeRFData(data, outDataSeq);
  
  TransmitRFData(outDataSeq); 
  delay(500);
}


Base node code:
#define BLYNK_PRINT Serial
#define TINY_GSM_MODEM_SIM900
#include <TinyGsmClient.h>
#include <BlynkSimpleSIM800.h>
#include <VirtualWire.h>
#include <DataCoder.h>
const int RX_PIN = 9;

char auth[] = "XXXXXXXXXXXXXXXXXXXXXXXX";
char apn[] = "XXXXXXXXX";
char user[] = "";
char pass[] = "";

#include <SoftwareSerial.h>
SoftwareSerial GPRS(2, 3);


TinyGsm modem(GPRS);

//BlynkTimer timer;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  vw_set_rx_pin(RX_PIN);
  vw_set_ptt_inverted(true);
  vw_setup(4000);
  vw_rx_start();
  delay(10);
  GPRS.begin(115200);
  
  delay(3000);
  Serial.println("Initializing modem...");
  modem.restart();

  Blynk.begin(auth,modem, apn, user, pass);
  //timer.setInterval(1000L, sendSensor);
}

void loop() {
  // put your main code here, to run repeatedly:
  Blynk.run();
  sendSensor();
}
void sendSensor(){
  uint8_t msg[VW_MAX_MESSAGE_LEN];
  uint8_t msglen = VW_MAX_MESSAGE_LEN;

  union RFData inDataSeq;

  float data[RF_DATA_ARRAY_SIZE];

  if (vw_get_message(msg, &msglen)){
    int i;
      for (i = 0; i < msglen; i++){
        inDataSeq.s[i] = msg[i];
      }
      DecodeRFData(data, inDataSeq);
      for(int i = 0; i < RF_DATA_ARRAY_SIZE-1; i++){
         if(i == 0){
          Blynk.virtualWrite(V1, data[i]);
          }
         if(i == 1){
          Blynk.virtualWrite(V2, data[i]);
          }
         if(i == 2){
          Blynk.virtualWrite(V3, data[i]);
          }
        }
    }
  }

No error after uploading these codes but after I tried to open the serial monitor for the base node to see if it was connected, all I can see was ‘cannot init’. Im new to blynk so I really dont know what was wrong with this. I really need to figure out whats the problem so please help me with this.
Thank you.

First of all forget about using 115200bps with software Serial. Try 19200 or 9600.
I do not know if the SIM900a is the same with respect to AT comm but the SIM900 works nice and stable, so try the above, do not mess the RX-TX lines and give feedback.

1 Like

Thank you, sir. I am currently trying what you said earlier.

@ArJames a proper help request should also contain your serial console output. Did you try the TinyGSM troubleshooting? You can find the link directly in the example sketch.

Im sorry, sir.
We try to change the baud rate to 19200 and, now, it is trying to connect to the cloud.

Wwe change the baud ratebto 19200

You have a very slow connection… Or high latency… Please try to set

#define BLYNK_TIMEOUT_MS     15000UL

on the top of your sketch

Also, it looks like it connects without issues. Do you have any problems now?

Im very sorry for the late reply.


We couldnt get the value for the soil moisture.

Please follow the diagnostics/troubleshooting guide.

I am also facing the same issue Cannot init messaage in Serial Monitor. I changed the baud rate to 19200 and still same error. Can you please help?

I’d suggest that you create a new “Need help with my project” topic, and provide ALL of the requested information, plus any additional information that may assist.

Pete.