GPS through Arduino and B_GSM Boards

For our GSM class final, partnered with Clara and Karthik we created a Geo-Fence hooked to an Arduino Uno.

If you're receiving garble when reading the incoming data from the GSM through Arduino, you should check whether both boards are working at the same baudrate (9600). To change the GSM board –Quectel 10M– baudrate through an FTDI adaptor and CoolTerm:

  1. AT+IPR? //Response (most likely) 115200
  2. AT+IPR = 9600 //Response OK
  3. —[Disconnect] change Baudrate to 9600 [Connect]—
  4. AT&W //Save settings. Response OK

Now plug the GSM Board to the chosen Software Serial PINS (10 and 11) and change the Fence center-point (homeLat and homeLon) the size –radius– of the fence in KMs (thresholdDistance) and the phone is going to be controlled from (phoneNumber), UPLOAD and run the SERIAL MONITOR. The code can be found in this Github Repo. Enjoy

The hardware used for this project was an Arduino UNO and one of Benedetta's custom GSM Boards with enabled GPS. This setup could work for potentially stand-alone purposes, however is advised to make sure beforehand that the power source has enough Watts to run the setup for the sought time.

SMS-LED

A simple snippet to make an LED light up when receiving a SMS, with one of Bennedetta's GSM Shields

Lighting the LED pin 13 in the Arduino board. After several failed attempts of writing from Arduino Serial Monitor, we decided to do it through Coolterm. 

This is the code:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3);
char inChar = 0;
char message[] = "que pasa HUMBA!";

void setup()  
{
  Serial.begin(9600);
  Serial.println("Hello Debug Terminal!");
  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  
  pinMode(13, OUTPUT);
  
//  
//  //Turn off echo from GSM
//  mySerial.print("ATE0");
//  mySerial.print("\r");
//  delay(300);
//  
//  //Set the module to text mode
//  mySerial.print("AT+CMGF=1");
//  mySerial.print("\r");
//  delay(500);
//  
//  //Send the following SMS to the following phone number
//  mySerial.write("AT+CMGS=\"");
//  // CHANGE THIS NUMBER! CHANGE THIS NUMBER! CHANGE THIS NUMBER! 
//  // 129 for domestic #s, 145 if with + in front of #
//  mySerial.write("6313180614\",129");
//  mySerial.write("\r");
//  delay(300);
//  // TYPE THE BODY OF THE TEXT HERE! 160 CHAR MAX!
//  mySerial.write(message);
//  // Special character to tell the module to send the message
//  mySerial.write(0x1A);
//  delay(500);
}

void loop() // run over and over
{
  if (mySerial.available()){
    inChar = mySerial.read();
    Serial.write(inChar);
    digitalWrite(13, HIGH);
    delay(20);
    digitalWrite(13, LOW);
    }
    
  if (Serial.available()>0){
    mySerial.write(Serial.read());
  }
}