RasPiCommPlus Logo:Using the GSM module to send a message

In this tutorial we will take a look at how to use the GSM-module to send and receive SMS! The GSM-module is designed for use with the RasPiComm+, now available for preorder on Indiegogo!


Required Parts

We'll need the following parts:
PartSource
Raspberry PiRS 8111284
RasPiComm+ MainboardTBA
RasPiComm+ GSM ModuleTBA
Sim-Card  
GSM Antenna RS 793-4357
SMA Coaxial Cable DK 931-1098-ND

  1. Hardware Setup
  2. Let's get our gear in place!

    GSM start
    Insert the SIM-Card into your GSM module and the module into any RasPiComm+ module slot (I inserted it in slot 3). Connect the Antenna and boot up your Raspberry Pi!
    GSM module mounted


  3. Software Setup
  4. If you haven't already, download the Setup-Script:

    wget downloads.amescon.com/rpc+setup.sh
    and make it executable:
    chmod +x rpc+setup.sh
    Then execute the automated setup
    sudo ./rpc+setup.sh
    Starting the Setup
    The setup recognizes the connected modules (in this case GSM in module slot #3). Prompt it to start firmware configuration
    y
    Server building Firmware
    If not present in the local cache the firmware is requested from our server and transferred to your Raspberry Pi. Confirm firmware update
    y
    Setup complete!
    Setup complete


  5. Using the GSM module
  6. Let's activate the GSM module in slot 3:

    echo 1 > /proc/rpc+/module3/enable_gsm
    The GSM module's LED will start to blink. Our Linux drivers have installed the GSM module as a serial device, available under /dev/ttyRPC+X, whereas X depends on the module slot and on how many serial ports are connected.
    Module Slottty
    Slot 1/dev/ttyRPC+0
    /dev/ttyRPC+1
    Slot 2/dev/ttyRPC+2
    /dev/ttyRPC+3
    Slot 3/dev/ttyRPC+4
    /dev/ttyRPC+5
    Slot 4/dev/ttyRPC+6
    /dev/ttyRPC+7

    In our example the GSM-module is located in slot 3, which means we can adress it with /dev/ttyRPC+4. I will access it with the screen terminal. You could also use echo commands (if you do, make sure you don't supress the newline, it activates the commands!).
    Upon activating the screen terminal at a baud rate of 9600 with
    screen /dev/ttyRPC+4 9600
    the GSM module is awaiting our AT commands (full list here).
    Let's try one!
    AT+CMEE=2
    and pressing Enter will activate verbose messages. Always a good thing.
    verbose GSM
    The module replies "OK" to let us know the command was well received. Let's enter our PIN so the GSM module can connect to the network
    AT+CPIN=xxxx
    where 'xxxx' is your SIM-card's PIN.
    GSM PIN
    Again the module replies "OK". Let's check the carrier and connection.
    AT+COPS?
    GSM Carrier
    shows that we are indeed connected to a carrier (Austrian 'A1' in this case), and
    AT+CSQ
    GSM connection strength
    returns "(24,0)" which implies a signal strength indication of 24 and an channel bit error rate of 0%. According to the AT command manual, the strength indication can be translated into dBm values:
    Strength indicationdBm
    0-115 dBm or less
    1-110 dBm
    2-30-110 to -54 dBm
    31-52 dBm or greater
    99not known or detectable


  7. Sending an SMS
  8. Let's activate text mode instead of PDU mode first

    AT+CMGF=1
    Textmode
    Now we can begin writing our SMS to a given number
    AT+CMGS="recipient"
    where recipient = the phone number you want to write the message to. You will need the quotes for the command to work!
    Sending the SMS
    After pressing Enter, the new line will start with ">", indicating that you are now supposed to write your message.
    Sending the SMS
    When you are done typing your text, send the message with
    Strg+Z
    Sending the SMS 2
    The reply
    +CMGS: xx
    tells us that sending the message with the number xx was sent successfully. If something went wrong, we'd be seeing
    +CMS ERROR: xx
    instead. Looking at the phone:
    SMS at phone
    Let's answer and see what happens at the RasPiComm+ side! Our screen terminal shows that a new message has been received:
    SMS received as RasPiCommPlus
    To read all our SMS, we enter
    AT+CMGL="ALL"
    reading sms
    Apart from "ALL", you can enter "REC UNREAD" and "REC READ" for received messages and "STO UNSENT" and "STO SENT" for sent messages. Quotation Marks and Caps Lock required.


  9. Quitting Screen
  10. To get back to your linux prompt, press

    Strg+A
    type
    :quit
    (grey bar at bottom of your screen) and press Enter.
    quit screen

Additional Resources

If you have questions or feedback, please check out the following Resources:

ResourceUrl
IndieGoGo CampaignIndieGoGo Campaign
RasPiComm+ Support ForumOfficial RasPiComm+ Support Forum
Twitter Github Tumblr PInterest Youtube