I've been trying to work with Waveshare SIM 808 shield on arduino, quite similar to this one: https://www.waveshare.com/wiki/GSM/GPRS/GPS_Shield_(B)#How_to_use_with_Arduino_UNO_R3
I tried using multiple examples, such as this:
#include <DFRobot_sim808.h>
#include <SoftwareSerial.h>
DFRobot_SIM808 sim808(&Serial);
void setup() {
Serial.begin(9600);
//******** Initialize sim808 module *************
while(!sim808.init()) {
delay(1000);
Serial.print("Sim808 init error\r\n");
}
//************* Turn on the GPS power************
if( sim808.attachGPS())
Serial.println("Open the GPS power success");
else
Serial.println("Open the GPS power failure");
}
void loop() {
//************** Get GPS data *******************
if (sim808.getGPS()) {
Serial.print(sim808.GPSdata.year);
Serial.print("/");
Serial.print(sim808.GPSdata.month);
Serial.print("/");
Serial.print(sim808.GPSdata.day);
Serial.print(" ");
Serial.print(sim808.GPSdata.hour);
Serial.print(":");
Serial.print(sim808.GPSdata.minute);
Serial.print(":");
Serial.print(sim808.GPSdata.second);
Serial.print(":");
Serial.println(sim808.GPSdata.centisecond);
Serial.print("latitude :");
Serial.println(sim808.GPSdata.lat,6);
sim808.latitudeConverToDMS();
Serial.print("latitude :");
Serial.print(sim808.latDMS.degrees);
Serial.print("\^");
Serial.print(sim808.latDMS.minutes);
Serial.print("\'");
Serial.print(sim808.latDMS.seconeds,6);
Serial.println("\"");
Serial.print("longitude :");
Serial.println(sim808.GPSdata.lon,6);
sim808.LongitudeConverToDMS();
Serial.print("longitude :");
Serial.print(sim808.longDMS.degrees);
Serial.print("\^");
Serial.print(sim808.longDMS.minutes);
Serial.print("\'");
Serial.print(sim808.longDMS.seconeds,6);
Serial.println("\"");
Serial.print("speed_kph :");
Serial.println(sim808.GPSdata.speed_kph);
Serial.print("heading :");
Serial.println(sim808.GPSdata.heading);
//************* Turn off the GPS power ************
sim808.detachGPS();
}
}
or this
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
String comdata = "";
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
delay(200);
}
void loop() // run over and over
{
delay(2000);
mySerial.println("AT");
delay(200);
//Send message
mySerial.println("AT+CGNSPWR=1");
delay(200);
//reset GPS in autonomy mode
mySerial.println("AT+CGNSTST=1");
delay(200);
mySerial.listen();
while(1)
{
while(mySerial.available()>0)
Serial.write(mySerial.read());
while(Serial.available())
mySerial.write(Serial.read());
}
}
In first case, I obviously don't declare RX, TX pins and use the Arduino's general purpose RX, TX pins (0, 1).
In second case I used wires to connect Arduino pins 2 and 3, to shield's D0 and D1 pins.
In both cases, neither RX or TX leds on shield's module light up, which means that it doesn't receive the sent data.
I made sure to set UART/ARDUINO switch on ARDUINO position and I did reset the module several times.
I am using Arduino Uno. What goes wrong here?