Feb 23, 2016 0 Comments in GSM/GPRS, Learning by
Using a GSM/GPRS modem

Having an Internet connection is nowadays a must-have for quite every embedded board, so let’s see how we can use a serial GSM/GPRS module on our Cosino based board for both sending a SMS or to surf the Internet.

Prerequisite

You need a Cosino core module plugged in into a Cosino’s extension with a preformatted microSD in order to have a running system, then you need a GSM modem connected to your Cosino board.

warning Even if this guide is referred to a GSM modem related to the Cosino Project you can use a generic GSM board too.

Sending a SMS

There are several ways to send a SMS message, but the most quick&easy is by using the gsm-utils. These are powerful utilities to manage a GSM module (checking the status, managing PINs, etc.) and they can be used to send/receive SMS messages too.

By using the following gsmctl command you can verify the modem’s status:

warning Note that the command is quite slow so you have to wait for a while before getting again the prompt.

warning Be sure you have correctly placed a functional SIM card enabled to send/receive SMS messages into the reader, and check that the antenna is correctly connected before using the following commands.

Then to send a SMS message you can use the command below:

Be sure to replace the XXXXXXXXXX with a valid GSM number.

Surfing the Internet

To get access to the Internet can use the wvdial program with the pppd daemon. Use the following command to install the software:

At the end of the installation you should see the message:

However some modifications to the configuration file /etc/wvdial.conf should be done and, under some circumstances regarding your GSM provider, also the pppd’s configuration file /etc/ppp/peers/wvdial should be modified.

As example on my system I used to following settings into /etc/wvdial.conf :

While into /etc/ppp/peers/wvdial I used to the following:

If everything is properly configured by using the simple wvdial command should be enough to sourf the Internet as shown below:

Now the Internet connection is ready to operate! We can check our new public IP address by using the ifconfig command as shown below:

To close the connection we can send a SIGINT to the wvdial program as follow:

Where the number 3547 is the wvdial‘s PID displayed by the Bash shell when we executed the program in background with the & directive.



Facebooktwitterlinkedin
Tags: