Giter Site home page Giter Site logo

bendz85 / arduino-gsm-sketches Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nejohnson2/arduino-gsm-sketches

0.0 2.0 0.0 252 KB

This uses the Arduino GSM Shield to gather nearby cell tower information and send it via SMS

Arduino 100.00%

arduino-gsm-sketches's Introduction

###Arduino GSM Sketches

These are a collection of sketches to be used with the Arduino GSM Shield. They focus primarily on using the shield through serial communication instead of using the Arduino GSM library. I found the library to be clunky and not allow me to do what I wanted to do.

As an initial setup, simple upload the basic-gsm-serial-communication.ino sketch to your Arduino with the shield. Once uploaded, use an application which lets you communicate over serial directly. I prefer to use Cool Term. Once you're connected over USB, push and hold the power button on the Arduino GSM shield until you see the status LED solid and the net LED blinking.

List of AT commands: http://arduino.cc/en/uploads/Main/Quectel_M10_AT_commands.pdf

####Notes on modifiying the Arduino SoftwareSerial Library

In working with the Arduino GSM shield, I kept finding text messages were only being halfway delivered. Meaning I would only see have the message. This happened with a couple of the AT Commands that I was using which return larger amounts of information. The problem I kept encountering is that the serial buffers in both the SoftwareSerial Library and the GSM library were too small causing the messages and information to be incomplete. I simply edited those variables in the library in order to get things to work properly.

If using the SoftwareSerial Library, modify the SoftwareSerial.h file to increase the buffer from 64 to 256.

This can be done by:

  • Go to the Arduino application (Applications > Arduino) and right click. Select show package contents
  • Find the file Resources > Java > libraries > SoftwareSerial > SoftwareSerial.h
  • Change the line: _#define SS_MAX_RX_BUFF 64 to _#define SS_MAX_RX_BUFF 256
  • Save file

For the GSM Library:

  • Go to the Arduino application (Applications > Arduino and right click. Select 'Show Package Contents'
  • Find the file Resources > Java > libraries > GSM > GSM3CircularBuffer.h
  • Change the line: __#define BUFFERSIZE 128 to __#define BUFFERSIZE 256
  • (I also changed the BUFFERMASK value to 0xFF though I'm not sure that is necessary)
  • Save file

####Notes for using AT Commands All of these commands work on the Quectel M10 GSM module which is used on the Arduino GSM Shield. If using other GSM modules, consult the data sheet or manual for that specific module. Each company adds and uses different commands which may cause confusion. That being said, there is a list of standard AT Commands which work across all modules. They too can be found online. Below are all most common commands.

  • AT Check to see if the module is active. Should return 'OK'
  • AT+CREG? Is the module registered to the network? Set mode first: AT+CREG=2
  • AT+COPS? What network is the module registered?
  • AT+CMGF=1 This puts the module into text mode so messages can be sent/received
  • AT+CMGS="number",129, <body of message> <hex return character '1A'> Send a text message. When using CoolTerm, enter this command, the use 'Command+T' to bring up another window. This will let you type ASCII and Hex. Type your message, and the add '1A' as Hex. Note: When sending a message through OpenBTS, you do not need to use the 129.
  • AT+CMGL="ALL" Lists all text messages that are on the device (or network)
  • AT+CMGR=<index> Read SMS message at index number
  • AT+QBAND? What band am I on?
  • AT+CIMI Get the IMSI number from the module
  • AT+CSQ Check the signal strength

####Notes on sending an SMS with AT Commands There are a series of commands which must be executed in order to send an SMS using AT Commands. First the module must be in text mode. Then, you must send the AT+CMGS command with the destination number, 129, body of the message and a return character. When using Cool Term this character must be a hex character. Not sure if this is always the case.

  • AT+CMGF=1 Set the module into text mode
  • AT+CMGS="destination phone number", 129, <body of message> <hex return character '1A'> Note: When sending SMS messages through OpenBTS you do not need to use the 129 code.

####Notes on receiving SMS messages The module must be in text mode. Then you can query the network for all of the messages or a message at a specific index.

  • AT+CMGF=1 Set the module into text mode
  • AT+CMGL="ALL" List all text messages that are on the network
  • AT+CMGR=<index> read an SMS at a specific index

####Notes on deleting SMS messages Deleting messages is very simple but very important to do as the buffer size of the GSM is not very big. This means that it can only display two or three messages at a time when you use the command AT+CMGL="ALL". By deleting old messages, you will be able to see the newest message.

  • AT+CMGD=<index> delete an SMS message at a certain index

arduino-gsm-sketches's People

Contributors

nejohnson2 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.