I hope you can help me because I'm already desperate. After several failed attempts with the SIM800L, I have changed the GSM/GPS module for the A9G and I have an arduino Mega.
The problem I have is that I try to communicate with the A9G through the arduino but it is impossible... Through a TTL I have succeeded, but not with Arduino. I have connected the Tx and Rx pins of the A9G module to the 19 and 18 of my arduino Mega. I feed the A9G with a 3.7V and 820mAh battery through the VBat connector of the module and I have connected the grounds of the module and Arduino. I have used the following program:
void setup()
{
//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);
//Begin serial communication with Module
Serial1.begin(38400);
Serial.println("Initializing...");
delay(10000);
}
void loop()
{
updateSerial();
}
void updateSerial()
{
delay(500);
while (Serial.available())
{
Serial1.write(Serial.read());//Forward what Serial received to Software Serial Port
}
while(Serial1.available())
{
Serial.write(Serial1.read());//Forward what Software Serial received to Serial Port
}
}
However, the serial monitor gives me no data. Nothing. I only see "Initializing..." and I don't know what to do anymore. I have to deliver a project next week with GPS and Blynk and I've been fighting with GSM module and GPS for 1 month. I pull my hair out XD
How could I do communication with the A9G?
Thank you very much for any kind of help.
Related
I am working on an Arduino and esp8266 project and I am facing a problem that after uploading following code nothing is showing on serial monitor. I am using USB connector to power up the Arduino then connected Esp8266 with it by connecting all 6 wires. I bypass the Arduino by connecting reset with ground. There is no error while uploading code but its showing nothing. Tried connecting esp8266 TX with Arduino RX and esp RX with Arduino TX. And TX with TX and RX with RX also but still hard luck. Baud rate is same 115200 port is also correct but still not working. Kindly help me to figure it out ! Thanks
PS: I attached the schematic, kindly check that.
void setup() {
Serial.begin(115200);
while(!Serial) { delay(100); }
}
void loop() {
Serial.println("Hello!");
delay(1000);
}
I've been trying to connect two HC-05 bluetooth modules together as master and slave devices. I know that to do this i need to establish one as a slave device and one as a master using the AT command mode. I am using an arduino nano with each of the modules and the circuit i have used is shown:
Vcc -----> 5V
GND ----> GND
Rx ------> Rx
Tx ------> Tx
I followed various online tutorials and have used this code:
include SoftwareSerial.h
SoftwareSerial BTSerial(0, 1); // RX | TX
void setup()
{
Serial.begin(9600);
BTSerial.begin(9600); // HC-05 default speed in AT command more
Serial.println("Enter AT commands:");
}
void loop()
{
// Keep reading from HC-05 and send to Arduino Serial Monitor
if (BTSerial.available()){
Serial.write(BTSerial.read());
}
// Keep reading from Arduino Serial Monitor and send to HC-05
if (Serial.available()){
BTSerial.write(Serial.read());
}
}
Using the button on the module or by setting the EN pin high, i am able to put the module into AT mode as displayed by the LED blinking every 2 seconds. However, i receive no response after sending commands to the module using the serial monitor when i should receive a confirmation of my command.
Any ideas where i'm going wrong?
Here's the solution that eventually worked for me: I used this circuit with a voltage divider:
Vcc -----> 5V
GND ----> GND
D2 ------> Tx
D3 ------> Rx
I ended up having to buy an Uno for this to work, I'm assuming then that my Nano's were faulty in some way. I then used the following code:
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(2, 3); // RX | TX
void setup()
{
Serial.begin(9600);
BTSerial.begin(38400); // HC-05 default speed in AT command more
Serial.println("Enter AT commands:");
}
void loop()
{
// Keep reading from HC-05 and send to Arduino Serial Monitor
if (BTSerial.available()){
Serial.write(BTSerial.read());
}
// Keep reading from Arduino Serial Monitor and send to HC-05
if (Serial.available()){
BTSerial.write(Serial.read());
}
}
This allowed me to enter the AT mode and also receive responses.
One of the issues was that I was using the Tx and Rx pins which are also used to communicate with the computer so cannot be used with the HC-05 at the same time.
Another issue was the baudrate: I alternated between 9600 and 38400 for each communication until I found a combination that worked, and adjusted the speed in the Serial monitor so that it made sense.
Then I was able to use the command mode normally.
I have a SIM800L module.
I have configured my 800L SIM module, where I connect OUT+ on LM2596 to VCC on SIM800L and OUT- on LM2596 to GND on SIM800L. Besides that, I connect TX SIM800L to pin 2 Arduino and RX SIM800L to pin 3 Arduino
Then, After the source code is uploaded to the arduino mega 2560 board, the SIM800L module flashes 3 times every 3 seconds, sometimes also blinks 7 times every 3 seconds. So on.
And until now my SIM800L module cannot send messages. where is the problem? thanks please answered
First, you must double check that the modem is connected correctly and have enough power. To ensure that I always try to read the output serial of the modem in startup and make a call to it.
If modem starts correctly it should print some data in the serial output (with default settings) and some of them prints the power issues.
You can use the following example to creating a two-way communication between your host PC and the modem. In here I'm using Serial1 with pins 18, 19.
If I remember correctly the blinks should be every 3 seconds, and if it changes it means that modem is being restarted.
After that, you can send AT commands with your host PC and check the functions.
#include <SoftwareSerial.h>
#define serialSIM800 Serial1
void setup()
{
//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);
//wait on host serial
while (!Serial);
//Being serial communication with Arduino and SIM800
// you should double check the default baudrate of SIM800 and set it here
serialSIM800.begin(9600);
delay(1000);
Serial.println(“Setup Complete !”);
}
void loop()
{
//Read SIM800 output (if available) and print it in Arduino IDE Serial Monitor
if (serialSIM800.available())
{
Serial.write(serialSIM800.read());
}
//Read Arduino IDE Serial Monitor inputs (if available) and send them to SIM800
if (Serial.available())
{
serialSIM800.write(Serial.read());
}
}
I am trying to communicate with my ESP8266 module through Arduino Mega with the ESP's Rx pin connected to Mega's Pin 7 the ESP's Tx pin connected to Mega's Pin 6. I tried to run the following test code:
#include <SoftwareSerial.h>
SoftwareSerial esp8266(6, 7);
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Started");
// set the data rate for the SoftwareSerial port
esp8266.begin(9600);
esp8266.write("AT\r\n");
}
void loop() {
if (esp8266.available()) {
Serial.write(esp8266.read());
}
if (Serial.available()) {
esp8266.write(Serial.read());
}
}
I get no response from the ESP8266 module. I then tried to use the Mega's dedicated Tx and Rx pins (1 and 0 respectively). I can send commands using the serial monitor and it replies. First I sent AT+CIOBAUD=9600 under a 115200 baud to change the baud rate of my ESP module to 9600. Then under 9600 baud I sent AT+UART_DEF=9600,8,1,0,0. It replied OK for both as expected. I tried again to run this program but I'm still getting no response from the ESP 8266 module. I also tried simply switching the Rx and Tx pins just to be safe. Still doesn't work. Any ideas on what I might be doing incorrectly?
As you've mentioned in comments, SoftwareSerial esp(6,7) works on UNO but not on Mega. That should be hint big enough to google the Arduino SoftwareSerial reference page, particularly the Limitation section.
In short, unlike UNO the Mega doesn't have Pin Change Interrupt capability on all pins. So you can't have Rx pin on pin 6.
I am a newbie with Arduino Mega 2560 .I have been trying to connect the Arduino and SIM900A module(GSM/GPRS module).I have connected the USB to my PC(Serial instance) and pins 18(Tx) and 19(Rx) to Rx and Tx in the GSM/GPRS module respectively and the GND pin(GSM/GPRS) module's is connected to GND,one near pin 13 in the Arduino.
Power connection:-
I am powering using 12V supplies for each of the boards.
The below is my code.
void setup()
{
Serial.begin(9600);
Serial1.begin(9600);
delay(1000);
Serial.print("Initial Setup !!");
delay(5000);
}
void loop()
{
if(Serial.available())
{
char a=Serial.read();
Serial1.print(a);
//Serial.print(a);
}
if(Serial1.available())
{
char B=Serial1.read();
Serial.print(B);
//Serial.print(a);
}
}
I am able to get the initial response in the "Serial Monitor" like (+CFUN:1,+CPIN:READY)(Once I open the Serial monitor I used to press the reset in the GSM/GPRSmodule).
But when I type some AT commands in the Serial Monitor,I am not able to get the response like "OK" from the GPRS/GSM Module.
Please let me know what I should be doing for getting the responses back from GSM/GPRS module.
Have you tried cutting out the Arduino, for just a moment? Get yourself a UART and wire up TX/RX to the GMS respectively. Then plug it into your PC and launch terminal (Tera Term, etc.).
Try issuing some AT commands and make sure you're getting correct responses/echos. You may also want to try a tool called QNavigator (free download).