Playing with the Arduino GSM shield

2863864897-1
Last week I attended the Arduino GSM Playground organised by Telefonica Digital.
The Arduino GSM shield was released about a month ago; manufactured by Arduino, but designed by Telefonica. All the specs are available on the Arduino webiste.
I’ll do a bit of research on GSM first, then I’ll try and highlight some features of the shield, and finally I’ll tell you all about my little hack at the playground.

1. About GSM

I recently found out that I was using a lot of acronyms without knowing what they meant. A LOT. So, let’s start with the meaning of GSM. GSM stands for Global System for Mobile Communications (originally, Groupe Spécial Mobile); thanks Wikipedia.
As I understand it, it is a network system, now recognized as an international standard for telecommunications. It was developed as a digital system to replace an existing analog cellular network. It is optimised for full duplex telephony (send/receive). Good to know : the cellular phone gets its name from the division of a geographic area into hexagonal cells; each area is covered by a station/antenna.
GSM provides useful services such as:

  • encryption, for secure phone calls
  • data networking
  • SMS
  • call forwarding
  • caller ID
  • multi-party conferencing

GPRS (General Packet Radio Service) is a packet that carries the information from one cell to another.

For more details, I recommend these links:
http://www.howstuffworks.com/question537.htm
http://www.radio-electronics.com/info/cellulartelecomms/gsm_technical/gsm_introduction.php
http://in.answers.yahoo.com/question/index?qid=20110414222305AAAP5JE

2. The Arduino GSM shield
a) What is a shield?
According to the Arduino website, “shields are boards that can be plugged on top of the Arduino PCB extending its capabilities. The different shields follow the same philosophy as the original toolkit: they are easy to mount, and cheap to produce.”
In other words, a shield is an add-on for the Arduino board. Each one of them has specific functionalities. You will, for example, find a WiFi shield, an Ethernet shield, a prototyping shield, a GPS shield,… and of course the latest GSM shield.

b) A few features
The GSM shield only requires a normal SIM card, that you would put in a mobile phone. It might be wise to go with a pre-paid card, depending on the project, to avoid astronomic phone bills!
The shield enables you to send and receive calls and text messages, and connect to the Internet (pretty useful when you can’t use the Ethernet or WiFi shield because you don’t have a router nearby). In short, you could build your own mobile phone with Arduino and a GSM shield. Although, I doubt it would be much smaller than this:

3. A simple hack
Before starting, ensure you’ve got the latest version of the Arduino IDE because it includes examples for the GSM shield.

a) Calling you with a tune
What I’ve done with the shield is actually really simple. Enter a number to call, and when the receiver picks up, a tune is played in their phone.
Screen Shot 2013-04-29 at 20.02.10

It all started with the idea for an app, Feel-good songs for friends, which basically would call your friends at random and play them the MP3 of a happy song. You don’t need an Arduino for that, just a service like Twilio, for example. However, with the GSM shield and Arduino, you can actually send 8-bit sounds over the phone. And I only had to write a few lines of code to do so! (The rest was mostly copy and paste). I am always a bit worried when I open the IDE, because I’m not fluent in Processing yet, but actually, it is quite easy to understand. So, all I did was merge two examples that were available in the IDE: toneMelody, by Tom Igoe and MakeVoiceCall, by Javier Zorzano. And Voilà! toneMelody is written to work with pin 8 of the Arduino board, so all you have to do is connect pin 8 with the microphone input of your GSM shield.
arduinoGSM
Thanks to Sam for his advice! 🙂

b) Next steps
Going further, I think I would try and change the melody, maybe make it random (or selected randomly from a library) for each call, or build an online interface where you can create a tune before sending it to your friends (it’s actually a bit more personal than just playing an MP3). I might also have a look at DTMF (Dual-tone multi-frequency signaling), like Sam suggested; I don’t know much about it yet but it might be interesting to create “richer” tones.

Related articles:
http://blog.bluevia.com/2013/04/16/arduino-gsm-playground-29th-april/
https://thelab.o2.com/2013/05/the-labs-arduino-playground/

Advertisements

9 thoughts on “Playing with the Arduino GSM shield

  1. Pingback: 02 Lab – Arduino GSM Playground | Haphazard Journey by Starlight

  2. Hi. I was there too – developed a SMS/Twitter mashup.
    Interested in what you did and taking it further – thinking of creating a unique tone based on colours.
    Would you share your Sketch?
    Thanks

    • Hi there,
      As mentioned, the sketch is just bringing two examples available in the Arduino IDE together. In the MakeVoiceCall sketch play the notes as defined in toneMelody (also an example from the IDE); it would be something like this:
      if(vcs.voiceCall(charbuffer))
      {
      Serial.println(“Call Established. Enter line to end”);
      for (int thisNote = 0; thisNote < 8; thisNote++) {

      // to calculate the note duration, take one second
      // divided by the note type.
      //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
      int noteDuration = 1000/noteDurations[thisNote];
      tone(8, melody[thisNote],noteDuration);

      // to distinguish the notes, set a minimum time between them.
      // the note's duration + 30% seems to work well:
      int pauseBetweenNotes = noteDuration * 1.30;
      delay(pauseBetweenNotes);
      // stop the tone playing:
      noTone(8);
      }
      // Wait for some input from the line
      while(Serial.read()!='\n' && (vcs.getvoiceCallStatus()==TALKING));
      // And hang up
      vcs.hangCall();
      }

      Hope that helps 🙂

      • Thanks. Interesting.
        Looking at developing something that interprets the Hex value of pixels and creates a tone based on that.
        Need to sort a GSM Shield out!

      • Unless you want to call someone with that tone, you don’t really need a GSM shield, a speaker/piezo plugged into an Arduino UNO would do.

  3. How would you play an mp3 over the phone with the use of the cellular shield? I have an Arduino Ethernet (not the shield, but the actual arduino board with built in Ethernet capability and the microSD card holder). So I know it must be possible to have the cell shield get access to a stored mp3 on the SD card, and play it to the recipient of the phone call… But I really don’t know where to start coding wise… If you have any ideas please help 🙂

    • Hi,
      I haven’t got an Arduino Ethernet, so I don’t know how easy it is to play an MP3. Although, if you already know how to play an MP3 through a speaker with that board, then I reckon it would just be a case of replacing the speaker by a GSM shield, using the MakeVoiceCall sketch available in the GSM examples. Hope that helps 🙂

  4. Heythere! Im doing a class project on child safety beacon. I need to send an alarming sound to a android via GSM shield on Sim card. The idea is to get to play a certain song from the music player. Any suggestions?? Much appreciated !

    • Hi,
      do you want the tune to be played when someone answers a call?
      Is the GSM shield a requirement? If not, using a service like Twilio would probably be easier.
      Otherwise, you’ll probably have to convert your tunes to 8-bit and use the toneMelody example from the Arduino IDE.
      Does that help?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s