Hello, everyone! This is my first topic and hopefully will be the last. I am having troubles setting up the GSM module for our invention.
Problem: The GSM Module does not receive AT commands and does not respond with an OK
.
What devices I am using: Arduino ATMEGA2560, SIM900A (GSM Module)
I have connected all the appropriate connections like so:
GSM Module, 5VR ---> Arduino ATMEGA2560, Pin 11 (Yellow, Jumper Wire)
GSM Module, 5VT ---> Arduino ATMEGA2560, Pin 10 (Orange, Jumper Wire)
GSM Module, VCC ---> TTL-to-USB, 5V (Red, Jumper wire)
GSM Module, GND ---> TTL-to-USB, GND (Black, Jumper wire)
I am cheerful to know that everything lights up as it should. So I proceeded to type my code:
#include <SoftwareSerial.h>
#define SerialTransmit_pinout 11
#define SerialReceive_pinout 10
SoftwareSerial gsmMod_obj(SerialReceive_pinout, SerialTransmit_pinout, false);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
gsmMod_obj.begin(9600);
gsmMod_obj.listen();
delay(1000);
Serial.println("GSM Module. Params:\n - Arduino Pin R = 10, T = 11\n - GSM Pin R = 5VR, T = 5VT\n Serial_BaudRate: 9600");
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available()){
Serial.write(gsmMod_obj.read());
}
if(gsmMod_obj.available()){
Serial.println("Theoretically ready.");
gsmMod_obj.write(Serial.read());
} else {
Serial.println("GSM Module, not available. Rechecking...");
}
delay(2000);
}
As you can see, I have initialized an object for the GSM Module with inverse_logic
to false and added some conditionals if available()
returns a value (I assume) other than zero.
After sorting out the code and hardware, I have finally executed the code. This is where it all gets finicky:
available()
returns zero and so the code under else
gets executed hence, "GSM Module, not available. Rechecking...".
What I have tried:
- Setting the baud rate for the GSM Module to 19200. Because apparently, the internet says so and because it is also where the GSM Module is most responsive. (Did not work)
- Copying and pasting other people's code. (Did not work)
- Connecting the extra VCC and GND from the GSM Module to the Arduino. (Did not work)
- Tried pin 1 and 0 (Rx and Tx pin for MEGA2560), it interfered the uploading process. (Did not work)
- Tried the 3V I/O, 3VR and 3VT. (Did not work)
- Connected GSM Module to 3V supply. (Did not work)
- Changing between SIM cards. (Did not work)
Then finally, I reworked the code; changed all of my jumper wires and turned the devices off and on and still, it did not function.
I appreciate the feedback and scrutiny that will come, thank you.