<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.linksprite.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Leona</id>
	<title>LinkSprite Playgound - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.linksprite.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Leona"/>
	<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php/Special:Contributions/Leona"/>
	<updated>2026-04-21T17:50:16Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=10mm_Blue_LED_Module&amp;diff=3789</id>
		<title>10mm Blue LED Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=10mm_Blue_LED_Module&amp;diff=3789"/>
		<updated>2013-12-26T04:10:30Z</updated>

		<summary type="html">&lt;p&gt;Leona: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
[[File:LED10MM_B.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Schematics ==&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/LinkerKit/Linker_LED.pdf Schematics]&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=JPEG_2M_Pixel_Color_Camera_Serial_Interface(TTL_level)&amp;diff=3751</id>
		<title>JPEG 2M Pixel Color Camera Serial Interface(TTL level)</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=JPEG_2M_Pixel_Color_Camera_Serial_Interface(TTL_level)&amp;diff=3751"/>
		<updated>2013-12-16T01:21:38Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Specification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
LS-Y201-2MP is LinkSprite’s new generation high resolution serial port camera module. Its resolution is 2 million pixel. It can captures high resolution pictures using the serial port. LS-Y201-2MP is a modular design that outputs JPEG images through UART, and can be easily integrated into existing design.&lt;br /&gt;
&lt;br /&gt;
[[File:2M_JPEGC_CAMERA.jpg | 400px]]&lt;br /&gt;
&lt;br /&gt;
== Specification ==&lt;br /&gt;
*2 Million Pixels&lt;br /&gt;
*Support capture JPEG from serial port&lt;br /&gt;
*Default baud rate of serial port is 115200&lt;br /&gt;
*DC 5V power supply&lt;br /&gt;
*Size 32mm X 32mm&lt;br /&gt;
*Current consumption: 80-100mA&lt;br /&gt;
*The pin near C03 is AV output pin, which is an analog output pin.&lt;br /&gt;
&lt;br /&gt;
== Application Idea ==&lt;br /&gt;
*Different image capture systems&lt;br /&gt;
*Environmental monitoring&lt;br /&gt;
*Industry monitoring&lt;br /&gt;
*Medical equipment&lt;br /&gt;
*Video phone&lt;br /&gt;
*Security&lt;br /&gt;
*Vehicle based GPS&lt;br /&gt;
&lt;br /&gt;
== Usage  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Installation  ===&lt;br /&gt;
'''Evaluation Setup'''&lt;br /&gt;
&lt;br /&gt;
[[File:evasetup.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Programming  ===&lt;br /&gt;
[[File:evascreenshot.jpg]]&lt;br /&gt;
&lt;br /&gt;
*Step 1: Click Open COM&lt;br /&gt;
*Step 2: Click Single Shot.&lt;br /&gt;
&lt;br /&gt;
'''''Arduino sample code provided'''''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* Linksprite */&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;NewSoftSerial.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
byte incomingbyte;&lt;br /&gt;
NewSoftSerial mySerial(4,5);                     //Configure pin 4 and 5 as soft serial port&lt;br /&gt;
int a=0x0000,j=0,k=0,count=0;                    //Read Starting address       &lt;br /&gt;
uint8_t MH,ML;&lt;br /&gt;
boolean EndFlag=0;&lt;br /&gt;
                               &lt;br /&gt;
void SendResetCmd();&lt;br /&gt;
void SendTakePhotoCmd();&lt;br /&gt;
void SendReadDataCmd();&lt;br /&gt;
void StopTakePhotoCmd();&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{ &lt;br /&gt;
  Serial.begin(19200);&lt;br /&gt;
  mySerial.begin(38400);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() &lt;br /&gt;
{&lt;br /&gt;
     SendResetCmd();&lt;br /&gt;
     delay(4000);                               //After reset, wait 2-3 second to send take picture command&lt;br /&gt;
      &lt;br /&gt;
      SendTakePhotoCmd();&lt;br /&gt;
&lt;br /&gt;
     while(mySerial.available()&amp;gt;0)&lt;br /&gt;
      {&lt;br /&gt;
        incomingbyte=mySerial.read();&lt;br /&gt;
&lt;br /&gt;
      }   &lt;br /&gt;
      byte a[32];&lt;br /&gt;
      &lt;br /&gt;
      while(!EndFlag)&lt;br /&gt;
      {  &lt;br /&gt;
         j=0;&lt;br /&gt;
         k=0;&lt;br /&gt;
         count=0;&lt;br /&gt;
         SendReadDataCmd();&lt;br /&gt;
&lt;br /&gt;
         delay(25);&lt;br /&gt;
          while(mySerial.available()&amp;gt;0)&lt;br /&gt;
          {&lt;br /&gt;
               incomingbyte=mySerial.read();&lt;br /&gt;
               k++;&lt;br /&gt;
               if((k&amp;gt;5)&amp;amp;&amp;amp;(j&amp;lt;32)&amp;amp;&amp;amp;(!EndFlag))&lt;br /&gt;
               {&lt;br /&gt;
               a[j]=incomingbyte;&lt;br /&gt;
               if((a[j-1]==0xFF)&amp;amp;&amp;amp;(a[j]==0xD9))      //Check if the picture is over&lt;br /&gt;
               EndFlag=1;                           &lt;br /&gt;
               j++;&lt;br /&gt;
	       count++;&lt;br /&gt;
               }&lt;br /&gt;
          }&lt;br /&gt;
         &lt;br /&gt;
          for(j=0;j&amp;lt;count;j++)&lt;br /&gt;
          {   if(a[j]&amp;lt;0x10)&lt;br /&gt;
              Serial.print(&amp;quot;0&amp;quot;);&lt;br /&gt;
              Serial.print(a[j],HEX);&lt;br /&gt;
              Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
          }                                       //Send jpeg picture over the serial port&lt;br /&gt;
          Serial.println();&lt;br /&gt;
      }      &lt;br /&gt;
     while(1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//Send Reset command&lt;br /&gt;
void SendResetCmd()&lt;br /&gt;
{&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x26, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//Send take picture command&lt;br /&gt;
void SendTakePhotoCmd()&lt;br /&gt;
{&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x36, BYTE);&lt;br /&gt;
      mySerial.print(0x01, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);  &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//Read data&lt;br /&gt;
void SendReadDataCmd()&lt;br /&gt;
{&lt;br /&gt;
      MH=a/0x100;&lt;br /&gt;
      ML=a%0x100;&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x32, BYTE);&lt;br /&gt;
      mySerial.print(0x0c, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE); &lt;br /&gt;
      mySerial.print(0x0a, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(MH, BYTE);&lt;br /&gt;
      mySerial.print(ML, BYTE);   &lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x20, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);  &lt;br /&gt;
      mySerial.print(0x0a, BYTE);&lt;br /&gt;
      a+=0x20;                            //address increases 32，set according to buffer size&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void StopTakePhotoCmd()&lt;br /&gt;
{&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x36, BYTE);&lt;br /&gt;
      mySerial.print(0x01, BYTE);&lt;br /&gt;
      mySerial.print(0x03, BYTE);        &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Support  ==&lt;br /&gt;
&lt;br /&gt;
If you have questions or other better design ideas, you can go to our [http://www.linksprite.com/forum/index.php forum] to discuss or creat a ticket for your issue at [http://www.linksprite.com/support/ linksprite support].&lt;br /&gt;
&lt;br /&gt;
== Resources  ==&lt;br /&gt;
*[http://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LinkSprite+JPEG+Color+Camera+User+Manual++V1.2.pdf User Manual]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LS-Y201-2MP.exe Evaluation Software]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LSY201.rar Linksprite Open Source Code for X86]&lt;br /&gt;
*[http://www.fezzer.com/project/220/linksprite-camera-library/ .Net micro framework source code]&lt;br /&gt;
*[https://github.com/nosebleed/jpeg-ttl-cam Github]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/JPEG_UART_camera_tutorial.pdf Tutorial at Linksprite]&lt;br /&gt;
&lt;br /&gt;
== How to buy  ==&lt;br /&gt;
&lt;br /&gt;
Here to buy on LinkSprite [http://www.linkspritedirect.com/index.php Cart]&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=16_X_2_LCD_Keypad_Shield_for_Arduino&amp;diff=3738</id>
		<title>16 X 2 LCD Keypad Shield for Arduino</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=16_X_2_LCD_Keypad_Shield_for_Arduino&amp;diff=3738"/>
		<updated>2013-11-22T01:43:56Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Specification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction  ==&lt;br /&gt;
&lt;br /&gt;
We wanted to make it easier for people to get these LCD into their projects so we devised a shield that lets you control a 16x2 Character LCD backlight with a potentiometer AND 5 keypad pins using 6 digital pins on the Arduino!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This shield is perfect for when you want to build a stand-alone project with its own user interface. The 4 directional buttons plus select button allows basic control without having to attach a bulky computer. &lt;br /&gt;
&lt;br /&gt;
*Comes with a 16x2 green backlight LCD, negative display&lt;br /&gt;
*Plug and play with any Arduino 'classic' - UNO, duemilanove, diecimilla, etc.&lt;br /&gt;
*Uses 6 pins of Arduino to control LCD and A0 pin for 5 buttons. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The LCD and Keypad Shield gives you a handy 16-character by 2-line display, 5 buttons and a controllable backlight, plug it straight in on top of your Arduino board or other project shields. The display is set behind the shield for a low profile fitment and nice look and we've included panel mounting screw holes in the corners.&lt;br /&gt;
&lt;br /&gt;
It's great when you want to build a stand-alone project with its own user interface that doesn't require a computer attached to send commands to your Arduino.&lt;br /&gt;
&lt;br /&gt;
Works perfectly in 4-bit mode with the &amp;quot;LiquidCrystal&amp;quot; library included with the Arduino IDE, allowing you to control the LCD with a total of just 6 digital I/O lines. We've deliberately picked D4-D9 so that it doesn't interfere with pins required by other popular products such as the Ethernet Shield and EtherTen, so you can stack this on top of other shields to give you a local display.&lt;br /&gt;
&lt;br /&gt;
The buttons provide &amp;quot;left&amp;quot;, &amp;quot;right&amp;quot;, &amp;quot;up&amp;quot;, &amp;quot;down&amp;quot;, and &amp;quot;select&amp;quot; while using just one analog input. That leaves the other analog inputs free for you to use in your projects.&lt;br /&gt;
&lt;br /&gt;
The LCD backlight is connected to a potentiometer can be controlled for on/off, brightness.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:1602 LCD shield-A01.jpg]] [Model A]&lt;br /&gt;
 &lt;br /&gt;
[[File:1602 lcd keypad shield-02.jpg | 400px]] [Model B]&lt;br /&gt;
&lt;br /&gt;
== Features  ==&lt;br /&gt;
*16x2 LCD using HD44780-compatible display module (black characters on green background).&lt;br /&gt;
*5 buttons on one analog input (A0).&lt;br /&gt;
*LCD backlight with current limiting, brightness and on/off controllable by a adjustable potentiometer.&lt;br /&gt;
*Recessed LCD, panel mount screw holes and button layout suitable for panel or cabinet mounting if desired.&lt;br /&gt;
*Reset button.&lt;br /&gt;
*Power supply smoothing capacitor.&lt;br /&gt;
&lt;br /&gt;
== Application Ideas  ==&lt;br /&gt;
'''test code'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;LiquidCrystal.h&amp;gt;&lt;br /&gt;
#include &amp;lt;LCDKeypad.h&amp;gt;&lt;br /&gt;
LiquidCrystal lcd(8, 13, 9, 4, 5, 6, 7);&lt;br /&gt;
char msgs[5][16] = {&amp;quot;Right Key OK &amp;quot;,&lt;br /&gt;
                    &amp;quot;Up Key OK    &amp;quot;,               &lt;br /&gt;
                    &amp;quot;Down Key OK  &amp;quot;,&lt;br /&gt;
                    &amp;quot;Left Key OK  &amp;quot;,&lt;br /&gt;
                    &amp;quot;Select Key OK&amp;quot; };&lt;br /&gt;
int adc_key_val[5] ={50, 200, 400, 600, 800 };&lt;br /&gt;
int NUM_KEYS = 5;&lt;br /&gt;
int adc_key_in;&lt;br /&gt;
int key=-1;&lt;br /&gt;
int oldkey=-1;&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  lcd.begin(16, 2);&lt;br /&gt;
  lcd.clear();&lt;br /&gt;
  lcd.setCursor(0,0);&lt;br /&gt;
  lcd.print(&amp;quot;     helle! &amp;quot;);&lt;br /&gt;
  lcd.print(&amp;quot;      welcome!&amp;quot;);&lt;br /&gt;
  lcd.setCursor(0,1);&lt;br /&gt;
  lcd.print(&amp;quot;   LinkSprite&amp;quot;);&lt;br /&gt;
  lcd.print(&amp;quot;    LCD Shield&amp;quot;);&lt;br /&gt;
  delay(1000);&lt;br /&gt;
  &lt;br /&gt;
  lcd.setCursor(0,0);&lt;br /&gt;
  for (char k=0;k&amp;lt;26;k++)&lt;br /&gt;
  {&lt;br /&gt;
    lcd.scrollDisplayLeft();&lt;br /&gt;
    delay(400);&lt;br /&gt;
  }&lt;br /&gt;
  lcd.clear();&lt;br /&gt;
  lcd.setCursor(0,0); &lt;br /&gt;
  lcd.print(&amp;quot;ADC key testing&amp;quot;); &lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
   adc_key_in = analogRead(0);    // read the value from the sensor &lt;br /&gt;
   key = get_key(adc_key_in);  // convert into key press&lt;br /&gt;
   if (key != oldkey)   // if keypress is detected&lt;br /&gt;
   {&lt;br /&gt;
     delay(50);  // wait for debounce time&lt;br /&gt;
     adc_key_in = analogRead(0);    // read the value from the sensor &lt;br /&gt;
     key = get_key(adc_key_in);    // convert into key press&lt;br /&gt;
     if (key != oldkey)    &lt;br /&gt;
     {   &lt;br /&gt;
       lcd.setCursor(0, 1);&lt;br /&gt;
       oldkey = key;&lt;br /&gt;
       if (key &amp;gt;=0)&lt;br /&gt;
       {&lt;br /&gt;
           lcd.print(msgs[key]);              &lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   delay(100);&lt;br /&gt;
}&lt;br /&gt;
// Convert ADC value to key number&lt;br /&gt;
int get_key(unsigned int input)&lt;br /&gt;
{&lt;br /&gt;
    int k;&lt;br /&gt;
    for (k = 0; k &amp;lt; NUM_KEYS; k++)&lt;br /&gt;
    {&lt;br /&gt;
      if (input &amp;lt; adc_key_val[k])&lt;br /&gt;
      {&lt;br /&gt;
        return k;&lt;br /&gt;
      }&lt;br /&gt;
    }   &lt;br /&gt;
    if (k &amp;gt;= NUM_KEYS)k = -1;  // No valid key pressed&lt;br /&gt;
    return k;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Cautions  ==&lt;br /&gt;
&lt;br /&gt;
The warnings and wrong operations possible cause dangerous. &lt;br /&gt;
&lt;br /&gt;
== Schematic  ==&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/1602+LCD+Shield+Sch.pdf Schematic in PDF]&lt;br /&gt;
&lt;br /&gt;
== Specification  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;width: 50%&amp;quot; align=&amp;quot;center&amp;quot; | Item &lt;br /&gt;
! scope=&amp;quot;col&amp;quot; align=&amp;quot;center&amp;quot; | Min &lt;br /&gt;
! scope=&amp;quot;col&amp;quot; align=&amp;quot;center&amp;quot; | Typical &lt;br /&gt;
! scope=&amp;quot;col&amp;quot; align=&amp;quot;center&amp;quot; | Max &lt;br /&gt;
! scope=&amp;quot;col&amp;quot; align=&amp;quot;center&amp;quot; | Unit&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | Voltage &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 4.3&lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 5.0 &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 5.7&lt;br /&gt;
| align=&amp;quot;center&amp;quot; | V&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | Current &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 39.6&lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 53.3 &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 65.0&lt;br /&gt;
| align=&amp;quot;center&amp;quot; | mA&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | Dimension &lt;br /&gt;
| align=&amp;quot;center&amp;quot; colspan=&amp;quot;3&amp;quot; | 79.5x55.1x16.6 &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | mm&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | Net Weight &lt;br /&gt;
| align=&amp;quot;center&amp;quot; colspan=&amp;quot;3&amp;quot; | 55.0 &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | g&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Pin definition and Rating  ==&lt;br /&gt;
&lt;br /&gt;
*A0: Buttons&lt;br /&gt;
*D4: LCD bit 4&lt;br /&gt;
*D5: LCD bit 5&lt;br /&gt;
*D6: LCD bit 6&lt;br /&gt;
*D7: LCD bit 7&lt;br /&gt;
*D8: LCD RS&lt;br /&gt;
*D9: LCD Enable&lt;br /&gt;
*LCD backlight with current limiting, brightness and on/off controllable by D10.&lt;br /&gt;
&lt;br /&gt;
== Mechanic Dimensions  ==&lt;br /&gt;
&lt;br /&gt;
== Usage  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 16x2 LCD And Keypad Shield is very simple to use because it's fully compatible with the Arduino &amp;quot;LiquidCrystal&amp;quot; library. You can initialise the LCD and display messages on it with just a few lines of code, but it also gives you the flexibility to do more advanced projects such as display menu items and select them using the buttons.&lt;br /&gt;
&lt;br /&gt;
'''Power Requirements'''&lt;br /&gt;
&lt;br /&gt;
The LCD &amp;amp; Keypad Shield requires a good 5V power supply to ensure the backlight fully illuminates and the display contrast is high, and if you power your Arduino from USB with the LCD Shield attached you may experience a voltage drop over the USB cable. If you have trouble with display contrast or backlight brightness, try attaching a power supply of around 7 to 9Vdc to the 2.1mm DC jack on the Arduino. A typical symptom in an undervoltage situation is that one line of the LCD will show pale rectangles in place of the characters, and the other line will show nothing at all. The Arduino may even continue running normally because it's quite happy at just 4V or so, but the LCD &amp;amp; Keypad Shield won't function.&lt;br /&gt;
&lt;br /&gt;
'''Library Requirements'''&lt;br /&gt;
&lt;br /&gt;
All the hard work of interfacing with the LCD Shield is handled by the LiquidCrystal library, which is included as part of the official Arduino distribution. You can check whether you have it installed by starting up the IDE and looking under Files -&amp;gt; Examples -&amp;gt; LiquidCrystal. If it exists, you're good to go.&lt;br /&gt;
&lt;br /&gt;
'''Minimal Display Example'''&lt;br /&gt;
&lt;br /&gt;
To start up the LCD and display a message, open a new sketch in the Arduino IDE and paste in the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;LiquidCrystal.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 );&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  lcd.begin(16, 2);&lt;br /&gt;
  lcd.print(&amp;quot;hello, world!&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
    // your main loop code here...&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Reading The Buttons'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The LCD Shield includes 5 buttons designed for use as navigational or control input. The buttons are arranged in a handy pattern and referred to as UP, DOWN, LEFT, RIGHT, and SELECT, but of course it's totally up to your sketch to decide what to do when any particular button is pressed.&lt;br /&gt;
&lt;br /&gt;
All the buttons are connected to a single analog input, A0, using a chain of resistors that causes a different reference voltage to be applied to A0 depending on which button is pressed. This section of the shield schematic shows the input buttons and associated resistors:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Lcd-button-ladder.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
As you can see, if no button is being pressed the voltage on A0 will be pulled all the way up to 5V by the 2K resistor called R6. In that situation none of the other resistors have any effect at all, and the analog reading on A0 will be hard on the upper limit of 1023. Therefore if you perform an analogRead() call on A0 and it returns 1023 (or any value above about 1000) you know that no buttons are being pressed.&lt;br /&gt;
&lt;br /&gt;
Now consider what happens if the &amp;quot;DOWN&amp;quot; button is pressed. Now A0 is being presented with a voltage that is divided between the 2K resistor that is trying to pull it up to 5V, and the 330R and 620R resistors in series (totaling 950R) that are trying to pull it down to 0V. The voltage presented to A0 in that case is about 1.61V, which means if you perform an analogRead() on A0 it will return a value of about 329. So if you read a value of about 329 from A0 you know the &amp;quot;DOWN&amp;quot; button is being pressed.&lt;br /&gt;
&lt;br /&gt;
The same principle applies for the other buttons, with the voltages and equivalent analogRead() values shown on the schematic above.&lt;br /&gt;
&lt;br /&gt;
This is a neat way to provide a whole set of input buttons while only using up one of the I/O pins on your Arduino, leaving more pins free for use in your project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Complex Example'''&lt;br /&gt;
&lt;br /&gt;
The extensive example below combines a number of techniques to demonstrate how to show messages on the LCD, read from the buttons, and change the display message depending on which buttons are pressed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 &lt;br /&gt;
  This example code is in the public domain.&lt;br /&gt;
  &lt;br /&gt;
  ---------------------------------------------------------------------&lt;br /&gt;
  &lt;br /&gt;
  This program demonstrates button detection, LCD text/number printing,&lt;br /&gt;
  and LCD backlight control on the Freetronics LCD &amp;amp; Keypad Shield, connected to an Arduino board.&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  Pins used by LCD &amp;amp; Keypad Shield:&lt;br /&gt;
  &lt;br /&gt;
    A0: Buttons, analog input from voltage ladder&lt;br /&gt;
    D4: LCD bit 4&lt;br /&gt;
    D5: LCD bit 5&lt;br /&gt;
    D6: LCD bit 6&lt;br /&gt;
    D7: LCD bit 7&lt;br /&gt;
    D8: LCD RS&lt;br /&gt;
    D9: LCD E&lt;br /&gt;
    D10: LCD Backlight (high = on, also has pullup high so default is on)&lt;br /&gt;
  &lt;br /&gt;
  ADC voltages for the 5 buttons on analog input pin A0:&lt;br /&gt;
  &lt;br /&gt;
    RIGHT:  0.00V :   0 @ 8bit ;   0 @ 10 bit&lt;br /&gt;
    UP:     0.71V :  36 @ 8bit ; 145 @ 10 bit&lt;br /&gt;
    DOWN:   1.61V :  82 @ 8bit ; 329 @ 10 bit&lt;br /&gt;
    LEFT:   2.47V : 126 @ 8bit ; 505 @ 10 bit&lt;br /&gt;
    SELECT: 3.62V : 185 @ 8bit ; 741 @ 10 bit&lt;br /&gt;
*/&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  Includes&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
#include &amp;lt;LiquidCrystal.h&amp;gt;   // include LCD library&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  Defines&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
// Pins in use&lt;br /&gt;
#define BUTTON_ADC_PIN           A0  // A0 is the button ADC input&lt;br /&gt;
#define LCD_BACKLIGHT_PIN         10  // D10 controls LCD backlight&lt;br /&gt;
// ADC readings expected for the 5 buttons on the ADC input&lt;br /&gt;
#define RIGHT_10BIT_ADC           0  // right&lt;br /&gt;
#define UP_10BIT_ADC            145  // up&lt;br /&gt;
#define DOWN_10BIT_ADC          329  // down&lt;br /&gt;
#define LEFT_10BIT_ADC          505  // left&lt;br /&gt;
#define SELECT_10BIT_ADC        741  // right&lt;br /&gt;
#define BUTTONHYSTERESIS         10  // hysteresis for valid button sensing window&lt;br /&gt;
//return values for ReadButtons()&lt;br /&gt;
#define BUTTON_NONE               0  // &lt;br /&gt;
#define BUTTON_RIGHT              1  // &lt;br /&gt;
#define BUTTON_UP                 2  // &lt;br /&gt;
#define BUTTON_DOWN               3  // &lt;br /&gt;
#define BUTTON_LEFT               4  // &lt;br /&gt;
#define BUTTON_SELECT             5  // &lt;br /&gt;
//some example macros with friendly labels for LCD backlight/pin control, tested and can be swapped into the example code as you like&lt;br /&gt;
#define LCD_BACKLIGHT_OFF()     digitalWrite( LCD_BACKLIGHT_PIN, LOW )&lt;br /&gt;
#define LCD_BACKLIGHT_ON()      digitalWrite( LCD_BACKLIGHT_PIN, HIGH )&lt;br /&gt;
#define LCD_BACKLIGHT(state)    { if( state ){digitalWrite( LCD_BACKLIGHT_PIN, HIGH );}else{digitalWrite( LCD_BACKLIGHT_PIN, LOW );} }&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  Variables&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
byte buttonJustPressed  = false;         //this will be true after a ReadButtons() call if triggered&lt;br /&gt;
byte buttonJustReleased = false;         //this will be true after a ReadButtons() call if triggered&lt;br /&gt;
byte buttonWas          = BUTTON_NONE;   //used by ReadButtons() for detection of button events&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  Init the LCD library with the LCD pins to be used&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 );   //Pins for the freetronics 16x2 LCD shield. LCD: ( RS, E, LCD-D4, LCD-D5, LCD-D6, LCD-D7 )&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  setup()&lt;br /&gt;
  Called by the Arduino framework once, before the main loop begins&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
   //button adc input&lt;br /&gt;
   pinMode( BUTTON_ADC_PIN, INPUT );         //ensure A0 is an input&lt;br /&gt;
   digitalWrite( BUTTON_ADC_PIN, LOW );      //ensure pullup is off on A0&lt;br /&gt;
   //lcd backlight control&lt;br /&gt;
   digitalWrite( LCD_BACKLIGHT_PIN, HIGH );  //backlight control pin D3 is high (on)&lt;br /&gt;
   pinMode( LCD_BACKLIGHT_PIN, OUTPUT );     //D3 is an output&lt;br /&gt;
   //set up the LCD number of columns and rows: &lt;br /&gt;
   lcd.begin( 16, 2 );&lt;br /&gt;
   //Print some initial text to the LCD.&lt;br /&gt;
   lcd.setCursor( 0, 0 );   //top left&lt;br /&gt;
   //          1234567890123456&lt;br /&gt;
   lcd.print( &amp;quot;LinkSprite  16x2&amp;quot; );&lt;br /&gt;
   //&lt;br /&gt;
   lcd.setCursor( 0, 1 );   //bottom left&lt;br /&gt;
   //          1234567890123456&lt;br /&gt;
   lcd.print( &amp;quot;Btn:&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  loop()&lt;br /&gt;
  Arduino main loop&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
   byte button;&lt;br /&gt;
   byte timestamp;&lt;br /&gt;
   &lt;br /&gt;
   //get the latest button pressed, also the buttonJustPressed, buttonJustReleased flags&lt;br /&gt;
   button = ReadButtons();&lt;br /&gt;
   //blank the demo text line if a new button is pressed or released, ready for a new label to be written&lt;br /&gt;
   if( buttonJustPressed || buttonJustReleased )&lt;br /&gt;
   {&lt;br /&gt;
     lcd.setCursor( 4, 1 );&lt;br /&gt;
     lcd.print( &amp;quot;            &amp;quot; );&lt;br /&gt;
   }&lt;br /&gt;
   //show text label for the button pressed&lt;br /&gt;
   switch( button )&lt;br /&gt;
   {&lt;br /&gt;
      case BUTTON_NONE:&lt;br /&gt;
      {&lt;br /&gt;
         break;&lt;br /&gt;
      }&lt;br /&gt;
      case BUTTON_RIGHT:&lt;br /&gt;
      {&lt;br /&gt;
         lcd.setCursor( 4, 1 );&lt;br /&gt;
         lcd.print( &amp;quot;RIGHT&amp;quot; );&lt;br /&gt;
         break;&lt;br /&gt;
      }&lt;br /&gt;
      case BUTTON_UP:&lt;br /&gt;
      {&lt;br /&gt;
         lcd.setCursor( 4, 1 );&lt;br /&gt;
         lcd.print( &amp;quot;UP&amp;quot; );&lt;br /&gt;
         break;&lt;br /&gt;
      }&lt;br /&gt;
      case BUTTON_DOWN:&lt;br /&gt;
      {&lt;br /&gt;
         lcd.setCursor( 4, 1 );&lt;br /&gt;
         lcd.print( &amp;quot;DOWN&amp;quot; );&lt;br /&gt;
         break;&lt;br /&gt;
      }&lt;br /&gt;
      case BUTTON_LEFT:&lt;br /&gt;
      {&lt;br /&gt;
        lcd.setCursor( 4, 1 );&lt;br /&gt;
        lcd.print( &amp;quot;LEFT&amp;quot; );&lt;br /&gt;
        break;&lt;br /&gt;
     }&lt;br /&gt;
     case BUTTON_SELECT:&lt;br /&gt;
     {&lt;br /&gt;
        lcd.setCursor( 4, 1 );&lt;br /&gt;
        lcd.print( &amp;quot;SELECT-FLASH&amp;quot; );    &lt;br /&gt;
        &lt;br /&gt;
        //SELECT is a special case, it pulses the LCD backlight off and on for demo&lt;br /&gt;
        digitalWrite( LCD_BACKLIGHT_PIN, LOW );&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        digitalWrite( LCD_BACKLIGHT_PIN, HIGH );   //leave the backlight on at exit&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        &lt;br /&gt;
        /* an example of LCD backlight control via macros with nice labels&lt;br /&gt;
        LCD_BACKLIGHT_OFF();&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        LCD_BACKLIGHT_ON();   //leave the backlight on at exit&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        */&lt;br /&gt;
        &lt;br /&gt;
        /*&lt;br /&gt;
        // an example of LCD backlight control via a macro with nice label, called with a value&lt;br /&gt;
        LCD_BACKLIGHT(false);&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        LCD_BACKLIGHT(true);   //leave the backlight on at exit&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        */&lt;br /&gt;
        &lt;br /&gt;
        break;&lt;br /&gt;
      }&lt;br /&gt;
      default:&lt;br /&gt;
     {&lt;br /&gt;
        break;&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   // print the number of seconds since reset (two digits only)&lt;br /&gt;
   timestamp = ( (millis() / 1000) % 100 );   //&amp;quot;% 100&amp;quot; is the remainder of a divide-by-100, which keeps the value as 0-99 even as the result goes over 100&lt;br /&gt;
   lcd.setCursor( 14, 1 );&lt;br /&gt;
   if( timestamp &amp;lt;= 9 )&lt;br /&gt;
      lcd.print( &amp;quot; &amp;quot; );   //quick trick to right-justify this 2 digit value when it's a single digit&lt;br /&gt;
   lcd.print( timestamp, DEC );&lt;br /&gt;
/*  &lt;br /&gt;
   //debug/test display of the adc reading for the button input voltage pin.&lt;br /&gt;
   lcd.setCursor(12, 0);&lt;br /&gt;
   lcd.print( &amp;quot;    &amp;quot; );          //quick hack to blank over default left-justification from lcd.print()&lt;br /&gt;
   lcd.setCursor(12, 0);         //note the value will be flickering/faint on the LCD&lt;br /&gt;
   lcd.print( analogRead( BUTTON_ADC_PIN ) );&lt;br /&gt;
*/&lt;br /&gt;
   //clear the buttonJustPressed or buttonJustReleased flags, they've already done their job now.&lt;br /&gt;
   if( buttonJustPressed )&lt;br /&gt;
      buttonJustPressed = false;&lt;br /&gt;
   if( buttonJustReleased )&lt;br /&gt;
      buttonJustReleased = false;&lt;br /&gt;
}&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  ReadButtons()&lt;br /&gt;
  Detect the button pressed and return the value&lt;br /&gt;
  Uses global values buttonWas, buttonJustPressed, buttonJustReleased.&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
byte ReadButtons()&lt;br /&gt;
{&lt;br /&gt;
   unsigned int buttonVoltage;&lt;br /&gt;
   byte button = BUTTON_NONE;   // return no button pressed if the below checks don't write to btn&lt;br /&gt;
   &lt;br /&gt;
   //read the button ADC pin voltage&lt;br /&gt;
   buttonVoltage = analogRead( BUTTON_ADC_PIN );&lt;br /&gt;
   //sense if the voltage falls within valid voltage windows&lt;br /&gt;
   if( buttonVoltage &amp;lt; ( RIGHT_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_RIGHT;&lt;br /&gt;
   }&lt;br /&gt;
   else if(   buttonVoltage &amp;gt;= ( UP_10BIT_ADC - BUTTONHYSTERESIS )&lt;br /&gt;
           &amp;amp;&amp;amp; buttonVoltage &amp;lt;= ( UP_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_UP;&lt;br /&gt;
   }&lt;br /&gt;
   else if(   buttonVoltage &amp;gt;= ( DOWN_10BIT_ADC - BUTTONHYSTERESIS )&lt;br /&gt;
           &amp;amp;&amp;amp; buttonVoltage &amp;lt;= ( DOWN_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_DOWN;&lt;br /&gt;
   }&lt;br /&gt;
   else if(   buttonVoltage &amp;gt;= ( LEFT_10BIT_ADC - BUTTONHYSTERESIS )&lt;br /&gt;
           &amp;amp;&amp;amp; buttonVoltage &amp;lt;= ( LEFT_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_LEFT;&lt;br /&gt;
   }&lt;br /&gt;
   else if(   buttonVoltage &amp;gt;= ( SELECT_10BIT_ADC - BUTTONHYSTERESIS )&lt;br /&gt;
           &amp;amp;&amp;amp; buttonVoltage &amp;lt;= ( SELECT_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_SELECT;&lt;br /&gt;
   }&lt;br /&gt;
   //handle button flags for just pressed and just released events&lt;br /&gt;
   if( ( buttonWas == BUTTON_NONE ) &amp;amp;&amp;amp; ( button != BUTTON_NONE ) )&lt;br /&gt;
   {&lt;br /&gt;
      //the button was just pressed, set buttonJustPressed, this can optionally be used to trigger a once-off action for a button press event&lt;br /&gt;
      //it's the duty of the receiver to clear these flags if it wants to detect a new button change event&lt;br /&gt;
      buttonJustPressed  = true;&lt;br /&gt;
      buttonJustReleased = false;&lt;br /&gt;
   }&lt;br /&gt;
   if( ( buttonWas != BUTTON_NONE ) &amp;amp;&amp;amp; ( button == BUTTON_NONE ) )&lt;br /&gt;
   {&lt;br /&gt;
      buttonJustPressed  = false;&lt;br /&gt;
      buttonJustReleased = true;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   //save the latest button value, for change event detection next time round&lt;br /&gt;
   buttonWas = button;&lt;br /&gt;
   &lt;br /&gt;
   return( button );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== pcDuino Sample Code  ==&lt;br /&gt;
&lt;br /&gt;
== FAQ  ==&lt;br /&gt;
Please list your question here:&lt;br /&gt;
&lt;br /&gt;
== Support  ==&lt;br /&gt;
&lt;br /&gt;
If you have questions or other better design ideas, you can go to our [http://www.linksprite.com/forum/index.php forum] to discuss or creat a ticket for your issue at [http://www.linksprite.com/support/ linksprite support].&lt;br /&gt;
&lt;br /&gt;
== Resources  ==&lt;br /&gt;
&lt;br /&gt;
*PDF Files&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/lcd-datasheet-dfr0009.pdf LCD Datasheet]&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/HD44780.pdf HD44780 Datasheet]&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/ZYMC1602-17.pdf  16x2 LCD Datasheet]&lt;br /&gt;
&lt;br /&gt;
*ZIP Files&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/LCD4Bit_mod.zip LCD 4Bit Mod]&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/lcd-keypad-library-dfr0009.zip LCD Keypad Library]&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/key-grabber-library-v2-dfr0009.zip Key Grabber Library V2]&lt;br /&gt;
&lt;br /&gt;
== How to buy  ==&lt;br /&gt;
&lt;br /&gt;
== See Also  ==&lt;br /&gt;
&lt;br /&gt;
Other related products and resources.&lt;br /&gt;
&lt;br /&gt;
== Licensing  ==&lt;br /&gt;
&lt;br /&gt;
This documentation is licensed under the Creative Commons [http://creativecommons.org/licenses/by-sa/3.0/ Attribution-ShareAlike License 3.0] Source code and libraries are licensed under [http://www.gnu.org/licenses/gpl.html GPL/LGPL], see source code files for details.&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=JPEG_2M_Pixel_Color_Camera_Serial_Interface(RS232_level)&amp;diff=3708</id>
		<title>JPEG 2M Pixel Color Camera Serial Interface(RS232 level)</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=JPEG_2M_Pixel_Color_Camera_Serial_Interface(RS232_level)&amp;diff=3708"/>
		<updated>2013-10-31T01:28:04Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
LS-Y201-2MP is LinkSprite’s new generation high resolution serial port camera module. Its resolution is 2 million pixel. It can captures high resolution pictures using the serial port. LS-Y201-2MP is a modular design that outputs JPEG images through UART, and can be easily integrated into existing design.&lt;br /&gt;
&lt;br /&gt;
[model:CAM_JPEG_2M_RS232]&lt;br /&gt;
&lt;br /&gt;
[[File:2M_JPEGC_CAMERA.jpg | 400px]][[File:2m_camera232.jpg | 400px]]&lt;br /&gt;
&lt;br /&gt;
== Specification ==&lt;br /&gt;
*2 Million Pixels&lt;br /&gt;
*Support capture JPEG from serial port&lt;br /&gt;
*Default baud rate of serial port is 38400&lt;br /&gt;
*DC 3.3V or 5V power supply&lt;br /&gt;
*Size 32mm X 32mm&lt;br /&gt;
*Current consumption: 80-100mA&lt;br /&gt;
*The pin near C03 is AV output pin, which is an analog output pin.&lt;br /&gt;
&lt;br /&gt;
== Application Idea ==&lt;br /&gt;
*Different image capture systems&lt;br /&gt;
*Environmental monitoring&lt;br /&gt;
*Industry monitoring&lt;br /&gt;
*Medical equipment&lt;br /&gt;
*Video phone&lt;br /&gt;
*Security&lt;br /&gt;
*Vehicle based GPS&lt;br /&gt;
&lt;br /&gt;
== Usage  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Installation  ===&lt;br /&gt;
'''Evaluation Setup'''&lt;br /&gt;
&lt;br /&gt;
[[File:evasetup.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Programming  ===&lt;br /&gt;
[[File:evascreenshot.jpg]]&lt;br /&gt;
&lt;br /&gt;
*Step 1: Click Open COM&lt;br /&gt;
*Step 2: Click Single Shot.&lt;br /&gt;
&lt;br /&gt;
'''''Arduino sample code provided'''''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* Linksprite */&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;NewSoftSerial.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
byte incomingbyte;&lt;br /&gt;
NewSoftSerial mySerial(4,5);                     //Configure pin 4 and 5 as soft serial port&lt;br /&gt;
int a=0x0000,j=0,k=0,count=0;                    //Read Starting address       &lt;br /&gt;
uint8_t MH,ML;&lt;br /&gt;
boolean EndFlag=0;&lt;br /&gt;
                               &lt;br /&gt;
void SendResetCmd();&lt;br /&gt;
void SendTakePhotoCmd();&lt;br /&gt;
void SendReadDataCmd();&lt;br /&gt;
void StopTakePhotoCmd();&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{ &lt;br /&gt;
  Serial.begin(19200);&lt;br /&gt;
  mySerial.begin(38400);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() &lt;br /&gt;
{&lt;br /&gt;
     SendResetCmd();&lt;br /&gt;
     delay(4000);                               //After reset, wait 2-3 second to send take picture command&lt;br /&gt;
      &lt;br /&gt;
      SendTakePhotoCmd();&lt;br /&gt;
&lt;br /&gt;
     while(mySerial.available()&amp;gt;0)&lt;br /&gt;
      {&lt;br /&gt;
        incomingbyte=mySerial.read();&lt;br /&gt;
&lt;br /&gt;
      }   &lt;br /&gt;
      byte a[32];&lt;br /&gt;
      &lt;br /&gt;
      while(!EndFlag)&lt;br /&gt;
      {  &lt;br /&gt;
         j=0;&lt;br /&gt;
         k=0;&lt;br /&gt;
         count=0;&lt;br /&gt;
         SendReadDataCmd();&lt;br /&gt;
&lt;br /&gt;
         delay(25);&lt;br /&gt;
          while(mySerial.available()&amp;gt;0)&lt;br /&gt;
          {&lt;br /&gt;
               incomingbyte=mySerial.read();&lt;br /&gt;
               k++;&lt;br /&gt;
               if((k&amp;gt;5)&amp;amp;&amp;amp;(j&amp;lt;32)&amp;amp;&amp;amp;(!EndFlag))&lt;br /&gt;
               {&lt;br /&gt;
               a[j]=incomingbyte;&lt;br /&gt;
               if((a[j-1]==0xFF)&amp;amp;&amp;amp;(a[j]==0xD9))      //Check if the picture is over&lt;br /&gt;
               EndFlag=1;                           &lt;br /&gt;
               j++;&lt;br /&gt;
	       count++;&lt;br /&gt;
               }&lt;br /&gt;
          }&lt;br /&gt;
         &lt;br /&gt;
          for(j=0;j&amp;lt;count;j++)&lt;br /&gt;
          {   if(a[j]&amp;lt;0x10)&lt;br /&gt;
              Serial.print(&amp;quot;0&amp;quot;);&lt;br /&gt;
              Serial.print(a[j],HEX);&lt;br /&gt;
              Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
          }                                       //Send jpeg picture over the serial port&lt;br /&gt;
          Serial.println();&lt;br /&gt;
      }      &lt;br /&gt;
     while(1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//Send Reset command&lt;br /&gt;
void SendResetCmd()&lt;br /&gt;
{&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x26, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//Send take picture command&lt;br /&gt;
void SendTakePhotoCmd()&lt;br /&gt;
{&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x36, BYTE);&lt;br /&gt;
      mySerial.print(0x01, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);  &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//Read data&lt;br /&gt;
void SendReadDataCmd()&lt;br /&gt;
{&lt;br /&gt;
      MH=a/0x100;&lt;br /&gt;
      ML=a%0x100;&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x32, BYTE);&lt;br /&gt;
      mySerial.print(0x0c, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE); &lt;br /&gt;
      mySerial.print(0x0a, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(MH, BYTE);&lt;br /&gt;
      mySerial.print(ML, BYTE);   &lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x20, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);  &lt;br /&gt;
      mySerial.print(0x0a, BYTE);&lt;br /&gt;
      a+=0x20;                            //address increases 32，set according to buffer size&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void StopTakePhotoCmd()&lt;br /&gt;
{&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x36, BYTE);&lt;br /&gt;
      mySerial.print(0x01, BYTE);&lt;br /&gt;
      mySerial.print(0x03, BYTE);        &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Support  ==&lt;br /&gt;
&lt;br /&gt;
If you have questions or other better design ideas, you can go to our [http://www.linksprite.com/forum/index.php forum] to discuss or creat a ticket for your issue at [http://www.linksprite.com/support/ linksprite support].&lt;br /&gt;
&lt;br /&gt;
== Resources  ==&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LS-Y201-2MP.exe Evaluation Software]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LSY201.rar Linksprite Open Source Code for X86]&lt;br /&gt;
*[http://www.fezzer.com/project/220/linksprite-camera-library/ .Net micro framework source code]&lt;br /&gt;
*[https://github.com/nosebleed/jpeg-ttl-cam Github]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/JPEG_UART_camera_tutorial.pdf Tutorial at Linksprite]&lt;br /&gt;
&lt;br /&gt;
== How to buy  ==&lt;br /&gt;
&lt;br /&gt;
Here to buy on LinkSprite [http://www.linkspritedirect.com/index.php Cart]&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=JPEG_2M_Pixel_Color_Camera_Serial_Interface(TTL_level)&amp;diff=3707</id>
		<title>JPEG 2M Pixel Color Camera Serial Interface(TTL level)</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=JPEG_2M_Pixel_Color_Camera_Serial_Interface(TTL_level)&amp;diff=3707"/>
		<updated>2013-10-31T01:23:34Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
LS-Y201-2MP is LinkSprite’s new generation high resolution serial port camera module. Its resolution is 2 million pixel. It can captures high resolution pictures using the serial port. LS-Y201-2MP is a modular design that outputs JPEG images through UART, and can be easily integrated into existing design.&lt;br /&gt;
&lt;br /&gt;
[[File:2M_JPEGC_CAMERA.jpg | 400px]]&lt;br /&gt;
&lt;br /&gt;
== Specification ==&lt;br /&gt;
*2 Million Pixels&lt;br /&gt;
*Support capture JPEG from serial port&lt;br /&gt;
*Default baud rate of serial port is 38400&lt;br /&gt;
*DC 3.3V or 5V power supply&lt;br /&gt;
*Size 32mm X 32mm&lt;br /&gt;
*Current consumption: 80-100mA&lt;br /&gt;
*The pin near C03 is AV output pin, which is an analog output pin.&lt;br /&gt;
&lt;br /&gt;
== Application Idea ==&lt;br /&gt;
*Different image capture systems&lt;br /&gt;
*Environmental monitoring&lt;br /&gt;
*Industry monitoring&lt;br /&gt;
*Medical equipment&lt;br /&gt;
*Video phone&lt;br /&gt;
*Security&lt;br /&gt;
*Vehicle based GPS&lt;br /&gt;
&lt;br /&gt;
== Usage  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Installation  ===&lt;br /&gt;
'''Evaluation Setup'''&lt;br /&gt;
&lt;br /&gt;
[[File:evasetup.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Programming  ===&lt;br /&gt;
[[File:evascreenshot.jpg]]&lt;br /&gt;
&lt;br /&gt;
*Step 1: Click Open COM&lt;br /&gt;
*Step 2: Click Single Shot.&lt;br /&gt;
&lt;br /&gt;
'''''Arduino sample code provided'''''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* Linksprite */&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;NewSoftSerial.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
byte incomingbyte;&lt;br /&gt;
NewSoftSerial mySerial(4,5);                     //Configure pin 4 and 5 as soft serial port&lt;br /&gt;
int a=0x0000,j=0,k=0,count=0;                    //Read Starting address       &lt;br /&gt;
uint8_t MH,ML;&lt;br /&gt;
boolean EndFlag=0;&lt;br /&gt;
                               &lt;br /&gt;
void SendResetCmd();&lt;br /&gt;
void SendTakePhotoCmd();&lt;br /&gt;
void SendReadDataCmd();&lt;br /&gt;
void StopTakePhotoCmd();&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{ &lt;br /&gt;
  Serial.begin(19200);&lt;br /&gt;
  mySerial.begin(38400);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() &lt;br /&gt;
{&lt;br /&gt;
     SendResetCmd();&lt;br /&gt;
     delay(4000);                               //After reset, wait 2-3 second to send take picture command&lt;br /&gt;
      &lt;br /&gt;
      SendTakePhotoCmd();&lt;br /&gt;
&lt;br /&gt;
     while(mySerial.available()&amp;gt;0)&lt;br /&gt;
      {&lt;br /&gt;
        incomingbyte=mySerial.read();&lt;br /&gt;
&lt;br /&gt;
      }   &lt;br /&gt;
      byte a[32];&lt;br /&gt;
      &lt;br /&gt;
      while(!EndFlag)&lt;br /&gt;
      {  &lt;br /&gt;
         j=0;&lt;br /&gt;
         k=0;&lt;br /&gt;
         count=0;&lt;br /&gt;
         SendReadDataCmd();&lt;br /&gt;
&lt;br /&gt;
         delay(25);&lt;br /&gt;
          while(mySerial.available()&amp;gt;0)&lt;br /&gt;
          {&lt;br /&gt;
               incomingbyte=mySerial.read();&lt;br /&gt;
               k++;&lt;br /&gt;
               if((k&amp;gt;5)&amp;amp;&amp;amp;(j&amp;lt;32)&amp;amp;&amp;amp;(!EndFlag))&lt;br /&gt;
               {&lt;br /&gt;
               a[j]=incomingbyte;&lt;br /&gt;
               if((a[j-1]==0xFF)&amp;amp;&amp;amp;(a[j]==0xD9))      //Check if the picture is over&lt;br /&gt;
               EndFlag=1;                           &lt;br /&gt;
               j++;&lt;br /&gt;
	       count++;&lt;br /&gt;
               }&lt;br /&gt;
          }&lt;br /&gt;
         &lt;br /&gt;
          for(j=0;j&amp;lt;count;j++)&lt;br /&gt;
          {   if(a[j]&amp;lt;0x10)&lt;br /&gt;
              Serial.print(&amp;quot;0&amp;quot;);&lt;br /&gt;
              Serial.print(a[j],HEX);&lt;br /&gt;
              Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
          }                                       //Send jpeg picture over the serial port&lt;br /&gt;
          Serial.println();&lt;br /&gt;
      }      &lt;br /&gt;
     while(1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//Send Reset command&lt;br /&gt;
void SendResetCmd()&lt;br /&gt;
{&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x26, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//Send take picture command&lt;br /&gt;
void SendTakePhotoCmd()&lt;br /&gt;
{&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x36, BYTE);&lt;br /&gt;
      mySerial.print(0x01, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);  &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//Read data&lt;br /&gt;
void SendReadDataCmd()&lt;br /&gt;
{&lt;br /&gt;
      MH=a/0x100;&lt;br /&gt;
      ML=a%0x100;&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x32, BYTE);&lt;br /&gt;
      mySerial.print(0x0c, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE); &lt;br /&gt;
      mySerial.print(0x0a, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(MH, BYTE);&lt;br /&gt;
      mySerial.print(ML, BYTE);   &lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x20, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);  &lt;br /&gt;
      mySerial.print(0x0a, BYTE);&lt;br /&gt;
      a+=0x20;                            //address increases 32，set according to buffer size&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void StopTakePhotoCmd()&lt;br /&gt;
{&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x36, BYTE);&lt;br /&gt;
      mySerial.print(0x01, BYTE);&lt;br /&gt;
      mySerial.print(0x03, BYTE);        &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Support  ==&lt;br /&gt;
&lt;br /&gt;
If you have questions or other better design ideas, you can go to our [http://www.linksprite.com/forum/index.php forum] to discuss or creat a ticket for your issue at [http://www.linksprite.com/support/ linksprite support].&lt;br /&gt;
&lt;br /&gt;
== Resources  ==&lt;br /&gt;
*[http://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LinkSprite+JPEG+Color+Camera+User+Manual++V1.2.pdf User Manual]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LS-Y201-2MP.exe Evaluation Software]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LSY201.rar Linksprite Open Source Code for X86]&lt;br /&gt;
*[http://www.fezzer.com/project/220/linksprite-camera-library/ .Net micro framework source code]&lt;br /&gt;
*[https://github.com/nosebleed/jpeg-ttl-cam Github]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/JPEG_UART_camera_tutorial.pdf Tutorial at Linksprite]&lt;br /&gt;
&lt;br /&gt;
== How to buy  ==&lt;br /&gt;
&lt;br /&gt;
Here to buy on LinkSprite [http://www.linkspritedirect.com/index.php Cart]&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=Products-description&amp;diff=3706</id>
		<title>Products-description</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=Products-description&amp;diff=3706"/>
		<updated>2013-10-24T07:22:04Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* GPS SD Shield */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Microcontrollers ==&lt;br /&gt;
=== Arduino Shields === &lt;br /&gt;
&lt;br /&gt;
==== GSM/GPRS Shield====&lt;br /&gt;
*[[ATWIN Quad-band GPRS/GSM Shield for Arduino ]] [SHD_GPRS_AW][101101005]&lt;br /&gt;
*[[Quad-band GPRS/GSM Shield for Arduino ]] [SHD_GPRSSM5100][101101032]&lt;br /&gt;
*[[Quad-band GPRS/GSM Shield for Arduino Mega]] [SHDM_GPRS_SM5100][101101020]&lt;br /&gt;
*[[SIM900 GPRS/GSM Shield]]  [SHD_SIM900][101101029]&lt;br /&gt;
*[[3G + GPS Shield for Arduino ]]  [SHD_3G + AN_M_SMA_UFL][101101024]&lt;br /&gt;
==== WiFi Shield ====&lt;br /&gt;
*[[CuHead WiFi Shield for Arduino V2.0]] [SHD_WIFI_CUHV2][101101002]&lt;br /&gt;
*[[CuHead WiFi Shield for Arduino Mega]] [SHDM_WIFI_CUH][101101003]&lt;br /&gt;
*[[CuHead Pro WiFi/Ethernet Shield with AirPlay/DLNA Audio for Arduino]] [SHD_WIFI_CUHPRO][101102002]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=JUNIPER-_WiFi_Shield_for_Arduino_Based_on_GainSpan_Module JUNIPER WiFi Shield for Arduino Based on GainSpan Module]  [SHD_WIFI_JNP][101101004]&lt;br /&gt;
*[[Anaconda WiFi Shield for Arduino     ]] [SHD_WIFI_ANA_WOM + WIFI_MOD_ANA + AN_M_SMA_UFL][108301002]&lt;br /&gt;
&lt;br /&gt;
==== LCD Shield ====&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=16_X_2_LCD_Keypad_Shield_for_Arduino 16 X 2 LCD Keypad Shield for pcDuino/Arduino]  [SHD_LCD_1602_A][101101016] or [SHD_LCD_1602_B][101102016] &lt;br /&gt;
*[[Color Image LCD Shield for Arduino ]] [SHD_LCD_NOKIA]OR [SHD_LCD_NOKIA_WOLCD] [101101009]&lt;br /&gt;
*[[Touch Shield for Arduino]] [SHD_TOUKEY][101101008]&lt;br /&gt;
*[[Touch LCD Shield]]  [SHD_TOUCHLCD][101101027]&lt;br /&gt;
==== GPS SD Shield ====&lt;br /&gt;
*[[GPS Shield With SD Card Slot for Arduino V2.0 A]]  [SHD_GPSV2_A][101101006]&lt;br /&gt;
*[[GPS Shield With SD Card Slot for Arduino V2.0 B]]  [SHD_GPSV2_B][101102006]&lt;br /&gt;
*[[GPS Shield with SD card slot for Arduino V3.0 with external GPS antenna]] [SHD_GPSV3][101101007]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*[[Bluetooth Shield for Arduino ]]  [SHD_BLUETOOTH][101101033]&lt;br /&gt;
*[[Gameduino for Arduino: A Game Adapter for Microcontrollers]] [SHD_FPGA_GAMEDUINO][101101015]&lt;br /&gt;
*[[Infrared Shield for Arduino]]  [SHD_IR][101101011]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=LED_Cube_Shield_for_Arduino 4x4x4 Light Cube Shield Kit for pcDuino/Arduino] [SHD_LEDCUBE][101101035]&lt;br /&gt;
*[[Mamba - Narrow Band Powerline Communication Shield for Arduino]] [SHD_PLC_MAMBA][101101021]&lt;br /&gt;
*[[MIDI Shield for Arduino]] [SHD_MIDI][101101022]&lt;br /&gt;
*[[MQ2 Smoke Detector Shield for Arduino]] [SHD_MQ2][101101010]&lt;br /&gt;
*[[RS232 Shield for Arduino]] [SHD_RS232][101101012]&lt;br /&gt;
*[[RS485 Shield for Arduino]] [SHD_RS485][101101013]&lt;br /&gt;
*[[USB Host Shield for Arduino]] [SHD_USB_HOST][101101018]&lt;br /&gt;
*[[Screw Shield for Arduino]]  [SHD_SCREW][101101019]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=Music_Shield_for_Arduino Music Shield for Arduino] [SHD_MUSIC][101101034]&lt;br /&gt;
*[[NFC PN532 Shield]]  [SHD_RFID_NFCPN532][101101001]&lt;br /&gt;
*[[Motor Shield ]] [SHD_MOTOR][101101014]&lt;br /&gt;
*[[SD Shield ]]   [SHD_SD] [101101026]&lt;br /&gt;
*[[Ethernet Shield]]   [SHD_ETH] [101101028]&lt;br /&gt;
*[[Xbee Shield]]  [SHD_XBEE][101101017]&lt;br /&gt;
*[[Relay Shield]]  [SHD_RELAY][101101030]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=Proto_Shield_Kits Proto Shield Kits for Arduino]  [SHD_PROTOKIT][101101025]&lt;br /&gt;
*[[Proto Shield for Mega]] [SHDM_PROTO][101101023]&lt;br /&gt;
*[[Proto shield for pcDuino]] [SHD_PROTOKITPCDUINO][101101031]&lt;br /&gt;
&lt;br /&gt;
=== AVR Based Arduino ===&lt;br /&gt;
*[[Diamondback WiFi Platform Compatible With Arduino]] [[MP_WIFI_DIAMOND][102101002]&lt;br /&gt;
*[[Redback WiFi Platform Compatible With Arduino Nano]] [MP_WIFI_REDBACK][102101003]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ARM Based Arduino ===&lt;br /&gt;
*[[Spruce]] [MP_SPRUCE_WLCD][102101004] or [MP_SPRUCE_WOLCD][102102004]&lt;br /&gt;
&lt;br /&gt;
=== FPGA Based Arduino ===&lt;br /&gt;
*[[Papilio 500K]]  [FPGA_PAP_500K][110101001]&lt;br /&gt;
*[[Papilio Pro]]   [FPGA_PAP_RO][110101006]&lt;br /&gt;
*[[Papilio I/O Wing]] [FPGA_PAP_IOWIG_BPW5015][110101002]&lt;br /&gt;
*[[Papilio VGA Wing]] [FPGA_PAP_VGA_BPW5017][110101003]&lt;br /&gt;
*[[Papilio B/LED Wing]] [FPGA_PAP_LED_BPW5007][110101004]&lt;br /&gt;
*[[Papilio LogicStart MegaWing]] [FPGA_PAP_LGS_BPW7003][110101005]&lt;br /&gt;
*[[Papilio MicroJoystick Wing]] [FPGA_PAP_MICJOYSTICK_BPW5038]&lt;br /&gt;
&lt;br /&gt;
=== IOIO ===&lt;br /&gt;
*[[IOIO V15]] [MP_IOIO][102101001]&lt;br /&gt;
*[[IOIO-OTG]] [MP_IOIOOTG][102101007]&lt;br /&gt;
*[[Micro USB OTG Cable]] [CAB_MICROUSB_OTG][117201003]&lt;br /&gt;
&lt;br /&gt;
=== pcDuino ===&lt;br /&gt;
*[http://www.pcduino.com/?page_id=1707  pcDuino Lite] [MP_PCDUINOLITE][102103006]&lt;br /&gt;
*[http://www.pcduino.com/?page_id=12 pcDuino] [MP_PCDUINO][102101006]&lt;br /&gt;
*[http://www.pcduino.com/?page_id=1618 pcDuino v2] [MP_PCDUINOV2][102102006]&lt;br /&gt;
*[[Voltage Translation Board for pcDuino V2]] [SHD_TPCDV2][101101036]&lt;br /&gt;
*[[AV Kit for pcDuino]] [KIT_AV_PCDUINO][108201012]&lt;br /&gt;
*[[Proto shield for pcDuino]] [SHD_PROTOKITPCDUINO][101101031]&lt;br /&gt;
*[[HDMI to DVI cable for pcDunio]]  [DVICAB_PCDUINO][108202002]&lt;br /&gt;
*[[HDMI to VGA cable with Audio for pcDuino]] [VGACAB_PCDUINO][108202001]&lt;br /&gt;
*[[WiFi Dongle for pcDuino]]  [WIFI_PCDUINO][103201008]&lt;br /&gt;
*[[Serial Debug Cable for pcDuino]] [CAB_USBTTL_PCDUINO][117301001] = Breakout Board for FT232RL USB to TTL 5V [BB_MINIUSB_TTL][105101005] + mini USB cable[117301001-1] + 3-wire male to female jumper wire[117301002-2]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=USB_Sound_Card_with_Audio_Input/Output USB Sound Card with Audio Input/Output for pcDuino] [USB_SOUND_PCDUINO][108202003]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=RTC_Module RTC Module for pcDuino]   [LINKER_RTC][118101009]&lt;br /&gt;
*[[Web Cam 3-axis Servo Kit for Real Time Video for pcDuino]][108202004] [KIT_WEBCAMSRV]=[WEBCAM_PCDUINO][108202004-1]+[KIT_SRV][108202004-3]&lt;br /&gt;
*[[Bluetooth USB Module Mini for pcDuino]] [BT-USB-MINI][119201001]&lt;br /&gt;
*[[pcDuino Rover kit]][BOT_PDROVER_KIT][104201006]&lt;br /&gt;
&lt;br /&gt;
==== Case ====&lt;br /&gt;
&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=LinkSprite_Clear_Enclosure_for_pcDuino  LinkSprite Clear Enclosure for pcDuino/Arduino] [COM_CASE_PCDUINO_CLEAR] [114201005]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=LinkSprite_Extension_Plate_for_Clear_Enclosure_for_Arduino LinkSprite Extension Plate for Clear Enclosure for pcDuino/Arduino] [COM_CASE_ARDU_CLEAR_PLATE][114201003]&lt;br /&gt;
*[[Acrylic Clear Enclosure for pcDuino With Removable Cover]]  [COM_CASE_PCDUINO_ACCLEAR][114201006]&lt;br /&gt;
*[[Lego Style Enclosure for pcDuino]] [COM_LECASE_PCDUINO][114201008]&lt;br /&gt;
&lt;br /&gt;
=== Pitaya ===&lt;br /&gt;
&lt;br /&gt;
*[[ Pitaya ]] [MP_PITAYA]&lt;br /&gt;
*[[ Pitaya Dual Core ]] [MP_PITAYA_DUAL][102201001]&lt;br /&gt;
*[[ USB 2.0 Ethernet Adapter]] [CAB_ETHUSB][117201002]&lt;br /&gt;
&lt;br /&gt;
== Raspberry Pi Kits ==&lt;br /&gt;
*[[GPIO Ribbon Cable for Raspberry Pi]] [RPI_GPIOCABLE][120201004]&lt;br /&gt;
*[[Assembled Raspberry Pi Cobbler Breakout]] [RPI_COBB][120201003]&lt;br /&gt;
*[[Assembled Raspberry Pi T-Cobbler Breakout]] [RPI_T_COBB][120201005]&lt;br /&gt;
*[[Raspberry Pi T-Cobbler Breakout Kit]] [RPI_TCOBB_KIT][120201001]&lt;br /&gt;
*[[Raspberry Pi Assorted Lego Style Enclosure]] [RPI_LEGOSTYLE_CASE][120201002]&lt;br /&gt;
*[[RS232/GPIO Shield for Raspberry Pi]] [SHD_RPI_RS232GPIO][101201001]&lt;br /&gt;
*[[TTL UART to USB Cable - Serial USB Debug Cable]] [CAB_RPIUARTUSB][117201001]&lt;br /&gt;
*[[ Linker kit Base Shield for Raspberry Pi with ADC Interface ]] [LINKER_RPIBASE][118101020]&lt;br /&gt;
&lt;br /&gt;
== Arduino Kits ==&lt;br /&gt;
&lt;br /&gt;
*[[LinkerKit]]&lt;br /&gt;
*[[LinkerKit for Raspberry Pi]]   [LINKERKIT_RPI]&lt;br /&gt;
*[[Sensors Pack for Arduino]]&lt;br /&gt;
*[[Advanced Sensors Kit for Arduino ]]   [ADVSEN_KIT]&lt;br /&gt;
*[[LED Matrix Kit]] [KIT_LEDMATRIX][108101001]&lt;br /&gt;
*[[LinkSprite Sensor Pack 101]]&lt;br /&gt;
*[[Introductory Kit with Clear Case for Arduino]] [INTOKIT_CLEARCASE]&lt;br /&gt;
&lt;br /&gt;
== Components and Breakout Boards ==&lt;br /&gt;
&lt;br /&gt;
===Components===&lt;br /&gt;
&lt;br /&gt;
*GPS&lt;br /&gt;
**[[GPS module SKM58]] [GPS_SKM58][116201002]&lt;br /&gt;
**[[32 Channel LinkSprite GPS 5Hz Receiver ]] [GPS_SKG17][116201001]&lt;br /&gt;
**[[GPS Patch Antenna (IPX interface with pig tale length 7cm)]] [ANT_GPS_PAT]&lt;br /&gt;
&lt;br /&gt;
*[[Serial port bluetooth module (Master/Slave)]]&lt;br /&gt;
*[[ RFID Card with UID Rewritable ]]&lt;br /&gt;
*[[ 7400 Series Kit , 5pcs]]&lt;br /&gt;
*LED&lt;br /&gt;
**[[8X8 RED LED Matrix ]]&lt;br /&gt;
*LCD Module&lt;br /&gt;
**[[Basic 20x4 Character LCD - Black on Green 5V ]] [LCD_20_4_5V]&lt;br /&gt;
**[[Basic 16x2 Character LCD - Black on Green 5V]] [LCD_16_2_5V]&lt;br /&gt;
**[[Color LCD 128x128 Nokia Knock-Off]] [NOKIA_6100_LCD]&lt;br /&gt;
*Breadboard&lt;br /&gt;
**[[Mini Breadboard Mini Self-Adhesive for Arduino (White)]] [PRT_MINIBRD_WHITE]&lt;br /&gt;
**[[Mini Breadboard Mini Self-Adhesive for Arduino (RED)]] [PRT_MINIBRD_RED]&lt;br /&gt;
**[[Mini Breadboard Mini Self-Adhesive for Arduino (BLUE)]] [PRT_MINIBRD_BLUE]&lt;br /&gt;
&lt;br /&gt;
=== Case and Enclosure===&lt;br /&gt;
&lt;br /&gt;
*[[ LinkSprite Clear Enclosure for Arduino ]] [COM_CASE_ARDU_CLEAR] [114201002]&lt;br /&gt;
*[[ LinkSprite Clear Enclosure for pcDuino ]] [COM_CASE_PCDUINO_CLEAR] [114201005]&lt;br /&gt;
*[[ Raspberry Pi Case]] [COM_RPI_CASE]&lt;br /&gt;
*[[ LinkSprite Extension Plate for Clear Enclosure for Arduino ]] [COM_CASE_ARDU_CLEAR_PLATE][114201003]&lt;br /&gt;
*[[ Arduino Uno Assorted Lego Style Enclosure ]] [COM_CASE_ARDULEGO][114201007]&lt;br /&gt;
&lt;br /&gt;
===Breakout===&lt;br /&gt;
&lt;br /&gt;
==== SD/MicroSD ====&lt;br /&gt;
*[[Breakout Board for microSD Transflash]] [BB_MINISD][105101004]&lt;br /&gt;
*[[SD Card Breakout Board]] [BB_SD][105101003]&lt;br /&gt;
&lt;br /&gt;
==== MP3/Music/Voice ====&lt;br /&gt;
*[[Serial Port Voice Recognition Module]]  [BB_SERVOICE] [105201001]&lt;br /&gt;
*[[Breakout Board for ADMP401 MEMS Microphone]] [BB_ADMP401][105101002]&lt;br /&gt;
*[[Breakout Board for Si4703 FM Tuner]] [BB_FM_SI4703][105101007]&lt;br /&gt;
*[[Serial port controllable MP3 module ]] [BB_SERIAL_MP3]&lt;br /&gt;
&lt;br /&gt;
==== USB ====&lt;br /&gt;
*[[Xbee USB Adapter]] [BB_XBEE_MINIUSB][105101006]&lt;br /&gt;
*[[Breakout Board for FT232RL USB to TTL 5V]] [BB_MINIUSB_TTL][105101005]&lt;br /&gt;
&lt;br /&gt;
==== Xbee====&lt;br /&gt;
*[[Xbee Socket to Xbee Socket Evaluation Board]] [BB_UART2UART][105101013]&lt;br /&gt;
*[[Xbee socket UART to RS232]] [BB_XBEE_UART2RS232][105101009]&lt;br /&gt;
*[[Xbee socket UART to RS485]] [BB_XBEE_UART2RS485][105101010]&lt;br /&gt;
*[[Xbee socket UART to USB]] [BB_XBEE_UART2USB][105101008]&lt;br /&gt;
*[[Breakout Board for XBee Module with 5V interface to 3.3V Xbee]]  [BB_XBEE_5_2_3P3][105101014]&lt;br /&gt;
*[[BluetoothBee]] [BB_XBEE_BLUETOOTH]&lt;br /&gt;
&lt;br /&gt;
==== RJ45 ====&lt;br /&gt;
&lt;br /&gt;
*[[RJ45 8-pin Connector and Breakout Board Kit]] [BB_RJ45_KIT][105101015]&lt;br /&gt;
&lt;br /&gt;
==== GPS ====&lt;br /&gt;
*[[GPS Bee]] [BB_GPSBEE][105201002]&lt;br /&gt;
&lt;br /&gt;
==== Sensors ====&lt;br /&gt;
===== Infrared=====&lt;br /&gt;
*[[Infrared Remote Control and Receiver]]&lt;br /&gt;
===== Light Sensor =====&lt;br /&gt;
*[[TEMT6000 Breakout Board]] [BB_TEMT6000][105101016]&lt;br /&gt;
===== Accelerometer =====&lt;br /&gt;
*[[ ADXL335 Triple-Axis Accelerometer]] [BB_ADXL335]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=BMP085_9-axis_IMU_Module  9 Degrees of Freedom IMU] [BB_9AX_IMU_BMP085]&lt;br /&gt;
&lt;br /&gt;
=====Distance=====&lt;br /&gt;
*[[Ultrasonic Range Sensor]] [SEN_DIS_ULTRA][115101001]&lt;br /&gt;
=====ID=====&lt;br /&gt;
*[[Silicon Fingerprint Scanner]]   [SEN_ID_FP_SCAN][115201001]&lt;br /&gt;
*[[Silicon Fingerprint Area Sensing Module]]   [SEN_ID_FP_AREA][115201001]&lt;br /&gt;
&lt;br /&gt;
====RTC====&lt;br /&gt;
*[[DS3234 Breakout Board]] [BB_DS3234][105201003]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*[[Serial UART 16x2 LCD]] [BB_SERLCD_1602G][105101001]&lt;br /&gt;
*[[FIR: Gainspan WiFi Module with Xbee Breakout]] [WIFI_MOD_FIR][103101001]&lt;br /&gt;
*[[TTL Level Shifter]] [BB_TTLLT][105101011]&lt;br /&gt;
*[[USB LiPoly Charger - Single Cell]] [BAT_USBCHARGER][106101001]&lt;br /&gt;
*[[Embedded Serial Web Server Module]] [BB_ETH_WS][105101012]&lt;br /&gt;
&lt;br /&gt;
== Lighting LEDs ==&lt;br /&gt;
&lt;br /&gt;
*[[LED strip driver]]  [LED_SPDRV][109101001]&lt;br /&gt;
*[[LED PWM Dimmer Constant Current Driver (DC: 12V -48V)]] [LED_CHAMELEON_I_48V][109201007]&lt;br /&gt;
*[[LED PWM Dimmer Constant Current Driver (DC:12V -200V)]] [LED_CHAMELEON_II_200V][109201008]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== JPEG Cameras ==&lt;br /&gt;
===JPEG Camera Without case===&lt;br /&gt;
*[[JPEG Color Camera Serial Interface (RS232 level)]] [CAM_JPEG_RS232][201201002]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=JPEG_Color_Camera_Serial_UART_Interface_(TTL_level) JPEG Color Camera Serial Interface (TTL level)]   [CAM_JPEG_TTLUART][201201001]&lt;br /&gt;
*[[JPEG Color Camera Serial Interface(RS485)]]  [CAM_JPEG_RS485][201201003]&lt;br /&gt;
*[[Lens of 90 degree view angle]] [CAM_LENS_JPEG_90D][206201001]&lt;br /&gt;
*[[JPEG Color Camera Serial Interface with Built-in Infrared (RS232 level)]] [CAM_JPEG_IR_RS232][202201002]&lt;br /&gt;
*[[JPEG Color Camera Serial Interface with Built-in Infrared (TTL level)]] [CAM_JPEG_IR_TTLUART][202201001]&lt;br /&gt;
*[[JPEG Color Camera Serial Interface with Built-in Infrared (RS485 level)]] [CAM_JPEG_IR_RS485][202201003]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*[[JPEG 2M Pixel Color Camera Serial Interface(TTL level)]]  [CAM_JPEG_2M_TTLUART][201201004]&lt;br /&gt;
*[[JPEG 2M Pixel Color Camera Serial Interface(RS232 level)]]  [CAM_JPEG_2M_RS232][201201005]&lt;br /&gt;
&lt;br /&gt;
===JPEG Camera With Case===&lt;br /&gt;
*[[LinkSprite Weather Proof JPEG Serial Port Camera with Infrared (TTL UART)]]  [CAM_AW_JPEG_TTLUART][203201001]&lt;br /&gt;
*[[LinkSprite Weather Proof JPEG Serial Port Camera with Infrared (RS232)]]  [CAM_AW_JPEG_RS232][203201002]&lt;br /&gt;
*[[LinkSprite Weather Proof JPEG Serial Port Camera with Infrared (RS485)]]  [CAM_AW_JPEG_RS485][203201003]&lt;br /&gt;
*[[LinkSprite Weather Proof Long Distance 120degree JPEG Serial Port Camera with Infrared (RS485)]]  [CAM_AW_JPEG_120DLR_RS485][203202003]&lt;br /&gt;
&lt;br /&gt;
*[[1.3Mp LinkSprite Long Range Weather Proof Infrared JPEG ]]   [CAM_AW_JPEG_LR_1P3M][204201002]&lt;br /&gt;
*[[0.3Mp LinkSprite Long Range Weather Proof Infrared JPEG]]  [CAM_AW_JPEG_LR_0P3M][204201001]&lt;br /&gt;
*[[5Mp LinkSprite Long Range Weather Proof Infrared JPEG Camera]] [CAM_AW_JPEG_LR_5M][204201003]&lt;br /&gt;
&lt;br /&gt;
==RFID==&lt;br /&gt;
=== 13.4MHz RFID Modules ===&lt;br /&gt;
*[[ PN532 RFID Module]] [RFID_NFC_BB_PN532][107101002]&lt;br /&gt;
*[[RFID Reader/Write Module A (IIC interface)]] [RFID_NFC_HY502A][107201005]&lt;br /&gt;
*[[RFID Reader/Write Module B (SPI interface)]] [RFID_NFC_HY502B][107201006]&lt;br /&gt;
*[[RFID Reader/Write Module C (UART interface)]][RFID_NFC_HY502C][107201007]&lt;br /&gt;
===Tag===&lt;br /&gt;
*[[RFID tag, rewritable, Mifare 1, S50 (13.56MHz)]] [RFID_NFC_MIFARE][107201012]&lt;br /&gt;
&lt;br /&gt;
=== UHF RFID Modules and Integrated Readers===&lt;br /&gt;
====Module====&lt;br /&gt;
*[[Cottonwood: UHF Long distance RFID reader module]][RFID_UHF_TTL_CW][107101001] or [RFID_UHF_USB_CW][107102001]&lt;br /&gt;
&lt;br /&gt;
====Integrated Readers====&lt;br /&gt;
*[[Long Range UHF RFID reader (1-6 meters) (ISO18000-6C EPC G2) RS232]]  [RFID_UHF_READER_WAN_0702_RS232][107201016]&lt;br /&gt;
*[[Long Range UHF RFID reader (1-6 meters) (ISO18000-6C EPC G2) RJ45]]  [RFID_UHF_READER_WAN_0702_RJ45][107201017]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=Integrated_far-distance_reader_(1-15meters)  Long Range UHF RFID reader (1-15 meters)(ISO18000-6C EPC G2) RS232]  [RFID_UHF_READER_WAN_0703_RS232][107201018]&lt;br /&gt;
*[[Long Range UHF RFID Reader (1-25meters) (ISO18000-6C EPC G2) RS232]] [RFID_UHF_READER_WAN_0704_RS232]&lt;br /&gt;
&lt;br /&gt;
==== Antenna ====&lt;br /&gt;
*[[5dBi PCB UHF RFID 902-928M Antenna 5cm x 5cm]] [RFID_UHF_AN5DB][107101002]&lt;br /&gt;
*[[LinkSprite UHF RFID Reader Antenna (902-928MHz, 8dBi RHC Pol)]] [RFID_UHF_AN8DBMINI]&lt;br /&gt;
*[[UHF RFID Reader Antenna (902-928MHz, 8dBic LHC Pol)]] [RFID_UHF_AN8DN_S9028PCL]&lt;br /&gt;
&lt;br /&gt;
====Tag ====&lt;br /&gt;
*[[UHF RFID tag, EPC Gen2 (900MHz)]] [RFID_UHF_CARDTAG_LS0831][107201008]&lt;br /&gt;
*[[LS0832- Dual Frequencies UHF+HF RFID tag]] [RFID_UHFHF_CARDTAG_LS0832][107201009]&lt;br /&gt;
*[[UHF RFID tag for metal surface and Vechile, EPC Gen2 (900MHz)]] [RFID_UHF_METALTAG][107201013]&lt;br /&gt;
*[[Key Tag UHF RFID tag , EPC Gen2 (900MHz)]] [RFID_UHF_KEYTAG][107201015]&lt;br /&gt;
*[[UHF RFID tag for Vechile Licenser Plate, EPC Gen2 (900MHz)]] [RFID_UHF_PLATETAG][107201014]&lt;br /&gt;
*[[UHF RFID tag for flex surface (tape on back) Transparent , EPC Gen2 (900MHz)]] [RFID_UHF_FLEXTRANTAG][107201010]&lt;br /&gt;
*[[UHF RFID tag for flex surface (tape on back) Nontransparent , EPC Gen2 (900MHz)]] [RFID_UHF_FLEXNONTRANTAG][107201011]&lt;br /&gt;
*[[Key Tag UHF RFID tag , EPC Gen2 (900MHz) ]] [RFID_UHF_KEYTAG] [107201015]&lt;br /&gt;
&lt;br /&gt;
== OpenWRT ==&lt;br /&gt;
*[[TL-WR703N Clone With OPENWRT, USB Camera Support, TTL UART]]&lt;br /&gt;
&lt;br /&gt;
== Robotics ==&lt;br /&gt;
&lt;br /&gt;
*[[LinkSprite Basic Robot Platform]]&lt;br /&gt;
&lt;br /&gt;
===LinkerBot===&lt;br /&gt;
&lt;br /&gt;
*[[LinkerBot Platform]] [BOT_LB_PLATFORM][104201002]&lt;br /&gt;
&lt;br /&gt;
===MiniBot===&lt;br /&gt;
&lt;br /&gt;
*[[Minibot with Arduino Programming ]]  [BOT_MINI][104201007]&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
*[[RB-65CS: Servo with 360 Degree freedom]][BOT_SERVO_65CS][104201003]&lt;br /&gt;
*[[RB-150CS: Servo with 360 Degree freedom ]][BOT_SERVO_150CS][104201004]&lt;br /&gt;
&lt;br /&gt;
===Robot Battery===&lt;br /&gt;
*[[Battery for Robot 4800mAH]] [BAT_4800MHAH]&lt;br /&gt;
&lt;br /&gt;
===Rover===&lt;br /&gt;
*[[Rover: WiFi Video Streaming Robot]] [BOT_ROVER][104201001]&lt;br /&gt;
*[[pcDuino Rover: WiFi Video Streaming Robot Kit]] [BOT_PDROVER_KIT][104201006]&lt;br /&gt;
&lt;br /&gt;
===Motor ===&lt;br /&gt;
*[[Stepper Motor with Cable]] [STEPPER_MOTOR]&lt;br /&gt;
&lt;br /&gt;
== FPGA ==&lt;br /&gt;
&lt;br /&gt;
== S3C6410 Development Kit==&lt;br /&gt;
&lt;br /&gt;
*[[LS6410 SAMSUNG ARM11 S3C6410 board kit Without LCD ]] [KIT_LS6410_WOLCD][108201008]&lt;br /&gt;
*[[LS6410 SAMSUNG ARM11 S3C6410 board kit 4.3 TFT LCD ]] [KIT_LS6410_4P3][108201009]&lt;br /&gt;
*[[LS6410 SAMSUNG ARM11 S3C6410 board kit 7.0 TFT LCD ]] [KIT_LS6410_7][108201010]&lt;br /&gt;
*[[Camera Module (3M pixel) for ARM development board]] [CAM_LS6410_OV3640_3MP][205201001]&lt;br /&gt;
*[[Camera Module (1.3M pixel) for ARM development board]] [CAM_LS6410_OV9650_1P3MP][205201002]&lt;br /&gt;
*[[Four-band GSM/GPRS Module SIM300 for LS6410 S3C6400 Dev Board]] [CL_LS6410_SIM300][113201001]&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=Products-description&amp;diff=3705</id>
		<title>Products-description</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=Products-description&amp;diff=3705"/>
		<updated>2013-10-24T07:21:24Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* GPS SD Shield */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Microcontrollers ==&lt;br /&gt;
=== Arduino Shields === &lt;br /&gt;
&lt;br /&gt;
==== GSM/GPRS Shield====&lt;br /&gt;
*[[ATWIN Quad-band GPRS/GSM Shield for Arduino ]] [SHD_GPRS_AW][101101005]&lt;br /&gt;
*[[Quad-band GPRS/GSM Shield for Arduino ]] [SHD_GPRSSM5100][101101032]&lt;br /&gt;
*[[Quad-band GPRS/GSM Shield for Arduino Mega]] [SHDM_GPRS_SM5100][101101020]&lt;br /&gt;
*[[SIM900 GPRS/GSM Shield]]  [SHD_SIM900][101101029]&lt;br /&gt;
*[[3G + GPS Shield for Arduino ]]  [SHD_3G + AN_M_SMA_UFL][101101024]&lt;br /&gt;
==== WiFi Shield ====&lt;br /&gt;
*[[CuHead WiFi Shield for Arduino V2.0]] [SHD_WIFI_CUHV2][101101002]&lt;br /&gt;
*[[CuHead WiFi Shield for Arduino Mega]] [SHDM_WIFI_CUH][101101003]&lt;br /&gt;
*[[CuHead Pro WiFi/Ethernet Shield with AirPlay/DLNA Audio for Arduino]] [SHD_WIFI_CUHPRO][101102002]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=JUNIPER-_WiFi_Shield_for_Arduino_Based_on_GainSpan_Module JUNIPER WiFi Shield for Arduino Based on GainSpan Module]  [SHD_WIFI_JNP][101101004]&lt;br /&gt;
*[[Anaconda WiFi Shield for Arduino     ]] [SHD_WIFI_ANA_WOM + WIFI_MOD_ANA + AN_M_SMA_UFL][108301002]&lt;br /&gt;
&lt;br /&gt;
==== LCD Shield ====&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=16_X_2_LCD_Keypad_Shield_for_Arduino 16 X 2 LCD Keypad Shield for pcDuino/Arduino]  [SHD_LCD_1602_A][101101016] or [SHD_LCD_1602_B][101102016] &lt;br /&gt;
*[[Color Image LCD Shield for Arduino ]] [SHD_LCD_NOKIA]OR [SHD_LCD_NOKIA_WOLCD] [101101009]&lt;br /&gt;
*[[Touch Shield for Arduino]] [SHD_TOUKEY][101101008]&lt;br /&gt;
*[[Touch LCD Shield]]  [SHD_TOUCHLCD][101101027]&lt;br /&gt;
==== GPS SD Shield ====&lt;br /&gt;
*[[GPS Shield With SD Card Slot for Arduino V2.0 A]]  [SHD_GPSV2_A][101101006]&lt;br /&gt;
*[[GPS Shield With SD Card Slot for Arduino V2.0 B]]  [SHD_GPSV2_B][101102006]&lt;br /&gt;
*[[GPS Shield with SD card slot for Arduino V3.0 with external GPS antenna]] [SHD_GPSV3][101101007]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*[[Bluetooth Shield for Arduino ]]  [SHD_BLUETOOTH][101101033]&lt;br /&gt;
*[[Gameduino for Arduino: A Game Adapter for Microcontrollers]] [SHD_FPGA_GAMEDUINO][101101015]&lt;br /&gt;
*[[Infrared Shield for Arduino]]  [SHD_IR][101101011]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=LED_Cube_Shield_for_Arduino 4x4x4 Light Cube Shield Kit for pcDuino/Arduino] [SHD_LEDCUBE][101101035]&lt;br /&gt;
*[[Mamba - Narrow Band Powerline Communication Shield for Arduino]] [SHD_PLC_MAMBA][101101021]&lt;br /&gt;
*[[MIDI Shield for Arduino]] [SHD_MIDI][101101022]&lt;br /&gt;
*[[MQ2 Smoke Detector Shield for Arduino]] [SHD_MQ2][101101010]&lt;br /&gt;
*[[RS232 Shield for Arduino]] [SHD_RS232][101101012]&lt;br /&gt;
*[[RS485 Shield for Arduino]] [SHD_RS485][101101013]&lt;br /&gt;
*[[USB Host Shield for Arduino]] [SHD_USB_HOST][101101018]&lt;br /&gt;
*[[Screw Shield for Arduino]]  [SHD_SCREW][101101019]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=Music_Shield_for_Arduino Music Shield for Arduino] [SHD_MUSIC][101101034]&lt;br /&gt;
*[[NFC PN532 Shield]]  [SHD_RFID_NFCPN532][101101001]&lt;br /&gt;
*[[Motor Shield ]] [SHD_MOTOR][101101014]&lt;br /&gt;
*[[SD Shield ]]   [SHD_SD] [101101026]&lt;br /&gt;
*[[Ethernet Shield]]   [SHD_ETH] [101101028]&lt;br /&gt;
*[[Xbee Shield]]  [SHD_XBEE][101101017]&lt;br /&gt;
*[[Xbee Relay Shield]]  [SHD_RELAY][101101030]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=Proto_Shield_Kits Proto Shield Kits for Arduino]  [SHD_PROTOKIT][101101025]&lt;br /&gt;
*[[Proto Shield for Mega]] [SHDM_PROTO][101101023]&lt;br /&gt;
*[[Proto shield for pcDuino]] [SHD_PROTOKITPCDUINO][101101031]&lt;br /&gt;
&lt;br /&gt;
=== AVR Based Arduino ===&lt;br /&gt;
*[[Diamondback WiFi Platform Compatible With Arduino]] [[MP_WIFI_DIAMOND][102101002]&lt;br /&gt;
*[[Redback WiFi Platform Compatible With Arduino Nano]] [MP_WIFI_REDBACK][102101003]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ARM Based Arduino ===&lt;br /&gt;
*[[Spruce]] [MP_SPRUCE_WLCD][102101004] or [MP_SPRUCE_WOLCD][102102004]&lt;br /&gt;
&lt;br /&gt;
=== FPGA Based Arduino ===&lt;br /&gt;
*[[Papilio 500K]]  [FPGA_PAP_500K][110101001]&lt;br /&gt;
*[[Papilio Pro]]   [FPGA_PAP_RO][110101006]&lt;br /&gt;
*[[Papilio I/O Wing]] [FPGA_PAP_IOWIG_BPW5015][110101002]&lt;br /&gt;
*[[Papilio VGA Wing]] [FPGA_PAP_VGA_BPW5017][110101003]&lt;br /&gt;
*[[Papilio B/LED Wing]] [FPGA_PAP_LED_BPW5007][110101004]&lt;br /&gt;
*[[Papilio LogicStart MegaWing]] [FPGA_PAP_LGS_BPW7003][110101005]&lt;br /&gt;
*[[Papilio MicroJoystick Wing]] [FPGA_PAP_MICJOYSTICK_BPW5038]&lt;br /&gt;
&lt;br /&gt;
=== IOIO ===&lt;br /&gt;
*[[IOIO V15]] [MP_IOIO][102101001]&lt;br /&gt;
*[[IOIO-OTG]] [MP_IOIOOTG][102101007]&lt;br /&gt;
*[[Micro USB OTG Cable]] [CAB_MICROUSB_OTG][117201003]&lt;br /&gt;
&lt;br /&gt;
=== pcDuino ===&lt;br /&gt;
*[http://www.pcduino.com/?page_id=1707  pcDuino Lite] [MP_PCDUINOLITE][102103006]&lt;br /&gt;
*[http://www.pcduino.com/?page_id=12 pcDuino] [MP_PCDUINO][102101006]&lt;br /&gt;
*[http://www.pcduino.com/?page_id=1618 pcDuino v2] [MP_PCDUINOV2][102102006]&lt;br /&gt;
*[[Voltage Translation Board for pcDuino V2]] [SHD_TPCDV2][101101036]&lt;br /&gt;
*[[AV Kit for pcDuino]] [KIT_AV_PCDUINO][108201012]&lt;br /&gt;
*[[Proto shield for pcDuino]] [SHD_PROTOKITPCDUINO][101101031]&lt;br /&gt;
*[[HDMI to DVI cable for pcDunio]]  [DVICAB_PCDUINO][108202002]&lt;br /&gt;
*[[HDMI to VGA cable with Audio for pcDuino]] [VGACAB_PCDUINO][108202001]&lt;br /&gt;
*[[WiFi Dongle for pcDuino]]  [WIFI_PCDUINO][103201008]&lt;br /&gt;
*[[Serial Debug Cable for pcDuino]] [CAB_USBTTL_PCDUINO][117301001] = Breakout Board for FT232RL USB to TTL 5V [BB_MINIUSB_TTL][105101005] + mini USB cable[117301001-1] + 3-wire male to female jumper wire[117301002-2]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=USB_Sound_Card_with_Audio_Input/Output USB Sound Card with Audio Input/Output for pcDuino] [USB_SOUND_PCDUINO][108202003]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=RTC_Module RTC Module for pcDuino]   [LINKER_RTC][118101009]&lt;br /&gt;
*[[Web Cam 3-axis Servo Kit for Real Time Video for pcDuino]][108202004] [KIT_WEBCAMSRV]=[WEBCAM_PCDUINO][108202004-1]+[KIT_SRV][108202004-3]&lt;br /&gt;
*[[Bluetooth USB Module Mini for pcDuino]] [BT-USB-MINI][119201001]&lt;br /&gt;
*[[pcDuino Rover kit]][BOT_PDROVER_KIT][104201006]&lt;br /&gt;
&lt;br /&gt;
==== Case ====&lt;br /&gt;
&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=LinkSprite_Clear_Enclosure_for_pcDuino  LinkSprite Clear Enclosure for pcDuino/Arduino] [COM_CASE_PCDUINO_CLEAR] [114201005]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=LinkSprite_Extension_Plate_for_Clear_Enclosure_for_Arduino LinkSprite Extension Plate for Clear Enclosure for pcDuino/Arduino] [COM_CASE_ARDU_CLEAR_PLATE][114201003]&lt;br /&gt;
*[[Acrylic Clear Enclosure for pcDuino With Removable Cover]]  [COM_CASE_PCDUINO_ACCLEAR][114201006]&lt;br /&gt;
*[[Lego Style Enclosure for pcDuino]] [COM_LECASE_PCDUINO][114201008]&lt;br /&gt;
&lt;br /&gt;
=== Pitaya ===&lt;br /&gt;
&lt;br /&gt;
*[[ Pitaya ]] [MP_PITAYA]&lt;br /&gt;
*[[ Pitaya Dual Core ]] [MP_PITAYA_DUAL][102201001]&lt;br /&gt;
*[[ USB 2.0 Ethernet Adapter]] [CAB_ETHUSB][117201002]&lt;br /&gt;
&lt;br /&gt;
== Raspberry Pi Kits ==&lt;br /&gt;
*[[GPIO Ribbon Cable for Raspberry Pi]] [RPI_GPIOCABLE][120201004]&lt;br /&gt;
*[[Assembled Raspberry Pi Cobbler Breakout]] [RPI_COBB][120201003]&lt;br /&gt;
*[[Assembled Raspberry Pi T-Cobbler Breakout]] [RPI_T_COBB][120201005]&lt;br /&gt;
*[[Raspberry Pi T-Cobbler Breakout Kit]] [RPI_TCOBB_KIT][120201001]&lt;br /&gt;
*[[Raspberry Pi Assorted Lego Style Enclosure]] [RPI_LEGOSTYLE_CASE][120201002]&lt;br /&gt;
*[[RS232/GPIO Shield for Raspberry Pi]] [SHD_RPI_RS232GPIO][101201001]&lt;br /&gt;
*[[TTL UART to USB Cable - Serial USB Debug Cable]] [CAB_RPIUARTUSB][117201001]&lt;br /&gt;
*[[ Linker kit Base Shield for Raspberry Pi with ADC Interface ]] [LINKER_RPIBASE][118101020]&lt;br /&gt;
&lt;br /&gt;
== Arduino Kits ==&lt;br /&gt;
&lt;br /&gt;
*[[LinkerKit]]&lt;br /&gt;
*[[LinkerKit for Raspberry Pi]]   [LINKERKIT_RPI]&lt;br /&gt;
*[[Sensors Pack for Arduino]]&lt;br /&gt;
*[[Advanced Sensors Kit for Arduino ]]   [ADVSEN_KIT]&lt;br /&gt;
*[[LED Matrix Kit]] [KIT_LEDMATRIX][108101001]&lt;br /&gt;
*[[LinkSprite Sensor Pack 101]]&lt;br /&gt;
*[[Introductory Kit with Clear Case for Arduino]] [INTOKIT_CLEARCASE]&lt;br /&gt;
&lt;br /&gt;
== Components and Breakout Boards ==&lt;br /&gt;
&lt;br /&gt;
===Components===&lt;br /&gt;
&lt;br /&gt;
*GPS&lt;br /&gt;
**[[GPS module SKM58]] [GPS_SKM58][116201002]&lt;br /&gt;
**[[32 Channel LinkSprite GPS 5Hz Receiver ]] [GPS_SKG17][116201001]&lt;br /&gt;
**[[GPS Patch Antenna (IPX interface with pig tale length 7cm)]] [ANT_GPS_PAT]&lt;br /&gt;
&lt;br /&gt;
*[[Serial port bluetooth module (Master/Slave)]]&lt;br /&gt;
*[[ RFID Card with UID Rewritable ]]&lt;br /&gt;
*[[ 7400 Series Kit , 5pcs]]&lt;br /&gt;
*LED&lt;br /&gt;
**[[8X8 RED LED Matrix ]]&lt;br /&gt;
*LCD Module&lt;br /&gt;
**[[Basic 20x4 Character LCD - Black on Green 5V ]] [LCD_20_4_5V]&lt;br /&gt;
**[[Basic 16x2 Character LCD - Black on Green 5V]] [LCD_16_2_5V]&lt;br /&gt;
**[[Color LCD 128x128 Nokia Knock-Off]] [NOKIA_6100_LCD]&lt;br /&gt;
*Breadboard&lt;br /&gt;
**[[Mini Breadboard Mini Self-Adhesive for Arduino (White)]] [PRT_MINIBRD_WHITE]&lt;br /&gt;
**[[Mini Breadboard Mini Self-Adhesive for Arduino (RED)]] [PRT_MINIBRD_RED]&lt;br /&gt;
**[[Mini Breadboard Mini Self-Adhesive for Arduino (BLUE)]] [PRT_MINIBRD_BLUE]&lt;br /&gt;
&lt;br /&gt;
=== Case and Enclosure===&lt;br /&gt;
&lt;br /&gt;
*[[ LinkSprite Clear Enclosure for Arduino ]] [COM_CASE_ARDU_CLEAR] [114201002]&lt;br /&gt;
*[[ LinkSprite Clear Enclosure for pcDuino ]] [COM_CASE_PCDUINO_CLEAR] [114201005]&lt;br /&gt;
*[[ Raspberry Pi Case]] [COM_RPI_CASE]&lt;br /&gt;
*[[ LinkSprite Extension Plate for Clear Enclosure for Arduino ]] [COM_CASE_ARDU_CLEAR_PLATE][114201003]&lt;br /&gt;
*[[ Arduino Uno Assorted Lego Style Enclosure ]] [COM_CASE_ARDULEGO][114201007]&lt;br /&gt;
&lt;br /&gt;
===Breakout===&lt;br /&gt;
&lt;br /&gt;
==== SD/MicroSD ====&lt;br /&gt;
*[[Breakout Board for microSD Transflash]] [BB_MINISD][105101004]&lt;br /&gt;
*[[SD Card Breakout Board]] [BB_SD][105101003]&lt;br /&gt;
&lt;br /&gt;
==== MP3/Music/Voice ====&lt;br /&gt;
*[[Serial Port Voice Recognition Module]]  [BB_SERVOICE] [105201001]&lt;br /&gt;
*[[Breakout Board for ADMP401 MEMS Microphone]] [BB_ADMP401][105101002]&lt;br /&gt;
*[[Breakout Board for Si4703 FM Tuner]] [BB_FM_SI4703][105101007]&lt;br /&gt;
*[[Serial port controllable MP3 module ]] [BB_SERIAL_MP3]&lt;br /&gt;
&lt;br /&gt;
==== USB ====&lt;br /&gt;
*[[Xbee USB Adapter]] [BB_XBEE_MINIUSB][105101006]&lt;br /&gt;
*[[Breakout Board for FT232RL USB to TTL 5V]] [BB_MINIUSB_TTL][105101005]&lt;br /&gt;
&lt;br /&gt;
==== Xbee====&lt;br /&gt;
*[[Xbee Socket to Xbee Socket Evaluation Board]] [BB_UART2UART][105101013]&lt;br /&gt;
*[[Xbee socket UART to RS232]] [BB_XBEE_UART2RS232][105101009]&lt;br /&gt;
*[[Xbee socket UART to RS485]] [BB_XBEE_UART2RS485][105101010]&lt;br /&gt;
*[[Xbee socket UART to USB]] [BB_XBEE_UART2USB][105101008]&lt;br /&gt;
*[[Breakout Board for XBee Module with 5V interface to 3.3V Xbee]]  [BB_XBEE_5_2_3P3][105101014]&lt;br /&gt;
*[[BluetoothBee]] [BB_XBEE_BLUETOOTH]&lt;br /&gt;
&lt;br /&gt;
==== RJ45 ====&lt;br /&gt;
&lt;br /&gt;
*[[RJ45 8-pin Connector and Breakout Board Kit]] [BB_RJ45_KIT][105101015]&lt;br /&gt;
&lt;br /&gt;
==== GPS ====&lt;br /&gt;
*[[GPS Bee]] [BB_GPSBEE][105201002]&lt;br /&gt;
&lt;br /&gt;
==== Sensors ====&lt;br /&gt;
===== Infrared=====&lt;br /&gt;
*[[Infrared Remote Control and Receiver]]&lt;br /&gt;
===== Light Sensor =====&lt;br /&gt;
*[[TEMT6000 Breakout Board]] [BB_TEMT6000][105101016]&lt;br /&gt;
===== Accelerometer =====&lt;br /&gt;
*[[ ADXL335 Triple-Axis Accelerometer]] [BB_ADXL335]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=BMP085_9-axis_IMU_Module  9 Degrees of Freedom IMU] [BB_9AX_IMU_BMP085]&lt;br /&gt;
&lt;br /&gt;
=====Distance=====&lt;br /&gt;
*[[Ultrasonic Range Sensor]] [SEN_DIS_ULTRA][115101001]&lt;br /&gt;
=====ID=====&lt;br /&gt;
*[[Silicon Fingerprint Scanner]]   [SEN_ID_FP_SCAN][115201001]&lt;br /&gt;
*[[Silicon Fingerprint Area Sensing Module]]   [SEN_ID_FP_AREA][115201001]&lt;br /&gt;
&lt;br /&gt;
====RTC====&lt;br /&gt;
*[[DS3234 Breakout Board]] [BB_DS3234][105201003]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*[[Serial UART 16x2 LCD]] [BB_SERLCD_1602G][105101001]&lt;br /&gt;
*[[FIR: Gainspan WiFi Module with Xbee Breakout]] [WIFI_MOD_FIR][103101001]&lt;br /&gt;
*[[TTL Level Shifter]] [BB_TTLLT][105101011]&lt;br /&gt;
*[[USB LiPoly Charger - Single Cell]] [BAT_USBCHARGER][106101001]&lt;br /&gt;
*[[Embedded Serial Web Server Module]] [BB_ETH_WS][105101012]&lt;br /&gt;
&lt;br /&gt;
== Lighting LEDs ==&lt;br /&gt;
&lt;br /&gt;
*[[LED strip driver]]  [LED_SPDRV][109101001]&lt;br /&gt;
*[[LED PWM Dimmer Constant Current Driver (DC: 12V -48V)]] [LED_CHAMELEON_I_48V][109201007]&lt;br /&gt;
*[[LED PWM Dimmer Constant Current Driver (DC:12V -200V)]] [LED_CHAMELEON_II_200V][109201008]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== JPEG Cameras ==&lt;br /&gt;
===JPEG Camera Without case===&lt;br /&gt;
*[[JPEG Color Camera Serial Interface (RS232 level)]] [CAM_JPEG_RS232][201201002]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=JPEG_Color_Camera_Serial_UART_Interface_(TTL_level) JPEG Color Camera Serial Interface (TTL level)]   [CAM_JPEG_TTLUART][201201001]&lt;br /&gt;
*[[JPEG Color Camera Serial Interface(RS485)]]  [CAM_JPEG_RS485][201201003]&lt;br /&gt;
*[[Lens of 90 degree view angle]] [CAM_LENS_JPEG_90D][206201001]&lt;br /&gt;
*[[JPEG Color Camera Serial Interface with Built-in Infrared (RS232 level)]] [CAM_JPEG_IR_RS232][202201002]&lt;br /&gt;
*[[JPEG Color Camera Serial Interface with Built-in Infrared (TTL level)]] [CAM_JPEG_IR_TTLUART][202201001]&lt;br /&gt;
*[[JPEG Color Camera Serial Interface with Built-in Infrared (RS485 level)]] [CAM_JPEG_IR_RS485][202201003]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*[[JPEG 2M Pixel Color Camera Serial Interface(TTL level)]]  [CAM_JPEG_2M_TTLUART][201201004]&lt;br /&gt;
*[[JPEG 2M Pixel Color Camera Serial Interface(RS232 level)]]  [CAM_JPEG_2M_RS232][201201005]&lt;br /&gt;
&lt;br /&gt;
===JPEG Camera With Case===&lt;br /&gt;
*[[LinkSprite Weather Proof JPEG Serial Port Camera with Infrared (TTL UART)]]  [CAM_AW_JPEG_TTLUART][203201001]&lt;br /&gt;
*[[LinkSprite Weather Proof JPEG Serial Port Camera with Infrared (RS232)]]  [CAM_AW_JPEG_RS232][203201002]&lt;br /&gt;
*[[LinkSprite Weather Proof JPEG Serial Port Camera with Infrared (RS485)]]  [CAM_AW_JPEG_RS485][203201003]&lt;br /&gt;
*[[LinkSprite Weather Proof Long Distance 120degree JPEG Serial Port Camera with Infrared (RS485)]]  [CAM_AW_JPEG_120DLR_RS485][203202003]&lt;br /&gt;
&lt;br /&gt;
*[[1.3Mp LinkSprite Long Range Weather Proof Infrared JPEG ]]   [CAM_AW_JPEG_LR_1P3M][204201002]&lt;br /&gt;
*[[0.3Mp LinkSprite Long Range Weather Proof Infrared JPEG]]  [CAM_AW_JPEG_LR_0P3M][204201001]&lt;br /&gt;
*[[5Mp LinkSprite Long Range Weather Proof Infrared JPEG Camera]] [CAM_AW_JPEG_LR_5M][204201003]&lt;br /&gt;
&lt;br /&gt;
==RFID==&lt;br /&gt;
=== 13.4MHz RFID Modules ===&lt;br /&gt;
*[[ PN532 RFID Module]] [RFID_NFC_BB_PN532][107101002]&lt;br /&gt;
*[[RFID Reader/Write Module A (IIC interface)]] [RFID_NFC_HY502A][107201005]&lt;br /&gt;
*[[RFID Reader/Write Module B (SPI interface)]] [RFID_NFC_HY502B][107201006]&lt;br /&gt;
*[[RFID Reader/Write Module C (UART interface)]][RFID_NFC_HY502C][107201007]&lt;br /&gt;
===Tag===&lt;br /&gt;
*[[RFID tag, rewritable, Mifare 1, S50 (13.56MHz)]] [RFID_NFC_MIFARE][107201012]&lt;br /&gt;
&lt;br /&gt;
=== UHF RFID Modules and Integrated Readers===&lt;br /&gt;
====Module====&lt;br /&gt;
*[[Cottonwood: UHF Long distance RFID reader module]][RFID_UHF_TTL_CW][107101001] or [RFID_UHF_USB_CW][107102001]&lt;br /&gt;
&lt;br /&gt;
====Integrated Readers====&lt;br /&gt;
*[[Long Range UHF RFID reader (1-6 meters) (ISO18000-6C EPC G2) RS232]]  [RFID_UHF_READER_WAN_0702_RS232][107201016]&lt;br /&gt;
*[[Long Range UHF RFID reader (1-6 meters) (ISO18000-6C EPC G2) RJ45]]  [RFID_UHF_READER_WAN_0702_RJ45][107201017]&lt;br /&gt;
*[http://linksprite.com/wiki/index.php5?title=Integrated_far-distance_reader_(1-15meters)  Long Range UHF RFID reader (1-15 meters)(ISO18000-6C EPC G2) RS232]  [RFID_UHF_READER_WAN_0703_RS232][107201018]&lt;br /&gt;
*[[Long Range UHF RFID Reader (1-25meters) (ISO18000-6C EPC G2) RS232]] [RFID_UHF_READER_WAN_0704_RS232]&lt;br /&gt;
&lt;br /&gt;
==== Antenna ====&lt;br /&gt;
*[[5dBi PCB UHF RFID 902-928M Antenna 5cm x 5cm]] [RFID_UHF_AN5DB][107101002]&lt;br /&gt;
*[[LinkSprite UHF RFID Reader Antenna (902-928MHz, 8dBi RHC Pol)]] [RFID_UHF_AN8DBMINI]&lt;br /&gt;
*[[UHF RFID Reader Antenna (902-928MHz, 8dBic LHC Pol)]] [RFID_UHF_AN8DN_S9028PCL]&lt;br /&gt;
&lt;br /&gt;
====Tag ====&lt;br /&gt;
*[[UHF RFID tag, EPC Gen2 (900MHz)]] [RFID_UHF_CARDTAG_LS0831][107201008]&lt;br /&gt;
*[[LS0832- Dual Frequencies UHF+HF RFID tag]] [RFID_UHFHF_CARDTAG_LS0832][107201009]&lt;br /&gt;
*[[UHF RFID tag for metal surface and Vechile, EPC Gen2 (900MHz)]] [RFID_UHF_METALTAG][107201013]&lt;br /&gt;
*[[Key Tag UHF RFID tag , EPC Gen2 (900MHz)]] [RFID_UHF_KEYTAG][107201015]&lt;br /&gt;
*[[UHF RFID tag for Vechile Licenser Plate, EPC Gen2 (900MHz)]] [RFID_UHF_PLATETAG][107201014]&lt;br /&gt;
*[[UHF RFID tag for flex surface (tape on back) Transparent , EPC Gen2 (900MHz)]] [RFID_UHF_FLEXTRANTAG][107201010]&lt;br /&gt;
*[[UHF RFID tag for flex surface (tape on back) Nontransparent , EPC Gen2 (900MHz)]] [RFID_UHF_FLEXNONTRANTAG][107201011]&lt;br /&gt;
*[[Key Tag UHF RFID tag , EPC Gen2 (900MHz) ]] [RFID_UHF_KEYTAG] [107201015]&lt;br /&gt;
&lt;br /&gt;
== OpenWRT ==&lt;br /&gt;
*[[TL-WR703N Clone With OPENWRT, USB Camera Support, TTL UART]]&lt;br /&gt;
&lt;br /&gt;
== Robotics ==&lt;br /&gt;
&lt;br /&gt;
*[[LinkSprite Basic Robot Platform]]&lt;br /&gt;
&lt;br /&gt;
===LinkerBot===&lt;br /&gt;
&lt;br /&gt;
*[[LinkerBot Platform]] [BOT_LB_PLATFORM][104201002]&lt;br /&gt;
&lt;br /&gt;
===MiniBot===&lt;br /&gt;
&lt;br /&gt;
*[[Minibot with Arduino Programming ]]  [BOT_MINI][104201007]&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
*[[RB-65CS: Servo with 360 Degree freedom]][BOT_SERVO_65CS][104201003]&lt;br /&gt;
*[[RB-150CS: Servo with 360 Degree freedom ]][BOT_SERVO_150CS][104201004]&lt;br /&gt;
&lt;br /&gt;
===Robot Battery===&lt;br /&gt;
*[[Battery for Robot 4800mAH]] [BAT_4800MHAH]&lt;br /&gt;
&lt;br /&gt;
===Rover===&lt;br /&gt;
*[[Rover: WiFi Video Streaming Robot]] [BOT_ROVER][104201001]&lt;br /&gt;
*[[pcDuino Rover: WiFi Video Streaming Robot Kit]] [BOT_PDROVER_KIT][104201006]&lt;br /&gt;
&lt;br /&gt;
===Motor ===&lt;br /&gt;
*[[Stepper Motor with Cable]] [STEPPER_MOTOR]&lt;br /&gt;
&lt;br /&gt;
== FPGA ==&lt;br /&gt;
&lt;br /&gt;
== S3C6410 Development Kit==&lt;br /&gt;
&lt;br /&gt;
*[[LS6410 SAMSUNG ARM11 S3C6410 board kit Without LCD ]] [KIT_LS6410_WOLCD][108201008]&lt;br /&gt;
*[[LS6410 SAMSUNG ARM11 S3C6410 board kit 4.3 TFT LCD ]] [KIT_LS6410_4P3][108201009]&lt;br /&gt;
*[[LS6410 SAMSUNG ARM11 S3C6410 board kit 7.0 TFT LCD ]] [KIT_LS6410_7][108201010]&lt;br /&gt;
*[[Camera Module (3M pixel) for ARM development board]] [CAM_LS6410_OV3640_3MP][205201001]&lt;br /&gt;
*[[Camera Module (1.3M pixel) for ARM development board]] [CAM_LS6410_OV9650_1P3MP][205201002]&lt;br /&gt;
*[[Four-band GSM/GPRS Module SIM300 for LS6410 S3C6400 Dev Board]] [CL_LS6410_SIM300][113201001]&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=File:Proto_pcduino.jpg&amp;diff=3704</id>
		<title>File:Proto pcduino.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=File:Proto_pcduino.jpg&amp;diff=3704"/>
		<updated>2013-10-22T01:03:40Z</updated>

		<summary type="html">&lt;p&gt;Leona: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=Proto_shield_for_pcDuino&amp;diff=3703</id>
		<title>Proto shield for pcDuino</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=Proto_shield_for_pcDuino&amp;diff=3703"/>
		<updated>2013-10-22T01:01:29Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
model: SHD_PROTOKITPCDUINO&lt;br /&gt;
&lt;br /&gt;
[[File:proto pcduino.jpg]]&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=Proto_shield_for_pcDuino&amp;diff=3702</id>
		<title>Proto shield for pcDuino</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=Proto_shield_for_pcDuino&amp;diff=3702"/>
		<updated>2013-10-22T01:00:32Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
model: SHD_PROTOKITPCDUINO&lt;br /&gt;
&lt;br /&gt;
[[File:pro pcduino.jpg]]&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=File:Pro_pcduino.jpg&amp;diff=3701</id>
		<title>File:Pro pcduino.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=File:Pro_pcduino.jpg&amp;diff=3701"/>
		<updated>2013-10-22T00:58:12Z</updated>

		<summary type="html">&lt;p&gt;Leona: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=Proto_shield_for_pcDuino&amp;diff=3699</id>
		<title>Proto shield for pcDuino</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=Proto_shield_for_pcDuino&amp;diff=3699"/>
		<updated>2013-10-22T00:54:40Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
model: SHD_PROTOKITPCDUINO&lt;br /&gt;
&lt;br /&gt;
[[File:pro_pcduino.jpg]]&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=Proto_shield_for_pcDuino&amp;diff=3698</id>
		<title>Proto shield for pcDuino</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=Proto_shield_for_pcDuino&amp;diff=3698"/>
		<updated>2013-10-22T00:53:05Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
model: SHD_PROTOKITPCDUINO&lt;br /&gt;
&lt;br /&gt;
[[File:]]&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=ATWIN_Quad-band_GPRS/GSM_Shield_for_Arduino&amp;diff=3623</id>
		<title>ATWIN Quad-band GPRS/GSM Shield for Arduino</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=ATWIN_Quad-band_GPRS/GSM_Shield_for_Arduino&amp;diff=3623"/>
		<updated>2013-09-17T07:21:25Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Hardware Installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction  ==&lt;br /&gt;
&lt;br /&gt;
This LinkSprite  ATWIN Quad-band GPRS/GSM shield has PCB etched antenna, so no need for external antenna.&lt;br /&gt;
&lt;br /&gt;
ATWIN Quad-band GPRS/GSM shield is an ultra compact and high quality wireless module base on infineon UCL2 platform with industy-standard interface. &lt;br /&gt;
&lt;br /&gt;
This is a SMT package with small dimension, low power consumption, quad-band (AT139) and dual-band (AT139D) GSM/GPRS module. &lt;br /&gt;
&lt;br /&gt;
It can provide with voice, SMS, Fax, data applicationgs for customers.&lt;br /&gt;
&lt;br /&gt;
'''[http://v.youku.com/v_show/id_XMzkyOTMyMTQ0.html Video Introduction]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:600PX-ATWIN.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Features  ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
! Features&lt;br /&gt;
! colspan=2 align=&amp;quot;center&amp;quot;| Description&lt;br /&gt;
&lt;br /&gt;
|- style=&amp;quot;background:silver; color:black&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Network&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| GSM/GPRS&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Frequency Bands&lt;br /&gt;
| width=&amp;quot;300px&amp;quot; align=&amp;quot;center&amp;quot;| AT139:GSM850/GSM900/DCS1800/PCS1900MHz&lt;br /&gt;
| width=&amp;quot;300px&amp;quot; align=&amp;quot;center&amp;quot;| AT139D:GSM900/DCS1800MHz&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| RF Output Power&lt;br /&gt;
| width=&amp;quot;300px&amp;quot; align=&amp;quot;center&amp;quot;| AT139:GSM850/GSM900: 33dBm, DCS1800/PCS1900:30dBm&lt;br /&gt;
| width=&amp;quot;300px&amp;quot; align=&amp;quot;center&amp;quot;| AT139D:GSM900:33dBm, DCS1800:30dBm&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| RF Receive Sensitivity&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| &amp;lt;-108dBm&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Speech codec modes&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| FR,EFR,HR,AMR&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| SMS&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| TEXT/PDU&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| GPRS Connectivity&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| GPRS Class 10&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| Coding Scheme：CS1,CS2,CS3,CS4&lt;br /&gt;
&lt;br /&gt;
|- style=&amp;quot;background:silver; color:black&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Physical Characteristics&lt;br /&gt;
| colspan=2|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Package&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| SMT&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Dimensions&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 24(±0.1)*24(±0.1)*3(±0.1)mm&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Weight&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 4g&lt;br /&gt;
&lt;br /&gt;
|- style=&amp;quot;background:silver; color:black&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Performance&lt;br /&gt;
| colspan=2|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Power Supply&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 3.3V~4.5V&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Antenna&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| External Antenna&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| MCP&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 64Mb NOR + 32Mb PSRAM&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Audio&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| Two input/output Audio channels&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| SIM Card Application&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| Support SIM Card:1.8V/3.0V&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Pin Amounts&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 38 PINs&lt;br /&gt;
&lt;br /&gt;
|- style=&amp;quot;background:silver; color:black&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Firmware&lt;br /&gt;
| colspan=2|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Operating System&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| OSE&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Application Ideas  ==&lt;br /&gt;
&lt;br /&gt;
== Cautions  ==&lt;br /&gt;
&lt;br /&gt;
The warnings and wrong operations possible cause dangerous. &lt;br /&gt;
&lt;br /&gt;
== Schematic  ==&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/schematic_of_ATWIN.rar  ATWIN Quad-band GPRS/GSM shield Schematic]&lt;br /&gt;
&lt;br /&gt;
== Specification  ==&lt;br /&gt;
May include key specification and other specifications.&lt;br /&gt;
&lt;br /&gt;
== Pin definition and Rating  ==&lt;br /&gt;
&lt;br /&gt;
== Mechanic Dimensions  ==&lt;br /&gt;
&lt;br /&gt;
== Usage  ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Installation  ===&lt;br /&gt;
&lt;br /&gt;
'''First Tutorial'''&lt;br /&gt;
The shield must be powered by a wall adapter with 9V, 1A, like this one: [http://www.cutedigi.com/tools/power-supply/wall-adapter-power-supply-12vdc-1a.html PW-12VDC-1A_X3]&lt;br /&gt;
&lt;br /&gt;
*RX jump to MRX, TX jump to MTX, and remove the atmega328P from arduino. By doing this, we can directly monitor serial port output using the USB port.The default baud rate is 115200.&lt;br /&gt;
&lt;br /&gt;
*Install X-CTU serial terminal console:[http://www.cutedigi.com/pub/software/setup_xctu_5100.exe setup_xctu_5100.exe]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Second Tutorial'''&lt;br /&gt;
&lt;br /&gt;
*Now we are going to use atmega328P's UART to talk to USB, and soft serial of atmega328P to talk to ATWIN.&lt;br /&gt;
&lt;br /&gt;
*Before we do that, we have to change ATWIN's data rate to 9600 as soft serial can't go to 119200.In first tutorial setup, do: AT+IPR=9600 to set the baud rate to 9600&lt;br /&gt;
&lt;br /&gt;
*Now set the jumper RX to D3, and TX to D2. SO that atmega328P's UART to talk to USB and soft serial of atmega328P to talk to ATWIN.&lt;br /&gt;
&lt;br /&gt;
=== Programming  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include   //Include the NewSoftSerial library to send serial commands to the cellular module.&lt;br /&gt;
#include          //Used for string manipulations&lt;br /&gt;
char incoming_char=0;      //Will hold the incoming character from the Serial Port.&lt;br /&gt;
NewSoftSerial cell(2,3);  //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  //Initialize serial ports for communication.&lt;br /&gt;
Serial.begin(9600);&lt;br /&gt;
cell.begin(9600);&lt;br /&gt;
Serial.println(&amp;quot;Starting ATWIN Communication...&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
//If a character comes in from the cellular module...&lt;br /&gt;
if(cell.available() &amp;gt;0)&lt;br /&gt;
{&lt;br /&gt;
incoming_char=cell.read();    //Get the character from the cellular serial port.&lt;br /&gt;
Serial.print(incoming_char);  //Print the incoming character to the terminal.&lt;br /&gt;
}&lt;br /&gt;
//If a character is coming from the terminal to the Arduino...&lt;br /&gt;
if(Serial.available() &amp;gt;0)&lt;br /&gt;
{&lt;br /&gt;
incoming_char=Serial.read();  //Get the character coming from the terminal&lt;br /&gt;
cell.print(incoming_char);    //Send the character to the cellular module.&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''AT Command Tester Application'''&lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/module-tester/ AT Command Tester] is a free online tool test [http://m2msupport.net/m2msupport/software-and-at-commands-for-m2m-modules/ AT Commands] and other modem functionalities of [http://m2msupport.net/m2msupport/category/devices/gprs-modem/ 2G modules] (GPRS/EDGE) , [http://m2msupport.net/m2msupport/category/devices/gprs-modem/ 3G Modules] (HSDPA/EVDO) and [http://m2msupport.net/m2msupport/search-page/?Max!Download!Speed=100%20Mbps 4G Modules] (LTE).AT Command Tester tool connects to the modem port of the device and can test various modem functions such as getting [http://m2msupport.net/m2msupport/at-commands-to-get-device-information/ device information], [http://m2msupport.net/m2msupport/data-call-at-commands-to-set-up-gprsedgeumtslte-data-call/ gprs data call], [http://m2msupport.net/m2msupport/voice-call-at-commands-to-set-up-voice-call/ voice call],[http://m2msupport.net/m2msupport/at-command-for-http-functions-for-remote-server-data-access/ http access], [http://m2msupport.net/m2msupport/signal-quality/ checking signal condition], [http://m2msupport.net/m2msupport/network-registration/ network registration], [http://m2msupport.net/m2msupport/sms-at-commands/ SMS functions], [http://m2msupport.net/m2msupport/sim-at-commands-for-sim-presense-and-status/ SIM access], [http://m2msupport.net/m2msupport/sim-phonebook-at-commands/ phonebook functions] etc.&lt;br /&gt;
&lt;br /&gt;
In the 'Port Configuration' section of the tool, users can search for available ports using the 'Find Ports' button. Then using the 'Connect' button, users can connect to the modem port of the device.&lt;br /&gt;
&lt;br /&gt;
In the 'Command Mode' tab of AT Command Tester, single AT commands can be sent. The drop down list provides AT command description and examples. Users can modify the default command settings.&lt;br /&gt;
&lt;br /&gt;
[[File:M2m img1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Under the 'Script Mode' tab, multiple AT commands can be sent at a time. Users can add descriptive comments and save the script on their local machine. &lt;br /&gt;
&lt;br /&gt;
[[File:Script mode.PNG]]&lt;br /&gt;
&lt;br /&gt;
Data Call&lt;br /&gt;
&lt;br /&gt;
To make a data call with the modem, you need to connect to the APN of the carrier network. The carrier APN and other required information are stored in the SIM card and are referred as PDP contexts. Typically multiple PDP contexts are stored in the SIM for different call types. With the AT Command Tester you can edit/add/delete PDP contexts in a easy to use user interface. &lt;br /&gt;
&lt;br /&gt;
[[Image:Datacall.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;Typical call setup sequence,&lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgdcont-define-pdp-context/ AT+CGDCONT?] &lt;br /&gt;
&lt;br /&gt;
+CGDCONT: 1,&amp;quot;IP&amp;quot;,&amp;quot;epc.tmobile.com&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0&amp;lt;br&amp;gt;+CGDCONT: 2,&amp;quot;IP&amp;quot;,&amp;quot;test5&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0&amp;lt;br&amp;gt;+CGDCONT: 3,&amp;quot;IP&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Checking registration status... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcreg-network-registration/ AT+CREG?] &lt;br /&gt;
&lt;br /&gt;
+CREG: 0,1 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;The device is registered in home network. &lt;br /&gt;
&lt;br /&gt;
Checking if device is already connected... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgact-pdp-context-activate-or-deactivate/ AT+CGACT?] &lt;br /&gt;
&lt;br /&gt;
+CGACT: 1,0&amp;lt;br&amp;gt;+CGACT: 2,0&amp;lt;br&amp;gt;+CGACT: 3,0 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;[http://m2msupport.net/m2msupport/atcmee-report-mobile-termination-error/ AT+CMEE=1] &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Attaching to network...&amp;lt;br&amp;gt;AT+CGATT=1 &lt;br /&gt;
&lt;br /&gt;
OK &lt;br /&gt;
&lt;br /&gt;
Connecting... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgact-pdp-context-activate-or-deactivate/ AT+CGACT=1, 1] &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Connect Sucessful &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; '''SMS''' &lt;br /&gt;
&lt;br /&gt;
The SMS tab of the 'AT Command Tester' tool provides the interfaces to send SMS messages. You can also list/view/delete SMS messages stored on the SIM.&lt;br /&gt;
&lt;br /&gt;
[[Image:Sms.PNG]] &amp;lt;br&amp;gt; General sequence for sending SMS message, &lt;br /&gt;
&lt;br /&gt;
Checking registration status... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcreg-network-registration/ AT+CREG?] &lt;br /&gt;
&lt;br /&gt;
+CREG: 0,1 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;The device is registered in home network. &lt;br /&gt;
&lt;br /&gt;
AT+CMGS=&amp;quot;858XXXXXXX&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&amp;amp;gt; Test Message with AT Command Tester� &lt;br /&gt;
&lt;br /&gt;
+CMGS: 19 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;SMS Send successful &lt;br /&gt;
&lt;br /&gt;
'''Network Selection''' - This tab allows the user to manually select available networks. Modems are typically set for automatic network selection. 'Find Networks' button will command the modem to scan for available networks.&lt;br /&gt;
&lt;br /&gt;
[[Image:Network selection.PNG]] &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
AT+COPS command will initiate network scan in the modem, &lt;br /&gt;
&lt;br /&gt;
Finding Networks. Please wait.. &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcops-plmn-selection/ AT+COPS=?] &lt;br /&gt;
&lt;br /&gt;
+COPS: (2,&amp;quot;T-Mobile&amp;quot;,&amp;quot;T-Mobile&amp;quot;,&amp;quot;310260&amp;quot;),(1,&amp;quot;AT&amp;amp;amp;T&amp;quot;,&amp;quot;AT&amp;amp;amp;T&amp;quot;,&amp;quot;310410&amp;quot;),,(0,1,4),(0,1,2) &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Networks found &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
'''Phonebook'''&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
With the 'Phone Book' tab, you can add/delete/read phone book entries stored on the SIM, &lt;br /&gt;
&lt;br /&gt;
[[Image:Phone book.PNG]] &lt;br /&gt;
&lt;br /&gt;
Getting phonebook entries.. &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcpbr-read-phonebook-entries/ AT+CPBR=1,99] &lt;br /&gt;
&lt;br /&gt;
+CPBR: 1,&amp;quot;*233&amp;quot;,129,&amp;quot;Refill Now&amp;quot; &lt;br /&gt;
&lt;br /&gt;
+CPBR: 2,&amp;quot;#999#&amp;quot;,255,&amp;quot;Check Balance&amp;quot; &lt;br /&gt;
&lt;br /&gt;
+CPBR: 3,&amp;quot;8878878878&amp;quot;,129,&amp;quot;Test&amp;quot; &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example Project  ==&lt;br /&gt;
&lt;br /&gt;
=== Send SMS ===&lt;br /&gt;
&lt;br /&gt;
For this project, the following is the jumper setting:&lt;br /&gt;
*TX-&amp;gt; MRX&lt;br /&gt;
*RX-&amp;gt;MTX&lt;br /&gt;
*Please remove the USB cable after downloading the program&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
char str1[]={'A','T','+','C','S','C','S','=','&amp;quot;','G','S','M','&amp;quot;'};&lt;br /&gt;
char str2[]={'A','T','+','C','M','G','S','=','&amp;quot;','1','5','9','7','2','1','6','9','1','8','9','&amp;quot;'};&lt;br /&gt;
int i;&lt;br /&gt;
char inByte = 0;&lt;br /&gt;
//unsigned char receive_ACK[6];&lt;br /&gt;
char hex1[]={0x1A};&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  // start serial port at 9600 bps and wait for port to open:&lt;br /&gt;
  Serial.begin(9600);&lt;br /&gt;
  //while (!Serial) {&lt;br /&gt;
    ; // wait for serial port to connect. Needed for Leonardo only&lt;br /&gt;
 // }&lt;br /&gt;
delay(8000);&lt;br /&gt;
Serial.println();&lt;br /&gt;
for(i=10;i&amp;gt;0;i--)&lt;br /&gt;
{delay(500);&lt;br /&gt;
Serial.println(&amp;quot;AT&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println(&amp;quot;AT&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(i=0;i&amp;lt;13;i++)&lt;br /&gt;
Serial.print(str1[i]);&lt;br /&gt;
Serial.println();&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println(&amp;quot;AT+CMGF=1&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(i=0;i&amp;lt;21;i++)&lt;br /&gt;
Serial.print(str2[i]);//AT+CMGS=&amp;quot;15972169189&amp;quot;&lt;br /&gt;
Serial.println();&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.print(&amp;quot;HELLO Sir,Thank you very much fit my test!&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.print(hex1);&lt;br /&gt;
delay(1000);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{ /*&lt;br /&gt;
  Serial.println(&amp;quot;AT&amp;quot;);   delay(500);        &lt;br /&gt;
 if (Serial.available() &amp;gt; 0) {&lt;br /&gt;
    // get incoming byte:&lt;br /&gt;
    inByte = Serial.read();&lt;br /&gt;
    Serial.println(inByte);&lt;br /&gt;
 }&lt;br /&gt;
 */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detect an event and send SMS to a cell phone number stored in SD card, and display alarm in 8X8 LED matrix===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;SD.h&amp;gt;&lt;br /&gt;
char str1[]={'A','T','+','C','S','C','S','=','&amp;quot;','G','S','M','&amp;quot;'};&lt;br /&gt;
//char str2[]={'A','T','+','C','M','G','S','=','&amp;quot;','1','5','9','7','2','1','6','9','1','8','9','&amp;quot;'};&lt;br /&gt;
char hex[]={0x1A};&lt;br /&gt;
char WORD;&lt;br /&gt;
&lt;br /&gt;
char inByte = 0;&lt;br /&gt;
File myFile;&lt;br /&gt;
char RxBuffer[100];//ZHONGZHUAN&lt;br /&gt;
char From[100];//1&lt;br /&gt;
char To[100];//2&lt;br /&gt;
char RxCounter = 0;&lt;br /&gt;
char Enter=0;&lt;br /&gt;
char From_len=0;&lt;br /&gt;
char To_len=0;&lt;br /&gt;
&lt;br /&gt;
const int analogInPin = A0;                                                  // Analog input pin that the potentiometer is attached to&lt;br /&gt;
int sensorValue = 0;                                                         // value read from the pot&lt;br /&gt;
int outputValue = 0;&lt;br /&gt;
int count = 0;&lt;br /&gt;
int count1 = 0; &lt;br /&gt;
&lt;br /&gt;
unsigned char i;&lt;br /&gt;
unsigned char j; &lt;br /&gt;
unsigned char k;&lt;br /&gt;
/*port definition*/&lt;br /&gt;
int Max7219_pinCLK = 10;&lt;br /&gt;
int Max7219_pinCS = 9;&lt;br /&gt;
int Max7219_pinDIN = 8;&lt;br /&gt;
unsigned char data[2][6]={&lt;br /&gt;
{10,21,14,27,29},&lt;br /&gt;
{23,24,27,22,10,21},};&lt;br /&gt;
unsigned char disp1[39][8]={&lt;br /&gt;
{0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//0&lt;br /&gt;
{0x10,0x18,0x14,0x10,0x10,0x10,0x10,0x10},//1&lt;br /&gt;
{0x7E,0x2,0x2,0x7E,0x40,0x40,0x40,0x7E},//2&lt;br /&gt;
{0x3E,0x2,0x2,0x3E,0x2,0x2,0x3E,0x0},//3&lt;br /&gt;
{0x8,0x18,0x28,0x48,0xFE,0x8,0x8,0x8},//4&lt;br /&gt;
{0x3C,0x20,0x20,0x3C,0x4,0x4,0x3C,0x0},//5&lt;br /&gt;
{0x3C,0x20,0x20,0x3C,0x24,0x24,0x3C,0x0},//6&lt;br /&gt;
{0x3E,0x22,0x4,0x8,0x8,0x8,0x8,0x8},//7&lt;br /&gt;
{0x0,0x3E,0x22,0x22,0x3E,0x22,0x22,0x3E},//8&lt;br /&gt;
{0x3E,0x22,0x22,0x3E,0x2,0x2,0x2,0x3E},//9&lt;br /&gt;
{0x8,0x14,0x22,0x3E,0x22,0x22,0x22,0x22},//A&lt;br /&gt;
{0x3C,0x22,0x22,0x3E,0x22,0x22,0x3C,0x0},//B&lt;br /&gt;
{0x3C,0x40,0x40,0x40,0x40,0x40,0x3C,0x0},//C&lt;br /&gt;
{0x7C,0x42,0x42,0x42,0x42,0x42,0x7C,0x0},//D&lt;br /&gt;
{0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x7C},//E&lt;br /&gt;
{0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x40},//F&lt;br /&gt;
{0x3C,0x40,0x40,0x40,0x40,0x44,0x44,0x3C},//G&lt;br /&gt;
{0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44},//H&lt;br /&gt;
{0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x7C},//I&lt;br /&gt;
{0x3C,0x8,0x8,0x8,0x8,0x8,0x48,0x30},//J&lt;br /&gt;
{0x0,0x24,0x28,0x30,0x20,0x30,0x28,0x24},//K&lt;br /&gt;
{0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C},//L&lt;br /&gt;
{0x81,0xC3,0xA5,0x99,0x81,0x81,0x81,0x81},//M&lt;br /&gt;
{0x0,0x42,0x62,0x52,0x4A,0x46,0x42,0x0},//N&lt;br /&gt;
{0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//O&lt;br /&gt;
{0x3C,0x22,0x22,0x22,0x3C,0x20,0x20,0x20},//P&lt;br /&gt;
{0x1C,0x22,0x22,0x22,0x22,0x26,0x22,0x1D},//Q&lt;br /&gt;
{0x3C,0x22,0x22,0x22,0x3C,0x24,0x22,0x21},//R&lt;br /&gt;
{0x0,0x1E,0x20,0x20,0x3E,0x2,0x2,0x3C},//S&lt;br /&gt;
{0x0,0x3E,0x8,0x8,0x8,0x8,0x8,0x8},//T&lt;br /&gt;
{0x42,0x42,0x42,0x42,0x42,0x42,0x22,0x1C},//U&lt;br /&gt;
{0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18},//V&lt;br /&gt;
{0x0,0x49,0x49,0x49,0x49,0x2A,0x1C,0x0},//W&lt;br /&gt;
{0x0,0x41,0x22,0x14,0x8,0x14,0x22,0x41},//X&lt;br /&gt;
{0x41,0x22,0x14,0x8,0x8,0x8,0x8,0x8},//Y&lt;br /&gt;
{0x0,0x7F,0x2,0x4,0x8,0x10,0x20,0x7F},//Z&lt;br /&gt;
{0x8,0x7F,0x49,0x49,0x7F,0x8,0x8,0x8},//Chinese Character 中&lt;br /&gt;
{0xFE,0xBA,0x92,0xBA,0x92,0x9A,0xBA,0xFE},//Chinese Character国&lt;br /&gt;
{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void Write_Max7219_byte(unsigned char DATA) &lt;br /&gt;
{   &lt;br /&gt;
            unsigned char i;&lt;br /&gt;
	    digitalWrite(Max7219_pinCS,LOW);		&lt;br /&gt;
	    for(i=8;i&amp;gt;=1;i--)&lt;br /&gt;
          {		  &lt;br /&gt;
             digitalWrite(Max7219_pinCLK,LOW);&lt;br /&gt;
             digitalWrite(Max7219_pinDIN,DATA&amp;amp;0x80);&lt;br /&gt;
             DATA = DATA&amp;lt;&amp;lt;1;&lt;br /&gt;
             digitalWrite(Max7219_pinCLK,HIGH);&lt;br /&gt;
           }                                 &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void Write_Max7219(unsigned char address,unsigned char dat)&lt;br /&gt;
{&lt;br /&gt;
        digitalWrite(Max7219_pinCS,LOW);&lt;br /&gt;
        Write_Max7219_byte(address);         &lt;br /&gt;
        Write_Max7219_byte(dat);             &lt;br /&gt;
        digitalWrite(Max7219_pinCS,HIGH);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Init_MAX7219(void)&lt;br /&gt;
{&lt;br /&gt;
 Write_Max7219(0x09, 0x00);       &lt;br /&gt;
 Write_Max7219(0x0a, 0x03);       &lt;br /&gt;
 Write_Max7219(0x0b, 0x07);       &lt;br /&gt;
 Write_Max7219(0x0c, 0x01);       &lt;br /&gt;
 Write_Max7219(0x0f, 0x00);       &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Alert(void)&lt;br /&gt;
{&lt;br /&gt;
  for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[10][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[21][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[14][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[27][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[29][i-1]);&lt;br /&gt;
   delay(1500);&lt;br /&gt;
}&lt;br /&gt;
void Normal(void)&lt;br /&gt;
{&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[23][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[24][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[27][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[22][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[10][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[21][i-1]);&lt;br /&gt;
   delay(1500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Message(void)&lt;br /&gt;
{&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println();&lt;br /&gt;
for(i=2;i&amp;gt;0;i--)&lt;br /&gt;
{delay(500);&lt;br /&gt;
Serial.println(&amp;quot;AT&amp;quot;);}&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println(&amp;quot;AT&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(i=0;i&amp;lt;13;i++)&lt;br /&gt;
Serial.print(str1[i]);&lt;br /&gt;
Serial.println();&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println(&amp;quot;AT+CMGF=1&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(char i=0;i&amp;lt;From_len;i++)&lt;br /&gt;
Serial.print(From[i]);//AT+CMGS=&amp;quot;15972169189&amp;quot;&lt;br /&gt;
Serial.println();&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(char i=0;i&amp;lt;To_len;i++)&lt;br /&gt;
Serial.print(To[i]);&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.print(hex);&lt;br /&gt;
delay(1000);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SDHC(void)&lt;br /&gt;
{&lt;br /&gt;
Serial.println(&amp;quot;Initializing SD card...&amp;quot;);&lt;br /&gt;
  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.&lt;br /&gt;
  // Note that even if it's not used as the CS pin, the hardware SS pin &lt;br /&gt;
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output &lt;br /&gt;
  // or the SD library functions will not work. &lt;br /&gt;
   pinMode(10, OUTPUT);&lt;br /&gt;
   &lt;br /&gt;
  if (!SD.begin(4)) {&lt;br /&gt;
    Serial.println(&amp;quot;initialization failed!&amp;quot;);&lt;br /&gt;
    return;&lt;br /&gt;
  }&lt;br /&gt;
  Serial.println(&amp;quot;initialization done.&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  // re-open the file for reading:&lt;br /&gt;
  myFile = SD.open(&amp;quot;test.txt&amp;quot;);&lt;br /&gt;
  if (myFile) {&lt;br /&gt;
    Serial.println(&amp;quot;test.txt:&amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    // read from the file until there's nothing else in it:&lt;br /&gt;
    while (myFile.available()) {&lt;br /&gt;
        char i;&lt;br /&gt;
        RxBuffer[RxCounter++] = myFile.read();&lt;br /&gt;
        if(RxBuffer[RxCounter-2]==0x0d&amp;amp;&amp;amp;RxBuffer[RxCounter-1]==0x0a)//0x0d huiche \ ,0x0a huanhang \n&lt;br /&gt;
	{&lt;br /&gt;
		Enter++;&lt;br /&gt;
		switch(Enter)&lt;br /&gt;
		{&lt;br /&gt;
		case 1:&lt;br /&gt;
		for(i=0; i&amp;lt; RxCounter-2; i++) From[i]= RxBuffer[i];&lt;br /&gt;
                From_len=RxCounter-2;&lt;br /&gt;
		;break;&lt;br /&gt;
		case 2:&lt;br /&gt;
		for(i=0; i&amp;lt; RxCounter-2; i++) To[i]= RxBuffer[i];&lt;br /&gt;
                To_len=RxCounter-2;&lt;br /&gt;
		;break;&lt;br /&gt;
		default:;break;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	RxCounter=0;&lt;br /&gt;
	} &lt;br /&gt;
    }&lt;br /&gt;
    // close the file:&lt;br /&gt;
    myFile.close();&lt;br /&gt;
  } else {&lt;br /&gt;
  	// if the file didn't open, print an error:&lt;br /&gt;
    Serial.println(&amp;quot;error opening test.txt&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  for(char i=0;i&amp;lt;From_len;i++)&lt;br /&gt;
    	Serial.write( To[i]);&lt;br /&gt;
        Serial.println();&lt;br /&gt;
        &lt;br /&gt;
  for(char i=0;i&amp;lt;To_len;i++)&lt;br /&gt;
    	Serial.write( From[i]);&lt;br /&gt;
        Serial.println();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  Serial.begin(9600);&lt;br /&gt;
 &lt;br /&gt;
  pinMode(Max7219_pinCLK,OUTPUT);&lt;br /&gt;
  pinMode(Max7219_pinCS,OUTPUT);&lt;br /&gt;
  pinMode(Max7219_pinDIN,OUTPUT);&lt;br /&gt;
  delay(50);&lt;br /&gt;
  Init_MAX7219();&lt;br /&gt;
  SDHC();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{ &lt;br /&gt;
 // if(count&amp;lt;50)&lt;br /&gt;
  //{&lt;br /&gt;
 // count++;&lt;br /&gt;
  &lt;br /&gt;
  //Normal();&lt;br /&gt;
  sensorValue = analogRead(analogInPin);&lt;br /&gt;
  outputValue = map(sensorValue, 0, 1023, 0, 255);&lt;br /&gt;
  Serial.print(&amp;quot;sensor = &amp;quot;);&lt;br /&gt;
  Serial.print(sensorValue);&lt;br /&gt;
  Serial.print(&amp;quot;\t output = &amp;quot;);&lt;br /&gt;
  Serial.println(outputValue);&lt;br /&gt;
  delay(500);&lt;br /&gt;
  if(outputValue&amp;gt;=60)&lt;br /&gt;
     {&lt;br /&gt;
      // count=0;&lt;br /&gt;
       //Alert();&lt;br /&gt;
       if(count1&amp;lt;3)&lt;br /&gt;
       Message();&lt;br /&gt;
       count1++;&lt;br /&gt;
     }    &lt;br /&gt;
 // } &lt;br /&gt;
 // else if(count=10)&lt;br /&gt;
 // { &lt;br /&gt;
  //Message();&lt;br /&gt;
  //}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FAQ  ==&lt;br /&gt;
Please list your question here:&lt;br /&gt;
&lt;br /&gt;
== Support  ==&lt;br /&gt;
&lt;br /&gt;
If you have questions or other better design ideas, you can go to our [http://www.linksprite.com/forum/index.php forum] to discuss or creat a ticket for your issue at [http://www.linksprite.com/support/ linksprite support].&lt;br /&gt;
&lt;br /&gt;
== Resources  ==&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/AT139+Hardware+Design+Manual_V1.3.pdf ATWIN Hardware Design Manual]&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/AT+Commands+for+AT137139.pdf AT commands for AT137/139]&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/AT137139_TCPIP_APPNOTE.pdf AT137/139_TCPIP_APPNOTE in PDF]&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/SMS_APPNOTE_FOR_AT137139.pdf SMS app note for AT137/AT139 in PDF]&lt;br /&gt;
&lt;br /&gt;
*[http://m2msupport.net/m2msupport/module-tester/  AT Command Tester Tool]&lt;br /&gt;
**Send single or batch AT commands&lt;br /&gt;
***Perform modem diagnostics&lt;br /&gt;
***Set up GSM/GPRS call&lt;br /&gt;
&lt;br /&gt;
== How to buy  ==&lt;br /&gt;
Here to buy ATWIN Quad-band GPRS/GSM Shield for Arduino [http://www.linkspritedirect.com/product_info.php?products_id=86 ATGPRS_SHIELD] on [http://www.linkspritedirect.com/index.php linkspritedirect]&lt;br /&gt;
&lt;br /&gt;
== See Also  ==&lt;br /&gt;
&lt;br /&gt;
Other related products and resources.&lt;br /&gt;
&lt;br /&gt;
== Licensing  ==&lt;br /&gt;
&lt;br /&gt;
This documentation is licensed under the Creative Commons [http://creativecommons.org/licenses/by-sa/3.0/ Attribution-ShareAlike License 3.0] Source code and libraries are licensed under [http://www.gnu.org/licenses/gpl.html GPL/LGPL], see source code files for details.&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=File:600PX-ATWIN.jpg&amp;diff=3610</id>
		<title>File:600PX-ATWIN.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=File:600PX-ATWIN.jpg&amp;diff=3610"/>
		<updated>2013-09-05T08:03:01Z</updated>

		<summary type="html">&lt;p&gt;Leona: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=ATWIN_Quad-band_GPRS/GSM_Shield_for_Arduino&amp;diff=3609</id>
		<title>ATWIN Quad-band GPRS/GSM Shield for Arduino</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=ATWIN_Quad-band_GPRS/GSM_Shield_for_Arduino&amp;diff=3609"/>
		<updated>2013-09-05T08:02:43Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction  ==&lt;br /&gt;
&lt;br /&gt;
This LinkSprite  ATWIN Quad-band GPRS/GSM shield has PCB etched antenna, so no need for external antenna.&lt;br /&gt;
&lt;br /&gt;
ATWIN Quad-band GPRS/GSM shield is an ultra compact and high quality wireless module base on infineon UCL2 platform with industy-standard interface. &lt;br /&gt;
&lt;br /&gt;
This is a SMT package with small dimension, low power consumption, quad-band (AT139) and dual-band (AT139D) GSM/GPRS module. &lt;br /&gt;
&lt;br /&gt;
It can provide with voice, SMS, Fax, data applicationgs for customers.&lt;br /&gt;
&lt;br /&gt;
'''[http://v.youku.com/v_show/id_XMzkyOTMyMTQ0.html Video Introduction]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:600PX-ATWIN.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Features  ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
! Features&lt;br /&gt;
! colspan=2 align=&amp;quot;center&amp;quot;| Description&lt;br /&gt;
&lt;br /&gt;
|- style=&amp;quot;background:silver; color:black&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Network&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| GSM/GPRS&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Frequency Bands&lt;br /&gt;
| width=&amp;quot;300px&amp;quot; align=&amp;quot;center&amp;quot;| AT139:GSM850/GSM900/DCS1800/PCS1900MHz&lt;br /&gt;
| width=&amp;quot;300px&amp;quot; align=&amp;quot;center&amp;quot;| AT139D:GSM900/DCS1800MHz&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| RF Output Power&lt;br /&gt;
| width=&amp;quot;300px&amp;quot; align=&amp;quot;center&amp;quot;| AT139:GSM850/GSM900: 33dBm, DCS1800/PCS1900:30dBm&lt;br /&gt;
| width=&amp;quot;300px&amp;quot; align=&amp;quot;center&amp;quot;| AT139D:GSM900:33dBm, DCS1800:30dBm&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| RF Receive Sensitivity&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| &amp;lt;-108dBm&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Speech codec modes&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| FR,EFR,HR,AMR&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| SMS&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| TEXT/PDU&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| GPRS Connectivity&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| GPRS Class 10&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| Coding Scheme：CS1,CS2,CS3,CS4&lt;br /&gt;
&lt;br /&gt;
|- style=&amp;quot;background:silver; color:black&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Physical Characteristics&lt;br /&gt;
| colspan=2|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Package&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| SMT&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Dimensions&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 24(±0.1)*24(±0.1)*3(±0.1)mm&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Weight&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 4g&lt;br /&gt;
&lt;br /&gt;
|- style=&amp;quot;background:silver; color:black&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Performance&lt;br /&gt;
| colspan=2|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Power Supply&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 3.3V~4.5V&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Antenna&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| External Antenna&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| MCP&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 64Mb NOR + 32Mb PSRAM&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Audio&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| Two input/output Audio channels&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| SIM Card Application&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| Support SIM Card:1.8V/3.0V&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Pin Amounts&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 38 PINs&lt;br /&gt;
&lt;br /&gt;
|- style=&amp;quot;background:silver; color:black&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Firmware&lt;br /&gt;
| colspan=2|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Operating System&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| OSE&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Application Ideas  ==&lt;br /&gt;
&lt;br /&gt;
== Cautions  ==&lt;br /&gt;
&lt;br /&gt;
The warnings and wrong operations possible cause dangerous. &lt;br /&gt;
&lt;br /&gt;
== Schematic  ==&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/schematic_of_ATWIN.rar  ATWIN Quad-band GPRS/GSM shield Schematic]&lt;br /&gt;
&lt;br /&gt;
== Specification  ==&lt;br /&gt;
May include key specification and other specifications.&lt;br /&gt;
&lt;br /&gt;
== Pin definition and Rating  ==&lt;br /&gt;
&lt;br /&gt;
== Mechanic Dimensions  ==&lt;br /&gt;
&lt;br /&gt;
== Usage  ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Installation  ===&lt;br /&gt;
&lt;br /&gt;
'''First Tutorial'''&lt;br /&gt;
The shield must be powered by a wall adapter with 12V, 1A, like this one: [http://www.cutedigi.com/tools/power-supply/wall-adapter-power-supply-12vdc-1a.html PW-12VDC-1A_X3]&lt;br /&gt;
&lt;br /&gt;
*RX jump to MRX, TX jump to MTX, and remove the atmega328P from arduino. By doing this, we can directly monitor serial port output using the USB port.The default baud rate is 115200.&lt;br /&gt;
&lt;br /&gt;
*Install X-CTU serial terminal console:[http://www.cutedigi.com/pub/software/setup_xctu_5100.exe setup_xctu_5100.exe]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Second Tutorial'''&lt;br /&gt;
&lt;br /&gt;
*Now we are going to use atmega328P's UART to talk to USB, and soft serial of atmega328P to talk to ATWIN.&lt;br /&gt;
&lt;br /&gt;
*Before we do that, we have to change ATWIN's data rate to 9600 as soft serial can't go to 119200.In first tutorial setup, do: AT+IPR=9600 to set the baud rate to 9600&lt;br /&gt;
&lt;br /&gt;
*Now set the jumper RX to D3, and TX to D2. SO that atmega328P's UART to talk to USB and soft serial of atmega328P to talk to ATWIN.&lt;br /&gt;
&lt;br /&gt;
=== Programming  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include   //Include the NewSoftSerial library to send serial commands to the cellular module.&lt;br /&gt;
#include          //Used for string manipulations&lt;br /&gt;
char incoming_char=0;      //Will hold the incoming character from the Serial Port.&lt;br /&gt;
NewSoftSerial cell(2,3);  //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  //Initialize serial ports for communication.&lt;br /&gt;
Serial.begin(9600);&lt;br /&gt;
cell.begin(9600);&lt;br /&gt;
Serial.println(&amp;quot;Starting ATWIN Communication...&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
//If a character comes in from the cellular module...&lt;br /&gt;
if(cell.available() &amp;gt;0)&lt;br /&gt;
{&lt;br /&gt;
incoming_char=cell.read();    //Get the character from the cellular serial port.&lt;br /&gt;
Serial.print(incoming_char);  //Print the incoming character to the terminal.&lt;br /&gt;
}&lt;br /&gt;
//If a character is coming from the terminal to the Arduino...&lt;br /&gt;
if(Serial.available() &amp;gt;0)&lt;br /&gt;
{&lt;br /&gt;
incoming_char=Serial.read();  //Get the character coming from the terminal&lt;br /&gt;
cell.print(incoming_char);    //Send the character to the cellular module.&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''AT Command Tester Application'''&lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/module-tester/ AT Command Tester] is a free online tool test [http://m2msupport.net/m2msupport/software-and-at-commands-for-m2m-modules/ AT Commands] and other modem functionalities of [http://m2msupport.net/m2msupport/category/devices/gprs-modem/ 2G modules] (GPRS/EDGE) , [http://m2msupport.net/m2msupport/category/devices/gprs-modem/ 3G Modules] (HSDPA/EVDO) and [http://m2msupport.net/m2msupport/search-page/?Max!Download!Speed=100%20Mbps 4G Modules] (LTE).AT Command Tester tool connects to the modem port of the device and can test various modem functions such as getting [http://m2msupport.net/m2msupport/at-commands-to-get-device-information/ device information], [http://m2msupport.net/m2msupport/data-call-at-commands-to-set-up-gprsedgeumtslte-data-call/ gprs data call], [http://m2msupport.net/m2msupport/voice-call-at-commands-to-set-up-voice-call/ voice call],[http://m2msupport.net/m2msupport/at-command-for-http-functions-for-remote-server-data-access/ http access], [http://m2msupport.net/m2msupport/signal-quality/ checking signal condition], [http://m2msupport.net/m2msupport/network-registration/ network registration], [http://m2msupport.net/m2msupport/sms-at-commands/ SMS functions], [http://m2msupport.net/m2msupport/sim-at-commands-for-sim-presense-and-status/ SIM access], [http://m2msupport.net/m2msupport/sim-phonebook-at-commands/ phonebook functions] etc.&lt;br /&gt;
&lt;br /&gt;
In the 'Port Configuration' section of the tool, users can search for available ports using the 'Find Ports' button. Then using the 'Connect' button, users can connect to the modem port of the device.&lt;br /&gt;
&lt;br /&gt;
In the 'Command Mode' tab of AT Command Tester, single AT commands can be sent. The drop down list provides AT command description and examples. Users can modify the default command settings.&lt;br /&gt;
&lt;br /&gt;
[[File:M2m img1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Under the 'Script Mode' tab, multiple AT commands can be sent at a time. Users can add descriptive comments and save the script on their local machine. &lt;br /&gt;
&lt;br /&gt;
[[File:Script mode.PNG]]&lt;br /&gt;
&lt;br /&gt;
Data Call&lt;br /&gt;
&lt;br /&gt;
To make a data call with the modem, you need to connect to the APN of the carrier network. The carrier APN and other required information are stored in the SIM card and are referred as PDP contexts. Typically multiple PDP contexts are stored in the SIM for different call types. With the AT Command Tester you can edit/add/delete PDP contexts in a easy to use user interface. &lt;br /&gt;
&lt;br /&gt;
[[Image:Datacall.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;Typical call setup sequence,&lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgdcont-define-pdp-context/ AT+CGDCONT?] &lt;br /&gt;
&lt;br /&gt;
+CGDCONT: 1,&amp;quot;IP&amp;quot;,&amp;quot;epc.tmobile.com&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0&amp;lt;br&amp;gt;+CGDCONT: 2,&amp;quot;IP&amp;quot;,&amp;quot;test5&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0&amp;lt;br&amp;gt;+CGDCONT: 3,&amp;quot;IP&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Checking registration status... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcreg-network-registration/ AT+CREG?] &lt;br /&gt;
&lt;br /&gt;
+CREG: 0,1 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;The device is registered in home network. &lt;br /&gt;
&lt;br /&gt;
Checking if device is already connected... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgact-pdp-context-activate-or-deactivate/ AT+CGACT?] &lt;br /&gt;
&lt;br /&gt;
+CGACT: 1,0&amp;lt;br&amp;gt;+CGACT: 2,0&amp;lt;br&amp;gt;+CGACT: 3,0 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;[http://m2msupport.net/m2msupport/atcmee-report-mobile-termination-error/ AT+CMEE=1] &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Attaching to network...&amp;lt;br&amp;gt;AT+CGATT=1 &lt;br /&gt;
&lt;br /&gt;
OK &lt;br /&gt;
&lt;br /&gt;
Connecting... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgact-pdp-context-activate-or-deactivate/ AT+CGACT=1, 1] &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Connect Sucessful &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; '''SMS''' &lt;br /&gt;
&lt;br /&gt;
The SMS tab of the 'AT Command Tester' tool provides the interfaces to send SMS messages. You can also list/view/delete SMS messages stored on the SIM.&lt;br /&gt;
&lt;br /&gt;
[[Image:Sms.PNG]] &amp;lt;br&amp;gt; General sequence for sending SMS message, &lt;br /&gt;
&lt;br /&gt;
Checking registration status... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcreg-network-registration/ AT+CREG?] &lt;br /&gt;
&lt;br /&gt;
+CREG: 0,1 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;The device is registered in home network. &lt;br /&gt;
&lt;br /&gt;
AT+CMGS=&amp;quot;858XXXXXXX&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&amp;amp;gt; Test Message with AT Command Tester� &lt;br /&gt;
&lt;br /&gt;
+CMGS: 19 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;SMS Send successful &lt;br /&gt;
&lt;br /&gt;
'''Network Selection''' - This tab allows the user to manually select available networks. Modems are typically set for automatic network selection. 'Find Networks' button will command the modem to scan for available networks.&lt;br /&gt;
&lt;br /&gt;
[[Image:Network selection.PNG]] &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
AT+COPS command will initiate network scan in the modem, &lt;br /&gt;
&lt;br /&gt;
Finding Networks. Please wait.. &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcops-plmn-selection/ AT+COPS=?] &lt;br /&gt;
&lt;br /&gt;
+COPS: (2,&amp;quot;T-Mobile&amp;quot;,&amp;quot;T-Mobile&amp;quot;,&amp;quot;310260&amp;quot;),(1,&amp;quot;AT&amp;amp;amp;T&amp;quot;,&amp;quot;AT&amp;amp;amp;T&amp;quot;,&amp;quot;310410&amp;quot;),,(0,1,4),(0,1,2) &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Networks found &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
'''Phonebook'''&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
With the 'Phone Book' tab, you can add/delete/read phone book entries stored on the SIM, &lt;br /&gt;
&lt;br /&gt;
[[Image:Phone book.PNG]] &lt;br /&gt;
&lt;br /&gt;
Getting phonebook entries.. &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcpbr-read-phonebook-entries/ AT+CPBR=1,99] &lt;br /&gt;
&lt;br /&gt;
+CPBR: 1,&amp;quot;*233&amp;quot;,129,&amp;quot;Refill Now&amp;quot; &lt;br /&gt;
&lt;br /&gt;
+CPBR: 2,&amp;quot;#999#&amp;quot;,255,&amp;quot;Check Balance&amp;quot; &lt;br /&gt;
&lt;br /&gt;
+CPBR: 3,&amp;quot;8878878878&amp;quot;,129,&amp;quot;Test&amp;quot; &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example Project  ==&lt;br /&gt;
&lt;br /&gt;
=== Send SMS ===&lt;br /&gt;
&lt;br /&gt;
For this project, the following is the jumper setting:&lt;br /&gt;
*TX-&amp;gt; MRX&lt;br /&gt;
*RX-&amp;gt;MTX&lt;br /&gt;
*Please remove the USB cable after downloading the program&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
char str1[]={'A','T','+','C','S','C','S','=','&amp;quot;','G','S','M','&amp;quot;'};&lt;br /&gt;
char str2[]={'A','T','+','C','M','G','S','=','&amp;quot;','1','5','9','7','2','1','6','9','1','8','9','&amp;quot;'};&lt;br /&gt;
int i;&lt;br /&gt;
char inByte = 0;&lt;br /&gt;
//unsigned char receive_ACK[6];&lt;br /&gt;
char hex1[]={0x1A};&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  // start serial port at 9600 bps and wait for port to open:&lt;br /&gt;
  Serial.begin(9600);&lt;br /&gt;
  //while (!Serial) {&lt;br /&gt;
    ; // wait for serial port to connect. Needed for Leonardo only&lt;br /&gt;
 // }&lt;br /&gt;
delay(8000);&lt;br /&gt;
Serial.println();&lt;br /&gt;
for(i=10;i&amp;gt;0;i--)&lt;br /&gt;
{delay(500);&lt;br /&gt;
Serial.println(&amp;quot;AT&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println(&amp;quot;AT&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(i=0;i&amp;lt;13;i++)&lt;br /&gt;
Serial.print(str1[i]);&lt;br /&gt;
Serial.println();&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println(&amp;quot;AT+CMGF=1&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(i=0;i&amp;lt;21;i++)&lt;br /&gt;
Serial.print(str2[i]);//AT+CMGS=&amp;quot;15972169189&amp;quot;&lt;br /&gt;
Serial.println();&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.print(&amp;quot;HELLO Sir,Thank you very much fit my test!&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.print(hex1);&lt;br /&gt;
delay(1000);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{ /*&lt;br /&gt;
  Serial.println(&amp;quot;AT&amp;quot;);   delay(500);        &lt;br /&gt;
 if (Serial.available() &amp;gt; 0) {&lt;br /&gt;
    // get incoming byte:&lt;br /&gt;
    inByte = Serial.read();&lt;br /&gt;
    Serial.println(inByte);&lt;br /&gt;
 }&lt;br /&gt;
 */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detect an event and send SMS to a cell phone number stored in SD card, and display alarm in 8X8 LED matrix===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;SD.h&amp;gt;&lt;br /&gt;
char str1[]={'A','T','+','C','S','C','S','=','&amp;quot;','G','S','M','&amp;quot;'};&lt;br /&gt;
//char str2[]={'A','T','+','C','M','G','S','=','&amp;quot;','1','5','9','7','2','1','6','9','1','8','9','&amp;quot;'};&lt;br /&gt;
char hex[]={0x1A};&lt;br /&gt;
char WORD;&lt;br /&gt;
&lt;br /&gt;
char inByte = 0;&lt;br /&gt;
File myFile;&lt;br /&gt;
char RxBuffer[100];//ZHONGZHUAN&lt;br /&gt;
char From[100];//1&lt;br /&gt;
char To[100];//2&lt;br /&gt;
char RxCounter = 0;&lt;br /&gt;
char Enter=0;&lt;br /&gt;
char From_len=0;&lt;br /&gt;
char To_len=0;&lt;br /&gt;
&lt;br /&gt;
const int analogInPin = A0;                                                  // Analog input pin that the potentiometer is attached to&lt;br /&gt;
int sensorValue = 0;                                                         // value read from the pot&lt;br /&gt;
int outputValue = 0;&lt;br /&gt;
int count = 0;&lt;br /&gt;
int count1 = 0; &lt;br /&gt;
&lt;br /&gt;
unsigned char i;&lt;br /&gt;
unsigned char j; &lt;br /&gt;
unsigned char k;&lt;br /&gt;
/*port definition*/&lt;br /&gt;
int Max7219_pinCLK = 10;&lt;br /&gt;
int Max7219_pinCS = 9;&lt;br /&gt;
int Max7219_pinDIN = 8;&lt;br /&gt;
unsigned char data[2][6]={&lt;br /&gt;
{10,21,14,27,29},&lt;br /&gt;
{23,24,27,22,10,21},};&lt;br /&gt;
unsigned char disp1[39][8]={&lt;br /&gt;
{0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//0&lt;br /&gt;
{0x10,0x18,0x14,0x10,0x10,0x10,0x10,0x10},//1&lt;br /&gt;
{0x7E,0x2,0x2,0x7E,0x40,0x40,0x40,0x7E},//2&lt;br /&gt;
{0x3E,0x2,0x2,0x3E,0x2,0x2,0x3E,0x0},//3&lt;br /&gt;
{0x8,0x18,0x28,0x48,0xFE,0x8,0x8,0x8},//4&lt;br /&gt;
{0x3C,0x20,0x20,0x3C,0x4,0x4,0x3C,0x0},//5&lt;br /&gt;
{0x3C,0x20,0x20,0x3C,0x24,0x24,0x3C,0x0},//6&lt;br /&gt;
{0x3E,0x22,0x4,0x8,0x8,0x8,0x8,0x8},//7&lt;br /&gt;
{0x0,0x3E,0x22,0x22,0x3E,0x22,0x22,0x3E},//8&lt;br /&gt;
{0x3E,0x22,0x22,0x3E,0x2,0x2,0x2,0x3E},//9&lt;br /&gt;
{0x8,0x14,0x22,0x3E,0x22,0x22,0x22,0x22},//A&lt;br /&gt;
{0x3C,0x22,0x22,0x3E,0x22,0x22,0x3C,0x0},//B&lt;br /&gt;
{0x3C,0x40,0x40,0x40,0x40,0x40,0x3C,0x0},//C&lt;br /&gt;
{0x7C,0x42,0x42,0x42,0x42,0x42,0x7C,0x0},//D&lt;br /&gt;
{0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x7C},//E&lt;br /&gt;
{0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x40},//F&lt;br /&gt;
{0x3C,0x40,0x40,0x40,0x40,0x44,0x44,0x3C},//G&lt;br /&gt;
{0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44},//H&lt;br /&gt;
{0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x7C},//I&lt;br /&gt;
{0x3C,0x8,0x8,0x8,0x8,0x8,0x48,0x30},//J&lt;br /&gt;
{0x0,0x24,0x28,0x30,0x20,0x30,0x28,0x24},//K&lt;br /&gt;
{0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C},//L&lt;br /&gt;
{0x81,0xC3,0xA5,0x99,0x81,0x81,0x81,0x81},//M&lt;br /&gt;
{0x0,0x42,0x62,0x52,0x4A,0x46,0x42,0x0},//N&lt;br /&gt;
{0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//O&lt;br /&gt;
{0x3C,0x22,0x22,0x22,0x3C,0x20,0x20,0x20},//P&lt;br /&gt;
{0x1C,0x22,0x22,0x22,0x22,0x26,0x22,0x1D},//Q&lt;br /&gt;
{0x3C,0x22,0x22,0x22,0x3C,0x24,0x22,0x21},//R&lt;br /&gt;
{0x0,0x1E,0x20,0x20,0x3E,0x2,0x2,0x3C},//S&lt;br /&gt;
{0x0,0x3E,0x8,0x8,0x8,0x8,0x8,0x8},//T&lt;br /&gt;
{0x42,0x42,0x42,0x42,0x42,0x42,0x22,0x1C},//U&lt;br /&gt;
{0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18},//V&lt;br /&gt;
{0x0,0x49,0x49,0x49,0x49,0x2A,0x1C,0x0},//W&lt;br /&gt;
{0x0,0x41,0x22,0x14,0x8,0x14,0x22,0x41},//X&lt;br /&gt;
{0x41,0x22,0x14,0x8,0x8,0x8,0x8,0x8},//Y&lt;br /&gt;
{0x0,0x7F,0x2,0x4,0x8,0x10,0x20,0x7F},//Z&lt;br /&gt;
{0x8,0x7F,0x49,0x49,0x7F,0x8,0x8,0x8},//Chinese Character 中&lt;br /&gt;
{0xFE,0xBA,0x92,0xBA,0x92,0x9A,0xBA,0xFE},//Chinese Character国&lt;br /&gt;
{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void Write_Max7219_byte(unsigned char DATA) &lt;br /&gt;
{   &lt;br /&gt;
            unsigned char i;&lt;br /&gt;
	    digitalWrite(Max7219_pinCS,LOW);		&lt;br /&gt;
	    for(i=8;i&amp;gt;=1;i--)&lt;br /&gt;
          {		  &lt;br /&gt;
             digitalWrite(Max7219_pinCLK,LOW);&lt;br /&gt;
             digitalWrite(Max7219_pinDIN,DATA&amp;amp;0x80);&lt;br /&gt;
             DATA = DATA&amp;lt;&amp;lt;1;&lt;br /&gt;
             digitalWrite(Max7219_pinCLK,HIGH);&lt;br /&gt;
           }                                 &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void Write_Max7219(unsigned char address,unsigned char dat)&lt;br /&gt;
{&lt;br /&gt;
        digitalWrite(Max7219_pinCS,LOW);&lt;br /&gt;
        Write_Max7219_byte(address);         &lt;br /&gt;
        Write_Max7219_byte(dat);             &lt;br /&gt;
        digitalWrite(Max7219_pinCS,HIGH);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Init_MAX7219(void)&lt;br /&gt;
{&lt;br /&gt;
 Write_Max7219(0x09, 0x00);       &lt;br /&gt;
 Write_Max7219(0x0a, 0x03);       &lt;br /&gt;
 Write_Max7219(0x0b, 0x07);       &lt;br /&gt;
 Write_Max7219(0x0c, 0x01);       &lt;br /&gt;
 Write_Max7219(0x0f, 0x00);       &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Alert(void)&lt;br /&gt;
{&lt;br /&gt;
  for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[10][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[21][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[14][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[27][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[29][i-1]);&lt;br /&gt;
   delay(1500);&lt;br /&gt;
}&lt;br /&gt;
void Normal(void)&lt;br /&gt;
{&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[23][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[24][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[27][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[22][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[10][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[21][i-1]);&lt;br /&gt;
   delay(1500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Message(void)&lt;br /&gt;
{&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println();&lt;br /&gt;
for(i=2;i&amp;gt;0;i--)&lt;br /&gt;
{delay(500);&lt;br /&gt;
Serial.println(&amp;quot;AT&amp;quot;);}&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println(&amp;quot;AT&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(i=0;i&amp;lt;13;i++)&lt;br /&gt;
Serial.print(str1[i]);&lt;br /&gt;
Serial.println();&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println(&amp;quot;AT+CMGF=1&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(char i=0;i&amp;lt;From_len;i++)&lt;br /&gt;
Serial.print(From[i]);//AT+CMGS=&amp;quot;15972169189&amp;quot;&lt;br /&gt;
Serial.println();&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(char i=0;i&amp;lt;To_len;i++)&lt;br /&gt;
Serial.print(To[i]);&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.print(hex);&lt;br /&gt;
delay(1000);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SDHC(void)&lt;br /&gt;
{&lt;br /&gt;
Serial.println(&amp;quot;Initializing SD card...&amp;quot;);&lt;br /&gt;
  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.&lt;br /&gt;
  // Note that even if it's not used as the CS pin, the hardware SS pin &lt;br /&gt;
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output &lt;br /&gt;
  // or the SD library functions will not work. &lt;br /&gt;
   pinMode(10, OUTPUT);&lt;br /&gt;
   &lt;br /&gt;
  if (!SD.begin(4)) {&lt;br /&gt;
    Serial.println(&amp;quot;initialization failed!&amp;quot;);&lt;br /&gt;
    return;&lt;br /&gt;
  }&lt;br /&gt;
  Serial.println(&amp;quot;initialization done.&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  // re-open the file for reading:&lt;br /&gt;
  myFile = SD.open(&amp;quot;test.txt&amp;quot;);&lt;br /&gt;
  if (myFile) {&lt;br /&gt;
    Serial.println(&amp;quot;test.txt:&amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    // read from the file until there's nothing else in it:&lt;br /&gt;
    while (myFile.available()) {&lt;br /&gt;
        char i;&lt;br /&gt;
        RxBuffer[RxCounter++] = myFile.read();&lt;br /&gt;
        if(RxBuffer[RxCounter-2]==0x0d&amp;amp;&amp;amp;RxBuffer[RxCounter-1]==0x0a)//0x0d huiche \ ,0x0a huanhang \n&lt;br /&gt;
	{&lt;br /&gt;
		Enter++;&lt;br /&gt;
		switch(Enter)&lt;br /&gt;
		{&lt;br /&gt;
		case 1:&lt;br /&gt;
		for(i=0; i&amp;lt; RxCounter-2; i++) From[i]= RxBuffer[i];&lt;br /&gt;
                From_len=RxCounter-2;&lt;br /&gt;
		;break;&lt;br /&gt;
		case 2:&lt;br /&gt;
		for(i=0; i&amp;lt; RxCounter-2; i++) To[i]= RxBuffer[i];&lt;br /&gt;
                To_len=RxCounter-2;&lt;br /&gt;
		;break;&lt;br /&gt;
		default:;break;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	RxCounter=0;&lt;br /&gt;
	} &lt;br /&gt;
    }&lt;br /&gt;
    // close the file:&lt;br /&gt;
    myFile.close();&lt;br /&gt;
  } else {&lt;br /&gt;
  	// if the file didn't open, print an error:&lt;br /&gt;
    Serial.println(&amp;quot;error opening test.txt&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  for(char i=0;i&amp;lt;From_len;i++)&lt;br /&gt;
    	Serial.write( To[i]);&lt;br /&gt;
        Serial.println();&lt;br /&gt;
        &lt;br /&gt;
  for(char i=0;i&amp;lt;To_len;i++)&lt;br /&gt;
    	Serial.write( From[i]);&lt;br /&gt;
        Serial.println();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  Serial.begin(9600);&lt;br /&gt;
 &lt;br /&gt;
  pinMode(Max7219_pinCLK,OUTPUT);&lt;br /&gt;
  pinMode(Max7219_pinCS,OUTPUT);&lt;br /&gt;
  pinMode(Max7219_pinDIN,OUTPUT);&lt;br /&gt;
  delay(50);&lt;br /&gt;
  Init_MAX7219();&lt;br /&gt;
  SDHC();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{ &lt;br /&gt;
 // if(count&amp;lt;50)&lt;br /&gt;
  //{&lt;br /&gt;
 // count++;&lt;br /&gt;
  &lt;br /&gt;
  //Normal();&lt;br /&gt;
  sensorValue = analogRead(analogInPin);&lt;br /&gt;
  outputValue = map(sensorValue, 0, 1023, 0, 255);&lt;br /&gt;
  Serial.print(&amp;quot;sensor = &amp;quot;);&lt;br /&gt;
  Serial.print(sensorValue);&lt;br /&gt;
  Serial.print(&amp;quot;\t output = &amp;quot;);&lt;br /&gt;
  Serial.println(outputValue);&lt;br /&gt;
  delay(500);&lt;br /&gt;
  if(outputValue&amp;gt;=60)&lt;br /&gt;
     {&lt;br /&gt;
      // count=0;&lt;br /&gt;
       //Alert();&lt;br /&gt;
       if(count1&amp;lt;3)&lt;br /&gt;
       Message();&lt;br /&gt;
       count1++;&lt;br /&gt;
     }    &lt;br /&gt;
 // } &lt;br /&gt;
 // else if(count=10)&lt;br /&gt;
 // { &lt;br /&gt;
  //Message();&lt;br /&gt;
  //}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FAQ  ==&lt;br /&gt;
Please list your question here:&lt;br /&gt;
&lt;br /&gt;
== Support  ==&lt;br /&gt;
&lt;br /&gt;
If you have questions or other better design ideas, you can go to our [http://www.linksprite.com/forum/index.php forum] to discuss or creat a ticket for your issue at [http://www.linksprite.com/support/ linksprite support].&lt;br /&gt;
&lt;br /&gt;
== Resources  ==&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/AT139+Hardware+Design+Manual_V1.3.pdf ATWIN Hardware Design Manual]&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/AT+Commands+for+AT137139.pdf AT commands for AT137/139]&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/AT137139_TCPIP_APPNOTE.pdf AT137/139_TCPIP_APPNOTE in PDF]&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/SMS_APPNOTE_FOR_AT137139.pdf SMS app note for AT137/AT139 in PDF]&lt;br /&gt;
&lt;br /&gt;
*[http://m2msupport.net/m2msupport/module-tester/  AT Command Tester Tool]&lt;br /&gt;
**Send single or batch AT commands&lt;br /&gt;
***Perform modem diagnostics&lt;br /&gt;
***Set up GSM/GPRS call&lt;br /&gt;
&lt;br /&gt;
== How to buy  ==&lt;br /&gt;
Here to buy ATWIN Quad-band GPRS/GSM Shield for Arduino [http://www.linkspritedirect.com/product_info.php?products_id=86 ATGPRS_SHIELD] on [http://www.linkspritedirect.com/index.php linkspritedirect]&lt;br /&gt;
&lt;br /&gt;
== See Also  ==&lt;br /&gt;
&lt;br /&gt;
Other related products and resources.&lt;br /&gt;
&lt;br /&gt;
== Licensing  ==&lt;br /&gt;
&lt;br /&gt;
This documentation is licensed under the Creative Commons [http://creativecommons.org/licenses/by-sa/3.0/ Attribution-ShareAlike License 3.0] Source code and libraries are licensed under [http://www.gnu.org/licenses/gpl.html GPL/LGPL], see source code files for details.&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=File:400PX-ATWIN.jpg&amp;diff=3607</id>
		<title>File:400PX-ATWIN.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=File:400PX-ATWIN.jpg&amp;diff=3607"/>
		<updated>2013-09-05T07:55:20Z</updated>

		<summary type="html">&lt;p&gt;Leona: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=ATWIN_Quad-band_GPRS/GSM_Shield_for_Arduino&amp;diff=3606</id>
		<title>ATWIN Quad-band GPRS/GSM Shield for Arduino</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=ATWIN_Quad-band_GPRS/GSM_Shield_for_Arduino&amp;diff=3606"/>
		<updated>2013-09-05T07:54:57Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction  ==&lt;br /&gt;
&lt;br /&gt;
This LinkSprite  ATWIN Quad-band GPRS/GSM shield has PCB etched antenna, so no need for external antenna.&lt;br /&gt;
&lt;br /&gt;
ATWIN Quad-band GPRS/GSM shield is an ultra compact and high quality wireless module base on infineon UCL2 platform with industy-standard interface. &lt;br /&gt;
&lt;br /&gt;
This is a SMT package with small dimension, low power consumption, quad-band (AT139) and dual-band (AT139D) GSM/GPRS module. &lt;br /&gt;
&lt;br /&gt;
It can provide with voice, SMS, Fax, data applicationgs for customers.&lt;br /&gt;
&lt;br /&gt;
'''[http://v.youku.com/v_show/id_XMzkyOTMyMTQ0.html Video Introduction]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:400PX-ATWIN.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Features  ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
! Features&lt;br /&gt;
! colspan=2 align=&amp;quot;center&amp;quot;| Description&lt;br /&gt;
&lt;br /&gt;
|- style=&amp;quot;background:silver; color:black&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Network&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| GSM/GPRS&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Frequency Bands&lt;br /&gt;
| width=&amp;quot;300px&amp;quot; align=&amp;quot;center&amp;quot;| AT139:GSM850/GSM900/DCS1800/PCS1900MHz&lt;br /&gt;
| width=&amp;quot;300px&amp;quot; align=&amp;quot;center&amp;quot;| AT139D:GSM900/DCS1800MHz&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| RF Output Power&lt;br /&gt;
| width=&amp;quot;300px&amp;quot; align=&amp;quot;center&amp;quot;| AT139:GSM850/GSM900: 33dBm, DCS1800/PCS1900:30dBm&lt;br /&gt;
| width=&amp;quot;300px&amp;quot; align=&amp;quot;center&amp;quot;| AT139D:GSM900:33dBm, DCS1800:30dBm&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| RF Receive Sensitivity&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| &amp;lt;-108dBm&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Speech codec modes&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| FR,EFR,HR,AMR&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| SMS&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| TEXT/PDU&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| GPRS Connectivity&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| GPRS Class 10&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| Coding Scheme：CS1,CS2,CS3,CS4&lt;br /&gt;
&lt;br /&gt;
|- style=&amp;quot;background:silver; color:black&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Physical Characteristics&lt;br /&gt;
| colspan=2|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Package&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| SMT&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Dimensions&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 24(±0.1)*24(±0.1)*3(±0.1)mm&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Weight&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 4g&lt;br /&gt;
&lt;br /&gt;
|- style=&amp;quot;background:silver; color:black&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Performance&lt;br /&gt;
| colspan=2|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Power Supply&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 3.3V~4.5V&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Antenna&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| External Antenna&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| MCP&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 64Mb NOR + 32Mb PSRAM&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Audio&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| Two input/output Audio channels&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| SIM Card Application&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| Support SIM Card:1.8V/3.0V&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Pin Amounts&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 38 PINs&lt;br /&gt;
&lt;br /&gt;
|- style=&amp;quot;background:silver; color:black&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Firmware&lt;br /&gt;
| colspan=2|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Operating System&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| OSE&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Application Ideas  ==&lt;br /&gt;
&lt;br /&gt;
== Cautions  ==&lt;br /&gt;
&lt;br /&gt;
The warnings and wrong operations possible cause dangerous. &lt;br /&gt;
&lt;br /&gt;
== Schematic  ==&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/schematic_of_ATWIN.rar  ATWIN Quad-band GPRS/GSM shield Schematic]&lt;br /&gt;
&lt;br /&gt;
== Specification  ==&lt;br /&gt;
May include key specification and other specifications.&lt;br /&gt;
&lt;br /&gt;
== Pin definition and Rating  ==&lt;br /&gt;
&lt;br /&gt;
== Mechanic Dimensions  ==&lt;br /&gt;
&lt;br /&gt;
== Usage  ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Installation  ===&lt;br /&gt;
&lt;br /&gt;
'''First Tutorial'''&lt;br /&gt;
The shield must be powered by a wall adapter with 12V, 1A, like this one: [http://www.cutedigi.com/tools/power-supply/wall-adapter-power-supply-12vdc-1a.html PW-12VDC-1A_X3]&lt;br /&gt;
&lt;br /&gt;
*RX jump to MRX, TX jump to MTX, and remove the atmega328P from arduino. By doing this, we can directly monitor serial port output using the USB port.The default baud rate is 115200.&lt;br /&gt;
&lt;br /&gt;
*Install X-CTU serial terminal console:[http://www.cutedigi.com/pub/software/setup_xctu_5100.exe setup_xctu_5100.exe]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Second Tutorial'''&lt;br /&gt;
&lt;br /&gt;
*Now we are going to use atmega328P's UART to talk to USB, and soft serial of atmega328P to talk to ATWIN.&lt;br /&gt;
&lt;br /&gt;
*Before we do that, we have to change ATWIN's data rate to 9600 as soft serial can't go to 119200.In first tutorial setup, do: AT+IPR=9600 to set the baud rate to 9600&lt;br /&gt;
&lt;br /&gt;
*Now set the jumper RX to D3, and TX to D2. SO that atmega328P's UART to talk to USB and soft serial of atmega328P to talk to ATWIN.&lt;br /&gt;
&lt;br /&gt;
=== Programming  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include   //Include the NewSoftSerial library to send serial commands to the cellular module.&lt;br /&gt;
#include          //Used for string manipulations&lt;br /&gt;
char incoming_char=0;      //Will hold the incoming character from the Serial Port.&lt;br /&gt;
NewSoftSerial cell(2,3);  //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  //Initialize serial ports for communication.&lt;br /&gt;
Serial.begin(9600);&lt;br /&gt;
cell.begin(9600);&lt;br /&gt;
Serial.println(&amp;quot;Starting ATWIN Communication...&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
//If a character comes in from the cellular module...&lt;br /&gt;
if(cell.available() &amp;gt;0)&lt;br /&gt;
{&lt;br /&gt;
incoming_char=cell.read();    //Get the character from the cellular serial port.&lt;br /&gt;
Serial.print(incoming_char);  //Print the incoming character to the terminal.&lt;br /&gt;
}&lt;br /&gt;
//If a character is coming from the terminal to the Arduino...&lt;br /&gt;
if(Serial.available() &amp;gt;0)&lt;br /&gt;
{&lt;br /&gt;
incoming_char=Serial.read();  //Get the character coming from the terminal&lt;br /&gt;
cell.print(incoming_char);    //Send the character to the cellular module.&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''AT Command Tester Application'''&lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/module-tester/ AT Command Tester] is a free online tool test [http://m2msupport.net/m2msupport/software-and-at-commands-for-m2m-modules/ AT Commands] and other modem functionalities of [http://m2msupport.net/m2msupport/category/devices/gprs-modem/ 2G modules] (GPRS/EDGE) , [http://m2msupport.net/m2msupport/category/devices/gprs-modem/ 3G Modules] (HSDPA/EVDO) and [http://m2msupport.net/m2msupport/search-page/?Max!Download!Speed=100%20Mbps 4G Modules] (LTE).AT Command Tester tool connects to the modem port of the device and can test various modem functions such as getting [http://m2msupport.net/m2msupport/at-commands-to-get-device-information/ device information], [http://m2msupport.net/m2msupport/data-call-at-commands-to-set-up-gprsedgeumtslte-data-call/ gprs data call], [http://m2msupport.net/m2msupport/voice-call-at-commands-to-set-up-voice-call/ voice call],[http://m2msupport.net/m2msupport/at-command-for-http-functions-for-remote-server-data-access/ http access], [http://m2msupport.net/m2msupport/signal-quality/ checking signal condition], [http://m2msupport.net/m2msupport/network-registration/ network registration], [http://m2msupport.net/m2msupport/sms-at-commands/ SMS functions], [http://m2msupport.net/m2msupport/sim-at-commands-for-sim-presense-and-status/ SIM access], [http://m2msupport.net/m2msupport/sim-phonebook-at-commands/ phonebook functions] etc.&lt;br /&gt;
&lt;br /&gt;
In the 'Port Configuration' section of the tool, users can search for available ports using the 'Find Ports' button. Then using the 'Connect' button, users can connect to the modem port of the device.&lt;br /&gt;
&lt;br /&gt;
In the 'Command Mode' tab of AT Command Tester, single AT commands can be sent. The drop down list provides AT command description and examples. Users can modify the default command settings.&lt;br /&gt;
&lt;br /&gt;
[[File:M2m img1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Under the 'Script Mode' tab, multiple AT commands can be sent at a time. Users can add descriptive comments and save the script on their local machine. &lt;br /&gt;
&lt;br /&gt;
[[File:Script mode.PNG]]&lt;br /&gt;
&lt;br /&gt;
Data Call&lt;br /&gt;
&lt;br /&gt;
To make a data call with the modem, you need to connect to the APN of the carrier network. The carrier APN and other required information are stored in the SIM card and are referred as PDP contexts. Typically multiple PDP contexts are stored in the SIM for different call types. With the AT Command Tester you can edit/add/delete PDP contexts in a easy to use user interface. &lt;br /&gt;
&lt;br /&gt;
[[Image:Datacall.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;Typical call setup sequence,&lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgdcont-define-pdp-context/ AT+CGDCONT?] &lt;br /&gt;
&lt;br /&gt;
+CGDCONT: 1,&amp;quot;IP&amp;quot;,&amp;quot;epc.tmobile.com&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0&amp;lt;br&amp;gt;+CGDCONT: 2,&amp;quot;IP&amp;quot;,&amp;quot;test5&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0&amp;lt;br&amp;gt;+CGDCONT: 3,&amp;quot;IP&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Checking registration status... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcreg-network-registration/ AT+CREG?] &lt;br /&gt;
&lt;br /&gt;
+CREG: 0,1 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;The device is registered in home network. &lt;br /&gt;
&lt;br /&gt;
Checking if device is already connected... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgact-pdp-context-activate-or-deactivate/ AT+CGACT?] &lt;br /&gt;
&lt;br /&gt;
+CGACT: 1,0&amp;lt;br&amp;gt;+CGACT: 2,0&amp;lt;br&amp;gt;+CGACT: 3,0 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;[http://m2msupport.net/m2msupport/atcmee-report-mobile-termination-error/ AT+CMEE=1] &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Attaching to network...&amp;lt;br&amp;gt;AT+CGATT=1 &lt;br /&gt;
&lt;br /&gt;
OK &lt;br /&gt;
&lt;br /&gt;
Connecting... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgact-pdp-context-activate-or-deactivate/ AT+CGACT=1, 1] &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Connect Sucessful &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; '''SMS''' &lt;br /&gt;
&lt;br /&gt;
The SMS tab of the 'AT Command Tester' tool provides the interfaces to send SMS messages. You can also list/view/delete SMS messages stored on the SIM.&lt;br /&gt;
&lt;br /&gt;
[[Image:Sms.PNG]] &amp;lt;br&amp;gt; General sequence for sending SMS message, &lt;br /&gt;
&lt;br /&gt;
Checking registration status... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcreg-network-registration/ AT+CREG?] &lt;br /&gt;
&lt;br /&gt;
+CREG: 0,1 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;The device is registered in home network. &lt;br /&gt;
&lt;br /&gt;
AT+CMGS=&amp;quot;858XXXXXXX&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&amp;amp;gt; Test Message with AT Command Tester� &lt;br /&gt;
&lt;br /&gt;
+CMGS: 19 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;SMS Send successful &lt;br /&gt;
&lt;br /&gt;
'''Network Selection''' - This tab allows the user to manually select available networks. Modems are typically set for automatic network selection. 'Find Networks' button will command the modem to scan for available networks.&lt;br /&gt;
&lt;br /&gt;
[[Image:Network selection.PNG]] &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
AT+COPS command will initiate network scan in the modem, &lt;br /&gt;
&lt;br /&gt;
Finding Networks. Please wait.. &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcops-plmn-selection/ AT+COPS=?] &lt;br /&gt;
&lt;br /&gt;
+COPS: (2,&amp;quot;T-Mobile&amp;quot;,&amp;quot;T-Mobile&amp;quot;,&amp;quot;310260&amp;quot;),(1,&amp;quot;AT&amp;amp;amp;T&amp;quot;,&amp;quot;AT&amp;amp;amp;T&amp;quot;,&amp;quot;310410&amp;quot;),,(0,1,4),(0,1,2) &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Networks found &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
'''Phonebook'''&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
With the 'Phone Book' tab, you can add/delete/read phone book entries stored on the SIM, &lt;br /&gt;
&lt;br /&gt;
[[Image:Phone book.PNG]] &lt;br /&gt;
&lt;br /&gt;
Getting phonebook entries.. &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcpbr-read-phonebook-entries/ AT+CPBR=1,99] &lt;br /&gt;
&lt;br /&gt;
+CPBR: 1,&amp;quot;*233&amp;quot;,129,&amp;quot;Refill Now&amp;quot; &lt;br /&gt;
&lt;br /&gt;
+CPBR: 2,&amp;quot;#999#&amp;quot;,255,&amp;quot;Check Balance&amp;quot; &lt;br /&gt;
&lt;br /&gt;
+CPBR: 3,&amp;quot;8878878878&amp;quot;,129,&amp;quot;Test&amp;quot; &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example Project  ==&lt;br /&gt;
&lt;br /&gt;
=== Send SMS ===&lt;br /&gt;
&lt;br /&gt;
For this project, the following is the jumper setting:&lt;br /&gt;
*TX-&amp;gt; MRX&lt;br /&gt;
*RX-&amp;gt;MTX&lt;br /&gt;
*Please remove the USB cable after downloading the program&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
char str1[]={'A','T','+','C','S','C','S','=','&amp;quot;','G','S','M','&amp;quot;'};&lt;br /&gt;
char str2[]={'A','T','+','C','M','G','S','=','&amp;quot;','1','5','9','7','2','1','6','9','1','8','9','&amp;quot;'};&lt;br /&gt;
int i;&lt;br /&gt;
char inByte = 0;&lt;br /&gt;
//unsigned char receive_ACK[6];&lt;br /&gt;
char hex1[]={0x1A};&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  // start serial port at 9600 bps and wait for port to open:&lt;br /&gt;
  Serial.begin(9600);&lt;br /&gt;
  //while (!Serial) {&lt;br /&gt;
    ; // wait for serial port to connect. Needed for Leonardo only&lt;br /&gt;
 // }&lt;br /&gt;
delay(8000);&lt;br /&gt;
Serial.println();&lt;br /&gt;
for(i=10;i&amp;gt;0;i--)&lt;br /&gt;
{delay(500);&lt;br /&gt;
Serial.println(&amp;quot;AT&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println(&amp;quot;AT&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(i=0;i&amp;lt;13;i++)&lt;br /&gt;
Serial.print(str1[i]);&lt;br /&gt;
Serial.println();&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println(&amp;quot;AT+CMGF=1&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(i=0;i&amp;lt;21;i++)&lt;br /&gt;
Serial.print(str2[i]);//AT+CMGS=&amp;quot;15972169189&amp;quot;&lt;br /&gt;
Serial.println();&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.print(&amp;quot;HELLO Sir,Thank you very much fit my test!&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.print(hex1);&lt;br /&gt;
delay(1000);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{ /*&lt;br /&gt;
  Serial.println(&amp;quot;AT&amp;quot;);   delay(500);        &lt;br /&gt;
 if (Serial.available() &amp;gt; 0) {&lt;br /&gt;
    // get incoming byte:&lt;br /&gt;
    inByte = Serial.read();&lt;br /&gt;
    Serial.println(inByte);&lt;br /&gt;
 }&lt;br /&gt;
 */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detect an event and send SMS to a cell phone number stored in SD card, and display alarm in 8X8 LED matrix===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;SD.h&amp;gt;&lt;br /&gt;
char str1[]={'A','T','+','C','S','C','S','=','&amp;quot;','G','S','M','&amp;quot;'};&lt;br /&gt;
//char str2[]={'A','T','+','C','M','G','S','=','&amp;quot;','1','5','9','7','2','1','6','9','1','8','9','&amp;quot;'};&lt;br /&gt;
char hex[]={0x1A};&lt;br /&gt;
char WORD;&lt;br /&gt;
&lt;br /&gt;
char inByte = 0;&lt;br /&gt;
File myFile;&lt;br /&gt;
char RxBuffer[100];//ZHONGZHUAN&lt;br /&gt;
char From[100];//1&lt;br /&gt;
char To[100];//2&lt;br /&gt;
char RxCounter = 0;&lt;br /&gt;
char Enter=0;&lt;br /&gt;
char From_len=0;&lt;br /&gt;
char To_len=0;&lt;br /&gt;
&lt;br /&gt;
const int analogInPin = A0;                                                  // Analog input pin that the potentiometer is attached to&lt;br /&gt;
int sensorValue = 0;                                                         // value read from the pot&lt;br /&gt;
int outputValue = 0;&lt;br /&gt;
int count = 0;&lt;br /&gt;
int count1 = 0; &lt;br /&gt;
&lt;br /&gt;
unsigned char i;&lt;br /&gt;
unsigned char j; &lt;br /&gt;
unsigned char k;&lt;br /&gt;
/*port definition*/&lt;br /&gt;
int Max7219_pinCLK = 10;&lt;br /&gt;
int Max7219_pinCS = 9;&lt;br /&gt;
int Max7219_pinDIN = 8;&lt;br /&gt;
unsigned char data[2][6]={&lt;br /&gt;
{10,21,14,27,29},&lt;br /&gt;
{23,24,27,22,10,21},};&lt;br /&gt;
unsigned char disp1[39][8]={&lt;br /&gt;
{0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//0&lt;br /&gt;
{0x10,0x18,0x14,0x10,0x10,0x10,0x10,0x10},//1&lt;br /&gt;
{0x7E,0x2,0x2,0x7E,0x40,0x40,0x40,0x7E},//2&lt;br /&gt;
{0x3E,0x2,0x2,0x3E,0x2,0x2,0x3E,0x0},//3&lt;br /&gt;
{0x8,0x18,0x28,0x48,0xFE,0x8,0x8,0x8},//4&lt;br /&gt;
{0x3C,0x20,0x20,0x3C,0x4,0x4,0x3C,0x0},//5&lt;br /&gt;
{0x3C,0x20,0x20,0x3C,0x24,0x24,0x3C,0x0},//6&lt;br /&gt;
{0x3E,0x22,0x4,0x8,0x8,0x8,0x8,0x8},//7&lt;br /&gt;
{0x0,0x3E,0x22,0x22,0x3E,0x22,0x22,0x3E},//8&lt;br /&gt;
{0x3E,0x22,0x22,0x3E,0x2,0x2,0x2,0x3E},//9&lt;br /&gt;
{0x8,0x14,0x22,0x3E,0x22,0x22,0x22,0x22},//A&lt;br /&gt;
{0x3C,0x22,0x22,0x3E,0x22,0x22,0x3C,0x0},//B&lt;br /&gt;
{0x3C,0x40,0x40,0x40,0x40,0x40,0x3C,0x0},//C&lt;br /&gt;
{0x7C,0x42,0x42,0x42,0x42,0x42,0x7C,0x0},//D&lt;br /&gt;
{0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x7C},//E&lt;br /&gt;
{0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x40},//F&lt;br /&gt;
{0x3C,0x40,0x40,0x40,0x40,0x44,0x44,0x3C},//G&lt;br /&gt;
{0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44},//H&lt;br /&gt;
{0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x7C},//I&lt;br /&gt;
{0x3C,0x8,0x8,0x8,0x8,0x8,0x48,0x30},//J&lt;br /&gt;
{0x0,0x24,0x28,0x30,0x20,0x30,0x28,0x24},//K&lt;br /&gt;
{0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C},//L&lt;br /&gt;
{0x81,0xC3,0xA5,0x99,0x81,0x81,0x81,0x81},//M&lt;br /&gt;
{0x0,0x42,0x62,0x52,0x4A,0x46,0x42,0x0},//N&lt;br /&gt;
{0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//O&lt;br /&gt;
{0x3C,0x22,0x22,0x22,0x3C,0x20,0x20,0x20},//P&lt;br /&gt;
{0x1C,0x22,0x22,0x22,0x22,0x26,0x22,0x1D},//Q&lt;br /&gt;
{0x3C,0x22,0x22,0x22,0x3C,0x24,0x22,0x21},//R&lt;br /&gt;
{0x0,0x1E,0x20,0x20,0x3E,0x2,0x2,0x3C},//S&lt;br /&gt;
{0x0,0x3E,0x8,0x8,0x8,0x8,0x8,0x8},//T&lt;br /&gt;
{0x42,0x42,0x42,0x42,0x42,0x42,0x22,0x1C},//U&lt;br /&gt;
{0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18},//V&lt;br /&gt;
{0x0,0x49,0x49,0x49,0x49,0x2A,0x1C,0x0},//W&lt;br /&gt;
{0x0,0x41,0x22,0x14,0x8,0x14,0x22,0x41},//X&lt;br /&gt;
{0x41,0x22,0x14,0x8,0x8,0x8,0x8,0x8},//Y&lt;br /&gt;
{0x0,0x7F,0x2,0x4,0x8,0x10,0x20,0x7F},//Z&lt;br /&gt;
{0x8,0x7F,0x49,0x49,0x7F,0x8,0x8,0x8},//Chinese Character 中&lt;br /&gt;
{0xFE,0xBA,0x92,0xBA,0x92,0x9A,0xBA,0xFE},//Chinese Character国&lt;br /&gt;
{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void Write_Max7219_byte(unsigned char DATA) &lt;br /&gt;
{   &lt;br /&gt;
            unsigned char i;&lt;br /&gt;
	    digitalWrite(Max7219_pinCS,LOW);		&lt;br /&gt;
	    for(i=8;i&amp;gt;=1;i--)&lt;br /&gt;
          {		  &lt;br /&gt;
             digitalWrite(Max7219_pinCLK,LOW);&lt;br /&gt;
             digitalWrite(Max7219_pinDIN,DATA&amp;amp;0x80);&lt;br /&gt;
             DATA = DATA&amp;lt;&amp;lt;1;&lt;br /&gt;
             digitalWrite(Max7219_pinCLK,HIGH);&lt;br /&gt;
           }                                 &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void Write_Max7219(unsigned char address,unsigned char dat)&lt;br /&gt;
{&lt;br /&gt;
        digitalWrite(Max7219_pinCS,LOW);&lt;br /&gt;
        Write_Max7219_byte(address);         &lt;br /&gt;
        Write_Max7219_byte(dat);             &lt;br /&gt;
        digitalWrite(Max7219_pinCS,HIGH);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Init_MAX7219(void)&lt;br /&gt;
{&lt;br /&gt;
 Write_Max7219(0x09, 0x00);       &lt;br /&gt;
 Write_Max7219(0x0a, 0x03);       &lt;br /&gt;
 Write_Max7219(0x0b, 0x07);       &lt;br /&gt;
 Write_Max7219(0x0c, 0x01);       &lt;br /&gt;
 Write_Max7219(0x0f, 0x00);       &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Alert(void)&lt;br /&gt;
{&lt;br /&gt;
  for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[10][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[21][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[14][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[27][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[29][i-1]);&lt;br /&gt;
   delay(1500);&lt;br /&gt;
}&lt;br /&gt;
void Normal(void)&lt;br /&gt;
{&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[23][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[24][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[27][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[22][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[10][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[21][i-1]);&lt;br /&gt;
   delay(1500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Message(void)&lt;br /&gt;
{&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println();&lt;br /&gt;
for(i=2;i&amp;gt;0;i--)&lt;br /&gt;
{delay(500);&lt;br /&gt;
Serial.println(&amp;quot;AT&amp;quot;);}&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println(&amp;quot;AT&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(i=0;i&amp;lt;13;i++)&lt;br /&gt;
Serial.print(str1[i]);&lt;br /&gt;
Serial.println();&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println(&amp;quot;AT+CMGF=1&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(char i=0;i&amp;lt;From_len;i++)&lt;br /&gt;
Serial.print(From[i]);//AT+CMGS=&amp;quot;15972169189&amp;quot;&lt;br /&gt;
Serial.println();&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(char i=0;i&amp;lt;To_len;i++)&lt;br /&gt;
Serial.print(To[i]);&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.print(hex);&lt;br /&gt;
delay(1000);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SDHC(void)&lt;br /&gt;
{&lt;br /&gt;
Serial.println(&amp;quot;Initializing SD card...&amp;quot;);&lt;br /&gt;
  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.&lt;br /&gt;
  // Note that even if it's not used as the CS pin, the hardware SS pin &lt;br /&gt;
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output &lt;br /&gt;
  // or the SD library functions will not work. &lt;br /&gt;
   pinMode(10, OUTPUT);&lt;br /&gt;
   &lt;br /&gt;
  if (!SD.begin(4)) {&lt;br /&gt;
    Serial.println(&amp;quot;initialization failed!&amp;quot;);&lt;br /&gt;
    return;&lt;br /&gt;
  }&lt;br /&gt;
  Serial.println(&amp;quot;initialization done.&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  // re-open the file for reading:&lt;br /&gt;
  myFile = SD.open(&amp;quot;test.txt&amp;quot;);&lt;br /&gt;
  if (myFile) {&lt;br /&gt;
    Serial.println(&amp;quot;test.txt:&amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    // read from the file until there's nothing else in it:&lt;br /&gt;
    while (myFile.available()) {&lt;br /&gt;
        char i;&lt;br /&gt;
        RxBuffer[RxCounter++] = myFile.read();&lt;br /&gt;
        if(RxBuffer[RxCounter-2]==0x0d&amp;amp;&amp;amp;RxBuffer[RxCounter-1]==0x0a)//0x0d huiche \ ,0x0a huanhang \n&lt;br /&gt;
	{&lt;br /&gt;
		Enter++;&lt;br /&gt;
		switch(Enter)&lt;br /&gt;
		{&lt;br /&gt;
		case 1:&lt;br /&gt;
		for(i=0; i&amp;lt; RxCounter-2; i++) From[i]= RxBuffer[i];&lt;br /&gt;
                From_len=RxCounter-2;&lt;br /&gt;
		;break;&lt;br /&gt;
		case 2:&lt;br /&gt;
		for(i=0; i&amp;lt; RxCounter-2; i++) To[i]= RxBuffer[i];&lt;br /&gt;
                To_len=RxCounter-2;&lt;br /&gt;
		;break;&lt;br /&gt;
		default:;break;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	RxCounter=0;&lt;br /&gt;
	} &lt;br /&gt;
    }&lt;br /&gt;
    // close the file:&lt;br /&gt;
    myFile.close();&lt;br /&gt;
  } else {&lt;br /&gt;
  	// if the file didn't open, print an error:&lt;br /&gt;
    Serial.println(&amp;quot;error opening test.txt&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  for(char i=0;i&amp;lt;From_len;i++)&lt;br /&gt;
    	Serial.write( To[i]);&lt;br /&gt;
        Serial.println();&lt;br /&gt;
        &lt;br /&gt;
  for(char i=0;i&amp;lt;To_len;i++)&lt;br /&gt;
    	Serial.write( From[i]);&lt;br /&gt;
        Serial.println();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  Serial.begin(9600);&lt;br /&gt;
 &lt;br /&gt;
  pinMode(Max7219_pinCLK,OUTPUT);&lt;br /&gt;
  pinMode(Max7219_pinCS,OUTPUT);&lt;br /&gt;
  pinMode(Max7219_pinDIN,OUTPUT);&lt;br /&gt;
  delay(50);&lt;br /&gt;
  Init_MAX7219();&lt;br /&gt;
  SDHC();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{ &lt;br /&gt;
 // if(count&amp;lt;50)&lt;br /&gt;
  //{&lt;br /&gt;
 // count++;&lt;br /&gt;
  &lt;br /&gt;
  //Normal();&lt;br /&gt;
  sensorValue = analogRead(analogInPin);&lt;br /&gt;
  outputValue = map(sensorValue, 0, 1023, 0, 255);&lt;br /&gt;
  Serial.print(&amp;quot;sensor = &amp;quot;);&lt;br /&gt;
  Serial.print(sensorValue);&lt;br /&gt;
  Serial.print(&amp;quot;\t output = &amp;quot;);&lt;br /&gt;
  Serial.println(outputValue);&lt;br /&gt;
  delay(500);&lt;br /&gt;
  if(outputValue&amp;gt;=60)&lt;br /&gt;
     {&lt;br /&gt;
      // count=0;&lt;br /&gt;
       //Alert();&lt;br /&gt;
       if(count1&amp;lt;3)&lt;br /&gt;
       Message();&lt;br /&gt;
       count1++;&lt;br /&gt;
     }    &lt;br /&gt;
 // } &lt;br /&gt;
 // else if(count=10)&lt;br /&gt;
 // { &lt;br /&gt;
  //Message();&lt;br /&gt;
  //}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FAQ  ==&lt;br /&gt;
Please list your question here:&lt;br /&gt;
&lt;br /&gt;
== Support  ==&lt;br /&gt;
&lt;br /&gt;
If you have questions or other better design ideas, you can go to our [http://www.linksprite.com/forum/index.php forum] to discuss or creat a ticket for your issue at [http://www.linksprite.com/support/ linksprite support].&lt;br /&gt;
&lt;br /&gt;
== Resources  ==&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/AT139+Hardware+Design+Manual_V1.3.pdf ATWIN Hardware Design Manual]&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/AT+Commands+for+AT137139.pdf AT commands for AT137/139]&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/AT137139_TCPIP_APPNOTE.pdf AT137/139_TCPIP_APPNOTE in PDF]&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/SMS_APPNOTE_FOR_AT137139.pdf SMS app note for AT137/AT139 in PDF]&lt;br /&gt;
&lt;br /&gt;
*[http://m2msupport.net/m2msupport/module-tester/  AT Command Tester Tool]&lt;br /&gt;
**Send single or batch AT commands&lt;br /&gt;
***Perform modem diagnostics&lt;br /&gt;
***Set up GSM/GPRS call&lt;br /&gt;
&lt;br /&gt;
== How to buy  ==&lt;br /&gt;
Here to buy ATWIN Quad-band GPRS/GSM Shield for Arduino [http://www.linkspritedirect.com/product_info.php?products_id=86 ATGPRS_SHIELD] on [http://www.linkspritedirect.com/index.php linkspritedirect]&lt;br /&gt;
&lt;br /&gt;
== See Also  ==&lt;br /&gt;
&lt;br /&gt;
Other related products and resources.&lt;br /&gt;
&lt;br /&gt;
== Licensing  ==&lt;br /&gt;
&lt;br /&gt;
This documentation is licensed under the Creative Commons [http://creativecommons.org/licenses/by-sa/3.0/ Attribution-ShareAlike License 3.0] Source code and libraries are licensed under [http://www.gnu.org/licenses/gpl.html GPL/LGPL], see source code files for details.&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=ATWIN_Quad-band_GPRS/GSM_Shield_for_Arduino&amp;diff=3605</id>
		<title>ATWIN Quad-band GPRS/GSM Shield for Arduino</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=ATWIN_Quad-band_GPRS/GSM_Shield_for_Arduino&amp;diff=3605"/>
		<updated>2013-09-05T07:54:34Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction  ==&lt;br /&gt;
&lt;br /&gt;
This LinkSprite  ATWIN Quad-band GPRS/GSM shield has PCB etched antenna, so no need for external antenna.&lt;br /&gt;
&lt;br /&gt;
ATWIN Quad-band GPRS/GSM shield is an ultra compact and high quality wireless module base on infineon UCL2 platform with industy-standard interface. &lt;br /&gt;
&lt;br /&gt;
This is a SMT package with small dimension, low power consumption, quad-band (AT139) and dual-band (AT139D) GSM/GPRS module. &lt;br /&gt;
&lt;br /&gt;
It can provide with voice, SMS, Fax, data applicationgs for customers.&lt;br /&gt;
&lt;br /&gt;
'''[http://v.youku.com/v_show/id_XMzkyOTMyMTQ0.html Video Introduction]'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:400PC-ATWIN.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Features  ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
! Features&lt;br /&gt;
! colspan=2 align=&amp;quot;center&amp;quot;| Description&lt;br /&gt;
&lt;br /&gt;
|- style=&amp;quot;background:silver; color:black&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Network&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| GSM/GPRS&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Frequency Bands&lt;br /&gt;
| width=&amp;quot;300px&amp;quot; align=&amp;quot;center&amp;quot;| AT139:GSM850/GSM900/DCS1800/PCS1900MHz&lt;br /&gt;
| width=&amp;quot;300px&amp;quot; align=&amp;quot;center&amp;quot;| AT139D:GSM900/DCS1800MHz&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| RF Output Power&lt;br /&gt;
| width=&amp;quot;300px&amp;quot; align=&amp;quot;center&amp;quot;| AT139:GSM850/GSM900: 33dBm, DCS1800/PCS1900:30dBm&lt;br /&gt;
| width=&amp;quot;300px&amp;quot; align=&amp;quot;center&amp;quot;| AT139D:GSM900:33dBm, DCS1800:30dBm&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| RF Receive Sensitivity&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| &amp;lt;-108dBm&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Speech codec modes&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| FR,EFR,HR,AMR&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| SMS&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| TEXT/PDU&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| GPRS Connectivity&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| GPRS Class 10&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| Coding Scheme：CS1,CS2,CS3,CS4&lt;br /&gt;
&lt;br /&gt;
|- style=&amp;quot;background:silver; color:black&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Physical Characteristics&lt;br /&gt;
| colspan=2|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Package&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| SMT&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Dimensions&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 24(±0.1)*24(±0.1)*3(±0.1)mm&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Weight&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 4g&lt;br /&gt;
&lt;br /&gt;
|- style=&amp;quot;background:silver; color:black&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Performance&lt;br /&gt;
| colspan=2|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Power Supply&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 3.3V~4.5V&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Antenna&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| External Antenna&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| MCP&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 64Mb NOR + 32Mb PSRAM&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Audio&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| Two input/output Audio channels&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| SIM Card Application&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| Support SIM Card:1.8V/3.0V&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Pin Amounts&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| 38 PINs&lt;br /&gt;
&lt;br /&gt;
|- style=&amp;quot;background:silver; color:black&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Firmware&lt;br /&gt;
| colspan=2|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;200px&amp;quot; align=&amp;quot;center&amp;quot;| Operating System&lt;br /&gt;
| colspan=2 align=&amp;quot;center&amp;quot;| OSE&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Application Ideas  ==&lt;br /&gt;
&lt;br /&gt;
== Cautions  ==&lt;br /&gt;
&lt;br /&gt;
The warnings and wrong operations possible cause dangerous. &lt;br /&gt;
&lt;br /&gt;
== Schematic  ==&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/schematic_of_ATWIN.rar  ATWIN Quad-band GPRS/GSM shield Schematic]&lt;br /&gt;
&lt;br /&gt;
== Specification  ==&lt;br /&gt;
May include key specification and other specifications.&lt;br /&gt;
&lt;br /&gt;
== Pin definition and Rating  ==&lt;br /&gt;
&lt;br /&gt;
== Mechanic Dimensions  ==&lt;br /&gt;
&lt;br /&gt;
== Usage  ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Installation  ===&lt;br /&gt;
&lt;br /&gt;
'''First Tutorial'''&lt;br /&gt;
The shield must be powered by a wall adapter with 12V, 1A, like this one: [http://www.cutedigi.com/tools/power-supply/wall-adapter-power-supply-12vdc-1a.html PW-12VDC-1A_X3]&lt;br /&gt;
&lt;br /&gt;
*RX jump to MRX, TX jump to MTX, and remove the atmega328P from arduino. By doing this, we can directly monitor serial port output using the USB port.The default baud rate is 115200.&lt;br /&gt;
&lt;br /&gt;
*Install X-CTU serial terminal console:[http://www.cutedigi.com/pub/software/setup_xctu_5100.exe setup_xctu_5100.exe]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Second Tutorial'''&lt;br /&gt;
&lt;br /&gt;
*Now we are going to use atmega328P's UART to talk to USB, and soft serial of atmega328P to talk to ATWIN.&lt;br /&gt;
&lt;br /&gt;
*Before we do that, we have to change ATWIN's data rate to 9600 as soft serial can't go to 119200.In first tutorial setup, do: AT+IPR=9600 to set the baud rate to 9600&lt;br /&gt;
&lt;br /&gt;
*Now set the jumper RX to D3, and TX to D2. SO that atmega328P's UART to talk to USB and soft serial of atmega328P to talk to ATWIN.&lt;br /&gt;
&lt;br /&gt;
=== Programming  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include   //Include the NewSoftSerial library to send serial commands to the cellular module.&lt;br /&gt;
#include          //Used for string manipulations&lt;br /&gt;
char incoming_char=0;      //Will hold the incoming character from the Serial Port.&lt;br /&gt;
NewSoftSerial cell(2,3);  //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  //Initialize serial ports for communication.&lt;br /&gt;
Serial.begin(9600);&lt;br /&gt;
cell.begin(9600);&lt;br /&gt;
Serial.println(&amp;quot;Starting ATWIN Communication...&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
//If a character comes in from the cellular module...&lt;br /&gt;
if(cell.available() &amp;gt;0)&lt;br /&gt;
{&lt;br /&gt;
incoming_char=cell.read();    //Get the character from the cellular serial port.&lt;br /&gt;
Serial.print(incoming_char);  //Print the incoming character to the terminal.&lt;br /&gt;
}&lt;br /&gt;
//If a character is coming from the terminal to the Arduino...&lt;br /&gt;
if(Serial.available() &amp;gt;0)&lt;br /&gt;
{&lt;br /&gt;
incoming_char=Serial.read();  //Get the character coming from the terminal&lt;br /&gt;
cell.print(incoming_char);    //Send the character to the cellular module.&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''AT Command Tester Application'''&lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/module-tester/ AT Command Tester] is a free online tool test [http://m2msupport.net/m2msupport/software-and-at-commands-for-m2m-modules/ AT Commands] and other modem functionalities of [http://m2msupport.net/m2msupport/category/devices/gprs-modem/ 2G modules] (GPRS/EDGE) , [http://m2msupport.net/m2msupport/category/devices/gprs-modem/ 3G Modules] (HSDPA/EVDO) and [http://m2msupport.net/m2msupport/search-page/?Max!Download!Speed=100%20Mbps 4G Modules] (LTE).AT Command Tester tool connects to the modem port of the device and can test various modem functions such as getting [http://m2msupport.net/m2msupport/at-commands-to-get-device-information/ device information], [http://m2msupport.net/m2msupport/data-call-at-commands-to-set-up-gprsedgeumtslte-data-call/ gprs data call], [http://m2msupport.net/m2msupport/voice-call-at-commands-to-set-up-voice-call/ voice call],[http://m2msupport.net/m2msupport/at-command-for-http-functions-for-remote-server-data-access/ http access], [http://m2msupport.net/m2msupport/signal-quality/ checking signal condition], [http://m2msupport.net/m2msupport/network-registration/ network registration], [http://m2msupport.net/m2msupport/sms-at-commands/ SMS functions], [http://m2msupport.net/m2msupport/sim-at-commands-for-sim-presense-and-status/ SIM access], [http://m2msupport.net/m2msupport/sim-phonebook-at-commands/ phonebook functions] etc.&lt;br /&gt;
&lt;br /&gt;
In the 'Port Configuration' section of the tool, users can search for available ports using the 'Find Ports' button. Then using the 'Connect' button, users can connect to the modem port of the device.&lt;br /&gt;
&lt;br /&gt;
In the 'Command Mode' tab of AT Command Tester, single AT commands can be sent. The drop down list provides AT command description and examples. Users can modify the default command settings.&lt;br /&gt;
&lt;br /&gt;
[[File:M2m img1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Under the 'Script Mode' tab, multiple AT commands can be sent at a time. Users can add descriptive comments and save the script on their local machine. &lt;br /&gt;
&lt;br /&gt;
[[File:Script mode.PNG]]&lt;br /&gt;
&lt;br /&gt;
Data Call&lt;br /&gt;
&lt;br /&gt;
To make a data call with the modem, you need to connect to the APN of the carrier network. The carrier APN and other required information are stored in the SIM card and are referred as PDP contexts. Typically multiple PDP contexts are stored in the SIM for different call types. With the AT Command Tester you can edit/add/delete PDP contexts in a easy to use user interface. &lt;br /&gt;
&lt;br /&gt;
[[Image:Datacall.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;Typical call setup sequence,&lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgdcont-define-pdp-context/ AT+CGDCONT?] &lt;br /&gt;
&lt;br /&gt;
+CGDCONT: 1,&amp;quot;IP&amp;quot;,&amp;quot;epc.tmobile.com&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0&amp;lt;br&amp;gt;+CGDCONT: 2,&amp;quot;IP&amp;quot;,&amp;quot;test5&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0&amp;lt;br&amp;gt;+CGDCONT: 3,&amp;quot;IP&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Checking registration status... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcreg-network-registration/ AT+CREG?] &lt;br /&gt;
&lt;br /&gt;
+CREG: 0,1 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;The device is registered in home network. &lt;br /&gt;
&lt;br /&gt;
Checking if device is already connected... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgact-pdp-context-activate-or-deactivate/ AT+CGACT?] &lt;br /&gt;
&lt;br /&gt;
+CGACT: 1,0&amp;lt;br&amp;gt;+CGACT: 2,0&amp;lt;br&amp;gt;+CGACT: 3,0 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;[http://m2msupport.net/m2msupport/atcmee-report-mobile-termination-error/ AT+CMEE=1] &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Attaching to network...&amp;lt;br&amp;gt;AT+CGATT=1 &lt;br /&gt;
&lt;br /&gt;
OK &lt;br /&gt;
&lt;br /&gt;
Connecting... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgact-pdp-context-activate-or-deactivate/ AT+CGACT=1, 1] &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Connect Sucessful &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; '''SMS''' &lt;br /&gt;
&lt;br /&gt;
The SMS tab of the 'AT Command Tester' tool provides the interfaces to send SMS messages. You can also list/view/delete SMS messages stored on the SIM.&lt;br /&gt;
&lt;br /&gt;
[[Image:Sms.PNG]] &amp;lt;br&amp;gt; General sequence for sending SMS message, &lt;br /&gt;
&lt;br /&gt;
Checking registration status... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcreg-network-registration/ AT+CREG?] &lt;br /&gt;
&lt;br /&gt;
+CREG: 0,1 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;The device is registered in home network. &lt;br /&gt;
&lt;br /&gt;
AT+CMGS=&amp;quot;858XXXXXXX&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&amp;amp;gt; Test Message with AT Command Tester� &lt;br /&gt;
&lt;br /&gt;
+CMGS: 19 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;SMS Send successful &lt;br /&gt;
&lt;br /&gt;
'''Network Selection''' - This tab allows the user to manually select available networks. Modems are typically set for automatic network selection. 'Find Networks' button will command the modem to scan for available networks.&lt;br /&gt;
&lt;br /&gt;
[[Image:Network selection.PNG]] &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
AT+COPS command will initiate network scan in the modem, &lt;br /&gt;
&lt;br /&gt;
Finding Networks. Please wait.. &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcops-plmn-selection/ AT+COPS=?] &lt;br /&gt;
&lt;br /&gt;
+COPS: (2,&amp;quot;T-Mobile&amp;quot;,&amp;quot;T-Mobile&amp;quot;,&amp;quot;310260&amp;quot;),(1,&amp;quot;AT&amp;amp;amp;T&amp;quot;,&amp;quot;AT&amp;amp;amp;T&amp;quot;,&amp;quot;310410&amp;quot;),,(0,1,4),(0,1,2) &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Networks found &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
'''Phonebook'''&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
With the 'Phone Book' tab, you can add/delete/read phone book entries stored on the SIM, &lt;br /&gt;
&lt;br /&gt;
[[Image:Phone book.PNG]] &lt;br /&gt;
&lt;br /&gt;
Getting phonebook entries.. &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcpbr-read-phonebook-entries/ AT+CPBR=1,99] &lt;br /&gt;
&lt;br /&gt;
+CPBR: 1,&amp;quot;*233&amp;quot;,129,&amp;quot;Refill Now&amp;quot; &lt;br /&gt;
&lt;br /&gt;
+CPBR: 2,&amp;quot;#999#&amp;quot;,255,&amp;quot;Check Balance&amp;quot; &lt;br /&gt;
&lt;br /&gt;
+CPBR: 3,&amp;quot;8878878878&amp;quot;,129,&amp;quot;Test&amp;quot; &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example Project  ==&lt;br /&gt;
&lt;br /&gt;
=== Send SMS ===&lt;br /&gt;
&lt;br /&gt;
For this project, the following is the jumper setting:&lt;br /&gt;
*TX-&amp;gt; MRX&lt;br /&gt;
*RX-&amp;gt;MTX&lt;br /&gt;
*Please remove the USB cable after downloading the program&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
char str1[]={'A','T','+','C','S','C','S','=','&amp;quot;','G','S','M','&amp;quot;'};&lt;br /&gt;
char str2[]={'A','T','+','C','M','G','S','=','&amp;quot;','1','5','9','7','2','1','6','9','1','8','9','&amp;quot;'};&lt;br /&gt;
int i;&lt;br /&gt;
char inByte = 0;&lt;br /&gt;
//unsigned char receive_ACK[6];&lt;br /&gt;
char hex1[]={0x1A};&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  // start serial port at 9600 bps and wait for port to open:&lt;br /&gt;
  Serial.begin(9600);&lt;br /&gt;
  //while (!Serial) {&lt;br /&gt;
    ; // wait for serial port to connect. Needed for Leonardo only&lt;br /&gt;
 // }&lt;br /&gt;
delay(8000);&lt;br /&gt;
Serial.println();&lt;br /&gt;
for(i=10;i&amp;gt;0;i--)&lt;br /&gt;
{delay(500);&lt;br /&gt;
Serial.println(&amp;quot;AT&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println(&amp;quot;AT&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(i=0;i&amp;lt;13;i++)&lt;br /&gt;
Serial.print(str1[i]);&lt;br /&gt;
Serial.println();&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println(&amp;quot;AT+CMGF=1&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(i=0;i&amp;lt;21;i++)&lt;br /&gt;
Serial.print(str2[i]);//AT+CMGS=&amp;quot;15972169189&amp;quot;&lt;br /&gt;
Serial.println();&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.print(&amp;quot;HELLO Sir,Thank you very much fit my test!&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.print(hex1);&lt;br /&gt;
delay(1000);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{ /*&lt;br /&gt;
  Serial.println(&amp;quot;AT&amp;quot;);   delay(500);        &lt;br /&gt;
 if (Serial.available() &amp;gt; 0) {&lt;br /&gt;
    // get incoming byte:&lt;br /&gt;
    inByte = Serial.read();&lt;br /&gt;
    Serial.println(inByte);&lt;br /&gt;
 }&lt;br /&gt;
 */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detect an event and send SMS to a cell phone number stored in SD card, and display alarm in 8X8 LED matrix===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;SD.h&amp;gt;&lt;br /&gt;
char str1[]={'A','T','+','C','S','C','S','=','&amp;quot;','G','S','M','&amp;quot;'};&lt;br /&gt;
//char str2[]={'A','T','+','C','M','G','S','=','&amp;quot;','1','5','9','7','2','1','6','9','1','8','9','&amp;quot;'};&lt;br /&gt;
char hex[]={0x1A};&lt;br /&gt;
char WORD;&lt;br /&gt;
&lt;br /&gt;
char inByte = 0;&lt;br /&gt;
File myFile;&lt;br /&gt;
char RxBuffer[100];//ZHONGZHUAN&lt;br /&gt;
char From[100];//1&lt;br /&gt;
char To[100];//2&lt;br /&gt;
char RxCounter = 0;&lt;br /&gt;
char Enter=0;&lt;br /&gt;
char From_len=0;&lt;br /&gt;
char To_len=0;&lt;br /&gt;
&lt;br /&gt;
const int analogInPin = A0;                                                  // Analog input pin that the potentiometer is attached to&lt;br /&gt;
int sensorValue = 0;                                                         // value read from the pot&lt;br /&gt;
int outputValue = 0;&lt;br /&gt;
int count = 0;&lt;br /&gt;
int count1 = 0; &lt;br /&gt;
&lt;br /&gt;
unsigned char i;&lt;br /&gt;
unsigned char j; &lt;br /&gt;
unsigned char k;&lt;br /&gt;
/*port definition*/&lt;br /&gt;
int Max7219_pinCLK = 10;&lt;br /&gt;
int Max7219_pinCS = 9;&lt;br /&gt;
int Max7219_pinDIN = 8;&lt;br /&gt;
unsigned char data[2][6]={&lt;br /&gt;
{10,21,14,27,29},&lt;br /&gt;
{23,24,27,22,10,21},};&lt;br /&gt;
unsigned char disp1[39][8]={&lt;br /&gt;
{0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//0&lt;br /&gt;
{0x10,0x18,0x14,0x10,0x10,0x10,0x10,0x10},//1&lt;br /&gt;
{0x7E,0x2,0x2,0x7E,0x40,0x40,0x40,0x7E},//2&lt;br /&gt;
{0x3E,0x2,0x2,0x3E,0x2,0x2,0x3E,0x0},//3&lt;br /&gt;
{0x8,0x18,0x28,0x48,0xFE,0x8,0x8,0x8},//4&lt;br /&gt;
{0x3C,0x20,0x20,0x3C,0x4,0x4,0x3C,0x0},//5&lt;br /&gt;
{0x3C,0x20,0x20,0x3C,0x24,0x24,0x3C,0x0},//6&lt;br /&gt;
{0x3E,0x22,0x4,0x8,0x8,0x8,0x8,0x8},//7&lt;br /&gt;
{0x0,0x3E,0x22,0x22,0x3E,0x22,0x22,0x3E},//8&lt;br /&gt;
{0x3E,0x22,0x22,0x3E,0x2,0x2,0x2,0x3E},//9&lt;br /&gt;
{0x8,0x14,0x22,0x3E,0x22,0x22,0x22,0x22},//A&lt;br /&gt;
{0x3C,0x22,0x22,0x3E,0x22,0x22,0x3C,0x0},//B&lt;br /&gt;
{0x3C,0x40,0x40,0x40,0x40,0x40,0x3C,0x0},//C&lt;br /&gt;
{0x7C,0x42,0x42,0x42,0x42,0x42,0x7C,0x0},//D&lt;br /&gt;
{0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x7C},//E&lt;br /&gt;
{0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x40},//F&lt;br /&gt;
{0x3C,0x40,0x40,0x40,0x40,0x44,0x44,0x3C},//G&lt;br /&gt;
{0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44},//H&lt;br /&gt;
{0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x7C},//I&lt;br /&gt;
{0x3C,0x8,0x8,0x8,0x8,0x8,0x48,0x30},//J&lt;br /&gt;
{0x0,0x24,0x28,0x30,0x20,0x30,0x28,0x24},//K&lt;br /&gt;
{0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C},//L&lt;br /&gt;
{0x81,0xC3,0xA5,0x99,0x81,0x81,0x81,0x81},//M&lt;br /&gt;
{0x0,0x42,0x62,0x52,0x4A,0x46,0x42,0x0},//N&lt;br /&gt;
{0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//O&lt;br /&gt;
{0x3C,0x22,0x22,0x22,0x3C,0x20,0x20,0x20},//P&lt;br /&gt;
{0x1C,0x22,0x22,0x22,0x22,0x26,0x22,0x1D},//Q&lt;br /&gt;
{0x3C,0x22,0x22,0x22,0x3C,0x24,0x22,0x21},//R&lt;br /&gt;
{0x0,0x1E,0x20,0x20,0x3E,0x2,0x2,0x3C},//S&lt;br /&gt;
{0x0,0x3E,0x8,0x8,0x8,0x8,0x8,0x8},//T&lt;br /&gt;
{0x42,0x42,0x42,0x42,0x42,0x42,0x22,0x1C},//U&lt;br /&gt;
{0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18},//V&lt;br /&gt;
{0x0,0x49,0x49,0x49,0x49,0x2A,0x1C,0x0},//W&lt;br /&gt;
{0x0,0x41,0x22,0x14,0x8,0x14,0x22,0x41},//X&lt;br /&gt;
{0x41,0x22,0x14,0x8,0x8,0x8,0x8,0x8},//Y&lt;br /&gt;
{0x0,0x7F,0x2,0x4,0x8,0x10,0x20,0x7F},//Z&lt;br /&gt;
{0x8,0x7F,0x49,0x49,0x7F,0x8,0x8,0x8},//Chinese Character 中&lt;br /&gt;
{0xFE,0xBA,0x92,0xBA,0x92,0x9A,0xBA,0xFE},//Chinese Character国&lt;br /&gt;
{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void Write_Max7219_byte(unsigned char DATA) &lt;br /&gt;
{   &lt;br /&gt;
            unsigned char i;&lt;br /&gt;
	    digitalWrite(Max7219_pinCS,LOW);		&lt;br /&gt;
	    for(i=8;i&amp;gt;=1;i--)&lt;br /&gt;
          {		  &lt;br /&gt;
             digitalWrite(Max7219_pinCLK,LOW);&lt;br /&gt;
             digitalWrite(Max7219_pinDIN,DATA&amp;amp;0x80);&lt;br /&gt;
             DATA = DATA&amp;lt;&amp;lt;1;&lt;br /&gt;
             digitalWrite(Max7219_pinCLK,HIGH);&lt;br /&gt;
           }                                 &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void Write_Max7219(unsigned char address,unsigned char dat)&lt;br /&gt;
{&lt;br /&gt;
        digitalWrite(Max7219_pinCS,LOW);&lt;br /&gt;
        Write_Max7219_byte(address);         &lt;br /&gt;
        Write_Max7219_byte(dat);             &lt;br /&gt;
        digitalWrite(Max7219_pinCS,HIGH);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Init_MAX7219(void)&lt;br /&gt;
{&lt;br /&gt;
 Write_Max7219(0x09, 0x00);       &lt;br /&gt;
 Write_Max7219(0x0a, 0x03);       &lt;br /&gt;
 Write_Max7219(0x0b, 0x07);       &lt;br /&gt;
 Write_Max7219(0x0c, 0x01);       &lt;br /&gt;
 Write_Max7219(0x0f, 0x00);       &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Alert(void)&lt;br /&gt;
{&lt;br /&gt;
  for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[10][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[21][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[14][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[27][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[29][i-1]);&lt;br /&gt;
   delay(1500);&lt;br /&gt;
}&lt;br /&gt;
void Normal(void)&lt;br /&gt;
{&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[23][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[24][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[27][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[22][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[10][i-1]);&lt;br /&gt;
   delay(500);&lt;br /&gt;
   for(i=1;i&amp;lt;9;i++)&lt;br /&gt;
    Write_Max7219(i,disp1[21][i-1]);&lt;br /&gt;
   delay(1500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Message(void)&lt;br /&gt;
{&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println();&lt;br /&gt;
for(i=2;i&amp;gt;0;i--)&lt;br /&gt;
{delay(500);&lt;br /&gt;
Serial.println(&amp;quot;AT&amp;quot;);}&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println(&amp;quot;AT&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(i=0;i&amp;lt;13;i++)&lt;br /&gt;
Serial.print(str1[i]);&lt;br /&gt;
Serial.println();&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.println(&amp;quot;AT+CMGF=1&amp;quot;);&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(char i=0;i&amp;lt;From_len;i++)&lt;br /&gt;
Serial.print(From[i]);//AT+CMGS=&amp;quot;15972169189&amp;quot;&lt;br /&gt;
Serial.println();&lt;br /&gt;
delay(1000);&lt;br /&gt;
for(char i=0;i&amp;lt;To_len;i++)&lt;br /&gt;
Serial.print(To[i]);&lt;br /&gt;
delay(1000);&lt;br /&gt;
Serial.print(hex);&lt;br /&gt;
delay(1000);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SDHC(void)&lt;br /&gt;
{&lt;br /&gt;
Serial.println(&amp;quot;Initializing SD card...&amp;quot;);&lt;br /&gt;
  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.&lt;br /&gt;
  // Note that even if it's not used as the CS pin, the hardware SS pin &lt;br /&gt;
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output &lt;br /&gt;
  // or the SD library functions will not work. &lt;br /&gt;
   pinMode(10, OUTPUT);&lt;br /&gt;
   &lt;br /&gt;
  if (!SD.begin(4)) {&lt;br /&gt;
    Serial.println(&amp;quot;initialization failed!&amp;quot;);&lt;br /&gt;
    return;&lt;br /&gt;
  }&lt;br /&gt;
  Serial.println(&amp;quot;initialization done.&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  // re-open the file for reading:&lt;br /&gt;
  myFile = SD.open(&amp;quot;test.txt&amp;quot;);&lt;br /&gt;
  if (myFile) {&lt;br /&gt;
    Serial.println(&amp;quot;test.txt:&amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    // read from the file until there's nothing else in it:&lt;br /&gt;
    while (myFile.available()) {&lt;br /&gt;
        char i;&lt;br /&gt;
        RxBuffer[RxCounter++] = myFile.read();&lt;br /&gt;
        if(RxBuffer[RxCounter-2]==0x0d&amp;amp;&amp;amp;RxBuffer[RxCounter-1]==0x0a)//0x0d huiche \ ,0x0a huanhang \n&lt;br /&gt;
	{&lt;br /&gt;
		Enter++;&lt;br /&gt;
		switch(Enter)&lt;br /&gt;
		{&lt;br /&gt;
		case 1:&lt;br /&gt;
		for(i=0; i&amp;lt; RxCounter-2; i++) From[i]= RxBuffer[i];&lt;br /&gt;
                From_len=RxCounter-2;&lt;br /&gt;
		;break;&lt;br /&gt;
		case 2:&lt;br /&gt;
		for(i=0; i&amp;lt; RxCounter-2; i++) To[i]= RxBuffer[i];&lt;br /&gt;
                To_len=RxCounter-2;&lt;br /&gt;
		;break;&lt;br /&gt;
		default:;break;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	RxCounter=0;&lt;br /&gt;
	} &lt;br /&gt;
    }&lt;br /&gt;
    // close the file:&lt;br /&gt;
    myFile.close();&lt;br /&gt;
  } else {&lt;br /&gt;
  	// if the file didn't open, print an error:&lt;br /&gt;
    Serial.println(&amp;quot;error opening test.txt&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  for(char i=0;i&amp;lt;From_len;i++)&lt;br /&gt;
    	Serial.write( To[i]);&lt;br /&gt;
        Serial.println();&lt;br /&gt;
        &lt;br /&gt;
  for(char i=0;i&amp;lt;To_len;i++)&lt;br /&gt;
    	Serial.write( From[i]);&lt;br /&gt;
        Serial.println();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  Serial.begin(9600);&lt;br /&gt;
 &lt;br /&gt;
  pinMode(Max7219_pinCLK,OUTPUT);&lt;br /&gt;
  pinMode(Max7219_pinCS,OUTPUT);&lt;br /&gt;
  pinMode(Max7219_pinDIN,OUTPUT);&lt;br /&gt;
  delay(50);&lt;br /&gt;
  Init_MAX7219();&lt;br /&gt;
  SDHC();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{ &lt;br /&gt;
 // if(count&amp;lt;50)&lt;br /&gt;
  //{&lt;br /&gt;
 // count++;&lt;br /&gt;
  &lt;br /&gt;
  //Normal();&lt;br /&gt;
  sensorValue = analogRead(analogInPin);&lt;br /&gt;
  outputValue = map(sensorValue, 0, 1023, 0, 255);&lt;br /&gt;
  Serial.print(&amp;quot;sensor = &amp;quot;);&lt;br /&gt;
  Serial.print(sensorValue);&lt;br /&gt;
  Serial.print(&amp;quot;\t output = &amp;quot;);&lt;br /&gt;
  Serial.println(outputValue);&lt;br /&gt;
  delay(500);&lt;br /&gt;
  if(outputValue&amp;gt;=60)&lt;br /&gt;
     {&lt;br /&gt;
      // count=0;&lt;br /&gt;
       //Alert();&lt;br /&gt;
       if(count1&amp;lt;3)&lt;br /&gt;
       Message();&lt;br /&gt;
       count1++;&lt;br /&gt;
     }    &lt;br /&gt;
 // } &lt;br /&gt;
 // else if(count=10)&lt;br /&gt;
 // { &lt;br /&gt;
  //Message();&lt;br /&gt;
  //}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FAQ  ==&lt;br /&gt;
Please list your question here:&lt;br /&gt;
&lt;br /&gt;
== Support  ==&lt;br /&gt;
&lt;br /&gt;
If you have questions or other better design ideas, you can go to our [http://www.linksprite.com/forum/index.php forum] to discuss or creat a ticket for your issue at [http://www.linksprite.com/support/ linksprite support].&lt;br /&gt;
&lt;br /&gt;
== Resources  ==&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/AT139+Hardware+Design+Manual_V1.3.pdf ATWIN Hardware Design Manual]&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/AT+Commands+for+AT137139.pdf AT commands for AT137/139]&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/AT137139_TCPIP_APPNOTE.pdf AT137/139_TCPIP_APPNOTE in PDF]&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/ATWIN/SMS_APPNOTE_FOR_AT137139.pdf SMS app note for AT137/AT139 in PDF]&lt;br /&gt;
&lt;br /&gt;
*[http://m2msupport.net/m2msupport/module-tester/  AT Command Tester Tool]&lt;br /&gt;
**Send single or batch AT commands&lt;br /&gt;
***Perform modem diagnostics&lt;br /&gt;
***Set up GSM/GPRS call&lt;br /&gt;
&lt;br /&gt;
== How to buy  ==&lt;br /&gt;
Here to buy ATWIN Quad-band GPRS/GSM Shield for Arduino [http://www.linkspritedirect.com/product_info.php?products_id=86 ATGPRS_SHIELD] on [http://www.linkspritedirect.com/index.php linkspritedirect]&lt;br /&gt;
&lt;br /&gt;
== See Also  ==&lt;br /&gt;
&lt;br /&gt;
Other related products and resources.&lt;br /&gt;
&lt;br /&gt;
== Licensing  ==&lt;br /&gt;
&lt;br /&gt;
This documentation is licensed under the Creative Commons [http://creativecommons.org/licenses/by-sa/3.0/ Attribution-ShareAlike License 3.0] Source code and libraries are licensed under [http://www.gnu.org/licenses/gpl.html GPL/LGPL], see source code files for details.&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=16_X_2_LCD_Keypad_Shield_for_Arduino&amp;diff=3580</id>
		<title>16 X 2 LCD Keypad Shield for Arduino</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=16_X_2_LCD_Keypad_Shield_for_Arduino&amp;diff=3580"/>
		<updated>2013-08-30T02:22:18Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Schematic */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction  ==&lt;br /&gt;
&lt;br /&gt;
We wanted to make it easier for people to get these LCD into their projects so we devised a shield that lets you control a 16x2 Character LCD backlight with a potentiometer AND 5 keypad pins using 6 digital pins on the Arduino!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This shield is perfect for when you want to build a stand-alone project with its own user interface. The 4 directional buttons plus select button allows basic control without having to attach a bulky computer. &lt;br /&gt;
&lt;br /&gt;
*Comes with a 16x2 green backlight LCD, negative display&lt;br /&gt;
*Plug and play with any Arduino 'classic' - UNO, duemilanove, diecimilla, etc.&lt;br /&gt;
*Uses 6 pins of Arduino to control LCD and A0 pin for 5 buttons. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The LCD and Keypad Shield gives you a handy 16-character by 2-line display, 5 buttons and a controllable backlight, plug it straight in on top of your Arduino board or other project shields. The display is set behind the shield for a low profile fitment and nice look and we've included panel mounting screw holes in the corners.&lt;br /&gt;
&lt;br /&gt;
It's great when you want to build a stand-alone project with its own user interface that doesn't require a computer attached to send commands to your Arduino.&lt;br /&gt;
&lt;br /&gt;
Works perfectly in 4-bit mode with the &amp;quot;LiquidCrystal&amp;quot; library included with the Arduino IDE, allowing you to control the LCD with a total of just 6 digital I/O lines. We've deliberately picked D4-D9 so that it doesn't interfere with pins required by other popular products such as the Ethernet Shield and EtherTen, so you can stack this on top of other shields to give you a local display.&lt;br /&gt;
&lt;br /&gt;
The buttons provide &amp;quot;left&amp;quot;, &amp;quot;right&amp;quot;, &amp;quot;up&amp;quot;, &amp;quot;down&amp;quot;, and &amp;quot;select&amp;quot; while using just one analog input. That leaves the other analog inputs free for you to use in your projects.&lt;br /&gt;
&lt;br /&gt;
The LCD backlight is connected to a potentiometer can be controlled for on/off, brightness.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:1602 LCD shield-A01.jpg]] [Model A]&lt;br /&gt;
 &lt;br /&gt;
[[File:1602 lcd keypad shield-02.jpg | 400px]] [Model B]&lt;br /&gt;
&lt;br /&gt;
== Features  ==&lt;br /&gt;
*16x2 LCD using HD44780-compatible display module (black characters on green background).&lt;br /&gt;
*5 buttons on one analog input (A0).&lt;br /&gt;
*LCD backlight with current limiting, brightness and on/off controllable by a adjustable potentiometer.&lt;br /&gt;
*Recessed LCD, panel mount screw holes and button layout suitable for panel or cabinet mounting if desired.&lt;br /&gt;
*Reset button.&lt;br /&gt;
*Power supply smoothing capacitor.&lt;br /&gt;
&lt;br /&gt;
== Application Ideas  ==&lt;br /&gt;
'''test code'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;LiquidCrystal.h&amp;gt;&lt;br /&gt;
#include &amp;lt;LCDKeypad.h&amp;gt;&lt;br /&gt;
LiquidCrystal lcd(8, 13, 9, 4, 5, 6, 7);&lt;br /&gt;
char msgs[5][16] = {&amp;quot;Right Key OK &amp;quot;,&lt;br /&gt;
                    &amp;quot;Up Key OK    &amp;quot;,               &lt;br /&gt;
                    &amp;quot;Down Key OK  &amp;quot;,&lt;br /&gt;
                    &amp;quot;Left Key OK  &amp;quot;,&lt;br /&gt;
                    &amp;quot;Select Key OK&amp;quot; };&lt;br /&gt;
int adc_key_val[5] ={50, 200, 400, 600, 800 };&lt;br /&gt;
int NUM_KEYS = 5;&lt;br /&gt;
int adc_key_in;&lt;br /&gt;
int key=-1;&lt;br /&gt;
int oldkey=-1;&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  lcd.begin(16, 2);&lt;br /&gt;
  lcd.clear();&lt;br /&gt;
  lcd.setCursor(0,0);&lt;br /&gt;
  lcd.print(&amp;quot;     helle! &amp;quot;);&lt;br /&gt;
  lcd.print(&amp;quot;      welcome!&amp;quot;);&lt;br /&gt;
  lcd.setCursor(0,1);&lt;br /&gt;
  lcd.print(&amp;quot;   LinkSprite&amp;quot;);&lt;br /&gt;
  lcd.print(&amp;quot;    LCD Shield&amp;quot;);&lt;br /&gt;
  delay(1000);&lt;br /&gt;
  &lt;br /&gt;
  lcd.setCursor(0,0);&lt;br /&gt;
  for (char k=0;k&amp;lt;26;k++)&lt;br /&gt;
  {&lt;br /&gt;
    lcd.scrollDisplayLeft();&lt;br /&gt;
    delay(400);&lt;br /&gt;
  }&lt;br /&gt;
  lcd.clear();&lt;br /&gt;
  lcd.setCursor(0,0); &lt;br /&gt;
  lcd.print(&amp;quot;ADC key testing&amp;quot;); &lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
   adc_key_in = analogRead(0);    // read the value from the sensor &lt;br /&gt;
   key = get_key(adc_key_in);  // convert into key press&lt;br /&gt;
   if (key != oldkey)   // if keypress is detected&lt;br /&gt;
   {&lt;br /&gt;
     delay(50);  // wait for debounce time&lt;br /&gt;
     adc_key_in = analogRead(0);    // read the value from the sensor &lt;br /&gt;
     key = get_key(adc_key_in);    // convert into key press&lt;br /&gt;
     if (key != oldkey)    &lt;br /&gt;
     {   &lt;br /&gt;
       lcd.setCursor(0, 1);&lt;br /&gt;
       oldkey = key;&lt;br /&gt;
       if (key &amp;gt;=0)&lt;br /&gt;
       {&lt;br /&gt;
           lcd.print(msgs[key]);              &lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   delay(100);&lt;br /&gt;
}&lt;br /&gt;
// Convert ADC value to key number&lt;br /&gt;
int get_key(unsigned int input)&lt;br /&gt;
{&lt;br /&gt;
    int k;&lt;br /&gt;
    for (k = 0; k &amp;lt; NUM_KEYS; k++)&lt;br /&gt;
    {&lt;br /&gt;
      if (input &amp;lt; adc_key_val[k])&lt;br /&gt;
      {&lt;br /&gt;
        return k;&lt;br /&gt;
      }&lt;br /&gt;
    }   &lt;br /&gt;
    if (k &amp;gt;= NUM_KEYS)k = -1;  // No valid key pressed&lt;br /&gt;
    return k;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Cautions  ==&lt;br /&gt;
&lt;br /&gt;
The warnings and wrong operations possible cause dangerous. &lt;br /&gt;
&lt;br /&gt;
== Schematic  ==&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/1602+LCD+Shield+Sch.pdf Schematic in PDF]&lt;br /&gt;
&lt;br /&gt;
== Specification  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;width: 50%&amp;quot; align=&amp;quot;center&amp;quot; | Item &lt;br /&gt;
! scope=&amp;quot;col&amp;quot; align=&amp;quot;center&amp;quot; | Min &lt;br /&gt;
! scope=&amp;quot;col&amp;quot; align=&amp;quot;center&amp;quot; | Typical &lt;br /&gt;
! scope=&amp;quot;col&amp;quot; align=&amp;quot;center&amp;quot; | Max &lt;br /&gt;
! scope=&amp;quot;col&amp;quot; align=&amp;quot;center&amp;quot; | Unit&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | Voltage &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 4.3&lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 5.0 &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 4.7&lt;br /&gt;
| align=&amp;quot;center&amp;quot; | V&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | Current &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 39.6&lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 53.3 &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 65.0&lt;br /&gt;
| align=&amp;quot;center&amp;quot; | mA&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | Dimension &lt;br /&gt;
| align=&amp;quot;center&amp;quot; colspan=&amp;quot;3&amp;quot; | 79.5x55.1x16.6 &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | mm&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | Net Weight &lt;br /&gt;
| align=&amp;quot;center&amp;quot; colspan=&amp;quot;3&amp;quot; | 55.0 &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | g&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Pin definition and Rating  ==&lt;br /&gt;
&lt;br /&gt;
*A0: Buttons&lt;br /&gt;
*D4: LCD bit 4&lt;br /&gt;
*D5: LCD bit 5&lt;br /&gt;
*D6: LCD bit 6&lt;br /&gt;
*D7: LCD bit 7&lt;br /&gt;
*D8: LCD RS&lt;br /&gt;
*D9: LCD Enable&lt;br /&gt;
*LCD backlight with current limiting, brightness and on/off controllable by D10.&lt;br /&gt;
&lt;br /&gt;
== Mechanic Dimensions  ==&lt;br /&gt;
&lt;br /&gt;
== Usage  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 16x2 LCD And Keypad Shield is very simple to use because it's fully compatible with the Arduino &amp;quot;LiquidCrystal&amp;quot; library. You can initialise the LCD and display messages on it with just a few lines of code, but it also gives you the flexibility to do more advanced projects such as display menu items and select them using the buttons.&lt;br /&gt;
&lt;br /&gt;
'''Power Requirements'''&lt;br /&gt;
&lt;br /&gt;
The LCD &amp;amp; Keypad Shield requires a good 5V power supply to ensure the backlight fully illuminates and the display contrast is high, and if you power your Arduino from USB with the LCD Shield attached you may experience a voltage drop over the USB cable. If you have trouble with display contrast or backlight brightness, try attaching a power supply of around 7 to 9Vdc to the 2.1mm DC jack on the Arduino. A typical symptom in an undervoltage situation is that one line of the LCD will show pale rectangles in place of the characters, and the other line will show nothing at all. The Arduino may even continue running normally because it's quite happy at just 4V or so, but the LCD &amp;amp; Keypad Shield won't function.&lt;br /&gt;
&lt;br /&gt;
'''Library Requirements'''&lt;br /&gt;
&lt;br /&gt;
All the hard work of interfacing with the LCD Shield is handled by the LiquidCrystal library, which is included as part of the official Arduino distribution. You can check whether you have it installed by starting up the IDE and looking under Files -&amp;gt; Examples -&amp;gt; LiquidCrystal. If it exists, you're good to go.&lt;br /&gt;
&lt;br /&gt;
'''Minimal Display Example'''&lt;br /&gt;
&lt;br /&gt;
To start up the LCD and display a message, open a new sketch in the Arduino IDE and paste in the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;LiquidCrystal.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 );&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  lcd.begin(16, 2);&lt;br /&gt;
  lcd.print(&amp;quot;hello, world!&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
    // your main loop code here...&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Reading The Buttons'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The LCD Shield includes 5 buttons designed for use as navigational or control input. The buttons are arranged in a handy pattern and referred to as UP, DOWN, LEFT, RIGHT, and SELECT, but of course it's totally up to your sketch to decide what to do when any particular button is pressed.&lt;br /&gt;
&lt;br /&gt;
All the buttons are connected to a single analog input, A0, using a chain of resistors that causes a different reference voltage to be applied to A0 depending on which button is pressed. This section of the shield schematic shows the input buttons and associated resistors:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Lcd-button-ladder.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
As you can see, if no button is being pressed the voltage on A0 will be pulled all the way up to 5V by the 2K resistor called R6. In that situation none of the other resistors have any effect at all, and the analog reading on A0 will be hard on the upper limit of 1023. Therefore if you perform an analogRead() call on A0 and it returns 1023 (or any value above about 1000) you know that no buttons are being pressed.&lt;br /&gt;
&lt;br /&gt;
Now consider what happens if the &amp;quot;DOWN&amp;quot; button is pressed. Now A0 is being presented with a voltage that is divided between the 2K resistor that is trying to pull it up to 5V, and the 330R and 620R resistors in series (totaling 950R) that are trying to pull it down to 0V. The voltage presented to A0 in that case is about 1.61V, which means if you perform an analogRead() on A0 it will return a value of about 329. So if you read a value of about 329 from A0 you know the &amp;quot;DOWN&amp;quot; button is being pressed.&lt;br /&gt;
&lt;br /&gt;
The same principle applies for the other buttons, with the voltages and equivalent analogRead() values shown on the schematic above.&lt;br /&gt;
&lt;br /&gt;
This is a neat way to provide a whole set of input buttons while only using up one of the I/O pins on your Arduino, leaving more pins free for use in your project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Complex Example'''&lt;br /&gt;
&lt;br /&gt;
The extensive example below combines a number of techniques to demonstrate how to show messages on the LCD, read from the buttons, and change the display message depending on which buttons are pressed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 &lt;br /&gt;
  This example code is in the public domain.&lt;br /&gt;
  &lt;br /&gt;
  ---------------------------------------------------------------------&lt;br /&gt;
  &lt;br /&gt;
  This program demonstrates button detection, LCD text/number printing,&lt;br /&gt;
  and LCD backlight control on the Freetronics LCD &amp;amp; Keypad Shield, connected to an Arduino board.&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  Pins used by LCD &amp;amp; Keypad Shield:&lt;br /&gt;
  &lt;br /&gt;
    A0: Buttons, analog input from voltage ladder&lt;br /&gt;
    D4: LCD bit 4&lt;br /&gt;
    D5: LCD bit 5&lt;br /&gt;
    D6: LCD bit 6&lt;br /&gt;
    D7: LCD bit 7&lt;br /&gt;
    D8: LCD RS&lt;br /&gt;
    D9: LCD E&lt;br /&gt;
    D10: LCD Backlight (high = on, also has pullup high so default is on)&lt;br /&gt;
  &lt;br /&gt;
  ADC voltages for the 5 buttons on analog input pin A0:&lt;br /&gt;
  &lt;br /&gt;
    RIGHT:  0.00V :   0 @ 8bit ;   0 @ 10 bit&lt;br /&gt;
    UP:     0.71V :  36 @ 8bit ; 145 @ 10 bit&lt;br /&gt;
    DOWN:   1.61V :  82 @ 8bit ; 329 @ 10 bit&lt;br /&gt;
    LEFT:   2.47V : 126 @ 8bit ; 505 @ 10 bit&lt;br /&gt;
    SELECT: 3.62V : 185 @ 8bit ; 741 @ 10 bit&lt;br /&gt;
*/&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  Includes&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
#include &amp;lt;LiquidCrystal.h&amp;gt;   // include LCD library&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  Defines&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
// Pins in use&lt;br /&gt;
#define BUTTON_ADC_PIN           A0  // A0 is the button ADC input&lt;br /&gt;
#define LCD_BACKLIGHT_PIN         10  // D10 controls LCD backlight&lt;br /&gt;
// ADC readings expected for the 5 buttons on the ADC input&lt;br /&gt;
#define RIGHT_10BIT_ADC           0  // right&lt;br /&gt;
#define UP_10BIT_ADC            145  // up&lt;br /&gt;
#define DOWN_10BIT_ADC          329  // down&lt;br /&gt;
#define LEFT_10BIT_ADC          505  // left&lt;br /&gt;
#define SELECT_10BIT_ADC        741  // right&lt;br /&gt;
#define BUTTONHYSTERESIS         10  // hysteresis for valid button sensing window&lt;br /&gt;
//return values for ReadButtons()&lt;br /&gt;
#define BUTTON_NONE               0  // &lt;br /&gt;
#define BUTTON_RIGHT              1  // &lt;br /&gt;
#define BUTTON_UP                 2  // &lt;br /&gt;
#define BUTTON_DOWN               3  // &lt;br /&gt;
#define BUTTON_LEFT               4  // &lt;br /&gt;
#define BUTTON_SELECT             5  // &lt;br /&gt;
//some example macros with friendly labels for LCD backlight/pin control, tested and can be swapped into the example code as you like&lt;br /&gt;
#define LCD_BACKLIGHT_OFF()     digitalWrite( LCD_BACKLIGHT_PIN, LOW )&lt;br /&gt;
#define LCD_BACKLIGHT_ON()      digitalWrite( LCD_BACKLIGHT_PIN, HIGH )&lt;br /&gt;
#define LCD_BACKLIGHT(state)    { if( state ){digitalWrite( LCD_BACKLIGHT_PIN, HIGH );}else{digitalWrite( LCD_BACKLIGHT_PIN, LOW );} }&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  Variables&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
byte buttonJustPressed  = false;         //this will be true after a ReadButtons() call if triggered&lt;br /&gt;
byte buttonJustReleased = false;         //this will be true after a ReadButtons() call if triggered&lt;br /&gt;
byte buttonWas          = BUTTON_NONE;   //used by ReadButtons() for detection of button events&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  Init the LCD library with the LCD pins to be used&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 );   //Pins for the freetronics 16x2 LCD shield. LCD: ( RS, E, LCD-D4, LCD-D5, LCD-D6, LCD-D7 )&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  setup()&lt;br /&gt;
  Called by the Arduino framework once, before the main loop begins&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
   //button adc input&lt;br /&gt;
   pinMode( BUTTON_ADC_PIN, INPUT );         //ensure A0 is an input&lt;br /&gt;
   digitalWrite( BUTTON_ADC_PIN, LOW );      //ensure pullup is off on A0&lt;br /&gt;
   //lcd backlight control&lt;br /&gt;
   digitalWrite( LCD_BACKLIGHT_PIN, HIGH );  //backlight control pin D3 is high (on)&lt;br /&gt;
   pinMode( LCD_BACKLIGHT_PIN, OUTPUT );     //D3 is an output&lt;br /&gt;
   //set up the LCD number of columns and rows: &lt;br /&gt;
   lcd.begin( 16, 2 );&lt;br /&gt;
   //Print some initial text to the LCD.&lt;br /&gt;
   lcd.setCursor( 0, 0 );   //top left&lt;br /&gt;
   //          1234567890123456&lt;br /&gt;
   lcd.print( &amp;quot;LinkSprite  16x2&amp;quot; );&lt;br /&gt;
   //&lt;br /&gt;
   lcd.setCursor( 0, 1 );   //bottom left&lt;br /&gt;
   //          1234567890123456&lt;br /&gt;
   lcd.print( &amp;quot;Btn:&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  loop()&lt;br /&gt;
  Arduino main loop&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
   byte button;&lt;br /&gt;
   byte timestamp;&lt;br /&gt;
   &lt;br /&gt;
   //get the latest button pressed, also the buttonJustPressed, buttonJustReleased flags&lt;br /&gt;
   button = ReadButtons();&lt;br /&gt;
   //blank the demo text line if a new button is pressed or released, ready for a new label to be written&lt;br /&gt;
   if( buttonJustPressed || buttonJustReleased )&lt;br /&gt;
   {&lt;br /&gt;
     lcd.setCursor( 4, 1 );&lt;br /&gt;
     lcd.print( &amp;quot;            &amp;quot; );&lt;br /&gt;
   }&lt;br /&gt;
   //show text label for the button pressed&lt;br /&gt;
   switch( button )&lt;br /&gt;
   {&lt;br /&gt;
      case BUTTON_NONE:&lt;br /&gt;
      {&lt;br /&gt;
         break;&lt;br /&gt;
      }&lt;br /&gt;
      case BUTTON_RIGHT:&lt;br /&gt;
      {&lt;br /&gt;
         lcd.setCursor( 4, 1 );&lt;br /&gt;
         lcd.print( &amp;quot;RIGHT&amp;quot; );&lt;br /&gt;
         break;&lt;br /&gt;
      }&lt;br /&gt;
      case BUTTON_UP:&lt;br /&gt;
      {&lt;br /&gt;
         lcd.setCursor( 4, 1 );&lt;br /&gt;
         lcd.print( &amp;quot;UP&amp;quot; );&lt;br /&gt;
         break;&lt;br /&gt;
      }&lt;br /&gt;
      case BUTTON_DOWN:&lt;br /&gt;
      {&lt;br /&gt;
         lcd.setCursor( 4, 1 );&lt;br /&gt;
         lcd.print( &amp;quot;DOWN&amp;quot; );&lt;br /&gt;
         break;&lt;br /&gt;
      }&lt;br /&gt;
      case BUTTON_LEFT:&lt;br /&gt;
      {&lt;br /&gt;
        lcd.setCursor( 4, 1 );&lt;br /&gt;
        lcd.print( &amp;quot;LEFT&amp;quot; );&lt;br /&gt;
        break;&lt;br /&gt;
     }&lt;br /&gt;
     case BUTTON_SELECT:&lt;br /&gt;
     {&lt;br /&gt;
        lcd.setCursor( 4, 1 );&lt;br /&gt;
        lcd.print( &amp;quot;SELECT-FLASH&amp;quot; );    &lt;br /&gt;
        &lt;br /&gt;
        //SELECT is a special case, it pulses the LCD backlight off and on for demo&lt;br /&gt;
        digitalWrite( LCD_BACKLIGHT_PIN, LOW );&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        digitalWrite( LCD_BACKLIGHT_PIN, HIGH );   //leave the backlight on at exit&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        &lt;br /&gt;
        /* an example of LCD backlight control via macros with nice labels&lt;br /&gt;
        LCD_BACKLIGHT_OFF();&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        LCD_BACKLIGHT_ON();   //leave the backlight on at exit&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        */&lt;br /&gt;
        &lt;br /&gt;
        /*&lt;br /&gt;
        // an example of LCD backlight control via a macro with nice label, called with a value&lt;br /&gt;
        LCD_BACKLIGHT(false);&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        LCD_BACKLIGHT(true);   //leave the backlight on at exit&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        */&lt;br /&gt;
        &lt;br /&gt;
        break;&lt;br /&gt;
      }&lt;br /&gt;
      default:&lt;br /&gt;
     {&lt;br /&gt;
        break;&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   // print the number of seconds since reset (two digits only)&lt;br /&gt;
   timestamp = ( (millis() / 1000) % 100 );   //&amp;quot;% 100&amp;quot; is the remainder of a divide-by-100, which keeps the value as 0-99 even as the result goes over 100&lt;br /&gt;
   lcd.setCursor( 14, 1 );&lt;br /&gt;
   if( timestamp &amp;lt;= 9 )&lt;br /&gt;
      lcd.print( &amp;quot; &amp;quot; );   //quick trick to right-justify this 2 digit value when it's a single digit&lt;br /&gt;
   lcd.print( timestamp, DEC );&lt;br /&gt;
/*  &lt;br /&gt;
   //debug/test display of the adc reading for the button input voltage pin.&lt;br /&gt;
   lcd.setCursor(12, 0);&lt;br /&gt;
   lcd.print( &amp;quot;    &amp;quot; );          //quick hack to blank over default left-justification from lcd.print()&lt;br /&gt;
   lcd.setCursor(12, 0);         //note the value will be flickering/faint on the LCD&lt;br /&gt;
   lcd.print( analogRead( BUTTON_ADC_PIN ) );&lt;br /&gt;
*/&lt;br /&gt;
   //clear the buttonJustPressed or buttonJustReleased flags, they've already done their job now.&lt;br /&gt;
   if( buttonJustPressed )&lt;br /&gt;
      buttonJustPressed = false;&lt;br /&gt;
   if( buttonJustReleased )&lt;br /&gt;
      buttonJustReleased = false;&lt;br /&gt;
}&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  ReadButtons()&lt;br /&gt;
  Detect the button pressed and return the value&lt;br /&gt;
  Uses global values buttonWas, buttonJustPressed, buttonJustReleased.&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
byte ReadButtons()&lt;br /&gt;
{&lt;br /&gt;
   unsigned int buttonVoltage;&lt;br /&gt;
   byte button = BUTTON_NONE;   // return no button pressed if the below checks don't write to btn&lt;br /&gt;
   &lt;br /&gt;
   //read the button ADC pin voltage&lt;br /&gt;
   buttonVoltage = analogRead( BUTTON_ADC_PIN );&lt;br /&gt;
   //sense if the voltage falls within valid voltage windows&lt;br /&gt;
   if( buttonVoltage &amp;lt; ( RIGHT_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_RIGHT;&lt;br /&gt;
   }&lt;br /&gt;
   else if(   buttonVoltage &amp;gt;= ( UP_10BIT_ADC - BUTTONHYSTERESIS )&lt;br /&gt;
           &amp;amp;&amp;amp; buttonVoltage &amp;lt;= ( UP_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_UP;&lt;br /&gt;
   }&lt;br /&gt;
   else if(   buttonVoltage &amp;gt;= ( DOWN_10BIT_ADC - BUTTONHYSTERESIS )&lt;br /&gt;
           &amp;amp;&amp;amp; buttonVoltage &amp;lt;= ( DOWN_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_DOWN;&lt;br /&gt;
   }&lt;br /&gt;
   else if(   buttonVoltage &amp;gt;= ( LEFT_10BIT_ADC - BUTTONHYSTERESIS )&lt;br /&gt;
           &amp;amp;&amp;amp; buttonVoltage &amp;lt;= ( LEFT_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_LEFT;&lt;br /&gt;
   }&lt;br /&gt;
   else if(   buttonVoltage &amp;gt;= ( SELECT_10BIT_ADC - BUTTONHYSTERESIS )&lt;br /&gt;
           &amp;amp;&amp;amp; buttonVoltage &amp;lt;= ( SELECT_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_SELECT;&lt;br /&gt;
   }&lt;br /&gt;
   //handle button flags for just pressed and just released events&lt;br /&gt;
   if( ( buttonWas == BUTTON_NONE ) &amp;amp;&amp;amp; ( button != BUTTON_NONE ) )&lt;br /&gt;
   {&lt;br /&gt;
      //the button was just pressed, set buttonJustPressed, this can optionally be used to trigger a once-off action for a button press event&lt;br /&gt;
      //it's the duty of the receiver to clear these flags if it wants to detect a new button change event&lt;br /&gt;
      buttonJustPressed  = true;&lt;br /&gt;
      buttonJustReleased = false;&lt;br /&gt;
   }&lt;br /&gt;
   if( ( buttonWas != BUTTON_NONE ) &amp;amp;&amp;amp; ( button == BUTTON_NONE ) )&lt;br /&gt;
   {&lt;br /&gt;
      buttonJustPressed  = false;&lt;br /&gt;
      buttonJustReleased = true;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   //save the latest button value, for change event detection next time round&lt;br /&gt;
   buttonWas = button;&lt;br /&gt;
   &lt;br /&gt;
   return( button );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== pcDuino Sample Code  ==&lt;br /&gt;
&lt;br /&gt;
== FAQ  ==&lt;br /&gt;
Please list your question here:&lt;br /&gt;
&lt;br /&gt;
== Support  ==&lt;br /&gt;
&lt;br /&gt;
If you have questions or other better design ideas, you can go to our [http://www.linksprite.com/forum/index.php forum] to discuss or creat a ticket for your issue at [http://www.linksprite.com/support/ linksprite support].&lt;br /&gt;
&lt;br /&gt;
== Resources  ==&lt;br /&gt;
&lt;br /&gt;
*PDF Files&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/lcd-datasheet-dfr0009.pdf LCD Datasheet]&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/HD44780.pdf HD44780 Datasheet]&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/ZYMC1602-17.pdf  16x2 LCD Datasheet]&lt;br /&gt;
&lt;br /&gt;
*ZIP Files&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/LCD4Bit_mod.zip LCD 4Bit Mod]&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/lcd-keypad-library-dfr0009.zip LCD Keypad Library]&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/key-grabber-library-v2-dfr0009.zip Key Grabber Library V2]&lt;br /&gt;
&lt;br /&gt;
== How to buy  ==&lt;br /&gt;
&lt;br /&gt;
== See Also  ==&lt;br /&gt;
&lt;br /&gt;
Other related products and resources.&lt;br /&gt;
&lt;br /&gt;
== Licensing  ==&lt;br /&gt;
&lt;br /&gt;
This documentation is licensed under the Creative Commons [http://creativecommons.org/licenses/by-sa/3.0/ Attribution-ShareAlike License 3.0] Source code and libraries are licensed under [http://www.gnu.org/licenses/gpl.html GPL/LGPL], see source code files for details.&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=16_X_2_LCD_Keypad_Shield_for_Arduino&amp;diff=3579</id>
		<title>16 X 2 LCD Keypad Shield for Arduino</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=16_X_2_LCD_Keypad_Shield_for_Arduino&amp;diff=3579"/>
		<updated>2013-08-30T02:21:33Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction  ==&lt;br /&gt;
&lt;br /&gt;
We wanted to make it easier for people to get these LCD into their projects so we devised a shield that lets you control a 16x2 Character LCD backlight with a potentiometer AND 5 keypad pins using 6 digital pins on the Arduino!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This shield is perfect for when you want to build a stand-alone project with its own user interface. The 4 directional buttons plus select button allows basic control without having to attach a bulky computer. &lt;br /&gt;
&lt;br /&gt;
*Comes with a 16x2 green backlight LCD, negative display&lt;br /&gt;
*Plug and play with any Arduino 'classic' - UNO, duemilanove, diecimilla, etc.&lt;br /&gt;
*Uses 6 pins of Arduino to control LCD and A0 pin for 5 buttons. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The LCD and Keypad Shield gives you a handy 16-character by 2-line display, 5 buttons and a controllable backlight, plug it straight in on top of your Arduino board or other project shields. The display is set behind the shield for a low profile fitment and nice look and we've included panel mounting screw holes in the corners.&lt;br /&gt;
&lt;br /&gt;
It's great when you want to build a stand-alone project with its own user interface that doesn't require a computer attached to send commands to your Arduino.&lt;br /&gt;
&lt;br /&gt;
Works perfectly in 4-bit mode with the &amp;quot;LiquidCrystal&amp;quot; library included with the Arduino IDE, allowing you to control the LCD with a total of just 6 digital I/O lines. We've deliberately picked D4-D9 so that it doesn't interfere with pins required by other popular products such as the Ethernet Shield and EtherTen, so you can stack this on top of other shields to give you a local display.&lt;br /&gt;
&lt;br /&gt;
The buttons provide &amp;quot;left&amp;quot;, &amp;quot;right&amp;quot;, &amp;quot;up&amp;quot;, &amp;quot;down&amp;quot;, and &amp;quot;select&amp;quot; while using just one analog input. That leaves the other analog inputs free for you to use in your projects.&lt;br /&gt;
&lt;br /&gt;
The LCD backlight is connected to a potentiometer can be controlled for on/off, brightness.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:1602 LCD shield-A01.jpg]] [Model A]&lt;br /&gt;
 &lt;br /&gt;
[[File:1602 lcd keypad shield-02.jpg | 400px]] [Model B]&lt;br /&gt;
&lt;br /&gt;
== Features  ==&lt;br /&gt;
*16x2 LCD using HD44780-compatible display module (black characters on green background).&lt;br /&gt;
*5 buttons on one analog input (A0).&lt;br /&gt;
*LCD backlight with current limiting, brightness and on/off controllable by a adjustable potentiometer.&lt;br /&gt;
*Recessed LCD, panel mount screw holes and button layout suitable for panel or cabinet mounting if desired.&lt;br /&gt;
*Reset button.&lt;br /&gt;
*Power supply smoothing capacitor.&lt;br /&gt;
&lt;br /&gt;
== Application Ideas  ==&lt;br /&gt;
'''test code'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;LiquidCrystal.h&amp;gt;&lt;br /&gt;
#include &amp;lt;LCDKeypad.h&amp;gt;&lt;br /&gt;
LiquidCrystal lcd(8, 13, 9, 4, 5, 6, 7);&lt;br /&gt;
char msgs[5][16] = {&amp;quot;Right Key OK &amp;quot;,&lt;br /&gt;
                    &amp;quot;Up Key OK    &amp;quot;,               &lt;br /&gt;
                    &amp;quot;Down Key OK  &amp;quot;,&lt;br /&gt;
                    &amp;quot;Left Key OK  &amp;quot;,&lt;br /&gt;
                    &amp;quot;Select Key OK&amp;quot; };&lt;br /&gt;
int adc_key_val[5] ={50, 200, 400, 600, 800 };&lt;br /&gt;
int NUM_KEYS = 5;&lt;br /&gt;
int adc_key_in;&lt;br /&gt;
int key=-1;&lt;br /&gt;
int oldkey=-1;&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  lcd.begin(16, 2);&lt;br /&gt;
  lcd.clear();&lt;br /&gt;
  lcd.setCursor(0,0);&lt;br /&gt;
  lcd.print(&amp;quot;     helle! &amp;quot;);&lt;br /&gt;
  lcd.print(&amp;quot;      welcome!&amp;quot;);&lt;br /&gt;
  lcd.setCursor(0,1);&lt;br /&gt;
  lcd.print(&amp;quot;   LinkSprite&amp;quot;);&lt;br /&gt;
  lcd.print(&amp;quot;    LCD Shield&amp;quot;);&lt;br /&gt;
  delay(1000);&lt;br /&gt;
  &lt;br /&gt;
  lcd.setCursor(0,0);&lt;br /&gt;
  for (char k=0;k&amp;lt;26;k++)&lt;br /&gt;
  {&lt;br /&gt;
    lcd.scrollDisplayLeft();&lt;br /&gt;
    delay(400);&lt;br /&gt;
  }&lt;br /&gt;
  lcd.clear();&lt;br /&gt;
  lcd.setCursor(0,0); &lt;br /&gt;
  lcd.print(&amp;quot;ADC key testing&amp;quot;); &lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
   adc_key_in = analogRead(0);    // read the value from the sensor &lt;br /&gt;
   key = get_key(adc_key_in);  // convert into key press&lt;br /&gt;
   if (key != oldkey)   // if keypress is detected&lt;br /&gt;
   {&lt;br /&gt;
     delay(50);  // wait for debounce time&lt;br /&gt;
     adc_key_in = analogRead(0);    // read the value from the sensor &lt;br /&gt;
     key = get_key(adc_key_in);    // convert into key press&lt;br /&gt;
     if (key != oldkey)    &lt;br /&gt;
     {   &lt;br /&gt;
       lcd.setCursor(0, 1);&lt;br /&gt;
       oldkey = key;&lt;br /&gt;
       if (key &amp;gt;=0)&lt;br /&gt;
       {&lt;br /&gt;
           lcd.print(msgs[key]);              &lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   delay(100);&lt;br /&gt;
}&lt;br /&gt;
// Convert ADC value to key number&lt;br /&gt;
int get_key(unsigned int input)&lt;br /&gt;
{&lt;br /&gt;
    int k;&lt;br /&gt;
    for (k = 0; k &amp;lt; NUM_KEYS; k++)&lt;br /&gt;
    {&lt;br /&gt;
      if (input &amp;lt; adc_key_val[k])&lt;br /&gt;
      {&lt;br /&gt;
        return k;&lt;br /&gt;
      }&lt;br /&gt;
    }   &lt;br /&gt;
    if (k &amp;gt;= NUM_KEYS)k = -1;  // No valid key pressed&lt;br /&gt;
    return k;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Cautions  ==&lt;br /&gt;
&lt;br /&gt;
The warnings and wrong operations possible cause dangerous. &lt;br /&gt;
&lt;br /&gt;
== Schematic  ==&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/Schemetics.pd Schematic in PDF]&lt;br /&gt;
&lt;br /&gt;
== Specification  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;width: 50%&amp;quot; align=&amp;quot;center&amp;quot; | Item &lt;br /&gt;
! scope=&amp;quot;col&amp;quot; align=&amp;quot;center&amp;quot; | Min &lt;br /&gt;
! scope=&amp;quot;col&amp;quot; align=&amp;quot;center&amp;quot; | Typical &lt;br /&gt;
! scope=&amp;quot;col&amp;quot; align=&amp;quot;center&amp;quot; | Max &lt;br /&gt;
! scope=&amp;quot;col&amp;quot; align=&amp;quot;center&amp;quot; | Unit&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | Voltage &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 4.3&lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 5.0 &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 4.7&lt;br /&gt;
| align=&amp;quot;center&amp;quot; | V&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | Current &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 39.6&lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 53.3 &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 65.0&lt;br /&gt;
| align=&amp;quot;center&amp;quot; | mA&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | Dimension &lt;br /&gt;
| align=&amp;quot;center&amp;quot; colspan=&amp;quot;3&amp;quot; | 79.5x55.1x16.6 &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | mm&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | Net Weight &lt;br /&gt;
| align=&amp;quot;center&amp;quot; colspan=&amp;quot;3&amp;quot; | 55.0 &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | g&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Pin definition and Rating  ==&lt;br /&gt;
&lt;br /&gt;
*A0: Buttons&lt;br /&gt;
*D4: LCD bit 4&lt;br /&gt;
*D5: LCD bit 5&lt;br /&gt;
*D6: LCD bit 6&lt;br /&gt;
*D7: LCD bit 7&lt;br /&gt;
*D8: LCD RS&lt;br /&gt;
*D9: LCD Enable&lt;br /&gt;
*LCD backlight with current limiting, brightness and on/off controllable by D10.&lt;br /&gt;
&lt;br /&gt;
== Mechanic Dimensions  ==&lt;br /&gt;
&lt;br /&gt;
== Usage  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 16x2 LCD And Keypad Shield is very simple to use because it's fully compatible with the Arduino &amp;quot;LiquidCrystal&amp;quot; library. You can initialise the LCD and display messages on it with just a few lines of code, but it also gives you the flexibility to do more advanced projects such as display menu items and select them using the buttons.&lt;br /&gt;
&lt;br /&gt;
'''Power Requirements'''&lt;br /&gt;
&lt;br /&gt;
The LCD &amp;amp; Keypad Shield requires a good 5V power supply to ensure the backlight fully illuminates and the display contrast is high, and if you power your Arduino from USB with the LCD Shield attached you may experience a voltage drop over the USB cable. If you have trouble with display contrast or backlight brightness, try attaching a power supply of around 7 to 9Vdc to the 2.1mm DC jack on the Arduino. A typical symptom in an undervoltage situation is that one line of the LCD will show pale rectangles in place of the characters, and the other line will show nothing at all. The Arduino may even continue running normally because it's quite happy at just 4V or so, but the LCD &amp;amp; Keypad Shield won't function.&lt;br /&gt;
&lt;br /&gt;
'''Library Requirements'''&lt;br /&gt;
&lt;br /&gt;
All the hard work of interfacing with the LCD Shield is handled by the LiquidCrystal library, which is included as part of the official Arduino distribution. You can check whether you have it installed by starting up the IDE and looking under Files -&amp;gt; Examples -&amp;gt; LiquidCrystal. If it exists, you're good to go.&lt;br /&gt;
&lt;br /&gt;
'''Minimal Display Example'''&lt;br /&gt;
&lt;br /&gt;
To start up the LCD and display a message, open a new sketch in the Arduino IDE and paste in the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;LiquidCrystal.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 );&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  lcd.begin(16, 2);&lt;br /&gt;
  lcd.print(&amp;quot;hello, world!&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
    // your main loop code here...&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Reading The Buttons'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The LCD Shield includes 5 buttons designed for use as navigational or control input. The buttons are arranged in a handy pattern and referred to as UP, DOWN, LEFT, RIGHT, and SELECT, but of course it's totally up to your sketch to decide what to do when any particular button is pressed.&lt;br /&gt;
&lt;br /&gt;
All the buttons are connected to a single analog input, A0, using a chain of resistors that causes a different reference voltage to be applied to A0 depending on which button is pressed. This section of the shield schematic shows the input buttons and associated resistors:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Lcd-button-ladder.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
As you can see, if no button is being pressed the voltage on A0 will be pulled all the way up to 5V by the 2K resistor called R6. In that situation none of the other resistors have any effect at all, and the analog reading on A0 will be hard on the upper limit of 1023. Therefore if you perform an analogRead() call on A0 and it returns 1023 (or any value above about 1000) you know that no buttons are being pressed.&lt;br /&gt;
&lt;br /&gt;
Now consider what happens if the &amp;quot;DOWN&amp;quot; button is pressed. Now A0 is being presented with a voltage that is divided between the 2K resistor that is trying to pull it up to 5V, and the 330R and 620R resistors in series (totaling 950R) that are trying to pull it down to 0V. The voltage presented to A0 in that case is about 1.61V, which means if you perform an analogRead() on A0 it will return a value of about 329. So if you read a value of about 329 from A0 you know the &amp;quot;DOWN&amp;quot; button is being pressed.&lt;br /&gt;
&lt;br /&gt;
The same principle applies for the other buttons, with the voltages and equivalent analogRead() values shown on the schematic above.&lt;br /&gt;
&lt;br /&gt;
This is a neat way to provide a whole set of input buttons while only using up one of the I/O pins on your Arduino, leaving more pins free for use in your project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Complex Example'''&lt;br /&gt;
&lt;br /&gt;
The extensive example below combines a number of techniques to demonstrate how to show messages on the LCD, read from the buttons, and change the display message depending on which buttons are pressed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 &lt;br /&gt;
  This example code is in the public domain.&lt;br /&gt;
  &lt;br /&gt;
  ---------------------------------------------------------------------&lt;br /&gt;
  &lt;br /&gt;
  This program demonstrates button detection, LCD text/number printing,&lt;br /&gt;
  and LCD backlight control on the Freetronics LCD &amp;amp; Keypad Shield, connected to an Arduino board.&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  Pins used by LCD &amp;amp; Keypad Shield:&lt;br /&gt;
  &lt;br /&gt;
    A0: Buttons, analog input from voltage ladder&lt;br /&gt;
    D4: LCD bit 4&lt;br /&gt;
    D5: LCD bit 5&lt;br /&gt;
    D6: LCD bit 6&lt;br /&gt;
    D7: LCD bit 7&lt;br /&gt;
    D8: LCD RS&lt;br /&gt;
    D9: LCD E&lt;br /&gt;
    D10: LCD Backlight (high = on, also has pullup high so default is on)&lt;br /&gt;
  &lt;br /&gt;
  ADC voltages for the 5 buttons on analog input pin A0:&lt;br /&gt;
  &lt;br /&gt;
    RIGHT:  0.00V :   0 @ 8bit ;   0 @ 10 bit&lt;br /&gt;
    UP:     0.71V :  36 @ 8bit ; 145 @ 10 bit&lt;br /&gt;
    DOWN:   1.61V :  82 @ 8bit ; 329 @ 10 bit&lt;br /&gt;
    LEFT:   2.47V : 126 @ 8bit ; 505 @ 10 bit&lt;br /&gt;
    SELECT: 3.62V : 185 @ 8bit ; 741 @ 10 bit&lt;br /&gt;
*/&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  Includes&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
#include &amp;lt;LiquidCrystal.h&amp;gt;   // include LCD library&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  Defines&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
// Pins in use&lt;br /&gt;
#define BUTTON_ADC_PIN           A0  // A0 is the button ADC input&lt;br /&gt;
#define LCD_BACKLIGHT_PIN         10  // D10 controls LCD backlight&lt;br /&gt;
// ADC readings expected for the 5 buttons on the ADC input&lt;br /&gt;
#define RIGHT_10BIT_ADC           0  // right&lt;br /&gt;
#define UP_10BIT_ADC            145  // up&lt;br /&gt;
#define DOWN_10BIT_ADC          329  // down&lt;br /&gt;
#define LEFT_10BIT_ADC          505  // left&lt;br /&gt;
#define SELECT_10BIT_ADC        741  // right&lt;br /&gt;
#define BUTTONHYSTERESIS         10  // hysteresis for valid button sensing window&lt;br /&gt;
//return values for ReadButtons()&lt;br /&gt;
#define BUTTON_NONE               0  // &lt;br /&gt;
#define BUTTON_RIGHT              1  // &lt;br /&gt;
#define BUTTON_UP                 2  // &lt;br /&gt;
#define BUTTON_DOWN               3  // &lt;br /&gt;
#define BUTTON_LEFT               4  // &lt;br /&gt;
#define BUTTON_SELECT             5  // &lt;br /&gt;
//some example macros with friendly labels for LCD backlight/pin control, tested and can be swapped into the example code as you like&lt;br /&gt;
#define LCD_BACKLIGHT_OFF()     digitalWrite( LCD_BACKLIGHT_PIN, LOW )&lt;br /&gt;
#define LCD_BACKLIGHT_ON()      digitalWrite( LCD_BACKLIGHT_PIN, HIGH )&lt;br /&gt;
#define LCD_BACKLIGHT(state)    { if( state ){digitalWrite( LCD_BACKLIGHT_PIN, HIGH );}else{digitalWrite( LCD_BACKLIGHT_PIN, LOW );} }&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  Variables&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
byte buttonJustPressed  = false;         //this will be true after a ReadButtons() call if triggered&lt;br /&gt;
byte buttonJustReleased = false;         //this will be true after a ReadButtons() call if triggered&lt;br /&gt;
byte buttonWas          = BUTTON_NONE;   //used by ReadButtons() for detection of button events&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  Init the LCD library with the LCD pins to be used&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 );   //Pins for the freetronics 16x2 LCD shield. LCD: ( RS, E, LCD-D4, LCD-D5, LCD-D6, LCD-D7 )&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  setup()&lt;br /&gt;
  Called by the Arduino framework once, before the main loop begins&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
   //button adc input&lt;br /&gt;
   pinMode( BUTTON_ADC_PIN, INPUT );         //ensure A0 is an input&lt;br /&gt;
   digitalWrite( BUTTON_ADC_PIN, LOW );      //ensure pullup is off on A0&lt;br /&gt;
   //lcd backlight control&lt;br /&gt;
   digitalWrite( LCD_BACKLIGHT_PIN, HIGH );  //backlight control pin D3 is high (on)&lt;br /&gt;
   pinMode( LCD_BACKLIGHT_PIN, OUTPUT );     //D3 is an output&lt;br /&gt;
   //set up the LCD number of columns and rows: &lt;br /&gt;
   lcd.begin( 16, 2 );&lt;br /&gt;
   //Print some initial text to the LCD.&lt;br /&gt;
   lcd.setCursor( 0, 0 );   //top left&lt;br /&gt;
   //          1234567890123456&lt;br /&gt;
   lcd.print( &amp;quot;LinkSprite  16x2&amp;quot; );&lt;br /&gt;
   //&lt;br /&gt;
   lcd.setCursor( 0, 1 );   //bottom left&lt;br /&gt;
   //          1234567890123456&lt;br /&gt;
   lcd.print( &amp;quot;Btn:&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  loop()&lt;br /&gt;
  Arduino main loop&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
   byte button;&lt;br /&gt;
   byte timestamp;&lt;br /&gt;
   &lt;br /&gt;
   //get the latest button pressed, also the buttonJustPressed, buttonJustReleased flags&lt;br /&gt;
   button = ReadButtons();&lt;br /&gt;
   //blank the demo text line if a new button is pressed or released, ready for a new label to be written&lt;br /&gt;
   if( buttonJustPressed || buttonJustReleased )&lt;br /&gt;
   {&lt;br /&gt;
     lcd.setCursor( 4, 1 );&lt;br /&gt;
     lcd.print( &amp;quot;            &amp;quot; );&lt;br /&gt;
   }&lt;br /&gt;
   //show text label for the button pressed&lt;br /&gt;
   switch( button )&lt;br /&gt;
   {&lt;br /&gt;
      case BUTTON_NONE:&lt;br /&gt;
      {&lt;br /&gt;
         break;&lt;br /&gt;
      }&lt;br /&gt;
      case BUTTON_RIGHT:&lt;br /&gt;
      {&lt;br /&gt;
         lcd.setCursor( 4, 1 );&lt;br /&gt;
         lcd.print( &amp;quot;RIGHT&amp;quot; );&lt;br /&gt;
         break;&lt;br /&gt;
      }&lt;br /&gt;
      case BUTTON_UP:&lt;br /&gt;
      {&lt;br /&gt;
         lcd.setCursor( 4, 1 );&lt;br /&gt;
         lcd.print( &amp;quot;UP&amp;quot; );&lt;br /&gt;
         break;&lt;br /&gt;
      }&lt;br /&gt;
      case BUTTON_DOWN:&lt;br /&gt;
      {&lt;br /&gt;
         lcd.setCursor( 4, 1 );&lt;br /&gt;
         lcd.print( &amp;quot;DOWN&amp;quot; );&lt;br /&gt;
         break;&lt;br /&gt;
      }&lt;br /&gt;
      case BUTTON_LEFT:&lt;br /&gt;
      {&lt;br /&gt;
        lcd.setCursor( 4, 1 );&lt;br /&gt;
        lcd.print( &amp;quot;LEFT&amp;quot; );&lt;br /&gt;
        break;&lt;br /&gt;
     }&lt;br /&gt;
     case BUTTON_SELECT:&lt;br /&gt;
     {&lt;br /&gt;
        lcd.setCursor( 4, 1 );&lt;br /&gt;
        lcd.print( &amp;quot;SELECT-FLASH&amp;quot; );    &lt;br /&gt;
        &lt;br /&gt;
        //SELECT is a special case, it pulses the LCD backlight off and on for demo&lt;br /&gt;
        digitalWrite( LCD_BACKLIGHT_PIN, LOW );&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        digitalWrite( LCD_BACKLIGHT_PIN, HIGH );   //leave the backlight on at exit&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        &lt;br /&gt;
        /* an example of LCD backlight control via macros with nice labels&lt;br /&gt;
        LCD_BACKLIGHT_OFF();&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        LCD_BACKLIGHT_ON();   //leave the backlight on at exit&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        */&lt;br /&gt;
        &lt;br /&gt;
        /*&lt;br /&gt;
        // an example of LCD backlight control via a macro with nice label, called with a value&lt;br /&gt;
        LCD_BACKLIGHT(false);&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        LCD_BACKLIGHT(true);   //leave the backlight on at exit&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        */&lt;br /&gt;
        &lt;br /&gt;
        break;&lt;br /&gt;
      }&lt;br /&gt;
      default:&lt;br /&gt;
     {&lt;br /&gt;
        break;&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   // print the number of seconds since reset (two digits only)&lt;br /&gt;
   timestamp = ( (millis() / 1000) % 100 );   //&amp;quot;% 100&amp;quot; is the remainder of a divide-by-100, which keeps the value as 0-99 even as the result goes over 100&lt;br /&gt;
   lcd.setCursor( 14, 1 );&lt;br /&gt;
   if( timestamp &amp;lt;= 9 )&lt;br /&gt;
      lcd.print( &amp;quot; &amp;quot; );   //quick trick to right-justify this 2 digit value when it's a single digit&lt;br /&gt;
   lcd.print( timestamp, DEC );&lt;br /&gt;
/*  &lt;br /&gt;
   //debug/test display of the adc reading for the button input voltage pin.&lt;br /&gt;
   lcd.setCursor(12, 0);&lt;br /&gt;
   lcd.print( &amp;quot;    &amp;quot; );          //quick hack to blank over default left-justification from lcd.print()&lt;br /&gt;
   lcd.setCursor(12, 0);         //note the value will be flickering/faint on the LCD&lt;br /&gt;
   lcd.print( analogRead( BUTTON_ADC_PIN ) );&lt;br /&gt;
*/&lt;br /&gt;
   //clear the buttonJustPressed or buttonJustReleased flags, they've already done their job now.&lt;br /&gt;
   if( buttonJustPressed )&lt;br /&gt;
      buttonJustPressed = false;&lt;br /&gt;
   if( buttonJustReleased )&lt;br /&gt;
      buttonJustReleased = false;&lt;br /&gt;
}&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  ReadButtons()&lt;br /&gt;
  Detect the button pressed and return the value&lt;br /&gt;
  Uses global values buttonWas, buttonJustPressed, buttonJustReleased.&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
byte ReadButtons()&lt;br /&gt;
{&lt;br /&gt;
   unsigned int buttonVoltage;&lt;br /&gt;
   byte button = BUTTON_NONE;   // return no button pressed if the below checks don't write to btn&lt;br /&gt;
   &lt;br /&gt;
   //read the button ADC pin voltage&lt;br /&gt;
   buttonVoltage = analogRead( BUTTON_ADC_PIN );&lt;br /&gt;
   //sense if the voltage falls within valid voltage windows&lt;br /&gt;
   if( buttonVoltage &amp;lt; ( RIGHT_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_RIGHT;&lt;br /&gt;
   }&lt;br /&gt;
   else if(   buttonVoltage &amp;gt;= ( UP_10BIT_ADC - BUTTONHYSTERESIS )&lt;br /&gt;
           &amp;amp;&amp;amp; buttonVoltage &amp;lt;= ( UP_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_UP;&lt;br /&gt;
   }&lt;br /&gt;
   else if(   buttonVoltage &amp;gt;= ( DOWN_10BIT_ADC - BUTTONHYSTERESIS )&lt;br /&gt;
           &amp;amp;&amp;amp; buttonVoltage &amp;lt;= ( DOWN_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_DOWN;&lt;br /&gt;
   }&lt;br /&gt;
   else if(   buttonVoltage &amp;gt;= ( LEFT_10BIT_ADC - BUTTONHYSTERESIS )&lt;br /&gt;
           &amp;amp;&amp;amp; buttonVoltage &amp;lt;= ( LEFT_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_LEFT;&lt;br /&gt;
   }&lt;br /&gt;
   else if(   buttonVoltage &amp;gt;= ( SELECT_10BIT_ADC - BUTTONHYSTERESIS )&lt;br /&gt;
           &amp;amp;&amp;amp; buttonVoltage &amp;lt;= ( SELECT_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_SELECT;&lt;br /&gt;
   }&lt;br /&gt;
   //handle button flags for just pressed and just released events&lt;br /&gt;
   if( ( buttonWas == BUTTON_NONE ) &amp;amp;&amp;amp; ( button != BUTTON_NONE ) )&lt;br /&gt;
   {&lt;br /&gt;
      //the button was just pressed, set buttonJustPressed, this can optionally be used to trigger a once-off action for a button press event&lt;br /&gt;
      //it's the duty of the receiver to clear these flags if it wants to detect a new button change event&lt;br /&gt;
      buttonJustPressed  = true;&lt;br /&gt;
      buttonJustReleased = false;&lt;br /&gt;
   }&lt;br /&gt;
   if( ( buttonWas != BUTTON_NONE ) &amp;amp;&amp;amp; ( button == BUTTON_NONE ) )&lt;br /&gt;
   {&lt;br /&gt;
      buttonJustPressed  = false;&lt;br /&gt;
      buttonJustReleased = true;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   //save the latest button value, for change event detection next time round&lt;br /&gt;
   buttonWas = button;&lt;br /&gt;
   &lt;br /&gt;
   return( button );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== pcDuino Sample Code  ==&lt;br /&gt;
&lt;br /&gt;
== FAQ  ==&lt;br /&gt;
Please list your question here:&lt;br /&gt;
&lt;br /&gt;
== Support  ==&lt;br /&gt;
&lt;br /&gt;
If you have questions or other better design ideas, you can go to our [http://www.linksprite.com/forum/index.php forum] to discuss or creat a ticket for your issue at [http://www.linksprite.com/support/ linksprite support].&lt;br /&gt;
&lt;br /&gt;
== Resources  ==&lt;br /&gt;
&lt;br /&gt;
*PDF Files&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/lcd-datasheet-dfr0009.pdf LCD Datasheet]&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/HD44780.pdf HD44780 Datasheet]&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/ZYMC1602-17.pdf  16x2 LCD Datasheet]&lt;br /&gt;
&lt;br /&gt;
*ZIP Files&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/LCD4Bit_mod.zip LCD 4Bit Mod]&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/lcd-keypad-library-dfr0009.zip LCD Keypad Library]&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/key-grabber-library-v2-dfr0009.zip Key Grabber Library V2]&lt;br /&gt;
&lt;br /&gt;
== How to buy  ==&lt;br /&gt;
&lt;br /&gt;
== See Also  ==&lt;br /&gt;
&lt;br /&gt;
Other related products and resources.&lt;br /&gt;
&lt;br /&gt;
== Licensing  ==&lt;br /&gt;
&lt;br /&gt;
This documentation is licensed under the Creative Commons [http://creativecommons.org/licenses/by-sa/3.0/ Attribution-ShareAlike License 3.0] Source code and libraries are licensed under [http://www.gnu.org/licenses/gpl.html GPL/LGPL], see source code files for details.&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=16_X_2_LCD_Keypad_Shield_for_Arduino&amp;diff=3578</id>
		<title>16 X 2 LCD Keypad Shield for Arduino</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=16_X_2_LCD_Keypad_Shield_for_Arduino&amp;diff=3578"/>
		<updated>2013-08-30T02:20:11Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction  ==&lt;br /&gt;
&lt;br /&gt;
We wanted to make it easier for people to get these LCD into their projects so we devised a shield that lets you control a 16x2 Character LCD backlight with a potentiometer AND 5 keypad pins using 6 digital pins on the Arduino!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This shield is perfect for when you want to build a stand-alone project with its own user interface. The 4 directional buttons plus select button allows basic control without having to attach a bulky computer. &lt;br /&gt;
&lt;br /&gt;
*Comes with a 16x2 green backlight LCD, negative display&lt;br /&gt;
*Plug and play with any Arduino 'classic' - UNO, duemilanove, diecimilla, etc.&lt;br /&gt;
*Uses 6 pins of Arduino to control LCD and A0 pin for 5 buttons. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The LCD and Keypad Shield gives you a handy 16-character by 2-line display, 5 buttons and a controllable backlight, plug it straight in on top of your Arduino board or other project shields. The display is set behind the shield for a low profile fitment and nice look and we've included panel mounting screw holes in the corners.&lt;br /&gt;
&lt;br /&gt;
It's great when you want to build a stand-alone project with its own user interface that doesn't require a computer attached to send commands to your Arduino.&lt;br /&gt;
&lt;br /&gt;
Works perfectly in 4-bit mode with the &amp;quot;LiquidCrystal&amp;quot; library included with the Arduino IDE, allowing you to control the LCD with a total of just 6 digital I/O lines. We've deliberately picked D4-D9 so that it doesn't interfere with pins required by other popular products such as the Ethernet Shield and EtherTen, so you can stack this on top of other shields to give you a local display.&lt;br /&gt;
&lt;br /&gt;
The buttons provide &amp;quot;left&amp;quot;, &amp;quot;right&amp;quot;, &amp;quot;up&amp;quot;, &amp;quot;down&amp;quot;, and &amp;quot;select&amp;quot; while using just one analog input. That leaves the other analog inputs free for you to use in your projects.&lt;br /&gt;
&lt;br /&gt;
The LCD backlight is connected to a potentiometer can be controlled for on/off, brightness.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:1602 LCD shield-A01.jpg]] [Model A]&lt;br /&gt;
 &lt;br /&gt;
[[File:1602 lcd keypad shield-02.jpg | 400px]] [Model B]&lt;br /&gt;
&lt;br /&gt;
== Features  ==&lt;br /&gt;
*16x2 LCD using HD44780-compatible display module (black characters on green background).&lt;br /&gt;
*5 buttons on one analog input (A0).&lt;br /&gt;
*LCD backlight with current limiting, brightness and on/off controllable by a adjustable potentiometer.&lt;br /&gt;
*Recessed LCD, panel mount screw holes and button layout suitable for panel or cabinet mounting if desired.&lt;br /&gt;
*Reset button.&lt;br /&gt;
*Power supply smoothing capacitor.&lt;br /&gt;
&lt;br /&gt;
== Application Ideas  ==&lt;br /&gt;
'''test code'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;LiquidCrystal.h&amp;gt;&lt;br /&gt;
#include &amp;lt;LCDKeypad.h&amp;gt;&lt;br /&gt;
LiquidCrystal lcd(8, 13, 9, 4, 5, 6, 7);&lt;br /&gt;
char msgs[5][16] = {&amp;quot;Right Key OK &amp;quot;,&lt;br /&gt;
                    &amp;quot;Up Key OK    &amp;quot;,               &lt;br /&gt;
                    &amp;quot;Down Key OK  &amp;quot;,&lt;br /&gt;
                    &amp;quot;Left Key OK  &amp;quot;,&lt;br /&gt;
                    &amp;quot;Select Key OK&amp;quot; };&lt;br /&gt;
int adc_key_val[5] ={50, 200, 400, 600, 800 };&lt;br /&gt;
int NUM_KEYS = 5;&lt;br /&gt;
int adc_key_in;&lt;br /&gt;
int key=-1;&lt;br /&gt;
int oldkey=-1;&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  lcd.begin(16, 2);&lt;br /&gt;
  lcd.clear();&lt;br /&gt;
  lcd.setCursor(0,0);&lt;br /&gt;
  lcd.print(&amp;quot;     helle! &amp;quot;);&lt;br /&gt;
  lcd.print(&amp;quot;      welcome!&amp;quot;);&lt;br /&gt;
  lcd.setCursor(0,1);&lt;br /&gt;
  lcd.print(&amp;quot;   LinkSprite&amp;quot;);&lt;br /&gt;
  lcd.print(&amp;quot;    LCD Shield&amp;quot;);&lt;br /&gt;
  delay(1000);&lt;br /&gt;
  &lt;br /&gt;
  lcd.setCursor(0,0);&lt;br /&gt;
  for (char k=0;k&amp;lt;26;k++)&lt;br /&gt;
  {&lt;br /&gt;
    lcd.scrollDisplayLeft();&lt;br /&gt;
    delay(400);&lt;br /&gt;
  }&lt;br /&gt;
  lcd.clear();&lt;br /&gt;
  lcd.setCursor(0,0); &lt;br /&gt;
  lcd.print(&amp;quot;ADC key testing&amp;quot;); &lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
   adc_key_in = analogRead(0);    // read the value from the sensor &lt;br /&gt;
   key = get_key(adc_key_in);  // convert into key press&lt;br /&gt;
   if (key != oldkey)   // if keypress is detected&lt;br /&gt;
   {&lt;br /&gt;
     delay(50);  // wait for debounce time&lt;br /&gt;
     adc_key_in = analogRead(0);    // read the value from the sensor &lt;br /&gt;
     key = get_key(adc_key_in);    // convert into key press&lt;br /&gt;
     if (key != oldkey)    &lt;br /&gt;
     {   &lt;br /&gt;
       lcd.setCursor(0, 1);&lt;br /&gt;
       oldkey = key;&lt;br /&gt;
       if (key &amp;gt;=0)&lt;br /&gt;
       {&lt;br /&gt;
           lcd.print(msgs[key]);              &lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   delay(100);&lt;br /&gt;
}&lt;br /&gt;
// Convert ADC value to key number&lt;br /&gt;
int get_key(unsigned int input)&lt;br /&gt;
{&lt;br /&gt;
    int k;&lt;br /&gt;
    for (k = 0; k &amp;lt; NUM_KEYS; k++)&lt;br /&gt;
    {&lt;br /&gt;
      if (input &amp;lt; adc_key_val[k])&lt;br /&gt;
      {&lt;br /&gt;
        return k;&lt;br /&gt;
      }&lt;br /&gt;
    }   &lt;br /&gt;
    if (k &amp;gt;= NUM_KEYS)k = -1;  // No valid key pressed&lt;br /&gt;
    return k;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Cautions  ==&lt;br /&gt;
&lt;br /&gt;
The warnings and wrong operations possible cause dangerous. &lt;br /&gt;
&lt;br /&gt;
== Schematic  ==&lt;br /&gt;
&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/Schemetics.pd Schematic in PDF]&lt;br /&gt;
&lt;br /&gt;
== Specification  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;width: 50%&amp;quot; align=&amp;quot;center&amp;quot; | Item &lt;br /&gt;
! scope=&amp;quot;col&amp;quot; align=&amp;quot;center&amp;quot; | Min &lt;br /&gt;
! scope=&amp;quot;col&amp;quot; align=&amp;quot;center&amp;quot; | Typical &lt;br /&gt;
! scope=&amp;quot;col&amp;quot; align=&amp;quot;center&amp;quot; | Max &lt;br /&gt;
! scope=&amp;quot;col&amp;quot; align=&amp;quot;center&amp;quot; | Unit&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | Voltage &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 4.3&lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 5.0 &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 4.7&lt;br /&gt;
| align=&amp;quot;center&amp;quot; | V&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | Current &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 39.6&lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 53.3 &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | 65.0&lt;br /&gt;
| align=&amp;quot;center&amp;quot; | mA&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | Dimension &lt;br /&gt;
| align=&amp;quot;center&amp;quot; colspan=&amp;quot;3&amp;quot; | 79.5x55.1x16.6 &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | mm&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | Net Weight &lt;br /&gt;
| align=&amp;quot;center&amp;quot; colspan=&amp;quot;3&amp;quot; | 55.0 &lt;br /&gt;
| align=&amp;quot;center&amp;quot; | g&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Pin definition and Rating  ==&lt;br /&gt;
&lt;br /&gt;
*A0: Buttons&lt;br /&gt;
*D4: LCD bit 4&lt;br /&gt;
*D5: LCD bit 5&lt;br /&gt;
*D6: LCD bit 6&lt;br /&gt;
*D7: LCD bit 7&lt;br /&gt;
*D8: LCD RS&lt;br /&gt;
*D9: LCD Enable&lt;br /&gt;
*LCD backlight with current limiting, brightness and on/off controllable by D10.&lt;br /&gt;
&lt;br /&gt;
== Mechanic Dimensions  ==&lt;br /&gt;
&lt;br /&gt;
== Usage  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 16x2 LCD And Keypad Shield is very simple to use because it's fully compatible with the Arduino &amp;quot;LiquidCrystal&amp;quot; library. You can initialise the LCD and display messages on it with just a few lines of code, but it also gives you the flexibility to do more advanced projects such as display menu items and select them using the buttons.&lt;br /&gt;
&lt;br /&gt;
'''Power Requirements'''&lt;br /&gt;
&lt;br /&gt;
The LCD &amp;amp; Keypad Shield requires a good 5V power supply to ensure the backlight fully illuminates and the display contrast is high, and if you power your Arduino from USB with the LCD Shield attached you may experience a voltage drop over the USB cable. If you have trouble with display contrast or backlight brightness, try attaching a power supply of around 7 to 9Vdc to the 2.1mm DC jack on the Arduino. A typical symptom in an undervoltage situation is that one line of the LCD will show pale rectangles in place of the characters, and the other line will show nothing at all. The Arduino may even continue running normally because it's quite happy at just 4V or so, but the LCD &amp;amp; Keypad Shield won't function.&lt;br /&gt;
&lt;br /&gt;
'''Library Requirements'''&lt;br /&gt;
&lt;br /&gt;
All the hard work of interfacing with the LCD Shield is handled by the LiquidCrystal library, which is included as part of the official Arduino distribution. You can check whether you have it installed by starting up the IDE and looking under Files -&amp;gt; Examples -&amp;gt; LiquidCrystal. If it exists, you're good to go.&lt;br /&gt;
&lt;br /&gt;
'''Minimal Display Example'''&lt;br /&gt;
&lt;br /&gt;
To start up the LCD and display a message, open a new sketch in the Arduino IDE and paste in the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;LiquidCrystal.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 );&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  lcd.begin(16, 2);&lt;br /&gt;
  lcd.print(&amp;quot;hello, world!&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
    // your main loop code here...&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Reading The Buttons'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The LCD Shield includes 5 buttons designed for use as navigational or control input. The buttons are arranged in a handy pattern and referred to as UP, DOWN, LEFT, RIGHT, and SELECT, but of course it's totally up to your sketch to decide what to do when any particular button is pressed.&lt;br /&gt;
&lt;br /&gt;
All the buttons are connected to a single analog input, A0, using a chain of resistors that causes a different reference voltage to be applied to A0 depending on which button is pressed. This section of the shield schematic shows the input buttons and associated resistors:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Lcd-button-ladder.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
As you can see, if no button is being pressed the voltage on A0 will be pulled all the way up to 5V by the 2K resistor called R6. In that situation none of the other resistors have any effect at all, and the analog reading on A0 will be hard on the upper limit of 1023. Therefore if you perform an analogRead() call on A0 and it returns 1023 (or any value above about 1000) you know that no buttons are being pressed.&lt;br /&gt;
&lt;br /&gt;
Now consider what happens if the &amp;quot;DOWN&amp;quot; button is pressed. Now A0 is being presented with a voltage that is divided between the 2K resistor that is trying to pull it up to 5V, and the 330R and 620R resistors in series (totaling 950R) that are trying to pull it down to 0V. The voltage presented to A0 in that case is about 1.61V, which means if you perform an analogRead() on A0 it will return a value of about 329. So if you read a value of about 329 from A0 you know the &amp;quot;DOWN&amp;quot; button is being pressed.&lt;br /&gt;
&lt;br /&gt;
The same principle applies for the other buttons, with the voltages and equivalent analogRead() values shown on the schematic above.&lt;br /&gt;
&lt;br /&gt;
This is a neat way to provide a whole set of input buttons while only using up one of the I/O pins on your Arduino, leaving more pins free for use in your project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Complex Example'''&lt;br /&gt;
&lt;br /&gt;
The extensive example below combines a number of techniques to demonstrate how to show messages on the LCD, read from the buttons, and change the display message depending on which buttons are pressed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 &lt;br /&gt;
  This example code is in the public domain.&lt;br /&gt;
  &lt;br /&gt;
  ---------------------------------------------------------------------&lt;br /&gt;
  &lt;br /&gt;
  This program demonstrates button detection, LCD text/number printing,&lt;br /&gt;
  and LCD backlight control on the Freetronics LCD &amp;amp; Keypad Shield, connected to an Arduino board.&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  Pins used by LCD &amp;amp; Keypad Shield:&lt;br /&gt;
  &lt;br /&gt;
    A0: Buttons, analog input from voltage ladder&lt;br /&gt;
    D4: LCD bit 4&lt;br /&gt;
    D5: LCD bit 5&lt;br /&gt;
    D6: LCD bit 6&lt;br /&gt;
    D7: LCD bit 7&lt;br /&gt;
    D8: LCD RS&lt;br /&gt;
    D9: LCD E&lt;br /&gt;
    D10: LCD Backlight (high = on, also has pullup high so default is on)&lt;br /&gt;
  &lt;br /&gt;
  ADC voltages for the 5 buttons on analog input pin A0:&lt;br /&gt;
  &lt;br /&gt;
    RIGHT:  0.00V :   0 @ 8bit ;   0 @ 10 bit&lt;br /&gt;
    UP:     0.71V :  36 @ 8bit ; 145 @ 10 bit&lt;br /&gt;
    DOWN:   1.61V :  82 @ 8bit ; 329 @ 10 bit&lt;br /&gt;
    LEFT:   2.47V : 126 @ 8bit ; 505 @ 10 bit&lt;br /&gt;
    SELECT: 3.62V : 185 @ 8bit ; 741 @ 10 bit&lt;br /&gt;
*/&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  Includes&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
#include &amp;lt;LiquidCrystal.h&amp;gt;   // include LCD library&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  Defines&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
// Pins in use&lt;br /&gt;
#define BUTTON_ADC_PIN           A0  // A0 is the button ADC input&lt;br /&gt;
#define LCD_BACKLIGHT_PIN         10  // D10 controls LCD backlight&lt;br /&gt;
// ADC readings expected for the 5 buttons on the ADC input&lt;br /&gt;
#define RIGHT_10BIT_ADC           0  // right&lt;br /&gt;
#define UP_10BIT_ADC            145  // up&lt;br /&gt;
#define DOWN_10BIT_ADC          329  // down&lt;br /&gt;
#define LEFT_10BIT_ADC          505  // left&lt;br /&gt;
#define SELECT_10BIT_ADC        741  // right&lt;br /&gt;
#define BUTTONHYSTERESIS         10  // hysteresis for valid button sensing window&lt;br /&gt;
//return values for ReadButtons()&lt;br /&gt;
#define BUTTON_NONE               0  // &lt;br /&gt;
#define BUTTON_RIGHT              1  // &lt;br /&gt;
#define BUTTON_UP                 2  // &lt;br /&gt;
#define BUTTON_DOWN               3  // &lt;br /&gt;
#define BUTTON_LEFT               4  // &lt;br /&gt;
#define BUTTON_SELECT             5  // &lt;br /&gt;
//some example macros with friendly labels for LCD backlight/pin control, tested and can be swapped into the example code as you like&lt;br /&gt;
#define LCD_BACKLIGHT_OFF()     digitalWrite( LCD_BACKLIGHT_PIN, LOW )&lt;br /&gt;
#define LCD_BACKLIGHT_ON()      digitalWrite( LCD_BACKLIGHT_PIN, HIGH )&lt;br /&gt;
#define LCD_BACKLIGHT(state)    { if( state ){digitalWrite( LCD_BACKLIGHT_PIN, HIGH );}else{digitalWrite( LCD_BACKLIGHT_PIN, LOW );} }&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  Variables&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
byte buttonJustPressed  = false;         //this will be true after a ReadButtons() call if triggered&lt;br /&gt;
byte buttonJustReleased = false;         //this will be true after a ReadButtons() call if triggered&lt;br /&gt;
byte buttonWas          = BUTTON_NONE;   //used by ReadButtons() for detection of button events&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  Init the LCD library with the LCD pins to be used&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 );   //Pins for the freetronics 16x2 LCD shield. LCD: ( RS, E, LCD-D4, LCD-D5, LCD-D6, LCD-D7 )&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  setup()&lt;br /&gt;
  Called by the Arduino framework once, before the main loop begins&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
   //button adc input&lt;br /&gt;
   pinMode( BUTTON_ADC_PIN, INPUT );         //ensure A0 is an input&lt;br /&gt;
   digitalWrite( BUTTON_ADC_PIN, LOW );      //ensure pullup is off on A0&lt;br /&gt;
   //lcd backlight control&lt;br /&gt;
   digitalWrite( LCD_BACKLIGHT_PIN, HIGH );  //backlight control pin D3 is high (on)&lt;br /&gt;
   pinMode( LCD_BACKLIGHT_PIN, OUTPUT );     //D3 is an output&lt;br /&gt;
   //set up the LCD number of columns and rows: &lt;br /&gt;
   lcd.begin( 16, 2 );&lt;br /&gt;
   //Print some initial text to the LCD.&lt;br /&gt;
   lcd.setCursor( 0, 0 );   //top left&lt;br /&gt;
   //          1234567890123456&lt;br /&gt;
   lcd.print( &amp;quot;LinkSprite  16x2&amp;quot; );&lt;br /&gt;
   //&lt;br /&gt;
   lcd.setCursor( 0, 1 );   //bottom left&lt;br /&gt;
   //          1234567890123456&lt;br /&gt;
   lcd.print( &amp;quot;Btn:&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  loop()&lt;br /&gt;
  Arduino main loop&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
   byte button;&lt;br /&gt;
   byte timestamp;&lt;br /&gt;
   &lt;br /&gt;
   //get the latest button pressed, also the buttonJustPressed, buttonJustReleased flags&lt;br /&gt;
   button = ReadButtons();&lt;br /&gt;
   //blank the demo text line if a new button is pressed or released, ready for a new label to be written&lt;br /&gt;
   if( buttonJustPressed || buttonJustReleased )&lt;br /&gt;
   {&lt;br /&gt;
     lcd.setCursor( 4, 1 );&lt;br /&gt;
     lcd.print( &amp;quot;            &amp;quot; );&lt;br /&gt;
   }&lt;br /&gt;
   //show text label for the button pressed&lt;br /&gt;
   switch( button )&lt;br /&gt;
   {&lt;br /&gt;
      case BUTTON_NONE:&lt;br /&gt;
      {&lt;br /&gt;
         break;&lt;br /&gt;
      }&lt;br /&gt;
      case BUTTON_RIGHT:&lt;br /&gt;
      {&lt;br /&gt;
         lcd.setCursor( 4, 1 );&lt;br /&gt;
         lcd.print( &amp;quot;RIGHT&amp;quot; );&lt;br /&gt;
         break;&lt;br /&gt;
      }&lt;br /&gt;
      case BUTTON_UP:&lt;br /&gt;
      {&lt;br /&gt;
         lcd.setCursor( 4, 1 );&lt;br /&gt;
         lcd.print( &amp;quot;UP&amp;quot; );&lt;br /&gt;
         break;&lt;br /&gt;
      }&lt;br /&gt;
      case BUTTON_DOWN:&lt;br /&gt;
      {&lt;br /&gt;
         lcd.setCursor( 4, 1 );&lt;br /&gt;
         lcd.print( &amp;quot;DOWN&amp;quot; );&lt;br /&gt;
         break;&lt;br /&gt;
      }&lt;br /&gt;
      case BUTTON_LEFT:&lt;br /&gt;
      {&lt;br /&gt;
        lcd.setCursor( 4, 1 );&lt;br /&gt;
        lcd.print( &amp;quot;LEFT&amp;quot; );&lt;br /&gt;
        break;&lt;br /&gt;
     }&lt;br /&gt;
     case BUTTON_SELECT:&lt;br /&gt;
     {&lt;br /&gt;
        lcd.setCursor( 4, 1 );&lt;br /&gt;
        lcd.print( &amp;quot;SELECT-FLASH&amp;quot; );    &lt;br /&gt;
        &lt;br /&gt;
        //SELECT is a special case, it pulses the LCD backlight off and on for demo&lt;br /&gt;
        digitalWrite( LCD_BACKLIGHT_PIN, LOW );&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        digitalWrite( LCD_BACKLIGHT_PIN, HIGH );   //leave the backlight on at exit&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        &lt;br /&gt;
        /* an example of LCD backlight control via macros with nice labels&lt;br /&gt;
        LCD_BACKLIGHT_OFF();&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        LCD_BACKLIGHT_ON();   //leave the backlight on at exit&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        */&lt;br /&gt;
        &lt;br /&gt;
        /*&lt;br /&gt;
        // an example of LCD backlight control via a macro with nice label, called with a value&lt;br /&gt;
        LCD_BACKLIGHT(false);&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        LCD_BACKLIGHT(true);   //leave the backlight on at exit&lt;br /&gt;
        delay( 150 );&lt;br /&gt;
        */&lt;br /&gt;
        &lt;br /&gt;
        break;&lt;br /&gt;
      }&lt;br /&gt;
      default:&lt;br /&gt;
     {&lt;br /&gt;
        break;&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   // print the number of seconds since reset (two digits only)&lt;br /&gt;
   timestamp = ( (millis() / 1000) % 100 );   //&amp;quot;% 100&amp;quot; is the remainder of a divide-by-100, which keeps the value as 0-99 even as the result goes over 100&lt;br /&gt;
   lcd.setCursor( 14, 1 );&lt;br /&gt;
   if( timestamp &amp;lt;= 9 )&lt;br /&gt;
      lcd.print( &amp;quot; &amp;quot; );   //quick trick to right-justify this 2 digit value when it's a single digit&lt;br /&gt;
   lcd.print( timestamp, DEC );&lt;br /&gt;
/*  &lt;br /&gt;
   //debug/test display of the adc reading for the button input voltage pin.&lt;br /&gt;
   lcd.setCursor(12, 0);&lt;br /&gt;
   lcd.print( &amp;quot;    &amp;quot; );          //quick hack to blank over default left-justification from lcd.print()&lt;br /&gt;
   lcd.setCursor(12, 0);         //note the value will be flickering/faint on the LCD&lt;br /&gt;
   lcd.print( analogRead( BUTTON_ADC_PIN ) );&lt;br /&gt;
*/&lt;br /&gt;
   //clear the buttonJustPressed or buttonJustReleased flags, they've already done their job now.&lt;br /&gt;
   if( buttonJustPressed )&lt;br /&gt;
      buttonJustPressed = false;&lt;br /&gt;
   if( buttonJustReleased )&lt;br /&gt;
      buttonJustReleased = false;&lt;br /&gt;
}&lt;br /&gt;
/*--------------------------------------------------------------------------------------&lt;br /&gt;
  ReadButtons()&lt;br /&gt;
  Detect the button pressed and return the value&lt;br /&gt;
  Uses global values buttonWas, buttonJustPressed, buttonJustReleased.&lt;br /&gt;
--------------------------------------------------------------------------------------*/&lt;br /&gt;
byte ReadButtons()&lt;br /&gt;
{&lt;br /&gt;
   unsigned int buttonVoltage;&lt;br /&gt;
   byte button = BUTTON_NONE;   // return no button pressed if the below checks don't write to btn&lt;br /&gt;
   &lt;br /&gt;
   //read the button ADC pin voltage&lt;br /&gt;
   buttonVoltage = analogRead( BUTTON_ADC_PIN );&lt;br /&gt;
   //sense if the voltage falls within valid voltage windows&lt;br /&gt;
   if( buttonVoltage &amp;lt; ( RIGHT_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_RIGHT;&lt;br /&gt;
   }&lt;br /&gt;
   else if(   buttonVoltage &amp;gt;= ( UP_10BIT_ADC - BUTTONHYSTERESIS )&lt;br /&gt;
           &amp;amp;&amp;amp; buttonVoltage &amp;lt;= ( UP_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_UP;&lt;br /&gt;
   }&lt;br /&gt;
   else if(   buttonVoltage &amp;gt;= ( DOWN_10BIT_ADC - BUTTONHYSTERESIS )&lt;br /&gt;
           &amp;amp;&amp;amp; buttonVoltage &amp;lt;= ( DOWN_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_DOWN;&lt;br /&gt;
   }&lt;br /&gt;
   else if(   buttonVoltage &amp;gt;= ( LEFT_10BIT_ADC - BUTTONHYSTERESIS )&lt;br /&gt;
           &amp;amp;&amp;amp; buttonVoltage &amp;lt;= ( LEFT_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_LEFT;&lt;br /&gt;
   }&lt;br /&gt;
   else if(   buttonVoltage &amp;gt;= ( SELECT_10BIT_ADC - BUTTONHYSTERESIS )&lt;br /&gt;
           &amp;amp;&amp;amp; buttonVoltage &amp;lt;= ( SELECT_10BIT_ADC + BUTTONHYSTERESIS ) )&lt;br /&gt;
   {&lt;br /&gt;
      button = BUTTON_SELECT;&lt;br /&gt;
   }&lt;br /&gt;
   //handle button flags for just pressed and just released events&lt;br /&gt;
   if( ( buttonWas == BUTTON_NONE ) &amp;amp;&amp;amp; ( button != BUTTON_NONE ) )&lt;br /&gt;
   {&lt;br /&gt;
      //the button was just pressed, set buttonJustPressed, this can optionally be used to trigger a once-off action for a button press event&lt;br /&gt;
      //it's the duty of the receiver to clear these flags if it wants to detect a new button change event&lt;br /&gt;
      buttonJustPressed  = true;&lt;br /&gt;
      buttonJustReleased = false;&lt;br /&gt;
   }&lt;br /&gt;
   if( ( buttonWas != BUTTON_NONE ) &amp;amp;&amp;amp; ( button == BUTTON_NONE ) )&lt;br /&gt;
   {&lt;br /&gt;
      buttonJustPressed  = false;&lt;br /&gt;
      buttonJustReleased = true;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   //save the latest button value, for change event detection next time round&lt;br /&gt;
   buttonWas = button;&lt;br /&gt;
   &lt;br /&gt;
   return( button );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== pcDuino Sample Code  ==&lt;br /&gt;
&lt;br /&gt;
== FAQ  ==&lt;br /&gt;
Please list your question here:&lt;br /&gt;
&lt;br /&gt;
== Support  ==&lt;br /&gt;
&lt;br /&gt;
If you have questions or other better design ideas, you can go to our [http://www.linksprite.com/forum/index.php forum] to discuss or creat a ticket for your issue at [http://www.linksprite.com/support/ linksprite support].&lt;br /&gt;
&lt;br /&gt;
== Resources  ==&lt;br /&gt;
&lt;br /&gt;
*PDF Files&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/lcd-datasheet-dfr0009.pdf LCD Datasheet]&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/HD44780.pdf HD44780 Datasheet]&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/ZYMC1602-17.pdf  16x2 LCD Datasheet]&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/1602+LCD+Shield+Sch.pdf 16x2 LCD shield schematics]&lt;br /&gt;
&lt;br /&gt;
*ZIP Files&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/LCD4Bit_mod.zip LCD 4Bit Mod]&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/lcd-keypad-library-dfr0009.zip LCD Keypad Library]&lt;br /&gt;
**[https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/key-grabber-library-v2-dfr0009.zip Key Grabber Library V2]&lt;br /&gt;
&lt;br /&gt;
== How to buy  ==&lt;br /&gt;
&lt;br /&gt;
== See Also  ==&lt;br /&gt;
&lt;br /&gt;
Other related products and resources.&lt;br /&gt;
&lt;br /&gt;
== Licensing  ==&lt;br /&gt;
&lt;br /&gt;
This documentation is licensed under the Creative Commons [http://creativecommons.org/licenses/by-sa/3.0/ Attribution-ShareAlike License 3.0] Source code and libraries are licensed under [http://www.gnu.org/licenses/gpl.html GPL/LGPL], see source code files for details.&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=File:3G_GPS_shield.jpg&amp;diff=3561</id>
		<title>File:3G GPS shield.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=File:3G_GPS_shield.jpg&amp;diff=3561"/>
		<updated>2013-08-13T05:56:19Z</updated>

		<summary type="html">&lt;p&gt;Leona: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=3G_%2B_GPS_Shield_for_Arduino&amp;diff=3559</id>
		<title>3G + GPS Shield for Arduino</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=3G_%2B_GPS_Shield_for_Arduino&amp;diff=3559"/>
		<updated>2013-08-13T02:54:53Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Note: &lt;br /&gt;
&lt;br /&gt;
This shield uses wall adapter rated at 6V/2A. Please don't use voltage larger than 6V, it will burn the 3G module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This 3G+GPS Shield is using the design, schematics and code from &lt;br /&gt;
&lt;br /&gt;
http://www.cooking-hacks.com/index.php/documentation/tutorials/arduino-3g-gprs-gsm-gps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The new 3G shield for Arduino enables the connectivity to high speed '''WCDMA''' and '''HSPA''' cellular networks in order to make possible the creation of the next level of worldwide interactivity projects inside the new &amp;quot;Internet of Things&amp;quot; era.&lt;br /&gt;
&lt;br /&gt;
The module counts also with an internal '''GPS''' what enables the location of the device outdoors and indoors combining standard NMEA frames with mobile cell ID triangulation using both assisted-mobile '''(A-GPS)''' and mobile-based '''(S-GPS)''' modes.&lt;br /&gt;
&lt;br /&gt;
Other interesting accessories which can be connected to the module are a video camera which enables the record of video in high resolution (640x480), an '''audio kit''' including microphone, speaker, hands free and headphones sets and a SD socket to save directly all the data coming from the 3G network or recorded from the video camera. You can even reproduce audio files stored in the SD card (like a mp3 player!).&lt;br /&gt;
&lt;br /&gt;
You can also use it as a standard '''3G modem''' at full speed (~7.2Mbps download, ~5.5Mbps upload) just connecting it through its specific mini-USB socket to your laptop (Linux, Windows, MacOS).&lt;br /&gt;
&lt;br /&gt;
The new communicating module is specially oriented to work with Internet servers implementing internally several application layer protocols which make easier to send the information to the cloud. We can make '''HTTP''' and '''HTTPS''' (secure mode) navigation, downloading and uploading content to a web server. In the same way '''FTP''' and '''FTPS''' (secure mode) protocols are also available which is really useful when your application requires handling files. You can even send and receive mails directly from Arduino using the '''SMTP''' and '''POP3''' clients implemented internally.&lt;br /&gt;
&lt;br /&gt;
With the '''SD''' Card socket so you can handle a complete FAT16 file systems and store up to '''32GB''' of information. This specially useful as the 3G module can work at full speed (~7.2Mbps download, ~5.5Mbps upload) when working with the SD files directly without need of Arduino for data or files management.&lt;br /&gt;
&lt;br /&gt;
The GPS module also makes possible perform geolocation services even in indoors as it can work in A-GPS and S-GPS modes, so the location given by the GPS through NMEA sentences is completed with the cell information provided by both the 3G module and external Internet Geoposition Servers which helps you to get the most accurate location in each case.&lt;br /&gt;
&lt;br /&gt;
[[File:3G_GPS_shield.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
*WCDMA and HSPA 3G networks compatibility &lt;br /&gt;
*Internal GPS for Assisted A-GPS and Supported S-GPS modes &lt;br /&gt;
*Video Camera (640x480) for video and photo recordings available &lt;br /&gt;
*Audio Kit including microphone, speaker, hands free and headphones available &lt;br /&gt;
*SD file system up to 32GB &lt;br /&gt;
*Works as a standard 3G modem in Linux/Windows/MacOS (~7.2Mbps download, ~5.5Mbps upload) &lt;br /&gt;
*Talk directly to web servers by HTTP/HTTPS (secure) &lt;br /&gt;
*Upload and download files directly by FTP/FTPS (secure) &lt;br /&gt;
*Send and receive mails by POP3/SMTP &lt;br /&gt;
*Play compressed audio files &lt;br /&gt;
&lt;br /&gt;
== Antennas ==&lt;br /&gt;
&lt;br /&gt;
=== Connections ===&lt;br /&gt;
&lt;br /&gt;
SIM5218 has 3 UFL connectors. Two for diversity of 3G mobile carriers and one for GPS antenna. The impedance of the RF interface is 50Ω. It is recommended use just the &amp;quot;main&amp;quot; antenna socket for the mobile connection unless you experience coverage or performance problems. In this case two antennas allowing diversity may be placed.&lt;br /&gt;
&lt;br /&gt;
[[File:antennacon1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Also, the module allows to solder the antenna to the pad, or attach it via contact springs.&lt;br /&gt;
&lt;br /&gt;
[[File:antennacon2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Bandwidth ==&lt;br /&gt;
&lt;br /&gt;
3G module connected with Arduino allows downlinks rates over 115200 bauds (~11.5KBps), the maximum UART's speed and uplinks rates over 30000 bauds (~3KBps). &lt;br /&gt;
&lt;br /&gt;
Using the module as 3G USB modem we got speeds of 2Mbps (~222KBps) for downlink and 0.7Mbps (~77KBps) for uplink and. &lt;br /&gt;
&lt;br /&gt;
The connection speed may vary depending on the state of the network, the quality of the signal and the carrier.&lt;br /&gt;
&lt;br /&gt;
== Using 3G module with AT commands ==&lt;br /&gt;
'''Important issues:'''&lt;br /&gt;
 &lt;br /&gt;
*Use capital letters for AT commands. &lt;br /&gt;
*Send CR (Carriage return) and LF (Line feed) after the AT command. &lt;br /&gt;
*Place the serial communication jumpers in the right position. &lt;br /&gt;
*Use an external power supply and place the power jumpers in the right position. If the shield is powered from the Arduino, the power jumper must be in Arduino 5V position. If the shield is powered from the Vin input (in the shield), the power jumper must be in Vext position. &lt;br /&gt;
&lt;br /&gt;
The first thing we are going to do with the module is to connect the module to a PC directly (using an Arduino as gateway) and check the basic AT commands. In this case, serial communication jumpers have to be set on USB gateway position.&lt;br /&gt;
&lt;br /&gt;
Remember take out the ATmega microcontroller from the Arduino gateway.&lt;br /&gt;
&lt;br /&gt;
Basic configuration:&lt;br /&gt;
&lt;br /&gt;
[[File:arduinouno.jpg | 400px]]&lt;br /&gt;
&lt;br /&gt;
Connect the shield to the Arduino gateway.&lt;br /&gt;
&lt;br /&gt;
Then connect the SIM card and the USB cable.&lt;br /&gt;
&lt;br /&gt;
Finally plug the USB cable to the computer and open a serial port terminal to communicate via the usb port (e.g: hyperterminal (win), cutecom / gtkterm (linux)).&lt;br /&gt;
&lt;br /&gt;
'''If you use the Arduino IDE serial monitor for sending AT commands – Be sure that you are sending CR (Carriage return) and LF (Line Feed).'''&lt;br /&gt;
&lt;br /&gt;
Set the baudrate to 115200 bps and open the serial port, then press the ON button for two seconds. Then if you type AT you'll get OK, this means that the communication with the module is working fine. Now, with the module working you can check some AT commands to control the module, the basic commands are:&lt;br /&gt;
&lt;br /&gt;
'''Important type commands in capital letters and with CR (carriage return) and LF (line feed)!!!'''&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command&lt;br /&gt;
! Respone&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT&lt;br /&gt;
| OK&lt;br /&gt;
| If you get OK, the communication with the module is working&lt;br /&gt;
|-&lt;br /&gt;
| AT+CPIN=&amp;quot;****&amp;quot;&lt;br /&gt;
| OK&lt;br /&gt;
| If the SIM card is locked with PIN (**** is the pin number)&lt;br /&gt;
|-&lt;br /&gt;
| AT+COPS?&lt;br /&gt;
| &lt;br /&gt;
| Operator information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''''NOTE''': If your 3G module doesn't answer to AT commands, maybe it is configured in a different baudrate. The command for change it temporally is AT+IPR. Try differents baudrates (300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800,921600, 3200000,3686400,4000000 ) until you get to communicate. Once you can communicate, you can configure it in the baudrate you want.''&lt;br /&gt;
&lt;br /&gt;
== Using 3G module like a modem ==&lt;br /&gt;
&lt;br /&gt;
If you want to use the 3G module such a modem, please refer to the next link:&lt;br /&gt;
&lt;br /&gt;
[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/3G_modem_tutorial.pdf 3G modem tutorial]&lt;br /&gt;
&lt;br /&gt;
== Audio ==&lt;br /&gt;
&lt;br /&gt;
=== Audio Features ===&lt;br /&gt;
SIM5218 module provides two analogy inputs for microphone and three analogy outputs for two speakers and headphones. Depending of the selected audio channel (normal, headset and hands-free) a specific input and output are activated. The different channels are selected with the command AT+CSDVC.&lt;br /&gt;
&lt;br /&gt;
Normal channel (AT+CSDVC=1) uses the main microphone and a speaker. Headset channel (AT+CSDVC=2) uses the jack connector. Hand-free channel (AT+CSDVC=3) uses the main microphone and the loudspeaker.&lt;br /&gt;
&lt;br /&gt;
Both microphones don't need an external power source because they are powered directly by the module. You can use some extra commands in your codes like noise suppression, echo canceller or the gain of the mic amps. Please, refer to the AT command document list at the end of this article for more information.&lt;br /&gt;
&lt;br /&gt;
=== Audio Connectors === &lt;br /&gt;
Audio connectors are situated at the bottom of the board. The two speakers and the main microphone are connected to board using pin connectors.&lt;br /&gt;
&lt;br /&gt;
Headset connector are situated at the bottom too, between Arduino board and 3G board.&lt;br /&gt;
&lt;br /&gt;
This connector has 4 terminals that correspond with the positive terminal of the microphone, left and rigth headphones and common ground. The order of connections show below.&lt;br /&gt;
&lt;br /&gt;
[[File:headphone.jpg | 400px]]&lt;br /&gt;
&lt;br /&gt;
Originating and receiving voice calls&lt;br /&gt;
&lt;br /&gt;
The code example and the connection diagram shown below are used to originate a voice call and, pushing a button, end that voice call. The button is connected between digital pin 12 an ground. A 10kΩ pull-up resistor is needed at this pin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int button = 12;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button)&lt;br /&gt;
&lt;br /&gt;
int timesToSend = 1;        // Numbers of calls to make&lt;br /&gt;
&lt;br /&gt;
char phone_number[]=&amp;quot;*********&amp;quot;;     // ********* is the number to call&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(button, INPUT);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    while (count &amp;lt; timesToSend){&lt;br /&gt;
&lt;br /&gt;
        for(int x=0;x &amp;lt; 9;x++){        //generates the tones of the phone number&lt;br /&gt;
            Serial.print(&amp;quot;AT+CPTONE=&amp;quot;);&lt;br /&gt;
            Serial.println(phone_number[x]);&lt;br /&gt;
            delay(400);                    &lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        Serial.print(&amp;quot;ATD&amp;quot;);     &lt;br /&gt;
        Serial.print(phone_number);     &lt;br /&gt;
        Serial.println(&amp;quot;;&amp;quot;);        &lt;br /&gt;
&lt;br /&gt;
        while(digitalRead(button)==1);        &lt;br /&gt;
&lt;br /&gt;
        Serial.println(&amp;quot;AT+CHUP&amp;quot;);            // disconnects the existing call&lt;br /&gt;
&lt;br /&gt;
        delay(5000);&lt;br /&gt;
&lt;br /&gt;
        count++;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make a lost call next code is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
*&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button)&lt;br /&gt;
&lt;br /&gt;
int timesToSend = 1;        // Numbers of calls to make&lt;br /&gt;
int count = 0;&lt;br /&gt;
int tones = 2;                //Each tone has a duration of 6 seconds aprox.&lt;br /&gt;
&lt;br /&gt;
char phone_number[]=&amp;quot;*********&amp;quot;;     // ********* is the number to call&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    while (count &amp;lt; timesToSend){&lt;br /&gt;
        delay(1500);&lt;br /&gt;
    for(int x=0;x &amp;lt; 9;x++){        //generates the tones of the phone number&lt;br /&gt;
            Serial.print(&amp;quot;AT+CPTONE=&amp;quot;);&lt;br /&gt;
            Serial.println(phone_number[x]);&lt;br /&gt;
            delay(400);                    &lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        Serial.print(&amp;quot;ATD&amp;quot;);     &lt;br /&gt;
        Serial.print(phone_number);     &lt;br /&gt;
        Serial.println(&amp;quot;;&amp;quot;);   &lt;br /&gt;
        delay(6000*tones);&lt;br /&gt;
        Serial.println(&amp;quot;AT+CHUP&amp;quot;);            // cancel the call&lt;br /&gt;
&lt;br /&gt;
        delay(5000);&lt;br /&gt;
&lt;br /&gt;
        count++;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To receive calls the used code are this and the connection diagram is the same that the used to originate calls. Don't forget the pull-up resistor on pin 12.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int button = 12;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button)&lt;br /&gt;
&lt;br /&gt;
int timesToSend = 1;        // Numbers of calls to make&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
boolean check_response(char *str){&lt;br /&gt;
    &lt;br /&gt;
    int i = 0;&lt;br /&gt;
    int j = 0;&lt;br /&gt;
    char b[10];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // reading the message and cutting&lt;br /&gt;
    // initials and finals &lt;br /&gt;
    while(Serial.available() &amp;gt; 0){&lt;br /&gt;
        if(j==0 || j==1){&lt;br /&gt;
            Serial.read();&lt;br /&gt;
            j++;&lt;br /&gt;
        }&lt;br /&gt;
        else if( Serial.peek() == 13 ){&lt;br /&gt;
            b[i] = 0;&lt;br /&gt;
            Serial.read();&lt;br /&gt;
        }&lt;br /&gt;
        else if( Serial.peek() == 10 ){&lt;br /&gt;
            Serial.read();&lt;br /&gt;
        }&lt;br /&gt;
        else {&lt;br /&gt;
            b[i++] = Serial.read();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // comparing&lt;br /&gt;
    int cont=0;&lt;br /&gt;
    int cont2=0;&lt;br /&gt;
    boolean ok=false;&lt;br /&gt;
    while(b[cont]!=-1){&lt;br /&gt;
        if (b[cont]==str[cont2]){&lt;br /&gt;
            while(str[cont2]!=-1){&lt;br /&gt;
                if (b[cont+cont2]!=b[cont2])&lt;br /&gt;
                {    &lt;br /&gt;
                    cont2++; &lt;br /&gt;
                    ok=true; &lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    ok=false; &lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
            }   &lt;br /&gt;
        }&lt;br /&gt;
        if (ok) break;&lt;br /&gt;
        cont++;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if(ok){&lt;br /&gt;
        return true;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(button, INPUT);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
   &lt;br /&gt;
    while(!check_response(&amp;quot;RING&amp;quot;));   //waits for a call&lt;br /&gt;
    Serial.println(&amp;quot;ATA&amp;quot;);          //answers an incoming call&lt;br /&gt;
    delay(10000);&lt;br /&gt;
    &lt;br /&gt;
    while(digitalRead(button)==1);        &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CHUP&amp;quot;);            // disconnects the existing call&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The channel may be changed during a call. Use the command AT+CSDVC to select the channel that you want.&lt;br /&gt;
&lt;br /&gt;
=== Recording and playing sound ===&lt;br /&gt;
&lt;br /&gt;
With the next code we can record a sound, stores it and before play it. You can select the place to store the sound clip: the local storage or a SD card. Once saved the sound can be sent to an FTP or FTPS as you'll see later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char name[20];&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    for(x=0;x &amp;lt; 20;x++){&lt;br /&gt;
        name[x]='\0';&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+FSLOCA=0&amp;quot;);     &lt;br /&gt;
    // store media files to local storage space, put 1 to store media files to storage card&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CNSM=1&amp;quot;);     // Enables noise supression&lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    //RECORDING A SOUND CLIP&lt;br /&gt;
    delay(1500);&lt;br /&gt;
    while(Serial.available()!=0){&lt;br /&gt;
        Serial.read();&lt;br /&gt;
    }&lt;br /&gt;
    Serial.println(&amp;quot;AT+CQCPREC=0,amr&amp;quot;);     // starts to record a sound clip&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='/');&lt;br /&gt;
    while(Serial.read()!='/');&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        name[x]=Serial.read();&lt;br /&gt;
        x++;&lt;br /&gt;
    }while(x &amp;lt; 19);&lt;br /&gt;
&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    Serial.println(name);      &lt;br /&gt;
    delay(10000);   &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CQCPPAUSE&amp;quot;);     // pauses record sound&lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
    delay(2000);   &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CQCPRESUME&amp;quot;);     // resumes record sound&lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
    delay(10000);&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CQCPSTOP&amp;quot;);     // stops to record a sound clip&lt;br /&gt;
    while(Serial.read()!='K');   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    //PLAY A SOUND CLIP&lt;br /&gt;
    Serial.println(&amp;quot;AT+FSCD=Audio&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CCMXPLAY=\&amp;quot;&amp;quot;);    //plays an audio file&lt;br /&gt;
    Serial.print(name);  &lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');   &lt;br /&gt;
    delay(7000);         &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCMXPAUSE&amp;quot;);     // pauses playing audio file&lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
    delay(2000);   &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCMXRESUME&amp;quot;);     // resumes playing audio file&lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
    delay(8000);&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCMXSTOP&amp;quot;);     // Stops playing audio file&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, you can use the 3G module like a mp3 player! First, you must save your music in mp3, amr or qcp format. You can use Audacity (linux) or Mobile Media Converter (Windows or Linux) to do this. Then, save the music in the Audio folder on microSD card. Now, put microSD card into the shield and enjoy the music!&lt;br /&gt;
&lt;br /&gt;
'''''NOTE''': You will need to '''update your firmware''' to play mp3. The update is available [https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/240150B15SIM5218E_HY.rar here]. Uncompress and run it in a PC with Windows (emulated Windows not supported).''&lt;br /&gt;
&lt;br /&gt;
A voice call can be recorded using these same commands too.&lt;br /&gt;
&lt;br /&gt;
=== Command summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command&lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CPTONE=**&lt;br /&gt;
| OK&lt;br /&gt;
| Plays a DTMF tone or complex tone on local voice channel device . ** is the number of the tone.&lt;br /&gt;
|-&lt;br /&gt;
| ATD*********;&lt;br /&gt;
|&lt;br /&gt;
| ********* is the number to call.&lt;br /&gt;
|-&lt;br /&gt;
| ATA&lt;br /&gt;
| OK&lt;br /&gt;
| Answer an incoming call.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHUP&lt;br /&gt;
| OK&lt;br /&gt;
| Cancel voice calls.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CNSM&lt;br /&gt;
| OK&lt;br /&gt;
| Enable/disable noise suppression.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CQCPREC=*,&amp;amp;&amp;amp;&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Starts recording sound clips . Answers with the path and the name of the clip. * is the path and &amp;amp;&amp;amp;&amp;amp; is the format.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CQCPPAUSE&lt;br /&gt;
| OK&lt;br /&gt;
| Pauses record sound.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CQCPRESUME&lt;br /&gt;
| OK&lt;br /&gt;
| Resumes record sound.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CQCPSTOP&lt;br /&gt;
| OK&lt;br /&gt;
| Stops record sound.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCMXPLAY=”*****”&lt;br /&gt;
| OK&lt;br /&gt;
| Plays an audio file . ***** is the name of the file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCMXPAUSE&lt;br /&gt;
| OK&lt;br /&gt;
| Pauses playing audio file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCMXRESUME&lt;br /&gt;
| OK&lt;br /&gt;
| Resumes playing audio file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCMXSTOP&lt;br /&gt;
| OK&lt;br /&gt;
| Stops playing audio file.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Camera ==&lt;br /&gt;
[[File:pindiagram.jpg]]&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Pin nº&lt;br /&gt;
! Name&lt;br /&gt;
! Pin nº&lt;br /&gt;
! Name&lt;br /&gt;
! Pin nº&lt;br /&gt;
! Name&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| NC&lt;br /&gt;
| 9&lt;br /&gt;
| HSYNC&lt;br /&gt;
| 17&lt;br /&gt;
| PCLK&lt;br /&gt;
|-&lt;br /&gt;
| 2 &lt;br /&gt;
| AGND&lt;br /&gt;
| 10 &lt;br /&gt;
| DVDD&lt;br /&gt;
| 18&lt;br /&gt;
| DATA6&lt;br /&gt;
|-&lt;br /&gt;
| 3 &lt;br /&gt;
| SDA&lt;br /&gt;
| 11&lt;br /&gt;
| DOVDD&lt;br /&gt;
| 19&lt;br /&gt;
| DATA2&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| AVDD&lt;br /&gt;
| 12&lt;br /&gt;
| DATA9&lt;br /&gt;
| 20&lt;br /&gt;
| DATA5&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| SCL&lt;br /&gt;
| 13&lt;br /&gt;
| MCLK&lt;br /&gt;
| 21&lt;br /&gt;
| DATA3&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| RESET&lt;br /&gt;
| 14&lt;br /&gt;
| DATA8&lt;br /&gt;
| 22&lt;br /&gt;
| DATA22&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| VSYNC&lt;br /&gt;
| 15&lt;br /&gt;
| AGND&lt;br /&gt;
| 23&lt;br /&gt;
| DATA1&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| PWDN&lt;br /&gt;
| 16&lt;br /&gt;
| DATA7&lt;br /&gt;
| 24&lt;br /&gt;
| DATA0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:cameraExample.jpg]]&lt;br /&gt;
&lt;br /&gt;
Mounting the camera&lt;br /&gt;
&lt;br /&gt;
'''Follow these simple steps to mount the camera into the 3G Arduino board.'''&lt;br /&gt;
&lt;br /&gt;
*The first step is to open the socket. To do this, pull carefully out the sides of the connector.&lt;br /&gt;
*Inserts the camera with metallic contacts facing up&lt;br /&gt;
*At the final step, push in the laterals of the connector&lt;br /&gt;
&lt;br /&gt;
=== Vedio Recording ===&lt;br /&gt;
To record video, and take images, you must start the camera in the first step. After you can configure some parameters like resolution, fps, rotation or zoom. The next code allows to record a video file in mp4 format. Remember, if you want to store the video file in a SD card, you must to use AT+FSLOCA command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char name[20];&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                //UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    }      &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMS&amp;quot;);     //starts the camera&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMSETD=320,240&amp;quot;);     //sets QVGA (320*240) resolution&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMSETF=2&amp;quot;);     //sets 15 frames per second&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    delay(1500);&lt;br /&gt;
    &lt;br /&gt;
    while(Serial.available()!=0){&lt;br /&gt;
        Serial.read();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMRS&amp;quot;);     //starts to record a video&lt;br /&gt;
    Serial.flush();                  //video is saved into C:/Video&lt;br /&gt;
    while(Serial.read()!='/');&lt;br /&gt;
    while(Serial.read()!='/');&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        name[x]=Serial.read();&lt;br /&gt;
        x++;&lt;br /&gt;
    }while(x &amp;lt; 19);&lt;br /&gt;
&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    Serial.println(name);      &lt;br /&gt;
    delay(10000);   &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMRP&amp;quot;);     // pauses record &lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
    delay(2000);   &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMRR&amp;quot;);     // resumes record &lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
    delay(10000);&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMRE&amp;quot;);     // stops to record&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAME&amp;quot;);     // stops the camera&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Taking Photo ===&lt;br /&gt;
Take photos is very easy, here is the example code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char name[20];&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    }   &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMS&amp;quot;);     //starts the camera&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMSETD=640,480&amp;quot;);     //sets VGA (640*480) resolution&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+FSLOCA=0&amp;quot;);     //stores the image file in the 3G module&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    delay(1500);&lt;br /&gt;
    while(Serial.available()!=0){&lt;br /&gt;
        Serial.read();&lt;br /&gt;
    }&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMTP&amp;quot;);     //takes a picture, but not saved it&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMEP&amp;quot;);     // saves the picture into C:/Picture    &lt;br /&gt;
    Serial.flush();     &lt;br /&gt;
    while(Serial.read()!='/');&lt;br /&gt;
    while(Serial.read()!='/');&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        name[x]=Serial.read();&lt;br /&gt;
        x++;&lt;br /&gt;
    }while(x &amp;lt; 19);&lt;br /&gt;
&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    Serial.println(name); &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAME&amp;quot;);     // stops the camera&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Video Call ===&lt;br /&gt;
&lt;br /&gt;
The SIM5218 allows video calls, but to carry them out correctly the operator and the network must be able to allow it. The example code is below. Cooking Hacks not ensure that the video call functions correctly.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char phone_number[]=&amp;quot;*********&amp;quot;;     // ********* is the number to call&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                //UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    }      &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMS&amp;quot;);     //starts the camera&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMSETD=320,240&amp;quot;);     //sets QVGA (320*240) resolution&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMSETF=2&amp;quot;);     //sets 15 frames per seconds&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    delay(1500);&lt;br /&gt;
&lt;br /&gt;
    while(Serial.available()!=0){&lt;br /&gt;
        Serial.read();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+VPMAKE=&amp;quot;);     //inits a videocall&lt;br /&gt;
    Serial.println(phone_number);&lt;br /&gt;
    delay(30000);&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+VPEND&amp;quot;);     // ends the videocall&lt;br /&gt;
    while(Serial.read()!='K');     &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAME&amp;quot;);     // stops the camera&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Command Summary ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command&lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMS&lt;br /&gt;
| OK&lt;br /&gt;
| Starts camera.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAME&lt;br /&gt;
| OK&lt;br /&gt;
| Stops camera.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMSETD=xxx,yyy&lt;br /&gt;
| OK&lt;br /&gt;
| Sets dimension of camera. xxx is the width and yyy is the height.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMSETF=*&lt;br /&gt;
| OK&lt;br /&gt;
| Sets the frames per second. * is the frame rate option.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMRS&lt;br /&gt;
| OK&lt;br /&gt;
| Starts video recording . Also responds with the path and name of the file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMRP&lt;br /&gt;
| OK&lt;br /&gt;
| Pauses the record.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMRR&lt;br /&gt;
| OK&lt;br /&gt;
| Resumes video record.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMRE&lt;br /&gt;
| OK&lt;br /&gt;
| Stops video record.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMTP&lt;br /&gt;
| OK&lt;br /&gt;
| Takes a picture.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMEP&lt;br /&gt;
| OK&lt;br /&gt;
| Saves a picture taken by last AT+CCAMTP. Also responds with the path and name of the file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+VPMAKE&lt;br /&gt;
| &lt;br /&gt;
| Makes a video call.&lt;br /&gt;
|-&lt;br /&gt;
| AT+VPEND&lt;br /&gt;
|&lt;br /&gt;
| Ends a video call.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== GPS ==&lt;br /&gt;
&lt;br /&gt;
SIM5218 supports both A-GPS and S-GPS and provides three operating modes: mobile-assisted mode, mobile-based mode and standalone mode. A-GPS is include mobile-assisted and mobile-based mode.&lt;br /&gt;
&lt;br /&gt;
In mobile-assisted mode, when a request for position location is issued, available network information is provided to the location server (e.g., Cell-ID) and assistance is requested from the location server. The location server sends the assistance information to the handset. The handset/mobile unit measures the GPS observables and provides the GPS measurements along with available network data (that is appropriate for the given air interface technology) to the location server. The location server then calculates the position location and returns results to the requesting entity.&lt;br /&gt;
&lt;br /&gt;
In mobile-based mode, the assistance data provided by the location server encompasses not only the information required to assist the handset in measuring the satellite signals, but also the information required to calculate the handset’s position. Therefore, rather than provide the GPS measurements and available network data back to the location server, the mobile calculates the location on the handset and passes the result to the requesting entity.&lt;br /&gt;
&lt;br /&gt;
In standalone (autonomous) mode, the handset demodulates the data directly from the GPS satellites. This mode has some reduced cold-start sensitivity, and a longer time to first fix as compared to the assisted modes. However, it requires no server interaction and works out of network coverage.&lt;br /&gt;
&lt;br /&gt;
This combination of GPS measurements and available network information provides: &lt;br /&gt;
*High-sensitivity solution that works in all terrains: indoor, outdoor, urban, and rural &lt;br /&gt;
*High availability that is enabled by using both satellite and network information &lt;br /&gt;
&lt;br /&gt;
Therefore, while network solutions typically perform poorly in rural areas and areas of poor cell geometry/density, and while unassisted, GPS-only solutions typically perform poorly indoors, the SIM5218 GPS solution provides optimal time to fix, accuracy, sensitivity, availability, and reduced network utilization in both of these environments, depending on the given condition.&lt;br /&gt;
&lt;br /&gt;
=== Stand-alone mode ===&lt;br /&gt;
In this mode, the GPS obtains position, altitude,... with only the signal of the satellites, making it the slowest of the three modes. If you use the AT+CGPSINFO command, the module bring directly latitud, logitude, date, UTC time, altitude and speed. Here is the example code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[255];&lt;br /&gt;
char latitude[11],longitude[12];&lt;br /&gt;
char date[6],UTC_time[8];&lt;br /&gt;
char speed_OG[6],altitude[6];&lt;br /&gt;
&lt;br /&gt;
int x,y;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGPS=1,1&amp;quot;);         // starts GPS session in stand-alone mode&lt;br /&gt;
    delay(100);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    delay(5000);&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGPSINFO&amp;quot;); // request GPS info&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        do{&lt;br /&gt;
            digitalWrite(led,HIGH);  &lt;br /&gt;
        }&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        digitalWrite(led,LOW);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    x=24;&lt;br /&gt;
    y=0;&lt;br /&gt;
    if(data[x]!=','){&lt;br /&gt;
        Serial.print(&amp;quot;Latitude: &amp;quot;);    //shows actual latitude&lt;br /&gt;
        do{&lt;br /&gt;
            latitude[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
        Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
        Serial.println(data[x]);    //north or south&lt;br /&gt;
&lt;br /&gt;
        x+=2;&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;Longitude: &amp;quot;);    //shows actual longitude&lt;br /&gt;
        do{&lt;br /&gt;
            longitude[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++; &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
        Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
        Serial.println(data[x]);    //west or east&lt;br /&gt;
&lt;br /&gt;
        x+=2;&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;Date: &amp;quot;);    //shows date&lt;br /&gt;
        do{&lt;br /&gt;
            date[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;\r\nUTC time: &amp;quot;);    //shows UTC time&lt;br /&gt;
        do{&lt;br /&gt;
            UTC_time[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;\r\nAltitude: &amp;quot;);    //shows altitude&lt;br /&gt;
        do{&lt;br /&gt;
            UTC_time[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        Serial.println(&amp;quot; m&amp;quot;);&lt;br /&gt;
        x++; &lt;br /&gt;
&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;Speed: &amp;quot;);    //shows speed&lt;br /&gt;
        do{&lt;br /&gt;
            speed_OG[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=0x0D);&lt;br /&gt;
        Serial.println(&amp;quot; knots&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    else{&lt;br /&gt;
        Serial.println(&amp;quot;GPS information not available, please wait...&amp;quot;);&lt;br /&gt;
    }   &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to get the NMEA sentences, you must to use the command AT+CGPSSWITCH=1 and configure the UART port at 57600 bauds. Supported NMEA sentences include GSV, GGA, RMC, GSA, and VTG.&lt;br /&gt;
&lt;br /&gt;
=== S-GPS Mode ===&lt;br /&gt;
For the S-GPS the module connects to a GPS server and the module calculates the position. Here is the example code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[255];&lt;br /&gt;
char latitude[11],longitude[12];&lt;br /&gt;
char date[6],UTC_time[8];&lt;br /&gt;
char speed_OG[6],altitude[6];&lt;br /&gt;
&lt;br /&gt;
int x,y;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
  Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!check_response(&amp;quot;OK&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGPSURL=\&amp;quot;supl.google.com:7276\&amp;quot;&amp;quot;);         // sets GPS server&lt;br /&gt;
    delay(100);   &lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGPSSSL=0&amp;quot;);         // without certificate&lt;br /&gt;
    delay(100);   &lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGPS=1,2&amp;quot;);         // starts GPS session in based mode&lt;br /&gt;
    delay(100);   &lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    delay(5000);&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGPSINFO&amp;quot;); // request GPS info&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    for (x=0;x&amp;lt; 255;x++){            &lt;br /&gt;
        data[x]='\0';                        &lt;br /&gt;
    } &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        do{&lt;br /&gt;
            digitalWrite(led,HIGH);  &lt;br /&gt;
        }&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        digitalWrite(led,LOW);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    x=24;&lt;br /&gt;
    y=0;&lt;br /&gt;
    if(data[x]!=','){&lt;br /&gt;
        Serial.print(&amp;quot;Latitude: &amp;quot;);    //shows actual latitude&lt;br /&gt;
        do{&lt;br /&gt;
            latitude[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
            if(y==2){&lt;br /&gt;
                Serial.print(0xF8);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            if(y==4){&lt;br /&gt;
                Serial.print(&amp;quot;.&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
        Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
        Serial.println(data[x]);    //north or south&lt;br /&gt;
&lt;br /&gt;
        x+=2;&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;Longitude: &amp;quot;);    //shows actual longitude&lt;br /&gt;
        do{&lt;br /&gt;
            longitude[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
            if(y==3){&lt;br /&gt;
                Serial.print(0xF8);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            if(y==5){&lt;br /&gt;
                Serial.print(&amp;quot;.&amp;quot;);&lt;br /&gt;
            }        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
        Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
        Serial.println(data[x]);    //west or east&lt;br /&gt;
&lt;br /&gt;
        x+=2;&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;Date: &amp;quot;);    //shows date&lt;br /&gt;
        do{&lt;br /&gt;
            date[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;\r\nUTC time: &amp;quot;);    //shows UTC time&lt;br /&gt;
        do{&lt;br /&gt;
            UTC_time[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;\r\nAltitude: &amp;quot;);    //shows altitude&lt;br /&gt;
        do{&lt;br /&gt;
            UTC_time[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        Serial.println(&amp;quot; m&amp;quot;);&lt;br /&gt;
        x++; &lt;br /&gt;
&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;Speed: &amp;quot;);    //shows speed&lt;br /&gt;
        do{&lt;br /&gt;
            speed_OG[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=0x0D);&lt;br /&gt;
        Serial.println(&amp;quot; knots&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    else{&lt;br /&gt;
        Serial.println(&amp;quot;GPS information not available, please wait...&amp;quot;);&lt;br /&gt;
    }   &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== A-GPS Mode ===&lt;br /&gt;
For the A-GPS the module connects to a GPS server for calculate the position. Here is the example code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! MS-assisted&lt;br /&gt;
! Server&lt;br /&gt;
! Module&lt;br /&gt;
|-&lt;br /&gt;
| Location server sends aiding data that is valid for the current fix&lt;br /&gt;
| Sending Data&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Module sends code phases&lt;br /&gt;
| &lt;br /&gt;
| Code phases&lt;br /&gt;
|-&lt;br /&gt;
| Server calculates position&lt;br /&gt;
| Calculate position&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! MS-based&lt;br /&gt;
! Server&lt;br /&gt;
! Module&lt;br /&gt;
|-&lt;br /&gt;
| Location server sends aiding data that is valid for the current fix&lt;br /&gt;
| Send aiding data&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Module calculates&lt;br /&gt;
| &lt;br /&gt;
| Calculate position&lt;br /&gt;
|-&lt;br /&gt;
! Stand alone&lt;br /&gt;
! Server&lt;br /&gt;
! Module&lt;br /&gt;
|-&lt;br /&gt;
| Module demodulates data form GPS satellite&lt;br /&gt;
| &lt;br /&gt;
|Demodulates GPS satellite data&lt;br /&gt;
|-&lt;br /&gt;
| Module calculates position&lt;br /&gt;
| &lt;br /&gt;
| Calculate position&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== GPS Units ===&lt;br /&gt;
The command AT+CGPSINFO returns the GPS info in a string:&lt;br /&gt;
&lt;br /&gt;
+CGPSINFO: [&amp;lt;latitude&amp;gt;],[&amp;lt;N/S&amp;gt;],[&amp;lt;longitude&amp;gt;],[&amp;lt;E/W&amp;gt;],[&amp;lt;date&amp;gt;],[&amp;lt;UTC_time&amp;gt;],[&amp;lt;altitude&amp;gt;],[&amp;lt;speedOG&amp;gt;],[&amp;lt;course&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Values&lt;br /&gt;
! Format&lt;br /&gt;
! Example&lt;br /&gt;
|-&lt;br /&gt;
| latitude&lt;br /&gt;
| ddmm.mmmmmm      &lt;br /&gt;
d: degree; m: minute&lt;br /&gt;
| 4140.831527&lt;br /&gt;
|-&lt;br /&gt;
| longitude&lt;br /&gt;
| dddmm.mmmmmm      &lt;br /&gt;
d: degree; m: minute&lt;br /&gt;
| 00053.173495&lt;br /&gt;
|-&lt;br /&gt;
| data&lt;br /&gt;
| ddmmyy    &lt;br /&gt;
d: day; m: month; y: year&lt;br /&gt;
| 020812&lt;br /&gt;
|-&lt;br /&gt;
| altitude&lt;br /&gt;
| meters&lt;br /&gt;
| 257.00&lt;br /&gt;
|-&lt;br /&gt;
| speedOG&lt;br /&gt;
| knots&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| course&lt;br /&gt;
| degrees&lt;br /&gt;
| 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If UE-assisted mode, when fixed will report indication:&lt;br /&gt;
&lt;br /&gt;
+CAGPSINFO:&amp;lt;latitude&amp;gt;,&amp;lt;longitude&amp;gt;,&amp;lt;altitude&amp;gt;,&amp;lt;date&amp;gt;,&amp;lt;UTC_time&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Values&lt;br /&gt;
! Format&lt;br /&gt;
! Example&lt;br /&gt;
|-&lt;br /&gt;
| latitude&lt;br /&gt;
| Unit is in 10^8 degree&lt;br /&gt;
| 4168050885&lt;br /&gt;
|-&lt;br /&gt;
| longitude&lt;br /&gt;
| Unit is in 10^8 degree&lt;br /&gt;
| 88618039&lt;br /&gt;
|-&lt;br /&gt;
| altitude&lt;br /&gt;
| meters&lt;br /&gt;
| 293&lt;br /&gt;
|-&lt;br /&gt;
| date&lt;br /&gt;
| ddmmyyyy      &lt;br /&gt;
d: day; m: month; y: year&lt;br /&gt;
| 28092012&lt;br /&gt;
|-&lt;br /&gt;
| UTC_time&lt;br /&gt;
| hhmmss.s      &lt;br /&gt;
h: hour; m: minute; s: seconds &lt;br /&gt;
| 081611.0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Command Summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command &lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGSOCKCONT=**,&amp;amp;&amp;amp;&amp;amp;&lt;br /&gt;
| OK&lt;br /&gt;
| ** is the protocol and &amp;amp;&amp;amp;&amp;amp; Access Point Name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGPS=*,&amp;amp;&lt;br /&gt;
| OK&lt;br /&gt;
| * sets on (1) or off (0) and &amp;amp; is the GPS mode.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGPSINFO&lt;br /&gt;
|&lt;br /&gt;
| Gets current position information.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGPSURL=”***”&lt;br /&gt;
| OK&lt;br /&gt;
| Sets AGPS default server URL . *** is the URL.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGPSSSL=*&lt;br /&gt;
| OK&lt;br /&gt;
| Select transport security, used certificate (*=1) or not (*=0).&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGPSSWITCH&lt;br /&gt;
| OK&lt;br /&gt;
| Choose the output port for NMEA sentence.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== SMS ==&lt;br /&gt;
=== Sending and Receiving SMS ===&lt;br /&gt;
The first code is used to send a SMS, the second one reads the SIM message memory and shows the last SMS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
 &lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int timesToSend = 1;        // Numbers of SMS to send&lt;br /&gt;
int count = 0;&lt;br /&gt;
&lt;br /&gt;
char phone_number[]=&amp;quot;*********&amp;quot;;     // ********* is the number to call&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CMGF=1&amp;quot;);         // sets the SMS mode to text&lt;br /&gt;
    delay(100);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    while (count &amp;lt; timesToSend){&lt;br /&gt;
        delay(1500);&lt;br /&gt;
        Serial.print(&amp;quot;AT+CMGS=\&amp;quot;&amp;quot;);   // send the SMS number&lt;br /&gt;
        Serial.print(phone_number);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
        delay(1500);      &lt;br /&gt;
        Serial.print(&amp;quot;Hola caracola...&amp;quot;);     // the SMS body&lt;br /&gt;
        delay(500);&lt;br /&gt;
        Serial.write(0x1A);       //sends ++&lt;br /&gt;
        Serial.write(0x0D);&lt;br /&gt;
        Serial.write(0x0A);&lt;br /&gt;
&lt;br /&gt;
        delay(5000);&lt;br /&gt;
&lt;br /&gt;
        count++;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
another code&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
*&lt;br /&gt;
 *  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
 *  it under the terms of the GNU General Public License as published by&lt;br /&gt;
 *  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
 *  (at your option) any later version.&lt;br /&gt;
 *&lt;br /&gt;
 *  This program is distributed in the hope that it will be useful,&lt;br /&gt;
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
 *  GNU General Public License for more details.&lt;br /&gt;
 *&lt;br /&gt;
 *  You should have received a copy of the GNU General Public License&lt;br /&gt;
 *  along with this program.  If not, see http://www.gnu.org/licenses/.&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
 *&lt;br /&gt;
 *  Version 0.1&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int timesToSend = 1;        // Numbers of SMS to send&lt;br /&gt;
int count = 0;&lt;br /&gt;
&lt;br /&gt;
int n_sms,x,sms_start;&lt;br /&gt;
char data[256];&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i = 0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CMGF=1&amp;quot;);         // sets the SMS mode to text&lt;br /&gt;
    delay(100);&lt;br /&gt;
    x = 0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;       &lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
    while(!((data[x-1] == 'K') &amp;amp;&amp;amp; (data[x-2] == 'O')));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    while (count &amp;lt; timesToSend){&lt;br /&gt;
        delay(1500);&lt;br /&gt;
&lt;br /&gt;
        while(Serial.available()!=0) Serial.read();&lt;br /&gt;
&lt;br /&gt;
        Serial.println(&amp;quot;AT+CPMS=\&amp;quot;SM\&amp;quot;,\&amp;quot;SM\&amp;quot;,\&amp;quot;SM\&amp;quot;&amp;quot;);    //selects SIM memory&lt;br /&gt;
        Serial.flush();&lt;br /&gt;
        for (x=0;x &amp;lt; 255;x++){            &lt;br /&gt;
            data[x]='\0';                        &lt;br /&gt;
        } &lt;br /&gt;
        x=0;&lt;br /&gt;
        do{&lt;br /&gt;
            while(Serial.available()==0);&lt;br /&gt;
            data[x]=Serial.read();  &lt;br /&gt;
            x++;       &lt;br /&gt;
&lt;br /&gt;
        }while(!((data[x-1] == 'K') &amp;amp;&amp;amp; (data[x-2] == 'O')));&lt;br /&gt;
&lt;br /&gt;
        x=0;&lt;br /&gt;
        do{&lt;br /&gt;
            x++;&lt;br /&gt;
        }while (data[x] != ' ');&lt;br /&gt;
&lt;br /&gt;
        x++;&lt;br /&gt;
        n_sms=0;&lt;br /&gt;
        do{&lt;br /&gt;
            n_sms*=10;&lt;br /&gt;
            n_sms=n_sms + (data[x]-0x30);&lt;br /&gt;
&lt;br /&gt;
            x++;&lt;br /&gt;
&lt;br /&gt;
        }while (data[x] != ',');&lt;br /&gt;
        &lt;br /&gt;
        Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
        Serial.print(n_sms,DEC);&lt;br /&gt;
&lt;br /&gt;
// Now it shows the total number of SMS and the last SMS&lt;br /&gt;
        Serial.println(&amp;quot;  SMS stored in SIM memory. Showing last SMS:&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        Serial.print(&amp;quot;AT+CMGR=&amp;quot;);    //Reads the last SMS &lt;br /&gt;
        Serial.println(n_sms-1,DEC);&lt;br /&gt;
        Serial.flush();&lt;br /&gt;
        for (x=0;x &amp;lt; 255;x++){            &lt;br /&gt;
            data[x]='\0';                        &lt;br /&gt;
        } &lt;br /&gt;
        x=0;&lt;br /&gt;
        do{&lt;br /&gt;
            while(Serial.available()==0);&lt;br /&gt;
            data[x]=Serial.read();  &lt;br /&gt;
            x++;           &lt;br /&gt;
            if((data[x-1] == 0x0D) &amp;amp;&amp;amp; (data[x-2] == '&amp;quot;')){&lt;br /&gt;
                x=0;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        while(!((data[x-1] == 'K') &amp;amp;&amp;amp; (data[x-2] == 'O')));&lt;br /&gt;
&lt;br /&gt;
        data[x-3]='\0';        //finish the string before the OK&lt;br /&gt;
&lt;br /&gt;
        Serial.println(data);    //shows the message&lt;br /&gt;
&lt;br /&gt;
        delay(5000);&lt;br /&gt;
&lt;br /&gt;
        count++;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Command Summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
! Command&lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CMGF=&lt;br /&gt;
| OK&lt;br /&gt;
| Specifies the input and output format of the short messages. 0 for PDU mode and 1 for text mode.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CMGS&lt;br /&gt;
|&lt;br /&gt;
| Sends a message.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CPMS=***&lt;br /&gt;
|&lt;br /&gt;
| Selects memory storages. *** is the memory type.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CMGR=*&lt;br /&gt;
|&lt;br /&gt;
| Reads a message. * is the number of the message.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== E-mails ==&lt;br /&gt;
=== Sending an E-mail ===&lt;br /&gt;
To send e-mail a SMTP server is used, so we need an e-mail account. The code example is the next:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
int x;&lt;br /&gt;
&lt;br /&gt;
//server and account data&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
//information about sender, direcctions and names&lt;br /&gt;
char sender_add[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char sender_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
char to_add[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char to_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
char cc_add[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char cc_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
char bcc_add[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char bcc_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
//&lt;br /&gt;
char subject[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char body[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
char response[128];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPSRV=\&amp;quot;&amp;quot;);    &lt;br /&gt;
    //configures the SIM5218 with server name and port&lt;br /&gt;
    Serial.print(server);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
    Serial.println(port);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPAUTH=1,\&amp;quot;&amp;quot;);    //configures the SIM5218 with user name and password&lt;br /&gt;
    Serial.print(user_name);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(password);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPFROM=\&amp;quot;&amp;quot;);    //sender adress and name&lt;br /&gt;
    Serial.print(sender_add);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(sender_name);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPRCPT=0,0,\&amp;quot;&amp;quot;);    //normal recipient address and name&lt;br /&gt;
    Serial.print(to_add);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(to_name);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    //If you don't need a carbon copy, delete this part&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPRCPT=1,0,\&amp;quot;&amp;quot;);    //carbon copy recipient address and name&lt;br /&gt;
    Serial.print(cc_add);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(cc_name);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    //If you don't need a blind carbon copy, delete this part&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPRCPT=2,0,\&amp;quot;&amp;quot;);    //blind carbon copy recipient address and name&lt;br /&gt;
    Serial.print(bcc_add);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(bcc_name);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPSUB=\&amp;quot;&amp;quot;);    //subjec of email&lt;br /&gt;
    Serial.print(subject);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPBODY=\&amp;quot;&amp;quot;);    //body of email&lt;br /&gt;
    Serial.print(body);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));    &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+SMTPSEND&amp;quot;);    //sends the email&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;Sending email...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        do{&lt;br /&gt;
            digitalWrite(led,HIGH);    &lt;br /&gt;
        }&lt;br /&gt;
        while(Serial.available()==0); &lt;br /&gt;
        digitalWrite(led,LOW);    &lt;br /&gt;
        response[x]=Serial.read();   &lt;br /&gt;
        x++;&lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='S'&amp;amp;&amp;amp;response[x-2]=='S'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(response);&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Receiving an E-mail ===&lt;br /&gt;
For read an e-mail from a POP3 server we need an e-mail account. The code example is here:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
 &lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
int x;&lt;br /&gt;
&lt;br /&gt;
//server and account data&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
char path[50];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+POP3SRV=\&amp;quot;&amp;quot;);    &lt;br /&gt;
    //configures the SIM5218 with server name, user, password and port&lt;br /&gt;
    Serial.print(server);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(user_name);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(password);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
    Serial.println(port);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+POP3IN&amp;quot;);    //logs into the server&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+POP3GET=1&amp;quot;);    //gets the first email&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        path[0]=Serial.read();&lt;br /&gt;
    }while(path[0]!='/'); &lt;br /&gt;
&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        path[0]=Serial.read();  &lt;br /&gt;
    }&lt;br /&gt;
    while(path[0]!='/');&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0); &lt;br /&gt;
        path[x]=Serial.read(); &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(path[x-1]!=' ');&lt;br /&gt;
&lt;br /&gt;
    x--;    //overwrite &amp;quot; &amp;quot; charracter&lt;br /&gt;
    x--;    //overwrite &amp;quot;,&amp;quot; charracter&lt;br /&gt;
&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0); &lt;br /&gt;
        path[x]=Serial.read(); &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(path[x-1]!=0x0D);&lt;br /&gt;
    path[x-1]='\0';&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+POP3OUT&amp;quot;);    //logs out the server&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+FSCD=C:/Email&amp;quot;);    //selects email directory as current directory&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+POP3READ=0,\&amp;quot;&amp;quot;);    //shows the email&lt;br /&gt;
    Serial.print(path);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[0]=Serial.read();         &lt;br /&gt;
    }while(data[0]!='D');&lt;br /&gt;
    &lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[0]=Serial.read();         &lt;br /&gt;
    }while(data[0]!='D');&lt;br /&gt;
    &lt;br /&gt;
    x=1;    &lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;   &lt;br /&gt;
        if(x==1020){&lt;br /&gt;
            Serial.print(data);&lt;br /&gt;
            x=0;&lt;br /&gt;
        }        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'&amp;amp;&amp;amp;data[x-3]==0x0A&amp;amp;&amp;amp;data[x-4]==0x0D));&lt;br /&gt;
&lt;br /&gt;
    data[x-2]='\0';&lt;br /&gt;
    Serial.println(data);&lt;br /&gt;
    &lt;br /&gt;
    while(1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Command Summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command &lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGSOCKCONT=**,&amp;amp;&amp;amp;&amp;amp;&lt;br /&gt;
| OK&lt;br /&gt;
| ** is the protocol and &amp;amp;&amp;amp;&amp;amp; Access Point Name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPSRV=”*****”,&amp;amp;&amp;amp;&amp;amp; &lt;br /&gt;
| OK&lt;br /&gt;
| Sets SMTP server address and server’s port . ***** is the sever address and &amp;amp;&amp;amp;&amp;amp; is the server's port.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPAUTH=1,”***”,”&amp;amp;&amp;amp;&amp;amp;”&lt;br /&gt;
| OK&lt;br /&gt;
| Controls SMTP authentication. *** is the user name and &amp;amp;&amp;amp;&amp;amp; is the password.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPFROM=”***”,”&amp;amp;&amp;amp;&amp;amp;”&lt;br /&gt;
| OK&lt;br /&gt;
| Sets sender’s address and nam e. *** is the sender's address and &amp;amp;&amp;amp;&amp;amp; is the sender's name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPRCPT=x,”***”,”&amp;amp;&amp;amp;&amp;amp;”&lt;br /&gt;
| OK&lt;br /&gt;
| Sets recipient address/name and kind .&lt;br /&gt;
x is the kind (TO/CC/BCC), *** is the recipient address and &amp;amp;&amp;amp;&amp;amp; is the recipient name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPSUB=”****”&lt;br /&gt;
| OK&lt;br /&gt;
| Sets the subject of e-mail . **** is the subject.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPBODY&lt;br /&gt;
|&lt;br /&gt;
| Sets e-mail body.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPSEND&lt;br /&gt;
|&lt;br /&gt;
| Initiates TCP session with SMTP server and sends an e-mail&lt;br /&gt;
|-&lt;br /&gt;
| AT+POP3SRV=”**”,”&amp;amp;&amp;amp;”,”xx”,yy&lt;br /&gt;
| OK&lt;br /&gt;
| Sets all parameters to get an e-mail from POP3 . ** is the server address, &amp;amp;&amp;amp; is the user name,&lt;br /&gt;
xx is the password and yy the server port&lt;br /&gt;
|-&lt;br /&gt;
| AT+POP3IN&lt;br /&gt;
| OK&lt;br /&gt;
| Logs in POP3 server&lt;br /&gt;
|-&lt;br /&gt;
| AT+POP3GET=***&lt;br /&gt;
|&lt;br /&gt;
| Gets an e-mail from POP3 server , *** is the number of the e-mail.&lt;br /&gt;
|-&lt;br /&gt;
| AT+POP3OUT&lt;br /&gt;
| OK&lt;br /&gt;
| Logs out POP3 server&lt;br /&gt;
|-&lt;br /&gt;
| AT+POP3READ=”***”,”&amp;amp;&amp;amp;&amp;amp;”&lt;br /&gt;
| &lt;br /&gt;
| Reads an e-mail from file system . *** is the location and &amp;amp;&amp;amp;&amp;amp; is the name.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== SD and system memory ==&lt;br /&gt;
The file system is used to store files in a hierarchical (tree) structure. Local storage space is mapped to “C:”, and SD is mapped to “D:”. In both “C:” and “D:” directories, module creates four directories named “Picture”, “Audio”, “Video” and “VideoCall” automatically; “Picture” is used to store static image when taking picture by camera, “Audio” is used to store audio file, “Video” is used to store video file when recor ding by camera, and “VideoCall” is used to store media file which is recorded during a video call.&lt;br /&gt;
&lt;br /&gt;
The maximum size of the microSD card is 32GB. Here are some AT commands to manage the file system:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command &lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSCD=****&lt;br /&gt;
| OK&lt;br /&gt;
| Select a directory as current directory . **** is the directory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSMKDIR=****&lt;br /&gt;
| OK&lt;br /&gt;
| Create a new directory in current directory . **** is the name of the new directory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSRMDIR=****&lt;br /&gt;
| OK&lt;br /&gt;
| Delete existing directory in current directory . **** is the name of the directory to delete.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSLS&lt;br /&gt;
| &lt;br /&gt;
| Make a list with informations of directories and/or files in current directory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+DEL=****&lt;br /&gt;
| OK&lt;br /&gt;
| Delete a file in current directory. **** is the name of the file to delete.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSRENAME=****,&amp;amp;&amp;amp;&amp;amp;&lt;br /&gt;
| OK&lt;br /&gt;
| Rename a file in current directory. **** is the actual name and &amp;amp;&amp;amp;&amp;amp; is the new name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSATTRI=****&lt;br /&gt;
| &lt;br /&gt;
| Request the attributes of file which is existing in current directory. **** is the name of the file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSMEM&lt;br /&gt;
| &lt;br /&gt;
| Check the size of available memory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSFMT&lt;br /&gt;
| OK&lt;br /&gt;
| Format storage card which is plugged in.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSLOCA=&lt;br /&gt;
| OK&lt;br /&gt;
| Set the storage place , 0 for local and 1 for SD&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== FTP and FTPS ==&lt;br /&gt;
=== FTP ===&lt;br /&gt;
Creating a file into the FTP server, writing it and reading it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
*&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int x=0;&lt;br /&gt;
int file_size;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPSERV=\&amp;quot;&amp;quot;); //Sets the FTP server&lt;br /&gt;
  Serial.print(server);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPPORT=&amp;quot;);    //Sets FTP port&lt;br /&gt;
  Serial.println(port);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPUN=\&amp;quot;&amp;quot;); //Sets the user name&lt;br /&gt;
  Serial.print(user_name);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPPW=\&amp;quot;&amp;quot;); //Sets password&lt;br /&gt;
  Serial.print(password);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;);     &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPMODE=1&amp;quot;);    //Selects pasive mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPTYPE=I&amp;quot;);    //Selects Binary mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPPUT=\&amp;quot;/test.txt\&amp;quot;&amp;quot;);    //Creates a file and sends data (ASCII)&lt;br /&gt;
    Serial.flush(); &lt;br /&gt;
    while(Serial.read()]!='N');    //Waits 'N' from BEGIN&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;01234567890123456789&amp;quot;);    //Data for the file&lt;br /&gt;
    Serial.write(0x1A);    //EOL character&lt;br /&gt;
    Serial.write(0x0D);&lt;br /&gt;
    Serial.write(0x0A);&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read(); &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    delay(1000);&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPGET=\&amp;quot;/test.txt\&amp;quot;&amp;quot;);    //Reads the data from test file&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while((data[x-1]!=','));&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    &lt;br /&gt;
    while(Serial.peek()!=0x0A){&lt;br /&gt;
        file_size=(file_size*10)+(Serial.read()-0x30);&lt;br /&gt;
    }; &lt;br /&gt;
&lt;br /&gt;
    for(x=0;x&amp;lt; file_size;x++){&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    Serial.print(data);&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uploading a file from local storage or SD to FTP server.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[256];&lt;br /&gt;
int x=0;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPSERV=\&amp;quot;&amp;quot;); //Sets the FTP server&lt;br /&gt;
  Serial.print(server);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPPORT=&amp;quot;);    //Sets FTP port&lt;br /&gt;
  Serial.println(port);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPUN=\&amp;quot;&amp;quot;); //Sets the user name&lt;br /&gt;
  Serial.print(user_name);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPPW=\&amp;quot;&amp;quot;); //Sets password&lt;br /&gt;
  Serial.print(password);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;);     &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPMODE=1&amp;quot;);    //Selects pasive mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    //Selecciona el tipo ASCII&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPTYPE=I&amp;quot;);    //Selects Binary mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPPUTFILE=\&amp;quot;/testfile.txt\&amp;quot;,0&amp;quot;);    //Uploads a test file into FTP server.&lt;br /&gt;
    Serial.flush(); &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read(); &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Downloading a file from FTP server or SD to local storage.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int x=0;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);   &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPSERV=\&amp;quot;&amp;quot;); //Sets the FTP server&lt;br /&gt;
  Serial.print(server);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPPORT=&amp;quot;);    //Sets FTP port&lt;br /&gt;
  Serial.println(port);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPUN=\&amp;quot;&amp;quot;); //Sets the user name&lt;br /&gt;
  Serial.print(user_name);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPPW=\&amp;quot;&amp;quot;); //Sets password&lt;br /&gt;
  Serial.print(password);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;);     &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPMODE=1&amp;quot;);    //Selects pasive mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    //Selecciona el tipo ASCII&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPTYPE=I&amp;quot;);    //Selects Binary mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    //Envia data&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPGETFILE=\&amp;quot;/testfile.txt\&amp;quot;,0&amp;quot;);  //Downloads a test file from FTP server.&lt;br /&gt;
    Serial.flush(); &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read(); &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FTPS ===&lt;br /&gt;
Creating a file into the FTP server, writing it and reading it (likes FTP codes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
*&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int x=0;&lt;br /&gt;
unsigned int file_size=0;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for(int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSSTART&amp;quot;);      //Acquires FTPS protocol stack&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPSLOGIN=\&amp;quot;&amp;quot;);      //Logs into FTPS server&lt;br /&gt;
    Serial.print(server);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
    Serial.print(port);&lt;br /&gt;
    Serial.print(&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(user_name);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(password);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPMODE=1&amp;quot;);    //Selects pasive mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSTYPE=I&amp;quot;);    //Selects Binary mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
   //Envia data&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSPUT=\&amp;quot;/test_file.txt\&amp;quot;,13&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();&lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(data[x-1]!='&amp;gt;');&lt;br /&gt;
    &lt;br /&gt;
    Serial.write(&amp;quot;Test message!&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        digitalWrite(13, LOW);&lt;br /&gt;
        data[x]=Serial.read(); &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    delay(1000);&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSGET=\&amp;quot;/test.txt\&amp;quot;&amp;quot;);    //Reads the data from test file&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while((data[x-1]!=','));&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    &lt;br /&gt;
    while(Serial.peek()!=0x0A){&lt;br /&gt;
        file_size=(file_size*10)+(Serial.read()-0x30);&lt;br /&gt;
    }; &lt;br /&gt;
&lt;br /&gt;
    for(x=0;x&amp;lt; file_size;x++){&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    Serial.print(data);&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uploading a file from local storage or SD to FTP server &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[256];&lt;br /&gt;
int x=0;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // swithes the module ON&lt;br /&gt;
&lt;br /&gt;
    for(int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSSTART&amp;quot;);      //Acquires FTPS protocol stack&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPSLOGIN=\&amp;quot;&amp;quot;);      //Logs into FTPS server&lt;br /&gt;
    Serial.print(server);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
    Serial.print(port);&lt;br /&gt;
    Serial.print(&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(user_name);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(password);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPMODE=1&amp;quot;);    //Selects pasive mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSTYPE=I&amp;quot;);    //Selects Binary mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    //Envia data&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSPUTFILE=\&amp;quot;/testfile.txt\&amp;quot;,0&amp;quot;); //Uploads a test file from FTPS server.&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        digitalWrite(13, LOW);&lt;br /&gt;
        data[x]=Serial.read(); &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Downloading a file from FTP server or SD to local storage&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[256];&lt;br /&gt;
int x=0;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for(int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSSTART&amp;quot;);      //Acquires FTPS protocol stack&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPSLOGIN=\&amp;quot;&amp;quot;);      //Logs into FTPS server&lt;br /&gt;
    Serial.print(server);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
    Serial.print(port);&lt;br /&gt;
    Serial.print(&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(user_name);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(password);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPMODE=1&amp;quot;);    //Selects pasive mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSTYPE=I&amp;quot;);    //Selects Binary mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    //Envia data&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSGETFILE=\&amp;quot;/testfile.txt\&amp;quot;,0&amp;quot;); //Downloads a test file from FTPS server.&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        digitalWrite(13, LOW);&lt;br /&gt;
        data[x]=Serial.read(); &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Command and Summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command&lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGSOCKCONT=**,&amp;amp;&amp;amp;&amp;amp;&lt;br /&gt;
| OK&lt;br /&gt;
| ** is the protocol and &amp;amp;&amp;amp;&amp;amp; Access Point Name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSERV=”****”&lt;br /&gt;
| &lt;br /&gt;
| Sets FTP server domain name or IP address. **** is the domain name or the IP.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPPORT=***&lt;br /&gt;
| OK&lt;br /&gt;
| Sets FTP server port. *** is the port.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPUN=”***”&lt;br /&gt;
| OK&lt;br /&gt;
| Sets user name for FTP server access. *** is the user name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPPW=”***”&lt;br /&gt;
| OK&lt;br /&gt;
| Sets password for FTP server access. *** is the password.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPMODE=&lt;br /&gt;
| OK&lt;br /&gt;
| Sets FTP mode. 1 for passive or 0 for proactive.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPTYPE=&lt;br /&gt;
| OK&lt;br /&gt;
| Sets the transfer type on FTP server . A for ASCII or I for binary.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPPUT=”***”,&amp;amp;&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Puts a file from FTP server to serial port . *** is the path with the name of the file and &amp;amp;&amp;amp; is the length.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPGET=”***”&lt;br /&gt;
|&lt;br /&gt;
| Gets a file from FTP server to serial port . *** is the path with the name of the file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPPUTFILE=”***”,&amp;amp;&lt;br /&gt;
|&lt;br /&gt;
| Uploads a file to FTP server from module . *** is the path and &amp;amp; is the storage directory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPGETFILE”=***”,&amp;amp;&lt;br /&gt;
|&lt;br /&gt;
| Downloads a file from FTP server to module . *** is the path with the name and &amp;amp; is the storage directory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSSTART&lt;br /&gt;
| OK&lt;br /&gt;
| Acquires FTPS protocol stack.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSLOGIN=”**”,&amp;amp;&amp;amp;&amp;amp;,”xxx”,”yyy&lt;br /&gt;
| OK&lt;br /&gt;
| Logs in FTPS server. *** is the host address, &amp;amp;&amp;amp;&amp;amp; is the port, xxx is the user name and yyy is the password.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSTYPE=&lt;br /&gt;
| OK&lt;br /&gt;
| Sets the transfer type on FTPS server . A for ASCII or I for binary.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSPUT=”***”,&amp;amp;&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Puts a file from FTPS server to serial port . *** is the path with the name of the file and &amp;amp;&amp;amp; is the length.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSGET=”***”&lt;br /&gt;
|&lt;br /&gt;
| Gets a file from FTPS server to serial port . *** is the path with the name of the file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSPUTFILE=”***”,&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Uploads a file to FTPS server from module . *** is the path and &amp;amp; is the storage directory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSGETFILE=”***”,&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Downloads a file from FTPS server to module . *** is the path with the name and &amp;amp; is the storage directory.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== TCP and UDP ==&lt;br /&gt;
=== UDP client ===&lt;br /&gt;
Sending data to a UDP server:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char name[20];&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+NETOPEN=\&amp;quot;UDP\&amp;quot;,&amp;quot;); //Opens the socket with the type of protocol and the port &lt;br /&gt;
  Serial.println(port);        &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='d'&amp;amp;&amp;amp;data[x-2]=='e'));        //waits for response &amp;quot;Network opened&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+UDPSEND=12,\&amp;quot;&amp;quot;); //Sends UDP data&lt;br /&gt;
  Serial.print(server);&lt;br /&gt;
  Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
  Serial.println(port);        &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='&amp;gt;');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;Test message&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+NETCLOSE&amp;quot;); //Opens the socket with the type of protocol and the port &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== TCP Client ===&lt;br /&gt;
Sending data to a TCP server:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char name[20];&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+NETOPEN=\&amp;quot;TCP\&amp;quot;,&amp;quot;);&lt;br /&gt;
    //Opens the socket with the type of protocol and the port &lt;br /&gt;
  Serial.println(port);        &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='d'&amp;amp;&amp;amp;data[x-2]=='e'));        //waits for response &amp;quot;Network opened&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    Serial.print(&amp;quot;AT+TCPCONNECT=\&amp;quot;&amp;quot;); //Connects with the server&lt;br /&gt;
  Serial.print(server);&lt;br /&gt;
  Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);    &lt;br /&gt;
  Serial.println(port);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+TCPWRITE=12&amp;quot;);        //Sends TCP data&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='&amp;gt;');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;Test message&amp;quot;); &lt;br /&gt;
    &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+NETCLOSE&amp;quot;); //Opens the socket with the type of protocol and the port &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Multiclient ===&lt;br /&gt;
SIM5218 allows to use ten connections simultaneously. Here is the example code with a UDP and TCP connections.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char UDP_server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char UDP_port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char TCP_server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char TCP_port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+NETOPEN=,,1&amp;quot;);        //Opens the socket in multiclient mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='d'&amp;amp;&amp;amp;data[x-2]=='e'));        //waits for response &amp;quot;Network opened&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CIPOPEN=0,\&amp;quot;UDP\&amp;quot;,\&amp;quot;&amp;quot;);  //Connects with the UDP server&lt;br /&gt;
  Serial.print(UDP_server);&lt;br /&gt;
  Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
  Serial.println(UDP_port);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CIPOPEN=1,\&amp;quot;TCP\&amp;quot;,\&amp;quot;&amp;quot;);  //Connects with the TCP server&lt;br /&gt;
  Serial.print(TCP_server);&lt;br /&gt;
  Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
  Serial.println(TCP_port);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CIPSEND=0,16&amp;quot;);    //Sends data to UDP server&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='&amp;gt;');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;UDP test message&amp;quot;); &lt;br /&gt;
    &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CIPSEND=1,16&amp;quot;);    //Sends data to TCP server&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='&amp;gt;');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;TCP test message&amp;quot;); &lt;br /&gt;
    &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CIPCLOSE=0&amp;quot;);    //Closes UDP connection&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CIPCLOSE=1&amp;quot;);    //Closes TCP connection&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+NETCLOSE&amp;quot;);        //Opens the socket with the type of protocol and the port &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== TCP Server ===&lt;br /&gt;
SIM5218 allows to create a TCP server with a maximum of ten TCP clients. In this example the server send a message every 5 seconds to all clients.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
 &lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char name[20];&lt;br /&gt;
&lt;br /&gt;
int clients=-2;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+NETOPEN=\&amp;quot;TCP\&amp;quot;,&amp;quot;);  &lt;br /&gt;
    //Opens the socket with the type of protocol and the port &lt;br /&gt;
    Serial.println(port);        &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='d'&amp;amp;&amp;amp;data[x-2]=='e'));        //waits for response &amp;quot;Network opened&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+SERVERSTART&amp;quot;); //Starts TCP server&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+LISTCLIENT&amp;quot;);  // List all of clients&lt;br /&gt;
  Serial.flush();&lt;br /&gt;
  clients=-2;&lt;br /&gt;
  do{&lt;br /&gt;
    if(Serial.read()==0x0D){&lt;br /&gt;
      clients++;&lt;br /&gt;
    }&lt;br /&gt;
  }while(Serial.peek()!='K'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  for(int y=0;y&amp;lt; clients;y++){&lt;br /&gt;
    Serial.print(&amp;quot;AT+ACTCLIENT=&amp;quot;);    //activates the connection with the client  &lt;br /&gt;
    Serial.println(y);&lt;br /&gt;
    while(Serial.read()!='K'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+TCPWRITE=12&amp;quot;);        //Sends TCP data&lt;br /&gt;
      Serial.flush();&lt;br /&gt;
      while(Serial.read()!='&amp;gt;');  &lt;br /&gt;
&lt;br /&gt;
      Serial.println(&amp;quot;Test message&amp;quot;); &lt;br /&gt;
    &lt;br /&gt;
      x=0;&lt;br /&gt;
      do{&lt;br /&gt;
          while(Serial.available()==0);&lt;br /&gt;
          data[x]=Serial.read();  &lt;br /&gt;
          x++;                        &lt;br /&gt;
      }while(!(data[x-1]=='k'&amp;amp;&amp;amp;data[x-2]=='o'));    Waits for &amp;quot;send ok&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CLOSECLIENT=&amp;quot;); //desactivates the connection with the client  &lt;br /&gt;
    Serial.println(y);&lt;br /&gt;
    while(Serial.read()!='K'));&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  delay(5000);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Command and Summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command&lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+NETOPEN=”***”,&amp;amp;&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Opens a socket . *** is the socket type and &amp;amp;&amp;amp; is the port.&lt;br /&gt;
|-&lt;br /&gt;
| AT+NETCLOSE&lt;br /&gt;
| OK&lt;br /&gt;
| Closes socket.&lt;br /&gt;
|-&lt;br /&gt;
| AT+UPDSEND&lt;br /&gt;
| &lt;br /&gt;
| Sends UDP data.&lt;br /&gt;
|-&lt;br /&gt;
| | |&lt;br /&gt;
|-&lt;br /&gt;
| AT+TCPCONNECT=”***”,&amp;amp;&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Establishes TCP connection with TCP server. *** is the IP address and &amp;amp;&amp;amp; is the port.&lt;br /&gt;
|-&lt;br /&gt;
| AT+TCPWRITE&lt;br /&gt;
|&lt;br /&gt;
| Sends TCP data when the TCP connection is established.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SERVERSTART&lt;br /&gt;
| OK&lt;br /&gt;
| Starts up TCP server.&lt;br /&gt;
|-&lt;br /&gt;
| AT+LISTCLIENT&lt;br /&gt;
|&lt;br /&gt;
| Lists all of clients’ information.&lt;br /&gt;
|-&lt;br /&gt;
| AT+ACTCLIENT=*&lt;br /&gt;
| OK&lt;br /&gt;
| Activates the specified client. * is the number of the client.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CLOSECLIENT=*&lt;br /&gt;
| OK&lt;br /&gt;
| Disconnects the specified client. * is the number of the client.&lt;br /&gt;
|-&lt;br /&gt;
| | | &lt;br /&gt;
|-&lt;br /&gt;
| AT+CIPOPEN=*,”&amp;amp;&amp;amp;”,”xx”,yy&lt;br /&gt;
| &lt;br /&gt;
| Establish a connection with TCP server or UDP server. * is the number of the connection, &lt;br /&gt;
&amp;amp;&amp;amp; is the type of transmision protocol, xx is the server IP and yy is the server port.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CIPSEND&lt;br /&gt;
| &lt;br /&gt;
| Sends some data to remote host in mult-client mode.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CIPCLOSE=*&lt;br /&gt;
| OK&lt;br /&gt;
| Closes a specified connection in multi-client mode. * is the number of the connection.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== HTTP and HTTPS ==&lt;br /&gt;
=== HTTP ===&lt;br /&gt;
SIM5218 can launch a HTTP operation like GET or POST. Here is an example with GET operation:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see ..&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int data_size&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CHTTPACT=\&amp;quot;&amp;quot;); //Connects with the HTTP server&lt;br /&gt;
  Serial.print(server);&lt;br /&gt;
  Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
  Serial.println(port);        &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='T'&amp;amp;&amp;amp;data[x-2]=='S'));        //waits for response &amp;quot;REQUEST&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;GET /index.html HTTP/1.1&amp;quot;);&lt;br /&gt;
  Serial.println(&amp;quot;Host: www.mywebsite.com&amp;quot;);&lt;br /&gt;
  Serial.println(&amp;quot;Content-Length: 0&amp;quot;);&lt;br /&gt;
  Serial.write(0x1A);       //sends ++&lt;br /&gt;
    Serial.write(0x0D);&lt;br /&gt;
    Serial.write(0x0A);&lt;br /&gt;
&lt;br /&gt;
  while(Serial.read()!='K');&lt;br /&gt;
  while(Serial.read()!=' ');&lt;br /&gt;
&lt;br /&gt;
  data_size=0;  &lt;br /&gt;
  do{&lt;br /&gt;
    data_size*=10;&lt;br /&gt;
    data_size=data_size+(Serial.read()-0x30);&lt;br /&gt;
  }while(Serial.peek()!=0x0D);&lt;br /&gt;
&lt;br /&gt;
  for(x=0;x&amp;lt; data_size;x++){&lt;br /&gt;
    data[x]=Serial.read();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  Serial.print(data);&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== HTTPS ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int data_size&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CHTTPSSTART&amp;quot;); //Acquires HTTPS protocol stack       &lt;br /&gt;
    Serial.flush();    &lt;br /&gt;
  while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
  Serial.println(&amp;quot;AT+CHTTPSOPSE&amp;quot;);  //Opens a new HTTPS session   &lt;br /&gt;
    Serial.flush();    &lt;br /&gt;
  while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
  Serial.println(&amp;quot;AT+CHTTPSSEND=63&amp;quot;); //Sends HTTPS request   &lt;br /&gt;
    Serial.flush();    &lt;br /&gt;
  while(Serial.read()!='&amp;gt;');&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;GET /index.html HTTP/1.1&amp;quot;);&lt;br /&gt;
  Serial.println(&amp;quot;Host: www.mywebsite.com&amp;quot;);&lt;br /&gt;
  Serial.println(&amp;quot;Content-Length: 0&amp;quot;);&lt;br /&gt;
  while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
  Serial.println(&amp;quot;AT+CHTTPSRECV=1&amp;quot;);  //Receives HTTPS response&lt;br /&gt;
    Serial.flush();    &lt;br /&gt;
  while(Serial.read()!=',');&lt;br /&gt;
&lt;br /&gt;
  data_size=0;  &lt;br /&gt;
  do{&lt;br /&gt;
    data_size*=10;&lt;br /&gt;
    data_size=data_size+(Serial.read()-0x30);&lt;br /&gt;
  }while(Serial.peek()!=0x0D);&lt;br /&gt;
&lt;br /&gt;
  for(x=0;x&amp;lt; d ata_size;x++){&lt;br /&gt;
    data[x]=Serial.read();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  Serial.println(&amp;quot;AT+CHTTPSCLSE&amp;quot;);  //Closes a new HTTPS session   &lt;br /&gt;
    Serial.flush();    &lt;br /&gt;
  while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
  Serial.println(&amp;quot;AT+CHTTPSSTOP&amp;quot;);  //Releases HTTPS protocol stack&lt;br /&gt;
    Serial.flush();    &lt;br /&gt;
  while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
  Serial.print(data);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Command and Summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command &lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPACT=”***”,&amp;amp;&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Launches a HTTP operation . *** is the server address and &amp;amp;&amp;amp; is the port.&lt;br /&gt;
|-&lt;br /&gt;
| | | |&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPSSTART&lt;br /&gt;
| OK&lt;br /&gt;
| Acquires HTTPS protocol stack.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPSSTOP&lt;br /&gt;
| OK&lt;br /&gt;
| Releases HTTPS protocol stack.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPSOPSE&lt;br /&gt;
| OK&lt;br /&gt;
| Opens a new HTTPS session.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPSCLSE&lt;br /&gt;
| OK&lt;br /&gt;
| Closes the opened HTTPS session.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPSSEND=*&lt;br /&gt;
| &lt;br /&gt;
| Sends HTTPS request. * is the length of the data in the sending buffer.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPSRECV=*&lt;br /&gt;
| &lt;br /&gt;
| Receives HTTPS response after sending HTTPS request.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''AT Command Tester Application'''&lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/module-tester/ AT Command Tester] is a free online tool test [http://m2msupport.net/m2msupport/software-and-at-commands-for-m2m-modules/ AT Commands] and other modem functionalities of [http://m2msupport.net/m2msupport/category/devices/gprs-modem/ 2G modules] (GPRS/EDGE) , [http://m2msupport.net/m2msupport/category/devices/gprs-modem/ 3G Modules] (HSDPA/EVDO) and [http://m2msupport.net/m2msupport/search-page/?Max!Download!Speed=100%20Mbps 4G Modules] (LTE).AT Command Tester tool connects to the modem port of the device and can test various modem functions such as getting [http://m2msupport.net/m2msupport/at-commands-to-get-device-information/ device information], [http://m2msupport.net/m2msupport/data-call-at-commands-to-set-up-gprsedgeumtslte-data-call/ gprs data call], [http://m2msupport.net/m2msupport/voice-call-at-commands-to-set-up-voice-call/ voice call],[http://m2msupport.net/m2msupport/at-command-for-http-functions-for-remote-server-data-access/ http access], [http://m2msupport.net/m2msupport/signal-quality/ checking signal condition], [http://m2msupport.net/m2msupport/network-registration/ network registration], [http://m2msupport.net/m2msupport/sms-at-commands/ SMS functions], [http://m2msupport.net/m2msupport/sim-at-commands-for-sim-presense-and-status/ SIM access], [http://m2msupport.net/m2msupport/sim-phonebook-at-commands/ phonebook functions] etc.&lt;br /&gt;
&lt;br /&gt;
In the 'Port Configuration' section of the tool, users can search for available ports using the 'Find Ports' button. Then using the 'Connect' button, users can connect to the modem port of the device.&lt;br /&gt;
&lt;br /&gt;
In the 'Command Mode' tab of AT Command Tester, single AT commands can be sent. The drop down list provides AT command description and examples. Users can modify the default command settings.&lt;br /&gt;
&lt;br /&gt;
[[File:M2m img1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Under the 'Script Mode' tab, multiple AT commands can be sent at a time. Users can add descriptive comments and save the script on their local machine. &lt;br /&gt;
&lt;br /&gt;
[[File:Script mode.PNG]]&lt;br /&gt;
&lt;br /&gt;
Data Call&lt;br /&gt;
&lt;br /&gt;
To make a data call with the modem, you need to connect to the APN of the carrier network. The carrier APN and other required information are stored in the SIM card and are referred as PDP contexts. Typically multiple PDP contexts are stored in the SIM for different call types. With the AT Command Tester you can edit/add/delete PDP contexts in a easy to use user interface. &lt;br /&gt;
&lt;br /&gt;
[[Image:Datacall.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;Typical call setup sequence,&lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgdcont-define-pdp-context/ AT+CGDCONT?] &lt;br /&gt;
&lt;br /&gt;
+CGDCONT: 1,&amp;quot;IP&amp;quot;,&amp;quot;epc.tmobile.com&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0&amp;lt;br&amp;gt;+CGDCONT: 2,&amp;quot;IP&amp;quot;,&amp;quot;test5&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0&amp;lt;br&amp;gt;+CGDCONT: 3,&amp;quot;IP&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Checking registration status... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcreg-network-registration/ AT+CREG?] &lt;br /&gt;
&lt;br /&gt;
+CREG: 0,1 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;The device is registered in home network. &lt;br /&gt;
&lt;br /&gt;
Checking if device is already connected... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgact-pdp-context-activate-or-deactivate/ AT+CGACT?] &lt;br /&gt;
&lt;br /&gt;
+CGACT: 1,0&amp;lt;br&amp;gt;+CGACT: 2,0&amp;lt;br&amp;gt;+CGACT: 3,0 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;[http://m2msupport.net/m2msupport/atcmee-report-mobile-termination-error/ AT+CMEE=1] &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Attaching to network...&amp;lt;br&amp;gt;AT+CGATT=1 &lt;br /&gt;
&lt;br /&gt;
OK &lt;br /&gt;
&lt;br /&gt;
Connecting... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgact-pdp-context-activate-or-deactivate/ AT+CGACT=1, 1] &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Connect Sucessful &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; '''SMS''' &lt;br /&gt;
&lt;br /&gt;
The SMS tab of the 'AT Command Tester' tool provides the interfaces to send SMS messages. You can also list/view/delete SMS messages stored on the SIM.&lt;br /&gt;
&lt;br /&gt;
[[Image:Sms.PNG]] &amp;lt;br&amp;gt; General sequence for sending SMS message, &lt;br /&gt;
&lt;br /&gt;
Checking registration status... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcreg-network-registration/ AT+CREG?] &lt;br /&gt;
&lt;br /&gt;
+CREG: 0,1 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;The device is registered in home network. &lt;br /&gt;
&lt;br /&gt;
AT+CMGS=&amp;quot;858XXXXXXX&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&amp;amp;gt; Test Message with AT Command Tester� &lt;br /&gt;
&lt;br /&gt;
+CMGS: 19 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;SMS Send successful &lt;br /&gt;
&lt;br /&gt;
'''Network Selection''' - This tab allows the user to manually select available networks. Modems are typically set for automatic network selection. 'Find Networks' button will command the modem to scan for available networks.&lt;br /&gt;
&lt;br /&gt;
[[Image:Network selection.PNG]] &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
AT+COPS command will initiate network scan in the modem, &lt;br /&gt;
&lt;br /&gt;
Finding Networks. Please wait.. &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcops-plmn-selection/ AT+COPS=?] &lt;br /&gt;
&lt;br /&gt;
+COPS: (2,&amp;quot;T-Mobile&amp;quot;,&amp;quot;T-Mobile&amp;quot;,&amp;quot;310260&amp;quot;),(1,&amp;quot;AT&amp;amp;amp;T&amp;quot;,&amp;quot;AT&amp;amp;amp;T&amp;quot;,&amp;quot;310410&amp;quot;),,(0,1,4),(0,1,2) &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Networks found &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
'''Phonebook'''&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
With the 'Phone Book' tab, you can add/delete/read phone book entries stored on the SIM, &lt;br /&gt;
&lt;br /&gt;
[[Image:Phone book.PNG]] &lt;br /&gt;
&lt;br /&gt;
Getting phonebook entries.. &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcpbr-read-phonebook-entries/ AT+CPBR=1,99] &lt;br /&gt;
&lt;br /&gt;
+CPBR: 1,&amp;quot;*233&amp;quot;,129,&amp;quot;Refill Now&amp;quot; &lt;br /&gt;
&lt;br /&gt;
+CPBR: 2,&amp;quot;#999#&amp;quot;,255,&amp;quot;Check Balance&amp;quot; &lt;br /&gt;
&lt;br /&gt;
+CPBR: 3,&amp;quot;8878878878&amp;quot;,129,&amp;quot;Test&amp;quot; &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resource ==&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/3G_shield_schematic+(1).pdf 3G shield schematic]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/SIM5218_AT_command_manual+(1).pdf SIM5218 AT command manual]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/V-SIM5218E_HD_V1.04.pdf SIM5218 Hardware Design]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/WindowsDrivers_SIM5218_2.4.00.rar Drivers for Windows]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/3G+GPS+shield+for+Arduino.fzpz  Fritzing libraries]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/Jumpers+of+3G+Arduino+shield.pdf Jumpers of 3G Arduino shield]&lt;br /&gt;
*[http://www.cutedigi.com/blog/?p=74 CuteDigi 3G+GPS Shield Test Tutorial]&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=3G_%2B_GPS_Shield_for_Arduino&amp;diff=3558</id>
		<title>3G + GPS Shield for Arduino</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=3G_%2B_GPS_Shield_for_Arduino&amp;diff=3558"/>
		<updated>2013-08-12T10:15:21Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Note: &lt;br /&gt;
&lt;br /&gt;
This shield uses wall adapter rated at 6V/2A. Please don't use voltage larger than 6V, it will burn the 3G module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This 3G+GPS Shield is using the design, schematics and code from &lt;br /&gt;
&lt;br /&gt;
http://www.cooking-hacks.com/index.php/documentation/tutorials/arduino-3g-gprs-gsm-gps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The new 3G shield for Arduino enables the connectivity to high speed '''WCDMA''' and '''HSPA''' cellular networks in order to make possible the creation of the next level of worldwide interactivity projects inside the new &amp;quot;Internet of Things&amp;quot; era.&lt;br /&gt;
&lt;br /&gt;
The module counts also with an internal '''GPS''' what enables the location of the device outdoors and indoors combining standard NMEA frames with mobile cell ID triangulation using both assisted-mobile '''(A-GPS)''' and mobile-based '''(S-GPS)''' modes.&lt;br /&gt;
&lt;br /&gt;
Other interesting accessories which can be connected to the module are a video camera which enables the record of video in high resolution (640x480), an '''audio kit''' including microphone, speaker, hands free and headphones sets and a SD socket to save directly all the data coming from the 3G network or recorded from the video camera. You can even reproduce audio files stored in the SD card (like a mp3 player!).&lt;br /&gt;
&lt;br /&gt;
You can also use it as a standard '''3G modem''' at full speed (~7.2Mbps download, ~5.5Mbps upload) just connecting it through its specific mini-USB socket to your laptop (Linux, Windows, MacOS).&lt;br /&gt;
&lt;br /&gt;
The new communicating module is specially oriented to work with Internet servers implementing internally several application layer protocols which make easier to send the information to the cloud. We can make '''HTTP''' and '''HTTPS''' (secure mode) navigation, downloading and uploading content to a web server. In the same way '''FTP''' and '''FTPS''' (secure mode) protocols are also available which is really useful when your application requires handling files. You can even send and receive mails directly from Arduino using the '''SMTP''' and '''POP3''' clients implemented internally.&lt;br /&gt;
&lt;br /&gt;
With the '''SD''' Card socket so you can handle a complete FAT16 file systems and store up to '''32GB''' of information. This specially useful as the 3G module can work at full speed (~7.2Mbps download, ~5.5Mbps upload) when working with the SD files directly without need of Arduino for data or files management.&lt;br /&gt;
&lt;br /&gt;
The GPS module also makes possible perform geolocation services even in indoors as it can work in A-GPS and S-GPS modes, so the location given by the GPS through NMEA sentences is completed with the cell information provided by both the 3G module and external Internet Geoposition Servers which helps you to get the most accurate location in each case.&lt;br /&gt;
&lt;br /&gt;
[[File:3G_GPS_shield.jgp]]&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
*WCDMA and HSPA 3G networks compatibility &lt;br /&gt;
*Internal GPS for Assisted A-GPS and Supported S-GPS modes &lt;br /&gt;
*Video Camera (640x480) for video and photo recordings available &lt;br /&gt;
*Audio Kit including microphone, speaker, hands free and headphones available &lt;br /&gt;
*SD file system up to 32GB &lt;br /&gt;
*Works as a standard 3G modem in Linux/Windows/MacOS (~7.2Mbps download, ~5.5Mbps upload) &lt;br /&gt;
*Talk directly to web servers by HTTP/HTTPS (secure) &lt;br /&gt;
*Upload and download files directly by FTP/FTPS (secure) &lt;br /&gt;
*Send and receive mails by POP3/SMTP &lt;br /&gt;
*Play compressed audio files &lt;br /&gt;
&lt;br /&gt;
== Antennas ==&lt;br /&gt;
&lt;br /&gt;
=== Connections ===&lt;br /&gt;
&lt;br /&gt;
SIM5218 has 3 UFL connectors. Two for diversity of 3G mobile carriers and one for GPS antenna. The impedance of the RF interface is 50Ω. It is recommended use just the &amp;quot;main&amp;quot; antenna socket for the mobile connection unless you experience coverage or performance problems. In this case two antennas allowing diversity may be placed.&lt;br /&gt;
&lt;br /&gt;
[[File:antennacon1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Also, the module allows to solder the antenna to the pad, or attach it via contact springs.&lt;br /&gt;
&lt;br /&gt;
[[File:antennacon2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Bandwidth ==&lt;br /&gt;
&lt;br /&gt;
3G module connected with Arduino allows downlinks rates over 115200 bauds (~11.5KBps), the maximum UART's speed and uplinks rates over 30000 bauds (~3KBps). &lt;br /&gt;
&lt;br /&gt;
Using the module as 3G USB modem we got speeds of 2Mbps (~222KBps) for downlink and 0.7Mbps (~77KBps) for uplink and. &lt;br /&gt;
&lt;br /&gt;
The connection speed may vary depending on the state of the network, the quality of the signal and the carrier.&lt;br /&gt;
&lt;br /&gt;
== Using 3G module with AT commands ==&lt;br /&gt;
'''Important issues:'''&lt;br /&gt;
 &lt;br /&gt;
*Use capital letters for AT commands. &lt;br /&gt;
*Send CR (Carriage return) and LF (Line feed) after the AT command. &lt;br /&gt;
*Place the serial communication jumpers in the right position. &lt;br /&gt;
*Use an external power supply and place the power jumpers in the right position. If the shield is powered from the Arduino, the power jumper must be in Arduino 5V position. If the shield is powered from the Vin input (in the shield), the power jumper must be in Vext position. &lt;br /&gt;
&lt;br /&gt;
The first thing we are going to do with the module is to connect the module to a PC directly (using an Arduino as gateway) and check the basic AT commands. In this case, serial communication jumpers have to be set on USB gateway position.&lt;br /&gt;
&lt;br /&gt;
Remember take out the ATmega microcontroller from the Arduino gateway.&lt;br /&gt;
&lt;br /&gt;
Basic configuration:&lt;br /&gt;
&lt;br /&gt;
[[File:arduinouno.jpg | 400px]]&lt;br /&gt;
&lt;br /&gt;
Connect the shield to the Arduino gateway.&lt;br /&gt;
&lt;br /&gt;
Then connect the SIM card and the USB cable.&lt;br /&gt;
&lt;br /&gt;
Finally plug the USB cable to the computer and open a serial port terminal to communicate via the usb port (e.g: hyperterminal (win), cutecom / gtkterm (linux)).&lt;br /&gt;
&lt;br /&gt;
'''If you use the Arduino IDE serial monitor for sending AT commands – Be sure that you are sending CR (Carriage return) and LF (Line Feed).'''&lt;br /&gt;
&lt;br /&gt;
Set the baudrate to 115200 bps and open the serial port, then press the ON button for two seconds. Then if you type AT you'll get OK, this means that the communication with the module is working fine. Now, with the module working you can check some AT commands to control the module, the basic commands are:&lt;br /&gt;
&lt;br /&gt;
'''Important type commands in capital letters and with CR (carriage return) and LF (line feed)!!!'''&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command&lt;br /&gt;
! Respone&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT&lt;br /&gt;
| OK&lt;br /&gt;
| If you get OK, the communication with the module is working&lt;br /&gt;
|-&lt;br /&gt;
| AT+CPIN=&amp;quot;****&amp;quot;&lt;br /&gt;
| OK&lt;br /&gt;
| If the SIM card is locked with PIN (**** is the pin number)&lt;br /&gt;
|-&lt;br /&gt;
| AT+COPS?&lt;br /&gt;
| &lt;br /&gt;
| Operator information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''''NOTE''': If your 3G module doesn't answer to AT commands, maybe it is configured in a different baudrate. The command for change it temporally is AT+IPR. Try differents baudrates (300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800,921600, 3200000,3686400,4000000 ) until you get to communicate. Once you can communicate, you can configure it in the baudrate you want.''&lt;br /&gt;
&lt;br /&gt;
== Using 3G module like a modem ==&lt;br /&gt;
&lt;br /&gt;
If you want to use the 3G module such a modem, please refer to the next link:&lt;br /&gt;
&lt;br /&gt;
[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/3G_modem_tutorial.pdf 3G modem tutorial]&lt;br /&gt;
&lt;br /&gt;
== Audio ==&lt;br /&gt;
&lt;br /&gt;
=== Audio Features ===&lt;br /&gt;
SIM5218 module provides two analogy inputs for microphone and three analogy outputs for two speakers and headphones. Depending of the selected audio channel (normal, headset and hands-free) a specific input and output are activated. The different channels are selected with the command AT+CSDVC.&lt;br /&gt;
&lt;br /&gt;
Normal channel (AT+CSDVC=1) uses the main microphone and a speaker. Headset channel (AT+CSDVC=2) uses the jack connector. Hand-free channel (AT+CSDVC=3) uses the main microphone and the loudspeaker.&lt;br /&gt;
&lt;br /&gt;
Both microphones don't need an external power source because they are powered directly by the module. You can use some extra commands in your codes like noise suppression, echo canceller or the gain of the mic amps. Please, refer to the AT command document list at the end of this article for more information.&lt;br /&gt;
&lt;br /&gt;
=== Audio Connectors === &lt;br /&gt;
Audio connectors are situated at the bottom of the board. The two speakers and the main microphone are connected to board using pin connectors.&lt;br /&gt;
&lt;br /&gt;
Headset connector are situated at the bottom too, between Arduino board and 3G board.&lt;br /&gt;
&lt;br /&gt;
This connector has 4 terminals that correspond with the positive terminal of the microphone, left and rigth headphones and common ground. The order of connections show below.&lt;br /&gt;
&lt;br /&gt;
[[File:headphone.jpg | 400px]]&lt;br /&gt;
&lt;br /&gt;
Originating and receiving voice calls&lt;br /&gt;
&lt;br /&gt;
The code example and the connection diagram shown below are used to originate a voice call and, pushing a button, end that voice call. The button is connected between digital pin 12 an ground. A 10kΩ pull-up resistor is needed at this pin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int button = 12;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button)&lt;br /&gt;
&lt;br /&gt;
int timesToSend = 1;        // Numbers of calls to make&lt;br /&gt;
&lt;br /&gt;
char phone_number[]=&amp;quot;*********&amp;quot;;     // ********* is the number to call&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(button, INPUT);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    while (count &amp;lt; timesToSend){&lt;br /&gt;
&lt;br /&gt;
        for(int x=0;x &amp;lt; 9;x++){        //generates the tones of the phone number&lt;br /&gt;
            Serial.print(&amp;quot;AT+CPTONE=&amp;quot;);&lt;br /&gt;
            Serial.println(phone_number[x]);&lt;br /&gt;
            delay(400);                    &lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        Serial.print(&amp;quot;ATD&amp;quot;);     &lt;br /&gt;
        Serial.print(phone_number);     &lt;br /&gt;
        Serial.println(&amp;quot;;&amp;quot;);        &lt;br /&gt;
&lt;br /&gt;
        while(digitalRead(button)==1);        &lt;br /&gt;
&lt;br /&gt;
        Serial.println(&amp;quot;AT+CHUP&amp;quot;);            // disconnects the existing call&lt;br /&gt;
&lt;br /&gt;
        delay(5000);&lt;br /&gt;
&lt;br /&gt;
        count++;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make a lost call next code is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
*&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button)&lt;br /&gt;
&lt;br /&gt;
int timesToSend = 1;        // Numbers of calls to make&lt;br /&gt;
int count = 0;&lt;br /&gt;
int tones = 2;                //Each tone has a duration of 6 seconds aprox.&lt;br /&gt;
&lt;br /&gt;
char phone_number[]=&amp;quot;*********&amp;quot;;     // ********* is the number to call&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    while (count &amp;lt; timesToSend){&lt;br /&gt;
        delay(1500);&lt;br /&gt;
    for(int x=0;x &amp;lt; 9;x++){        //generates the tones of the phone number&lt;br /&gt;
            Serial.print(&amp;quot;AT+CPTONE=&amp;quot;);&lt;br /&gt;
            Serial.println(phone_number[x]);&lt;br /&gt;
            delay(400);                    &lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        Serial.print(&amp;quot;ATD&amp;quot;);     &lt;br /&gt;
        Serial.print(phone_number);     &lt;br /&gt;
        Serial.println(&amp;quot;;&amp;quot;);   &lt;br /&gt;
        delay(6000*tones);&lt;br /&gt;
        Serial.println(&amp;quot;AT+CHUP&amp;quot;);            // cancel the call&lt;br /&gt;
&lt;br /&gt;
        delay(5000);&lt;br /&gt;
&lt;br /&gt;
        count++;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To receive calls the used code are this and the connection diagram is the same that the used to originate calls. Don't forget the pull-up resistor on pin 12.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int button = 12;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button)&lt;br /&gt;
&lt;br /&gt;
int timesToSend = 1;        // Numbers of calls to make&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
boolean check_response(char *str){&lt;br /&gt;
    &lt;br /&gt;
    int i = 0;&lt;br /&gt;
    int j = 0;&lt;br /&gt;
    char b[10];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // reading the message and cutting&lt;br /&gt;
    // initials and finals &lt;br /&gt;
    while(Serial.available() &amp;gt; 0){&lt;br /&gt;
        if(j==0 || j==1){&lt;br /&gt;
            Serial.read();&lt;br /&gt;
            j++;&lt;br /&gt;
        }&lt;br /&gt;
        else if( Serial.peek() == 13 ){&lt;br /&gt;
            b[i] = 0;&lt;br /&gt;
            Serial.read();&lt;br /&gt;
        }&lt;br /&gt;
        else if( Serial.peek() == 10 ){&lt;br /&gt;
            Serial.read();&lt;br /&gt;
        }&lt;br /&gt;
        else {&lt;br /&gt;
            b[i++] = Serial.read();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // comparing&lt;br /&gt;
    int cont=0;&lt;br /&gt;
    int cont2=0;&lt;br /&gt;
    boolean ok=false;&lt;br /&gt;
    while(b[cont]!=-1){&lt;br /&gt;
        if (b[cont]==str[cont2]){&lt;br /&gt;
            while(str[cont2]!=-1){&lt;br /&gt;
                if (b[cont+cont2]!=b[cont2])&lt;br /&gt;
                {    &lt;br /&gt;
                    cont2++; &lt;br /&gt;
                    ok=true; &lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    ok=false; &lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
            }   &lt;br /&gt;
        }&lt;br /&gt;
        if (ok) break;&lt;br /&gt;
        cont++;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if(ok){&lt;br /&gt;
        return true;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(button, INPUT);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
   &lt;br /&gt;
    while(!check_response(&amp;quot;RING&amp;quot;));   //waits for a call&lt;br /&gt;
    Serial.println(&amp;quot;ATA&amp;quot;);          //answers an incoming call&lt;br /&gt;
    delay(10000);&lt;br /&gt;
    &lt;br /&gt;
    while(digitalRead(button)==1);        &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CHUP&amp;quot;);            // disconnects the existing call&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The channel may be changed during a call. Use the command AT+CSDVC to select the channel that you want.&lt;br /&gt;
&lt;br /&gt;
=== Recording and playing sound ===&lt;br /&gt;
&lt;br /&gt;
With the next code we can record a sound, stores it and before play it. You can select the place to store the sound clip: the local storage or a SD card. Once saved the sound can be sent to an FTP or FTPS as you'll see later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char name[20];&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    for(x=0;x &amp;lt; 20;x++){&lt;br /&gt;
        name[x]='\0';&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+FSLOCA=0&amp;quot;);     &lt;br /&gt;
    // store media files to local storage space, put 1 to store media files to storage card&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CNSM=1&amp;quot;);     // Enables noise supression&lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    //RECORDING A SOUND CLIP&lt;br /&gt;
    delay(1500);&lt;br /&gt;
    while(Serial.available()!=0){&lt;br /&gt;
        Serial.read();&lt;br /&gt;
    }&lt;br /&gt;
    Serial.println(&amp;quot;AT+CQCPREC=0,amr&amp;quot;);     // starts to record a sound clip&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='/');&lt;br /&gt;
    while(Serial.read()!='/');&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        name[x]=Serial.read();&lt;br /&gt;
        x++;&lt;br /&gt;
    }while(x &amp;lt; 19);&lt;br /&gt;
&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    Serial.println(name);      &lt;br /&gt;
    delay(10000);   &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CQCPPAUSE&amp;quot;);     // pauses record sound&lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
    delay(2000);   &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CQCPRESUME&amp;quot;);     // resumes record sound&lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
    delay(10000);&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CQCPSTOP&amp;quot;);     // stops to record a sound clip&lt;br /&gt;
    while(Serial.read()!='K');   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    //PLAY A SOUND CLIP&lt;br /&gt;
    Serial.println(&amp;quot;AT+FSCD=Audio&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CCMXPLAY=\&amp;quot;&amp;quot;);    //plays an audio file&lt;br /&gt;
    Serial.print(name);  &lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');   &lt;br /&gt;
    delay(7000);         &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCMXPAUSE&amp;quot;);     // pauses playing audio file&lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
    delay(2000);   &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCMXRESUME&amp;quot;);     // resumes playing audio file&lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
    delay(8000);&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCMXSTOP&amp;quot;);     // Stops playing audio file&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, you can use the 3G module like a mp3 player! First, you must save your music in mp3, amr or qcp format. You can use Audacity (linux) or Mobile Media Converter (Windows or Linux) to do this. Then, save the music in the Audio folder on microSD card. Now, put microSD card into the shield and enjoy the music!&lt;br /&gt;
&lt;br /&gt;
'''''NOTE''': You will need to '''update your firmware''' to play mp3. The update is available [https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/240150B15SIM5218E_HY.rar here]. Uncompress and run it in a PC with Windows (emulated Windows not supported).''&lt;br /&gt;
&lt;br /&gt;
A voice call can be recorded using these same commands too.&lt;br /&gt;
&lt;br /&gt;
=== Command summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command&lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CPTONE=**&lt;br /&gt;
| OK&lt;br /&gt;
| Plays a DTMF tone or complex tone on local voice channel device . ** is the number of the tone.&lt;br /&gt;
|-&lt;br /&gt;
| ATD*********;&lt;br /&gt;
|&lt;br /&gt;
| ********* is the number to call.&lt;br /&gt;
|-&lt;br /&gt;
| ATA&lt;br /&gt;
| OK&lt;br /&gt;
| Answer an incoming call.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHUP&lt;br /&gt;
| OK&lt;br /&gt;
| Cancel voice calls.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CNSM&lt;br /&gt;
| OK&lt;br /&gt;
| Enable/disable noise suppression.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CQCPREC=*,&amp;amp;&amp;amp;&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Starts recording sound clips . Answers with the path and the name of the clip. * is the path and &amp;amp;&amp;amp;&amp;amp; is the format.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CQCPPAUSE&lt;br /&gt;
| OK&lt;br /&gt;
| Pauses record sound.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CQCPRESUME&lt;br /&gt;
| OK&lt;br /&gt;
| Resumes record sound.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CQCPSTOP&lt;br /&gt;
| OK&lt;br /&gt;
| Stops record sound.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCMXPLAY=”*****”&lt;br /&gt;
| OK&lt;br /&gt;
| Plays an audio file . ***** is the name of the file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCMXPAUSE&lt;br /&gt;
| OK&lt;br /&gt;
| Pauses playing audio file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCMXRESUME&lt;br /&gt;
| OK&lt;br /&gt;
| Resumes playing audio file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCMXSTOP&lt;br /&gt;
| OK&lt;br /&gt;
| Stops playing audio file.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Camera ==&lt;br /&gt;
[[File:pindiagram.jpg]]&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Pin nº&lt;br /&gt;
! Name&lt;br /&gt;
! Pin nº&lt;br /&gt;
! Name&lt;br /&gt;
! Pin nº&lt;br /&gt;
! Name&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| NC&lt;br /&gt;
| 9&lt;br /&gt;
| HSYNC&lt;br /&gt;
| 17&lt;br /&gt;
| PCLK&lt;br /&gt;
|-&lt;br /&gt;
| 2 &lt;br /&gt;
| AGND&lt;br /&gt;
| 10 &lt;br /&gt;
| DVDD&lt;br /&gt;
| 18&lt;br /&gt;
| DATA6&lt;br /&gt;
|-&lt;br /&gt;
| 3 &lt;br /&gt;
| SDA&lt;br /&gt;
| 11&lt;br /&gt;
| DOVDD&lt;br /&gt;
| 19&lt;br /&gt;
| DATA2&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| AVDD&lt;br /&gt;
| 12&lt;br /&gt;
| DATA9&lt;br /&gt;
| 20&lt;br /&gt;
| DATA5&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| SCL&lt;br /&gt;
| 13&lt;br /&gt;
| MCLK&lt;br /&gt;
| 21&lt;br /&gt;
| DATA3&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| RESET&lt;br /&gt;
| 14&lt;br /&gt;
| DATA8&lt;br /&gt;
| 22&lt;br /&gt;
| DATA22&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| VSYNC&lt;br /&gt;
| 15&lt;br /&gt;
| AGND&lt;br /&gt;
| 23&lt;br /&gt;
| DATA1&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| PWDN&lt;br /&gt;
| 16&lt;br /&gt;
| DATA7&lt;br /&gt;
| 24&lt;br /&gt;
| DATA0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:cameraExample.jpg]]&lt;br /&gt;
&lt;br /&gt;
Mounting the camera&lt;br /&gt;
&lt;br /&gt;
'''Follow these simple steps to mount the camera into the 3G Arduino board.'''&lt;br /&gt;
&lt;br /&gt;
*The first step is to open the socket. To do this, pull carefully out the sides of the connector.&lt;br /&gt;
*Inserts the camera with metallic contacts facing up&lt;br /&gt;
*At the final step, push in the laterals of the connector&lt;br /&gt;
&lt;br /&gt;
=== Vedio Recording ===&lt;br /&gt;
To record video, and take images, you must start the camera in the first step. After you can configure some parameters like resolution, fps, rotation or zoom. The next code allows to record a video file in mp4 format. Remember, if you want to store the video file in a SD card, you must to use AT+FSLOCA command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char name[20];&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                //UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    }      &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMS&amp;quot;);     //starts the camera&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMSETD=320,240&amp;quot;);     //sets QVGA (320*240) resolution&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMSETF=2&amp;quot;);     //sets 15 frames per second&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    delay(1500);&lt;br /&gt;
    &lt;br /&gt;
    while(Serial.available()!=0){&lt;br /&gt;
        Serial.read();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMRS&amp;quot;);     //starts to record a video&lt;br /&gt;
    Serial.flush();                  //video is saved into C:/Video&lt;br /&gt;
    while(Serial.read()!='/');&lt;br /&gt;
    while(Serial.read()!='/');&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        name[x]=Serial.read();&lt;br /&gt;
        x++;&lt;br /&gt;
    }while(x &amp;lt; 19);&lt;br /&gt;
&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    Serial.println(name);      &lt;br /&gt;
    delay(10000);   &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMRP&amp;quot;);     // pauses record &lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
    delay(2000);   &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMRR&amp;quot;);     // resumes record &lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
    delay(10000);&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMRE&amp;quot;);     // stops to record&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAME&amp;quot;);     // stops the camera&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Taking Photo ===&lt;br /&gt;
Take photos is very easy, here is the example code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char name[20];&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    }   &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMS&amp;quot;);     //starts the camera&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMSETD=640,480&amp;quot;);     //sets VGA (640*480) resolution&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+FSLOCA=0&amp;quot;);     //stores the image file in the 3G module&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    delay(1500);&lt;br /&gt;
    while(Serial.available()!=0){&lt;br /&gt;
        Serial.read();&lt;br /&gt;
    }&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMTP&amp;quot;);     //takes a picture, but not saved it&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMEP&amp;quot;);     // saves the picture into C:/Picture    &lt;br /&gt;
    Serial.flush();     &lt;br /&gt;
    while(Serial.read()!='/');&lt;br /&gt;
    while(Serial.read()!='/');&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        name[x]=Serial.read();&lt;br /&gt;
        x++;&lt;br /&gt;
    }while(x &amp;lt; 19);&lt;br /&gt;
&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    Serial.println(name); &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAME&amp;quot;);     // stops the camera&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Video Call ===&lt;br /&gt;
&lt;br /&gt;
The SIM5218 allows video calls, but to carry them out correctly the operator and the network must be able to allow it. The example code is below. Cooking Hacks not ensure that the video call functions correctly.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char phone_number[]=&amp;quot;*********&amp;quot;;     // ********* is the number to call&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                //UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    }      &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMS&amp;quot;);     //starts the camera&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMSETD=320,240&amp;quot;);     //sets QVGA (320*240) resolution&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMSETF=2&amp;quot;);     //sets 15 frames per seconds&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    delay(1500);&lt;br /&gt;
&lt;br /&gt;
    while(Serial.available()!=0){&lt;br /&gt;
        Serial.read();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+VPMAKE=&amp;quot;);     //inits a videocall&lt;br /&gt;
    Serial.println(phone_number);&lt;br /&gt;
    delay(30000);&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+VPEND&amp;quot;);     // ends the videocall&lt;br /&gt;
    while(Serial.read()!='K');     &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAME&amp;quot;);     // stops the camera&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Command Summary ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command&lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMS&lt;br /&gt;
| OK&lt;br /&gt;
| Starts camera.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAME&lt;br /&gt;
| OK&lt;br /&gt;
| Stops camera.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMSETD=xxx,yyy&lt;br /&gt;
| OK&lt;br /&gt;
| Sets dimension of camera. xxx is the width and yyy is the height.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMSETF=*&lt;br /&gt;
| OK&lt;br /&gt;
| Sets the frames per second. * is the frame rate option.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMRS&lt;br /&gt;
| OK&lt;br /&gt;
| Starts video recording . Also responds with the path and name of the file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMRP&lt;br /&gt;
| OK&lt;br /&gt;
| Pauses the record.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMRR&lt;br /&gt;
| OK&lt;br /&gt;
| Resumes video record.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMRE&lt;br /&gt;
| OK&lt;br /&gt;
| Stops video record.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMTP&lt;br /&gt;
| OK&lt;br /&gt;
| Takes a picture.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMEP&lt;br /&gt;
| OK&lt;br /&gt;
| Saves a picture taken by last AT+CCAMTP. Also responds with the path and name of the file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+VPMAKE&lt;br /&gt;
| &lt;br /&gt;
| Makes a video call.&lt;br /&gt;
|-&lt;br /&gt;
| AT+VPEND&lt;br /&gt;
|&lt;br /&gt;
| Ends a video call.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== GPS ==&lt;br /&gt;
&lt;br /&gt;
SIM5218 supports both A-GPS and S-GPS and provides three operating modes: mobile-assisted mode, mobile-based mode and standalone mode. A-GPS is include mobile-assisted and mobile-based mode.&lt;br /&gt;
&lt;br /&gt;
In mobile-assisted mode, when a request for position location is issued, available network information is provided to the location server (e.g., Cell-ID) and assistance is requested from the location server. The location server sends the assistance information to the handset. The handset/mobile unit measures the GPS observables and provides the GPS measurements along with available network data (that is appropriate for the given air interface technology) to the location server. The location server then calculates the position location and returns results to the requesting entity.&lt;br /&gt;
&lt;br /&gt;
In mobile-based mode, the assistance data provided by the location server encompasses not only the information required to assist the handset in measuring the satellite signals, but also the information required to calculate the handset’s position. Therefore, rather than provide the GPS measurements and available network data back to the location server, the mobile calculates the location on the handset and passes the result to the requesting entity.&lt;br /&gt;
&lt;br /&gt;
In standalone (autonomous) mode, the handset demodulates the data directly from the GPS satellites. This mode has some reduced cold-start sensitivity, and a longer time to first fix as compared to the assisted modes. However, it requires no server interaction and works out of network coverage.&lt;br /&gt;
&lt;br /&gt;
This combination of GPS measurements and available network information provides: &lt;br /&gt;
*High-sensitivity solution that works in all terrains: indoor, outdoor, urban, and rural &lt;br /&gt;
*High availability that is enabled by using both satellite and network information &lt;br /&gt;
&lt;br /&gt;
Therefore, while network solutions typically perform poorly in rural areas and areas of poor cell geometry/density, and while unassisted, GPS-only solutions typically perform poorly indoors, the SIM5218 GPS solution provides optimal time to fix, accuracy, sensitivity, availability, and reduced network utilization in both of these environments, depending on the given condition.&lt;br /&gt;
&lt;br /&gt;
=== Stand-alone mode ===&lt;br /&gt;
In this mode, the GPS obtains position, altitude,... with only the signal of the satellites, making it the slowest of the three modes. If you use the AT+CGPSINFO command, the module bring directly latitud, logitude, date, UTC time, altitude and speed. Here is the example code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[255];&lt;br /&gt;
char latitude[11],longitude[12];&lt;br /&gt;
char date[6],UTC_time[8];&lt;br /&gt;
char speed_OG[6],altitude[6];&lt;br /&gt;
&lt;br /&gt;
int x,y;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGPS=1,1&amp;quot;);         // starts GPS session in stand-alone mode&lt;br /&gt;
    delay(100);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    delay(5000);&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGPSINFO&amp;quot;); // request GPS info&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        do{&lt;br /&gt;
            digitalWrite(led,HIGH);  &lt;br /&gt;
        }&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        digitalWrite(led,LOW);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    x=24;&lt;br /&gt;
    y=0;&lt;br /&gt;
    if(data[x]!=','){&lt;br /&gt;
        Serial.print(&amp;quot;Latitude: &amp;quot;);    //shows actual latitude&lt;br /&gt;
        do{&lt;br /&gt;
            latitude[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
        Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
        Serial.println(data[x]);    //north or south&lt;br /&gt;
&lt;br /&gt;
        x+=2;&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;Longitude: &amp;quot;);    //shows actual longitude&lt;br /&gt;
        do{&lt;br /&gt;
            longitude[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++; &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
        Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
        Serial.println(data[x]);    //west or east&lt;br /&gt;
&lt;br /&gt;
        x+=2;&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;Date: &amp;quot;);    //shows date&lt;br /&gt;
        do{&lt;br /&gt;
            date[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;\r\nUTC time: &amp;quot;);    //shows UTC time&lt;br /&gt;
        do{&lt;br /&gt;
            UTC_time[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;\r\nAltitude: &amp;quot;);    //shows altitude&lt;br /&gt;
        do{&lt;br /&gt;
            UTC_time[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        Serial.println(&amp;quot; m&amp;quot;);&lt;br /&gt;
        x++; &lt;br /&gt;
&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;Speed: &amp;quot;);    //shows speed&lt;br /&gt;
        do{&lt;br /&gt;
            speed_OG[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=0x0D);&lt;br /&gt;
        Serial.println(&amp;quot; knots&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    else{&lt;br /&gt;
        Serial.println(&amp;quot;GPS information not available, please wait...&amp;quot;);&lt;br /&gt;
    }   &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to get the NMEA sentences, you must to use the command AT+CGPSSWITCH=1 and configure the UART port at 57600 bauds. Supported NMEA sentences include GSV, GGA, RMC, GSA, and VTG.&lt;br /&gt;
&lt;br /&gt;
=== S-GPS Mode ===&lt;br /&gt;
For the S-GPS the module connects to a GPS server and the module calculates the position. Here is the example code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[255];&lt;br /&gt;
char latitude[11],longitude[12];&lt;br /&gt;
char date[6],UTC_time[8];&lt;br /&gt;
char speed_OG[6],altitude[6];&lt;br /&gt;
&lt;br /&gt;
int x,y;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
  Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!check_response(&amp;quot;OK&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGPSURL=\&amp;quot;supl.google.com:7276\&amp;quot;&amp;quot;);         // sets GPS server&lt;br /&gt;
    delay(100);   &lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGPSSSL=0&amp;quot;);         // without certificate&lt;br /&gt;
    delay(100);   &lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGPS=1,2&amp;quot;);         // starts GPS session in based mode&lt;br /&gt;
    delay(100);   &lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    delay(5000);&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGPSINFO&amp;quot;); // request GPS info&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    for (x=0;x&amp;lt; 255;x++){            &lt;br /&gt;
        data[x]='\0';                        &lt;br /&gt;
    } &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        do{&lt;br /&gt;
            digitalWrite(led,HIGH);  &lt;br /&gt;
        }&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        digitalWrite(led,LOW);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    x=24;&lt;br /&gt;
    y=0;&lt;br /&gt;
    if(data[x]!=','){&lt;br /&gt;
        Serial.print(&amp;quot;Latitude: &amp;quot;);    //shows actual latitude&lt;br /&gt;
        do{&lt;br /&gt;
            latitude[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
            if(y==2){&lt;br /&gt;
                Serial.print(0xF8);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            if(y==4){&lt;br /&gt;
                Serial.print(&amp;quot;.&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
        Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
        Serial.println(data[x]);    //north or south&lt;br /&gt;
&lt;br /&gt;
        x+=2;&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;Longitude: &amp;quot;);    //shows actual longitude&lt;br /&gt;
        do{&lt;br /&gt;
            longitude[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
            if(y==3){&lt;br /&gt;
                Serial.print(0xF8);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            if(y==5){&lt;br /&gt;
                Serial.print(&amp;quot;.&amp;quot;);&lt;br /&gt;
            }        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
        Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
        Serial.println(data[x]);    //west or east&lt;br /&gt;
&lt;br /&gt;
        x+=2;&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;Date: &amp;quot;);    //shows date&lt;br /&gt;
        do{&lt;br /&gt;
            date[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;\r\nUTC time: &amp;quot;);    //shows UTC time&lt;br /&gt;
        do{&lt;br /&gt;
            UTC_time[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;\r\nAltitude: &amp;quot;);    //shows altitude&lt;br /&gt;
        do{&lt;br /&gt;
            UTC_time[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        Serial.println(&amp;quot; m&amp;quot;);&lt;br /&gt;
        x++; &lt;br /&gt;
&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;Speed: &amp;quot;);    //shows speed&lt;br /&gt;
        do{&lt;br /&gt;
            speed_OG[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=0x0D);&lt;br /&gt;
        Serial.println(&amp;quot; knots&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    else{&lt;br /&gt;
        Serial.println(&amp;quot;GPS information not available, please wait...&amp;quot;);&lt;br /&gt;
    }   &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== A-GPS Mode ===&lt;br /&gt;
For the A-GPS the module connects to a GPS server for calculate the position. Here is the example code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! MS-assisted&lt;br /&gt;
! Server&lt;br /&gt;
! Module&lt;br /&gt;
|-&lt;br /&gt;
| Location server sends aiding data that is valid for the current fix&lt;br /&gt;
| Sending Data&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Module sends code phases&lt;br /&gt;
| &lt;br /&gt;
| Code phases&lt;br /&gt;
|-&lt;br /&gt;
| Server calculates position&lt;br /&gt;
| Calculate position&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! MS-based&lt;br /&gt;
! Server&lt;br /&gt;
! Module&lt;br /&gt;
|-&lt;br /&gt;
| Location server sends aiding data that is valid for the current fix&lt;br /&gt;
| Send aiding data&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Module calculates&lt;br /&gt;
| &lt;br /&gt;
| Calculate position&lt;br /&gt;
|-&lt;br /&gt;
! Stand alone&lt;br /&gt;
! Server&lt;br /&gt;
! Module&lt;br /&gt;
|-&lt;br /&gt;
| Module demodulates data form GPS satellite&lt;br /&gt;
| &lt;br /&gt;
|Demodulates GPS satellite data&lt;br /&gt;
|-&lt;br /&gt;
| Module calculates position&lt;br /&gt;
| &lt;br /&gt;
| Calculate position&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== GPS Units ===&lt;br /&gt;
The command AT+CGPSINFO returns the GPS info in a string:&lt;br /&gt;
&lt;br /&gt;
+CGPSINFO: [&amp;lt;latitude&amp;gt;],[&amp;lt;N/S&amp;gt;],[&amp;lt;longitude&amp;gt;],[&amp;lt;E/W&amp;gt;],[&amp;lt;date&amp;gt;],[&amp;lt;UTC_time&amp;gt;],[&amp;lt;altitude&amp;gt;],[&amp;lt;speedOG&amp;gt;],[&amp;lt;course&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Values&lt;br /&gt;
! Format&lt;br /&gt;
! Example&lt;br /&gt;
|-&lt;br /&gt;
| latitude&lt;br /&gt;
| ddmm.mmmmmm      &lt;br /&gt;
d: degree; m: minute&lt;br /&gt;
| 4140.831527&lt;br /&gt;
|-&lt;br /&gt;
| longitude&lt;br /&gt;
| dddmm.mmmmmm      &lt;br /&gt;
d: degree; m: minute&lt;br /&gt;
| 00053.173495&lt;br /&gt;
|-&lt;br /&gt;
| data&lt;br /&gt;
| ddmmyy    &lt;br /&gt;
d: day; m: month; y: year&lt;br /&gt;
| 020812&lt;br /&gt;
|-&lt;br /&gt;
| altitude&lt;br /&gt;
| meters&lt;br /&gt;
| 257.00&lt;br /&gt;
|-&lt;br /&gt;
| speedOG&lt;br /&gt;
| knots&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| course&lt;br /&gt;
| degrees&lt;br /&gt;
| 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If UE-assisted mode, when fixed will report indication:&lt;br /&gt;
&lt;br /&gt;
+CAGPSINFO:&amp;lt;latitude&amp;gt;,&amp;lt;longitude&amp;gt;,&amp;lt;altitude&amp;gt;,&amp;lt;date&amp;gt;,&amp;lt;UTC_time&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Values&lt;br /&gt;
! Format&lt;br /&gt;
! Example&lt;br /&gt;
|-&lt;br /&gt;
| latitude&lt;br /&gt;
| Unit is in 10^8 degree&lt;br /&gt;
| 4168050885&lt;br /&gt;
|-&lt;br /&gt;
| longitude&lt;br /&gt;
| Unit is in 10^8 degree&lt;br /&gt;
| 88618039&lt;br /&gt;
|-&lt;br /&gt;
| altitude&lt;br /&gt;
| meters&lt;br /&gt;
| 293&lt;br /&gt;
|-&lt;br /&gt;
| date&lt;br /&gt;
| ddmmyyyy      &lt;br /&gt;
d: day; m: month; y: year&lt;br /&gt;
| 28092012&lt;br /&gt;
|-&lt;br /&gt;
| UTC_time&lt;br /&gt;
| hhmmss.s      &lt;br /&gt;
h: hour; m: minute; s: seconds &lt;br /&gt;
| 081611.0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Command Summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command &lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGSOCKCONT=**,&amp;amp;&amp;amp;&amp;amp;&lt;br /&gt;
| OK&lt;br /&gt;
| ** is the protocol and &amp;amp;&amp;amp;&amp;amp; Access Point Name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGPS=*,&amp;amp;&lt;br /&gt;
| OK&lt;br /&gt;
| * sets on (1) or off (0) and &amp;amp; is the GPS mode.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGPSINFO&lt;br /&gt;
|&lt;br /&gt;
| Gets current position information.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGPSURL=”***”&lt;br /&gt;
| OK&lt;br /&gt;
| Sets AGPS default server URL . *** is the URL.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGPSSSL=*&lt;br /&gt;
| OK&lt;br /&gt;
| Select transport security, used certificate (*=1) or not (*=0).&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGPSSWITCH&lt;br /&gt;
| OK&lt;br /&gt;
| Choose the output port for NMEA sentence.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== SMS ==&lt;br /&gt;
=== Sending and Receiving SMS ===&lt;br /&gt;
The first code is used to send a SMS, the second one reads the SIM message memory and shows the last SMS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
 &lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int timesToSend = 1;        // Numbers of SMS to send&lt;br /&gt;
int count = 0;&lt;br /&gt;
&lt;br /&gt;
char phone_number[]=&amp;quot;*********&amp;quot;;     // ********* is the number to call&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CMGF=1&amp;quot;);         // sets the SMS mode to text&lt;br /&gt;
    delay(100);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    while (count &amp;lt; timesToSend){&lt;br /&gt;
        delay(1500);&lt;br /&gt;
        Serial.print(&amp;quot;AT+CMGS=\&amp;quot;&amp;quot;);   // send the SMS number&lt;br /&gt;
        Serial.print(phone_number);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
        delay(1500);      &lt;br /&gt;
        Serial.print(&amp;quot;Hola caracola...&amp;quot;);     // the SMS body&lt;br /&gt;
        delay(500);&lt;br /&gt;
        Serial.write(0x1A);       //sends ++&lt;br /&gt;
        Serial.write(0x0D);&lt;br /&gt;
        Serial.write(0x0A);&lt;br /&gt;
&lt;br /&gt;
        delay(5000);&lt;br /&gt;
&lt;br /&gt;
        count++;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
another code&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
*&lt;br /&gt;
 *  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
 *  it under the terms of the GNU General Public License as published by&lt;br /&gt;
 *  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
 *  (at your option) any later version.&lt;br /&gt;
 *&lt;br /&gt;
 *  This program is distributed in the hope that it will be useful,&lt;br /&gt;
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
 *  GNU General Public License for more details.&lt;br /&gt;
 *&lt;br /&gt;
 *  You should have received a copy of the GNU General Public License&lt;br /&gt;
 *  along with this program.  If not, see http://www.gnu.org/licenses/.&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
 *&lt;br /&gt;
 *  Version 0.1&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int timesToSend = 1;        // Numbers of SMS to send&lt;br /&gt;
int count = 0;&lt;br /&gt;
&lt;br /&gt;
int n_sms,x,sms_start;&lt;br /&gt;
char data[256];&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i = 0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CMGF=1&amp;quot;);         // sets the SMS mode to text&lt;br /&gt;
    delay(100);&lt;br /&gt;
    x = 0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;       &lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
    while(!((data[x-1] == 'K') &amp;amp;&amp;amp; (data[x-2] == 'O')));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    while (count &amp;lt; timesToSend){&lt;br /&gt;
        delay(1500);&lt;br /&gt;
&lt;br /&gt;
        while(Serial.available()!=0) Serial.read();&lt;br /&gt;
&lt;br /&gt;
        Serial.println(&amp;quot;AT+CPMS=\&amp;quot;SM\&amp;quot;,\&amp;quot;SM\&amp;quot;,\&amp;quot;SM\&amp;quot;&amp;quot;);    //selects SIM memory&lt;br /&gt;
        Serial.flush();&lt;br /&gt;
        for (x=0;x &amp;lt; 255;x++){            &lt;br /&gt;
            data[x]='\0';                        &lt;br /&gt;
        } &lt;br /&gt;
        x=0;&lt;br /&gt;
        do{&lt;br /&gt;
            while(Serial.available()==0);&lt;br /&gt;
            data[x]=Serial.read();  &lt;br /&gt;
            x++;       &lt;br /&gt;
&lt;br /&gt;
        }while(!((data[x-1] == 'K') &amp;amp;&amp;amp; (data[x-2] == 'O')));&lt;br /&gt;
&lt;br /&gt;
        x=0;&lt;br /&gt;
        do{&lt;br /&gt;
            x++;&lt;br /&gt;
        }while (data[x] != ' ');&lt;br /&gt;
&lt;br /&gt;
        x++;&lt;br /&gt;
        n_sms=0;&lt;br /&gt;
        do{&lt;br /&gt;
            n_sms*=10;&lt;br /&gt;
            n_sms=n_sms + (data[x]-0x30);&lt;br /&gt;
&lt;br /&gt;
            x++;&lt;br /&gt;
&lt;br /&gt;
        }while (data[x] != ',');&lt;br /&gt;
        &lt;br /&gt;
        Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
        Serial.print(n_sms,DEC);&lt;br /&gt;
&lt;br /&gt;
// Now it shows the total number of SMS and the last SMS&lt;br /&gt;
        Serial.println(&amp;quot;  SMS stored in SIM memory. Showing last SMS:&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        Serial.print(&amp;quot;AT+CMGR=&amp;quot;);    //Reads the last SMS &lt;br /&gt;
        Serial.println(n_sms-1,DEC);&lt;br /&gt;
        Serial.flush();&lt;br /&gt;
        for (x=0;x &amp;lt; 255;x++){            &lt;br /&gt;
            data[x]='\0';                        &lt;br /&gt;
        } &lt;br /&gt;
        x=0;&lt;br /&gt;
        do{&lt;br /&gt;
            while(Serial.available()==0);&lt;br /&gt;
            data[x]=Serial.read();  &lt;br /&gt;
            x++;           &lt;br /&gt;
            if((data[x-1] == 0x0D) &amp;amp;&amp;amp; (data[x-2] == '&amp;quot;')){&lt;br /&gt;
                x=0;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        while(!((data[x-1] == 'K') &amp;amp;&amp;amp; (data[x-2] == 'O')));&lt;br /&gt;
&lt;br /&gt;
        data[x-3]='\0';        //finish the string before the OK&lt;br /&gt;
&lt;br /&gt;
        Serial.println(data);    //shows the message&lt;br /&gt;
&lt;br /&gt;
        delay(5000);&lt;br /&gt;
&lt;br /&gt;
        count++;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Command Summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
! Command&lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CMGF=&lt;br /&gt;
| OK&lt;br /&gt;
| Specifies the input and output format of the short messages. 0 for PDU mode and 1 for text mode.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CMGS&lt;br /&gt;
|&lt;br /&gt;
| Sends a message.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CPMS=***&lt;br /&gt;
|&lt;br /&gt;
| Selects memory storages. *** is the memory type.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CMGR=*&lt;br /&gt;
|&lt;br /&gt;
| Reads a message. * is the number of the message.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== E-mails ==&lt;br /&gt;
=== Sending an E-mail ===&lt;br /&gt;
To send e-mail a SMTP server is used, so we need an e-mail account. The code example is the next:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
int x;&lt;br /&gt;
&lt;br /&gt;
//server and account data&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
//information about sender, direcctions and names&lt;br /&gt;
char sender_add[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char sender_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
char to_add[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char to_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
char cc_add[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char cc_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
char bcc_add[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char bcc_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
//&lt;br /&gt;
char subject[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char body[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
char response[128];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPSRV=\&amp;quot;&amp;quot;);    &lt;br /&gt;
    //configures the SIM5218 with server name and port&lt;br /&gt;
    Serial.print(server);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
    Serial.println(port);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPAUTH=1,\&amp;quot;&amp;quot;);    //configures the SIM5218 with user name and password&lt;br /&gt;
    Serial.print(user_name);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(password);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPFROM=\&amp;quot;&amp;quot;);    //sender adress and name&lt;br /&gt;
    Serial.print(sender_add);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(sender_name);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPRCPT=0,0,\&amp;quot;&amp;quot;);    //normal recipient address and name&lt;br /&gt;
    Serial.print(to_add);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(to_name);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    //If you don't need a carbon copy, delete this part&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPRCPT=1,0,\&amp;quot;&amp;quot;);    //carbon copy recipient address and name&lt;br /&gt;
    Serial.print(cc_add);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(cc_name);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    //If you don't need a blind carbon copy, delete this part&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPRCPT=2,0,\&amp;quot;&amp;quot;);    //blind carbon copy recipient address and name&lt;br /&gt;
    Serial.print(bcc_add);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(bcc_name);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPSUB=\&amp;quot;&amp;quot;);    //subjec of email&lt;br /&gt;
    Serial.print(subject);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPBODY=\&amp;quot;&amp;quot;);    //body of email&lt;br /&gt;
    Serial.print(body);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));    &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+SMTPSEND&amp;quot;);    //sends the email&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;Sending email...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        do{&lt;br /&gt;
            digitalWrite(led,HIGH);    &lt;br /&gt;
        }&lt;br /&gt;
        while(Serial.available()==0); &lt;br /&gt;
        digitalWrite(led,LOW);    &lt;br /&gt;
        response[x]=Serial.read();   &lt;br /&gt;
        x++;&lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='S'&amp;amp;&amp;amp;response[x-2]=='S'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(response);&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Receiving an E-mail ===&lt;br /&gt;
For read an e-mail from a POP3 server we need an e-mail account. The code example is here:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
 &lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
int x;&lt;br /&gt;
&lt;br /&gt;
//server and account data&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
char path[50];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+POP3SRV=\&amp;quot;&amp;quot;);    &lt;br /&gt;
    //configures the SIM5218 with server name, user, password and port&lt;br /&gt;
    Serial.print(server);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(user_name);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(password);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
    Serial.println(port);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+POP3IN&amp;quot;);    //logs into the server&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+POP3GET=1&amp;quot;);    //gets the first email&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        path[0]=Serial.read();&lt;br /&gt;
    }while(path[0]!='/'); &lt;br /&gt;
&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        path[0]=Serial.read();  &lt;br /&gt;
    }&lt;br /&gt;
    while(path[0]!='/');&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0); &lt;br /&gt;
        path[x]=Serial.read(); &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(path[x-1]!=' ');&lt;br /&gt;
&lt;br /&gt;
    x--;    //overwrite &amp;quot; &amp;quot; charracter&lt;br /&gt;
    x--;    //overwrite &amp;quot;,&amp;quot; charracter&lt;br /&gt;
&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0); &lt;br /&gt;
        path[x]=Serial.read(); &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(path[x-1]!=0x0D);&lt;br /&gt;
    path[x-1]='\0';&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+POP3OUT&amp;quot;);    //logs out the server&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+FSCD=C:/Email&amp;quot;);    //selects email directory as current directory&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+POP3READ=0,\&amp;quot;&amp;quot;);    //shows the email&lt;br /&gt;
    Serial.print(path);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[0]=Serial.read();         &lt;br /&gt;
    }while(data[0]!='D');&lt;br /&gt;
    &lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[0]=Serial.read();         &lt;br /&gt;
    }while(data[0]!='D');&lt;br /&gt;
    &lt;br /&gt;
    x=1;    &lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;   &lt;br /&gt;
        if(x==1020){&lt;br /&gt;
            Serial.print(data);&lt;br /&gt;
            x=0;&lt;br /&gt;
        }        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'&amp;amp;&amp;amp;data[x-3]==0x0A&amp;amp;&amp;amp;data[x-4]==0x0D));&lt;br /&gt;
&lt;br /&gt;
    data[x-2]='\0';&lt;br /&gt;
    Serial.println(data);&lt;br /&gt;
    &lt;br /&gt;
    while(1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Command Summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command &lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGSOCKCONT=**,&amp;amp;&amp;amp;&amp;amp;&lt;br /&gt;
| OK&lt;br /&gt;
| ** is the protocol and &amp;amp;&amp;amp;&amp;amp; Access Point Name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPSRV=”*****”,&amp;amp;&amp;amp;&amp;amp; &lt;br /&gt;
| OK&lt;br /&gt;
| Sets SMTP server address and server’s port . ***** is the sever address and &amp;amp;&amp;amp;&amp;amp; is the server's port.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPAUTH=1,”***”,”&amp;amp;&amp;amp;&amp;amp;”&lt;br /&gt;
| OK&lt;br /&gt;
| Controls SMTP authentication. *** is the user name and &amp;amp;&amp;amp;&amp;amp; is the password.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPFROM=”***”,”&amp;amp;&amp;amp;&amp;amp;”&lt;br /&gt;
| OK&lt;br /&gt;
| Sets sender’s address and nam e. *** is the sender's address and &amp;amp;&amp;amp;&amp;amp; is the sender's name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPRCPT=x,”***”,”&amp;amp;&amp;amp;&amp;amp;”&lt;br /&gt;
| OK&lt;br /&gt;
| Sets recipient address/name and kind .&lt;br /&gt;
x is the kind (TO/CC/BCC), *** is the recipient address and &amp;amp;&amp;amp;&amp;amp; is the recipient name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPSUB=”****”&lt;br /&gt;
| OK&lt;br /&gt;
| Sets the subject of e-mail . **** is the subject.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPBODY&lt;br /&gt;
|&lt;br /&gt;
| Sets e-mail body.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPSEND&lt;br /&gt;
|&lt;br /&gt;
| Initiates TCP session with SMTP server and sends an e-mail&lt;br /&gt;
|-&lt;br /&gt;
| AT+POP3SRV=”**”,”&amp;amp;&amp;amp;”,”xx”,yy&lt;br /&gt;
| OK&lt;br /&gt;
| Sets all parameters to get an e-mail from POP3 . ** is the server address, &amp;amp;&amp;amp; is the user name,&lt;br /&gt;
xx is the password and yy the server port&lt;br /&gt;
|-&lt;br /&gt;
| AT+POP3IN&lt;br /&gt;
| OK&lt;br /&gt;
| Logs in POP3 server&lt;br /&gt;
|-&lt;br /&gt;
| AT+POP3GET=***&lt;br /&gt;
|&lt;br /&gt;
| Gets an e-mail from POP3 server , *** is the number of the e-mail.&lt;br /&gt;
|-&lt;br /&gt;
| AT+POP3OUT&lt;br /&gt;
| OK&lt;br /&gt;
| Logs out POP3 server&lt;br /&gt;
|-&lt;br /&gt;
| AT+POP3READ=”***”,”&amp;amp;&amp;amp;&amp;amp;”&lt;br /&gt;
| &lt;br /&gt;
| Reads an e-mail from file system . *** is the location and &amp;amp;&amp;amp;&amp;amp; is the name.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== SD and system memory ==&lt;br /&gt;
The file system is used to store files in a hierarchical (tree) structure. Local storage space is mapped to “C:”, and SD is mapped to “D:”. In both “C:” and “D:” directories, module creates four directories named “Picture”, “Audio”, “Video” and “VideoCall” automatically; “Picture” is used to store static image when taking picture by camera, “Audio” is used to store audio file, “Video” is used to store video file when recor ding by camera, and “VideoCall” is used to store media file which is recorded during a video call.&lt;br /&gt;
&lt;br /&gt;
The maximum size of the microSD card is 32GB. Here are some AT commands to manage the file system:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command &lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSCD=****&lt;br /&gt;
| OK&lt;br /&gt;
| Select a directory as current directory . **** is the directory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSMKDIR=****&lt;br /&gt;
| OK&lt;br /&gt;
| Create a new directory in current directory . **** is the name of the new directory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSRMDIR=****&lt;br /&gt;
| OK&lt;br /&gt;
| Delete existing directory in current directory . **** is the name of the directory to delete.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSLS&lt;br /&gt;
| &lt;br /&gt;
| Make a list with informations of directories and/or files in current directory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+DEL=****&lt;br /&gt;
| OK&lt;br /&gt;
| Delete a file in current directory. **** is the name of the file to delete.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSRENAME=****,&amp;amp;&amp;amp;&amp;amp;&lt;br /&gt;
| OK&lt;br /&gt;
| Rename a file in current directory. **** is the actual name and &amp;amp;&amp;amp;&amp;amp; is the new name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSATTRI=****&lt;br /&gt;
| &lt;br /&gt;
| Request the attributes of file which is existing in current directory. **** is the name of the file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSMEM&lt;br /&gt;
| &lt;br /&gt;
| Check the size of available memory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSFMT&lt;br /&gt;
| OK&lt;br /&gt;
| Format storage card which is plugged in.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSLOCA=&lt;br /&gt;
| OK&lt;br /&gt;
| Set the storage place , 0 for local and 1 for SD&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== FTP and FTPS ==&lt;br /&gt;
=== FTP ===&lt;br /&gt;
Creating a file into the FTP server, writing it and reading it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
*&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int x=0;&lt;br /&gt;
int file_size;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPSERV=\&amp;quot;&amp;quot;); //Sets the FTP server&lt;br /&gt;
  Serial.print(server);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPPORT=&amp;quot;);    //Sets FTP port&lt;br /&gt;
  Serial.println(port);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPUN=\&amp;quot;&amp;quot;); //Sets the user name&lt;br /&gt;
  Serial.print(user_name);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPPW=\&amp;quot;&amp;quot;); //Sets password&lt;br /&gt;
  Serial.print(password);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;);     &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPMODE=1&amp;quot;);    //Selects pasive mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPTYPE=I&amp;quot;);    //Selects Binary mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPPUT=\&amp;quot;/test.txt\&amp;quot;&amp;quot;);    //Creates a file and sends data (ASCII)&lt;br /&gt;
    Serial.flush(); &lt;br /&gt;
    while(Serial.read()]!='N');    //Waits 'N' from BEGIN&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;01234567890123456789&amp;quot;);    //Data for the file&lt;br /&gt;
    Serial.write(0x1A);    //EOL character&lt;br /&gt;
    Serial.write(0x0D);&lt;br /&gt;
    Serial.write(0x0A);&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read(); &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    delay(1000);&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPGET=\&amp;quot;/test.txt\&amp;quot;&amp;quot;);    //Reads the data from test file&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while((data[x-1]!=','));&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    &lt;br /&gt;
    while(Serial.peek()!=0x0A){&lt;br /&gt;
        file_size=(file_size*10)+(Serial.read()-0x30);&lt;br /&gt;
    }; &lt;br /&gt;
&lt;br /&gt;
    for(x=0;x&amp;lt; file_size;x++){&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    Serial.print(data);&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uploading a file from local storage or SD to FTP server.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[256];&lt;br /&gt;
int x=0;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPSERV=\&amp;quot;&amp;quot;); //Sets the FTP server&lt;br /&gt;
  Serial.print(server);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPPORT=&amp;quot;);    //Sets FTP port&lt;br /&gt;
  Serial.println(port);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPUN=\&amp;quot;&amp;quot;); //Sets the user name&lt;br /&gt;
  Serial.print(user_name);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPPW=\&amp;quot;&amp;quot;); //Sets password&lt;br /&gt;
  Serial.print(password);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;);     &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPMODE=1&amp;quot;);    //Selects pasive mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    //Selecciona el tipo ASCII&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPTYPE=I&amp;quot;);    //Selects Binary mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPPUTFILE=\&amp;quot;/testfile.txt\&amp;quot;,0&amp;quot;);    //Uploads a test file into FTP server.&lt;br /&gt;
    Serial.flush(); &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read(); &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Downloading a file from FTP server or SD to local storage.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int x=0;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);   &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPSERV=\&amp;quot;&amp;quot;); //Sets the FTP server&lt;br /&gt;
  Serial.print(server);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPPORT=&amp;quot;);    //Sets FTP port&lt;br /&gt;
  Serial.println(port);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPUN=\&amp;quot;&amp;quot;); //Sets the user name&lt;br /&gt;
  Serial.print(user_name);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPPW=\&amp;quot;&amp;quot;); //Sets password&lt;br /&gt;
  Serial.print(password);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;);     &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPMODE=1&amp;quot;);    //Selects pasive mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    //Selecciona el tipo ASCII&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPTYPE=I&amp;quot;);    //Selects Binary mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    //Envia data&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPGETFILE=\&amp;quot;/testfile.txt\&amp;quot;,0&amp;quot;);  //Downloads a test file from FTP server.&lt;br /&gt;
    Serial.flush(); &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read(); &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FTPS ===&lt;br /&gt;
Creating a file into the FTP server, writing it and reading it (likes FTP codes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
*&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int x=0;&lt;br /&gt;
unsigned int file_size=0;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for(int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSSTART&amp;quot;);      //Acquires FTPS protocol stack&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPSLOGIN=\&amp;quot;&amp;quot;);      //Logs into FTPS server&lt;br /&gt;
    Serial.print(server);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
    Serial.print(port);&lt;br /&gt;
    Serial.print(&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(user_name);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(password);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPMODE=1&amp;quot;);    //Selects pasive mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSTYPE=I&amp;quot;);    //Selects Binary mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
   //Envia data&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSPUT=\&amp;quot;/test_file.txt\&amp;quot;,13&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();&lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(data[x-1]!='&amp;gt;');&lt;br /&gt;
    &lt;br /&gt;
    Serial.write(&amp;quot;Test message!&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        digitalWrite(13, LOW);&lt;br /&gt;
        data[x]=Serial.read(); &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    delay(1000);&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSGET=\&amp;quot;/test.txt\&amp;quot;&amp;quot;);    //Reads the data from test file&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while((data[x-1]!=','));&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    &lt;br /&gt;
    while(Serial.peek()!=0x0A){&lt;br /&gt;
        file_size=(file_size*10)+(Serial.read()-0x30);&lt;br /&gt;
    }; &lt;br /&gt;
&lt;br /&gt;
    for(x=0;x&amp;lt; file_size;x++){&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    Serial.print(data);&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uploading a file from local storage or SD to FTP server &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[256];&lt;br /&gt;
int x=0;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // swithes the module ON&lt;br /&gt;
&lt;br /&gt;
    for(int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSSTART&amp;quot;);      //Acquires FTPS protocol stack&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPSLOGIN=\&amp;quot;&amp;quot;);      //Logs into FTPS server&lt;br /&gt;
    Serial.print(server);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
    Serial.print(port);&lt;br /&gt;
    Serial.print(&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(user_name);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(password);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPMODE=1&amp;quot;);    //Selects pasive mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSTYPE=I&amp;quot;);    //Selects Binary mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    //Envia data&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSPUTFILE=\&amp;quot;/testfile.txt\&amp;quot;,0&amp;quot;); //Uploads a test file from FTPS server.&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        digitalWrite(13, LOW);&lt;br /&gt;
        data[x]=Serial.read(); &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Downloading a file from FTP server or SD to local storage&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[256];&lt;br /&gt;
int x=0;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for(int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSSTART&amp;quot;);      //Acquires FTPS protocol stack&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPSLOGIN=\&amp;quot;&amp;quot;);      //Logs into FTPS server&lt;br /&gt;
    Serial.print(server);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
    Serial.print(port);&lt;br /&gt;
    Serial.print(&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(user_name);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(password);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPMODE=1&amp;quot;);    //Selects pasive mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSTYPE=I&amp;quot;);    //Selects Binary mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    //Envia data&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSGETFILE=\&amp;quot;/testfile.txt\&amp;quot;,0&amp;quot;); //Downloads a test file from FTPS server.&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        digitalWrite(13, LOW);&lt;br /&gt;
        data[x]=Serial.read(); &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Command and Summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command&lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGSOCKCONT=**,&amp;amp;&amp;amp;&amp;amp;&lt;br /&gt;
| OK&lt;br /&gt;
| ** is the protocol and &amp;amp;&amp;amp;&amp;amp; Access Point Name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSERV=”****”&lt;br /&gt;
| &lt;br /&gt;
| Sets FTP server domain name or IP address. **** is the domain name or the IP.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPPORT=***&lt;br /&gt;
| OK&lt;br /&gt;
| Sets FTP server port. *** is the port.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPUN=”***”&lt;br /&gt;
| OK&lt;br /&gt;
| Sets user name for FTP server access. *** is the user name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPPW=”***”&lt;br /&gt;
| OK&lt;br /&gt;
| Sets password for FTP server access. *** is the password.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPMODE=&lt;br /&gt;
| OK&lt;br /&gt;
| Sets FTP mode. 1 for passive or 0 for proactive.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPTYPE=&lt;br /&gt;
| OK&lt;br /&gt;
| Sets the transfer type on FTP server . A for ASCII or I for binary.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPPUT=”***”,&amp;amp;&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Puts a file from FTP server to serial port . *** is the path with the name of the file and &amp;amp;&amp;amp; is the length.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPGET=”***”&lt;br /&gt;
|&lt;br /&gt;
| Gets a file from FTP server to serial port . *** is the path with the name of the file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPPUTFILE=”***”,&amp;amp;&lt;br /&gt;
|&lt;br /&gt;
| Uploads a file to FTP server from module . *** is the path and &amp;amp; is the storage directory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPGETFILE”=***”,&amp;amp;&lt;br /&gt;
|&lt;br /&gt;
| Downloads a file from FTP server to module . *** is the path with the name and &amp;amp; is the storage directory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSSTART&lt;br /&gt;
| OK&lt;br /&gt;
| Acquires FTPS protocol stack.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSLOGIN=”**”,&amp;amp;&amp;amp;&amp;amp;,”xxx”,”yyy&lt;br /&gt;
| OK&lt;br /&gt;
| Logs in FTPS server. *** is the host address, &amp;amp;&amp;amp;&amp;amp; is the port, xxx is the user name and yyy is the password.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSTYPE=&lt;br /&gt;
| OK&lt;br /&gt;
| Sets the transfer type on FTPS server . A for ASCII or I for binary.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSPUT=”***”,&amp;amp;&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Puts a file from FTPS server to serial port . *** is the path with the name of the file and &amp;amp;&amp;amp; is the length.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSGET=”***”&lt;br /&gt;
|&lt;br /&gt;
| Gets a file from FTPS server to serial port . *** is the path with the name of the file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSPUTFILE=”***”,&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Uploads a file to FTPS server from module . *** is the path and &amp;amp; is the storage directory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSGETFILE=”***”,&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Downloads a file from FTPS server to module . *** is the path with the name and &amp;amp; is the storage directory.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== TCP and UDP ==&lt;br /&gt;
=== UDP client ===&lt;br /&gt;
Sending data to a UDP server:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char name[20];&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+NETOPEN=\&amp;quot;UDP\&amp;quot;,&amp;quot;); //Opens the socket with the type of protocol and the port &lt;br /&gt;
  Serial.println(port);        &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='d'&amp;amp;&amp;amp;data[x-2]=='e'));        //waits for response &amp;quot;Network opened&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+UDPSEND=12,\&amp;quot;&amp;quot;); //Sends UDP data&lt;br /&gt;
  Serial.print(server);&lt;br /&gt;
  Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
  Serial.println(port);        &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='&amp;gt;');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;Test message&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+NETCLOSE&amp;quot;); //Opens the socket with the type of protocol and the port &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== TCP Client ===&lt;br /&gt;
Sending data to a TCP server:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char name[20];&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+NETOPEN=\&amp;quot;TCP\&amp;quot;,&amp;quot;);&lt;br /&gt;
    //Opens the socket with the type of protocol and the port &lt;br /&gt;
  Serial.println(port);        &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='d'&amp;amp;&amp;amp;data[x-2]=='e'));        //waits for response &amp;quot;Network opened&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    Serial.print(&amp;quot;AT+TCPCONNECT=\&amp;quot;&amp;quot;); //Connects with the server&lt;br /&gt;
  Serial.print(server);&lt;br /&gt;
  Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);    &lt;br /&gt;
  Serial.println(port);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+TCPWRITE=12&amp;quot;);        //Sends TCP data&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='&amp;gt;');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;Test message&amp;quot;); &lt;br /&gt;
    &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+NETCLOSE&amp;quot;); //Opens the socket with the type of protocol and the port &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Multiclient ===&lt;br /&gt;
SIM5218 allows to use ten connections simultaneously. Here is the example code with a UDP and TCP connections.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char UDP_server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char UDP_port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char TCP_server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char TCP_port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+NETOPEN=,,1&amp;quot;);        //Opens the socket in multiclient mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='d'&amp;amp;&amp;amp;data[x-2]=='e'));        //waits for response &amp;quot;Network opened&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CIPOPEN=0,\&amp;quot;UDP\&amp;quot;,\&amp;quot;&amp;quot;);  //Connects with the UDP server&lt;br /&gt;
  Serial.print(UDP_server);&lt;br /&gt;
  Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
  Serial.println(UDP_port);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CIPOPEN=1,\&amp;quot;TCP\&amp;quot;,\&amp;quot;&amp;quot;);  //Connects with the TCP server&lt;br /&gt;
  Serial.print(TCP_server);&lt;br /&gt;
  Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
  Serial.println(TCP_port);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CIPSEND=0,16&amp;quot;);    //Sends data to UDP server&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='&amp;gt;');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;UDP test message&amp;quot;); &lt;br /&gt;
    &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CIPSEND=1,16&amp;quot;);    //Sends data to TCP server&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='&amp;gt;');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;TCP test message&amp;quot;); &lt;br /&gt;
    &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CIPCLOSE=0&amp;quot;);    //Closes UDP connection&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CIPCLOSE=1&amp;quot;);    //Closes TCP connection&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+NETCLOSE&amp;quot;);        //Opens the socket with the type of protocol and the port &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== TCP Server ===&lt;br /&gt;
SIM5218 allows to create a TCP server with a maximum of ten TCP clients. In this example the server send a message every 5 seconds to all clients.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
 &lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char name[20];&lt;br /&gt;
&lt;br /&gt;
int clients=-2;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+NETOPEN=\&amp;quot;TCP\&amp;quot;,&amp;quot;);  &lt;br /&gt;
    //Opens the socket with the type of protocol and the port &lt;br /&gt;
    Serial.println(port);        &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='d'&amp;amp;&amp;amp;data[x-2]=='e'));        //waits for response &amp;quot;Network opened&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+SERVERSTART&amp;quot;); //Starts TCP server&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+LISTCLIENT&amp;quot;);  // List all of clients&lt;br /&gt;
  Serial.flush();&lt;br /&gt;
  clients=-2;&lt;br /&gt;
  do{&lt;br /&gt;
    if(Serial.read()==0x0D){&lt;br /&gt;
      clients++;&lt;br /&gt;
    }&lt;br /&gt;
  }while(Serial.peek()!='K'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  for(int y=0;y&amp;lt; clients;y++){&lt;br /&gt;
    Serial.print(&amp;quot;AT+ACTCLIENT=&amp;quot;);    //activates the connection with the client  &lt;br /&gt;
    Serial.println(y);&lt;br /&gt;
    while(Serial.read()!='K'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+TCPWRITE=12&amp;quot;);        //Sends TCP data&lt;br /&gt;
      Serial.flush();&lt;br /&gt;
      while(Serial.read()!='&amp;gt;');  &lt;br /&gt;
&lt;br /&gt;
      Serial.println(&amp;quot;Test message&amp;quot;); &lt;br /&gt;
    &lt;br /&gt;
      x=0;&lt;br /&gt;
      do{&lt;br /&gt;
          while(Serial.available()==0);&lt;br /&gt;
          data[x]=Serial.read();  &lt;br /&gt;
          x++;                        &lt;br /&gt;
      }while(!(data[x-1]=='k'&amp;amp;&amp;amp;data[x-2]=='o'));    Waits for &amp;quot;send ok&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CLOSECLIENT=&amp;quot;); //desactivates the connection with the client  &lt;br /&gt;
    Serial.println(y);&lt;br /&gt;
    while(Serial.read()!='K'));&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  delay(5000);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Command and Summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command&lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+NETOPEN=”***”,&amp;amp;&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Opens a socket . *** is the socket type and &amp;amp;&amp;amp; is the port.&lt;br /&gt;
|-&lt;br /&gt;
| AT+NETCLOSE&lt;br /&gt;
| OK&lt;br /&gt;
| Closes socket.&lt;br /&gt;
|-&lt;br /&gt;
| AT+UPDSEND&lt;br /&gt;
| &lt;br /&gt;
| Sends UDP data.&lt;br /&gt;
|-&lt;br /&gt;
| | |&lt;br /&gt;
|-&lt;br /&gt;
| AT+TCPCONNECT=”***”,&amp;amp;&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Establishes TCP connection with TCP server. *** is the IP address and &amp;amp;&amp;amp; is the port.&lt;br /&gt;
|-&lt;br /&gt;
| AT+TCPWRITE&lt;br /&gt;
|&lt;br /&gt;
| Sends TCP data when the TCP connection is established.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SERVERSTART&lt;br /&gt;
| OK&lt;br /&gt;
| Starts up TCP server.&lt;br /&gt;
|-&lt;br /&gt;
| AT+LISTCLIENT&lt;br /&gt;
|&lt;br /&gt;
| Lists all of clients’ information.&lt;br /&gt;
|-&lt;br /&gt;
| AT+ACTCLIENT=*&lt;br /&gt;
| OK&lt;br /&gt;
| Activates the specified client. * is the number of the client.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CLOSECLIENT=*&lt;br /&gt;
| OK&lt;br /&gt;
| Disconnects the specified client. * is the number of the client.&lt;br /&gt;
|-&lt;br /&gt;
| | | &lt;br /&gt;
|-&lt;br /&gt;
| AT+CIPOPEN=*,”&amp;amp;&amp;amp;”,”xx”,yy&lt;br /&gt;
| &lt;br /&gt;
| Establish a connection with TCP server or UDP server. * is the number of the connection, &lt;br /&gt;
&amp;amp;&amp;amp; is the type of transmision protocol, xx is the server IP and yy is the server port.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CIPSEND&lt;br /&gt;
| &lt;br /&gt;
| Sends some data to remote host in mult-client mode.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CIPCLOSE=*&lt;br /&gt;
| OK&lt;br /&gt;
| Closes a specified connection in multi-client mode. * is the number of the connection.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== HTTP and HTTPS ==&lt;br /&gt;
=== HTTP ===&lt;br /&gt;
SIM5218 can launch a HTTP operation like GET or POST. Here is an example with GET operation:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see ..&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int data_size&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CHTTPACT=\&amp;quot;&amp;quot;); //Connects with the HTTP server&lt;br /&gt;
  Serial.print(server);&lt;br /&gt;
  Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
  Serial.println(port);        &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='T'&amp;amp;&amp;amp;data[x-2]=='S'));        //waits for response &amp;quot;REQUEST&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;GET /index.html HTTP/1.1&amp;quot;);&lt;br /&gt;
  Serial.println(&amp;quot;Host: www.mywebsite.com&amp;quot;);&lt;br /&gt;
  Serial.println(&amp;quot;Content-Length: 0&amp;quot;);&lt;br /&gt;
  Serial.write(0x1A);       //sends ++&lt;br /&gt;
    Serial.write(0x0D);&lt;br /&gt;
    Serial.write(0x0A);&lt;br /&gt;
&lt;br /&gt;
  while(Serial.read()!='K');&lt;br /&gt;
  while(Serial.read()!=' ');&lt;br /&gt;
&lt;br /&gt;
  data_size=0;  &lt;br /&gt;
  do{&lt;br /&gt;
    data_size*=10;&lt;br /&gt;
    data_size=data_size+(Serial.read()-0x30);&lt;br /&gt;
  }while(Serial.peek()!=0x0D);&lt;br /&gt;
&lt;br /&gt;
  for(x=0;x&amp;lt; data_size;x++){&lt;br /&gt;
    data[x]=Serial.read();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  Serial.print(data);&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== HTTPS ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int data_size&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CHTTPSSTART&amp;quot;); //Acquires HTTPS protocol stack       &lt;br /&gt;
    Serial.flush();    &lt;br /&gt;
  while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
  Serial.println(&amp;quot;AT+CHTTPSOPSE&amp;quot;);  //Opens a new HTTPS session   &lt;br /&gt;
    Serial.flush();    &lt;br /&gt;
  while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
  Serial.println(&amp;quot;AT+CHTTPSSEND=63&amp;quot;); //Sends HTTPS request   &lt;br /&gt;
    Serial.flush();    &lt;br /&gt;
  while(Serial.read()!='&amp;gt;');&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;GET /index.html HTTP/1.1&amp;quot;);&lt;br /&gt;
  Serial.println(&amp;quot;Host: www.mywebsite.com&amp;quot;);&lt;br /&gt;
  Serial.println(&amp;quot;Content-Length: 0&amp;quot;);&lt;br /&gt;
  while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
  Serial.println(&amp;quot;AT+CHTTPSRECV=1&amp;quot;);  //Receives HTTPS response&lt;br /&gt;
    Serial.flush();    &lt;br /&gt;
  while(Serial.read()!=',');&lt;br /&gt;
&lt;br /&gt;
  data_size=0;  &lt;br /&gt;
  do{&lt;br /&gt;
    data_size*=10;&lt;br /&gt;
    data_size=data_size+(Serial.read()-0x30);&lt;br /&gt;
  }while(Serial.peek()!=0x0D);&lt;br /&gt;
&lt;br /&gt;
  for(x=0;x&amp;lt; d ata_size;x++){&lt;br /&gt;
    data[x]=Serial.read();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  Serial.println(&amp;quot;AT+CHTTPSCLSE&amp;quot;);  //Closes a new HTTPS session   &lt;br /&gt;
    Serial.flush();    &lt;br /&gt;
  while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
  Serial.println(&amp;quot;AT+CHTTPSSTOP&amp;quot;);  //Releases HTTPS protocol stack&lt;br /&gt;
    Serial.flush();    &lt;br /&gt;
  while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
  Serial.print(data);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Command and Summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command &lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPACT=”***”,&amp;amp;&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Launches a HTTP operation . *** is the server address and &amp;amp;&amp;amp; is the port.&lt;br /&gt;
|-&lt;br /&gt;
| | | |&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPSSTART&lt;br /&gt;
| OK&lt;br /&gt;
| Acquires HTTPS protocol stack.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPSSTOP&lt;br /&gt;
| OK&lt;br /&gt;
| Releases HTTPS protocol stack.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPSOPSE&lt;br /&gt;
| OK&lt;br /&gt;
| Opens a new HTTPS session.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPSCLSE&lt;br /&gt;
| OK&lt;br /&gt;
| Closes the opened HTTPS session.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPSSEND=*&lt;br /&gt;
| &lt;br /&gt;
| Sends HTTPS request. * is the length of the data in the sending buffer.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPSRECV=*&lt;br /&gt;
| &lt;br /&gt;
| Receives HTTPS response after sending HTTPS request.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''AT Command Tester Application'''&lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/module-tester/ AT Command Tester] is a free online tool test [http://m2msupport.net/m2msupport/software-and-at-commands-for-m2m-modules/ AT Commands] and other modem functionalities of [http://m2msupport.net/m2msupport/category/devices/gprs-modem/ 2G modules] (GPRS/EDGE) , [http://m2msupport.net/m2msupport/category/devices/gprs-modem/ 3G Modules] (HSDPA/EVDO) and [http://m2msupport.net/m2msupport/search-page/?Max!Download!Speed=100%20Mbps 4G Modules] (LTE).AT Command Tester tool connects to the modem port of the device and can test various modem functions such as getting [http://m2msupport.net/m2msupport/at-commands-to-get-device-information/ device information], [http://m2msupport.net/m2msupport/data-call-at-commands-to-set-up-gprsedgeumtslte-data-call/ gprs data call], [http://m2msupport.net/m2msupport/voice-call-at-commands-to-set-up-voice-call/ voice call],[http://m2msupport.net/m2msupport/at-command-for-http-functions-for-remote-server-data-access/ http access], [http://m2msupport.net/m2msupport/signal-quality/ checking signal condition], [http://m2msupport.net/m2msupport/network-registration/ network registration], [http://m2msupport.net/m2msupport/sms-at-commands/ SMS functions], [http://m2msupport.net/m2msupport/sim-at-commands-for-sim-presense-and-status/ SIM access], [http://m2msupport.net/m2msupport/sim-phonebook-at-commands/ phonebook functions] etc.&lt;br /&gt;
&lt;br /&gt;
In the 'Port Configuration' section of the tool, users can search for available ports using the 'Find Ports' button. Then using the 'Connect' button, users can connect to the modem port of the device.&lt;br /&gt;
&lt;br /&gt;
In the 'Command Mode' tab of AT Command Tester, single AT commands can be sent. The drop down list provides AT command description and examples. Users can modify the default command settings.&lt;br /&gt;
&lt;br /&gt;
[[File:M2m img1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Under the 'Script Mode' tab, multiple AT commands can be sent at a time. Users can add descriptive comments and save the script on their local machine. &lt;br /&gt;
&lt;br /&gt;
[[File:Script mode.PNG]]&lt;br /&gt;
&lt;br /&gt;
Data Call&lt;br /&gt;
&lt;br /&gt;
To make a data call with the modem, you need to connect to the APN of the carrier network. The carrier APN and other required information are stored in the SIM card and are referred as PDP contexts. Typically multiple PDP contexts are stored in the SIM for different call types. With the AT Command Tester you can edit/add/delete PDP contexts in a easy to use user interface. &lt;br /&gt;
&lt;br /&gt;
[[Image:Datacall.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;Typical call setup sequence,&lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgdcont-define-pdp-context/ AT+CGDCONT?] &lt;br /&gt;
&lt;br /&gt;
+CGDCONT: 1,&amp;quot;IP&amp;quot;,&amp;quot;epc.tmobile.com&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0&amp;lt;br&amp;gt;+CGDCONT: 2,&amp;quot;IP&amp;quot;,&amp;quot;test5&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0&amp;lt;br&amp;gt;+CGDCONT: 3,&amp;quot;IP&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Checking registration status... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcreg-network-registration/ AT+CREG?] &lt;br /&gt;
&lt;br /&gt;
+CREG: 0,1 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;The device is registered in home network. &lt;br /&gt;
&lt;br /&gt;
Checking if device is already connected... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgact-pdp-context-activate-or-deactivate/ AT+CGACT?] &lt;br /&gt;
&lt;br /&gt;
+CGACT: 1,0&amp;lt;br&amp;gt;+CGACT: 2,0&amp;lt;br&amp;gt;+CGACT: 3,0 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;[http://m2msupport.net/m2msupport/atcmee-report-mobile-termination-error/ AT+CMEE=1] &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Attaching to network...&amp;lt;br&amp;gt;AT+CGATT=1 &lt;br /&gt;
&lt;br /&gt;
OK &lt;br /&gt;
&lt;br /&gt;
Connecting... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgact-pdp-context-activate-or-deactivate/ AT+CGACT=1, 1] &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Connect Sucessful &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; '''SMS''' &lt;br /&gt;
&lt;br /&gt;
The SMS tab of the 'AT Command Tester' tool provides the interfaces to send SMS messages. You can also list/view/delete SMS messages stored on the SIM.&lt;br /&gt;
&lt;br /&gt;
[[Image:Sms.PNG]] &amp;lt;br&amp;gt; General sequence for sending SMS message, &lt;br /&gt;
&lt;br /&gt;
Checking registration status... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcreg-network-registration/ AT+CREG?] &lt;br /&gt;
&lt;br /&gt;
+CREG: 0,1 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;The device is registered in home network. &lt;br /&gt;
&lt;br /&gt;
AT+CMGS=&amp;quot;858XXXXXXX&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&amp;amp;gt; Test Message with AT Command Tester� &lt;br /&gt;
&lt;br /&gt;
+CMGS: 19 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;SMS Send successful &lt;br /&gt;
&lt;br /&gt;
'''Network Selection''' - This tab allows the user to manually select available networks. Modems are typically set for automatic network selection. 'Find Networks' button will command the modem to scan for available networks.&lt;br /&gt;
&lt;br /&gt;
[[Image:Network selection.PNG]] &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
AT+COPS command will initiate network scan in the modem, &lt;br /&gt;
&lt;br /&gt;
Finding Networks. Please wait.. &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcops-plmn-selection/ AT+COPS=?] &lt;br /&gt;
&lt;br /&gt;
+COPS: (2,&amp;quot;T-Mobile&amp;quot;,&amp;quot;T-Mobile&amp;quot;,&amp;quot;310260&amp;quot;),(1,&amp;quot;AT&amp;amp;amp;T&amp;quot;,&amp;quot;AT&amp;amp;amp;T&amp;quot;,&amp;quot;310410&amp;quot;),,(0,1,4),(0,1,2) &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Networks found &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
'''Phonebook'''&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
With the 'Phone Book' tab, you can add/delete/read phone book entries stored on the SIM, &lt;br /&gt;
&lt;br /&gt;
[[Image:Phone book.PNG]] &lt;br /&gt;
&lt;br /&gt;
Getting phonebook entries.. &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcpbr-read-phonebook-entries/ AT+CPBR=1,99] &lt;br /&gt;
&lt;br /&gt;
+CPBR: 1,&amp;quot;*233&amp;quot;,129,&amp;quot;Refill Now&amp;quot; &lt;br /&gt;
&lt;br /&gt;
+CPBR: 2,&amp;quot;#999#&amp;quot;,255,&amp;quot;Check Balance&amp;quot; &lt;br /&gt;
&lt;br /&gt;
+CPBR: 3,&amp;quot;8878878878&amp;quot;,129,&amp;quot;Test&amp;quot; &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resource ==&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/3G_shield_schematic+(1).pdf 3G shield schematic]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/SIM5218_AT_command_manual+(1).pdf SIM5218 AT command manual]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/V-SIM5218E_HD_V1.04.pdf SIM5218 Hardware Design]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/WindowsDrivers_SIM5218_2.4.00.rar Drivers for Windows]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/3G+GPS+shield+for+Arduino.fzpz  Fritzing libraries]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/Jumpers+of+3G+Arduino+shield.pdf Jumpers of 3G Arduino shield]&lt;br /&gt;
*[http://www.cutedigi.com/blog/?p=74 CuteDigi 3G+GPS Shield Test Tutorial]&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=3G_%2B_GPS_Shield_for_Arduino&amp;diff=3557</id>
		<title>3G + GPS Shield for Arduino</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=3G_%2B_GPS_Shield_for_Arduino&amp;diff=3557"/>
		<updated>2013-08-12T09:35:19Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Note: &lt;br /&gt;
&lt;br /&gt;
This shield uses wall adapter rated at 6V/2A. Please don't use voltage larger than 6V, it will burn the 3G module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This 3G+GPS Shield is using the design, schematics and code from &lt;br /&gt;
&lt;br /&gt;
http://www.cooking-hacks.com/index.php/documentation/tutorials/arduino-3g-gprs-gsm-gps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The new 3G shield for Arduino enables the connectivity to high speed '''WCDMA''' and '''HSPA''' cellular networks in order to make possible the creation of the next level of worldwide interactivity projects inside the new &amp;quot;Internet of Things&amp;quot; era.&lt;br /&gt;
&lt;br /&gt;
The module counts also with an internal '''GPS''' what enables the location of the device outdoors and indoors combining standard NMEA frames with mobile cell ID triangulation using both assisted-mobile '''(A-GPS)''' and mobile-based '''(S-GPS)''' modes.&lt;br /&gt;
&lt;br /&gt;
Other interesting accessories which can be connected to the module are a video camera which enables the record of video in high resolution (640x480), an '''audio kit''' including microphone, speaker, hands free and headphones sets and a SD socket to save directly all the data coming from the 3G network or recorded from the video camera. You can even reproduce audio files stored in the SD card (like a mp3 player!).&lt;br /&gt;
&lt;br /&gt;
You can also use it as a standard '''3G modem''' at full speed (~7.2Mbps download, ~5.5Mbps upload) just connecting it through its specific mini-USB socket to your laptop (Linux, Windows, MacOS).&lt;br /&gt;
&lt;br /&gt;
The new communicating module is specially oriented to work with Internet servers implementing internally several application layer protocols which make easier to send the information to the cloud. We can make '''HTTP''' and '''HTTPS''' (secure mode) navigation, downloading and uploading content to a web server. In the same way '''FTP''' and '''FTPS''' (secure mode) protocols are also available which is really useful when your application requires handling files. You can even send and receive mails directly from Arduino using the '''SMTP''' and '''POP3''' clients implemented internally.&lt;br /&gt;
&lt;br /&gt;
With the '''SD''' Card socket so you can handle a complete FAT16 file systems and store up to '''32GB''' of information. This specially useful as the 3G module can work at full speed (~7.2Mbps download, ~5.5Mbps upload) when working with the SD files directly without need of Arduino for data or files management.&lt;br /&gt;
&lt;br /&gt;
The GPS module also makes possible perform geolocation services even in indoors as it can work in A-GPS and S-GPS modes, so the location given by the GPS through NMEA sentences is completed with the cell information provided by both the 3G module and external Internet Geoposition Servers which helps you to get the most accurate location in each case.&lt;br /&gt;
&lt;br /&gt;
[[File:3G_GPS_shield.jgp/png]]&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
*WCDMA and HSPA 3G networks compatibility &lt;br /&gt;
*Internal GPS for Assisted A-GPS and Supported S-GPS modes &lt;br /&gt;
*Video Camera (640x480) for video and photo recordings available &lt;br /&gt;
*Audio Kit including microphone, speaker, hands free and headphones available &lt;br /&gt;
*SD file system up to 32GB &lt;br /&gt;
*Works as a standard 3G modem in Linux/Windows/MacOS (~7.2Mbps download, ~5.5Mbps upload) &lt;br /&gt;
*Talk directly to web servers by HTTP/HTTPS (secure) &lt;br /&gt;
*Upload and download files directly by FTP/FTPS (secure) &lt;br /&gt;
*Send and receive mails by POP3/SMTP &lt;br /&gt;
*Play compressed audio files &lt;br /&gt;
&lt;br /&gt;
== Antennas ==&lt;br /&gt;
&lt;br /&gt;
=== Connections ===&lt;br /&gt;
&lt;br /&gt;
SIM5218 has 3 UFL connectors. Two for diversity of 3G mobile carriers and one for GPS antenna. The impedance of the RF interface is 50Ω. It is recommended use just the &amp;quot;main&amp;quot; antenna socket for the mobile connection unless you experience coverage or performance problems. In this case two antennas allowing diversity may be placed.&lt;br /&gt;
&lt;br /&gt;
[[File:antennacon1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Also, the module allows to solder the antenna to the pad, or attach it via contact springs.&lt;br /&gt;
&lt;br /&gt;
[[File:antennacon2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Bandwidth ==&lt;br /&gt;
&lt;br /&gt;
3G module connected with Arduino allows downlinks rates over 115200 bauds (~11.5KBps), the maximum UART's speed and uplinks rates over 30000 bauds (~3KBps). &lt;br /&gt;
&lt;br /&gt;
Using the module as 3G USB modem we got speeds of 2Mbps (~222KBps) for downlink and 0.7Mbps (~77KBps) for uplink and. &lt;br /&gt;
&lt;br /&gt;
The connection speed may vary depending on the state of the network, the quality of the signal and the carrier.&lt;br /&gt;
&lt;br /&gt;
== Using 3G module with AT commands ==&lt;br /&gt;
'''Important issues:'''&lt;br /&gt;
 &lt;br /&gt;
*Use capital letters for AT commands. &lt;br /&gt;
*Send CR (Carriage return) and LF (Line feed) after the AT command. &lt;br /&gt;
*Place the serial communication jumpers in the right position. &lt;br /&gt;
*Use an external power supply and place the power jumpers in the right position. If the shield is powered from the Arduino, the power jumper must be in Arduino 5V position. If the shield is powered from the Vin input (in the shield), the power jumper must be in Vext position. &lt;br /&gt;
&lt;br /&gt;
The first thing we are going to do with the module is to connect the module to a PC directly (using an Arduino as gateway) and check the basic AT commands. In this case, serial communication jumpers have to be set on USB gateway position.&lt;br /&gt;
&lt;br /&gt;
Remember take out the ATmega microcontroller from the Arduino gateway.&lt;br /&gt;
&lt;br /&gt;
Basic configuration:&lt;br /&gt;
&lt;br /&gt;
[[File:arduinouno.jpg | 400px]]&lt;br /&gt;
&lt;br /&gt;
Connect the shield to the Arduino gateway.&lt;br /&gt;
&lt;br /&gt;
Then connect the SIM card and the USB cable.&lt;br /&gt;
&lt;br /&gt;
Finally plug the USB cable to the computer and open a serial port terminal to communicate via the usb port (e.g: hyperterminal (win), cutecom / gtkterm (linux)).&lt;br /&gt;
&lt;br /&gt;
'''If you use the Arduino IDE serial monitor for sending AT commands – Be sure that you are sending CR (Carriage return) and LF (Line Feed).'''&lt;br /&gt;
&lt;br /&gt;
Set the baudrate to 115200 bps and open the serial port, then press the ON button for two seconds. Then if you type AT you'll get OK, this means that the communication with the module is working fine. Now, with the module working you can check some AT commands to control the module, the basic commands are:&lt;br /&gt;
&lt;br /&gt;
'''Important type commands in capital letters and with CR (carriage return) and LF (line feed)!!!'''&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command&lt;br /&gt;
! Respone&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT&lt;br /&gt;
| OK&lt;br /&gt;
| If you get OK, the communication with the module is working&lt;br /&gt;
|-&lt;br /&gt;
| AT+CPIN=&amp;quot;****&amp;quot;&lt;br /&gt;
| OK&lt;br /&gt;
| If the SIM card is locked with PIN (**** is the pin number)&lt;br /&gt;
|-&lt;br /&gt;
| AT+COPS?&lt;br /&gt;
| &lt;br /&gt;
| Operator information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''''NOTE''': If your 3G module doesn't answer to AT commands, maybe it is configured in a different baudrate. The command for change it temporally is AT+IPR. Try differents baudrates (300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800,921600, 3200000,3686400,4000000 ) until you get to communicate. Once you can communicate, you can configure it in the baudrate you want.''&lt;br /&gt;
&lt;br /&gt;
== Using 3G module like a modem ==&lt;br /&gt;
&lt;br /&gt;
If you want to use the 3G module such a modem, please refer to the next link:&lt;br /&gt;
&lt;br /&gt;
[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/3G_modem_tutorial.pdf 3G modem tutorial]&lt;br /&gt;
&lt;br /&gt;
== Audio ==&lt;br /&gt;
&lt;br /&gt;
=== Audio Features ===&lt;br /&gt;
SIM5218 module provides two analogy inputs for microphone and three analogy outputs for two speakers and headphones. Depending of the selected audio channel (normal, headset and hands-free) a specific input and output are activated. The different channels are selected with the command AT+CSDVC.&lt;br /&gt;
&lt;br /&gt;
Normal channel (AT+CSDVC=1) uses the main microphone and a speaker. Headset channel (AT+CSDVC=2) uses the jack connector. Hand-free channel (AT+CSDVC=3) uses the main microphone and the loudspeaker.&lt;br /&gt;
&lt;br /&gt;
Both microphones don't need an external power source because they are powered directly by the module. You can use some extra commands in your codes like noise suppression, echo canceller or the gain of the mic amps. Please, refer to the AT command document list at the end of this article for more information.&lt;br /&gt;
&lt;br /&gt;
=== Audio Connectors === &lt;br /&gt;
Audio connectors are situated at the bottom of the board. The two speakers and the main microphone are connected to board using pin connectors.&lt;br /&gt;
&lt;br /&gt;
Headset connector are situated at the bottom too, between Arduino board and 3G board.&lt;br /&gt;
&lt;br /&gt;
This connector has 4 terminals that correspond with the positive terminal of the microphone, left and rigth headphones and common ground. The order of connections show below.&lt;br /&gt;
&lt;br /&gt;
[[File:headphone.jpg | 400px]]&lt;br /&gt;
&lt;br /&gt;
Originating and receiving voice calls&lt;br /&gt;
&lt;br /&gt;
The code example and the connection diagram shown below are used to originate a voice call and, pushing a button, end that voice call. The button is connected between digital pin 12 an ground. A 10kΩ pull-up resistor is needed at this pin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int button = 12;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button)&lt;br /&gt;
&lt;br /&gt;
int timesToSend = 1;        // Numbers of calls to make&lt;br /&gt;
&lt;br /&gt;
char phone_number[]=&amp;quot;*********&amp;quot;;     // ********* is the number to call&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(button, INPUT);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    while (count &amp;lt; timesToSend){&lt;br /&gt;
&lt;br /&gt;
        for(int x=0;x &amp;lt; 9;x++){        //generates the tones of the phone number&lt;br /&gt;
            Serial.print(&amp;quot;AT+CPTONE=&amp;quot;);&lt;br /&gt;
            Serial.println(phone_number[x]);&lt;br /&gt;
            delay(400);                    &lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        Serial.print(&amp;quot;ATD&amp;quot;);     &lt;br /&gt;
        Serial.print(phone_number);     &lt;br /&gt;
        Serial.println(&amp;quot;;&amp;quot;);        &lt;br /&gt;
&lt;br /&gt;
        while(digitalRead(button)==1);        &lt;br /&gt;
&lt;br /&gt;
        Serial.println(&amp;quot;AT+CHUP&amp;quot;);            // disconnects the existing call&lt;br /&gt;
&lt;br /&gt;
        delay(5000);&lt;br /&gt;
&lt;br /&gt;
        count++;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make a lost call next code is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
*&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button)&lt;br /&gt;
&lt;br /&gt;
int timesToSend = 1;        // Numbers of calls to make&lt;br /&gt;
int count = 0;&lt;br /&gt;
int tones = 2;                //Each tone has a duration of 6 seconds aprox.&lt;br /&gt;
&lt;br /&gt;
char phone_number[]=&amp;quot;*********&amp;quot;;     // ********* is the number to call&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    while (count &amp;lt; timesToSend){&lt;br /&gt;
        delay(1500);&lt;br /&gt;
    for(int x=0;x &amp;lt; 9;x++){        //generates the tones of the phone number&lt;br /&gt;
            Serial.print(&amp;quot;AT+CPTONE=&amp;quot;);&lt;br /&gt;
            Serial.println(phone_number[x]);&lt;br /&gt;
            delay(400);                    &lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        Serial.print(&amp;quot;ATD&amp;quot;);     &lt;br /&gt;
        Serial.print(phone_number);     &lt;br /&gt;
        Serial.println(&amp;quot;;&amp;quot;);   &lt;br /&gt;
        delay(6000*tones);&lt;br /&gt;
        Serial.println(&amp;quot;AT+CHUP&amp;quot;);            // cancel the call&lt;br /&gt;
&lt;br /&gt;
        delay(5000);&lt;br /&gt;
&lt;br /&gt;
        count++;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To receive calls the used code are this and the connection diagram is the same that the used to originate calls. Don't forget the pull-up resistor on pin 12.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int button = 12;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button)&lt;br /&gt;
&lt;br /&gt;
int timesToSend = 1;        // Numbers of calls to make&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
boolean check_response(char *str){&lt;br /&gt;
    &lt;br /&gt;
    int i = 0;&lt;br /&gt;
    int j = 0;&lt;br /&gt;
    char b[10];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // reading the message and cutting&lt;br /&gt;
    // initials and finals &lt;br /&gt;
    while(Serial.available() &amp;gt; 0){&lt;br /&gt;
        if(j==0 || j==1){&lt;br /&gt;
            Serial.read();&lt;br /&gt;
            j++;&lt;br /&gt;
        }&lt;br /&gt;
        else if( Serial.peek() == 13 ){&lt;br /&gt;
            b[i] = 0;&lt;br /&gt;
            Serial.read();&lt;br /&gt;
        }&lt;br /&gt;
        else if( Serial.peek() == 10 ){&lt;br /&gt;
            Serial.read();&lt;br /&gt;
        }&lt;br /&gt;
        else {&lt;br /&gt;
            b[i++] = Serial.read();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // comparing&lt;br /&gt;
    int cont=0;&lt;br /&gt;
    int cont2=0;&lt;br /&gt;
    boolean ok=false;&lt;br /&gt;
    while(b[cont]!=-1){&lt;br /&gt;
        if (b[cont]==str[cont2]){&lt;br /&gt;
            while(str[cont2]!=-1){&lt;br /&gt;
                if (b[cont+cont2]!=b[cont2])&lt;br /&gt;
                {    &lt;br /&gt;
                    cont2++; &lt;br /&gt;
                    ok=true; &lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    ok=false; &lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
            }   &lt;br /&gt;
        }&lt;br /&gt;
        if (ok) break;&lt;br /&gt;
        cont++;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if(ok){&lt;br /&gt;
        return true;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(button, INPUT);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
   &lt;br /&gt;
    while(!check_response(&amp;quot;RING&amp;quot;));   //waits for a call&lt;br /&gt;
    Serial.println(&amp;quot;ATA&amp;quot;);          //answers an incoming call&lt;br /&gt;
    delay(10000);&lt;br /&gt;
    &lt;br /&gt;
    while(digitalRead(button)==1);        &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CHUP&amp;quot;);            // disconnects the existing call&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The channel may be changed during a call. Use the command AT+CSDVC to select the channel that you want.&lt;br /&gt;
&lt;br /&gt;
=== Recording and playing sound ===&lt;br /&gt;
&lt;br /&gt;
With the next code we can record a sound, stores it and before play it. You can select the place to store the sound clip: the local storage or a SD card. Once saved the sound can be sent to an FTP or FTPS as you'll see later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char name[20];&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    for(x=0;x &amp;lt; 20;x++){&lt;br /&gt;
        name[x]='\0';&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+FSLOCA=0&amp;quot;);     &lt;br /&gt;
    // store media files to local storage space, put 1 to store media files to storage card&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CNSM=1&amp;quot;);     // Enables noise supression&lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    //RECORDING A SOUND CLIP&lt;br /&gt;
    delay(1500);&lt;br /&gt;
    while(Serial.available()!=0){&lt;br /&gt;
        Serial.read();&lt;br /&gt;
    }&lt;br /&gt;
    Serial.println(&amp;quot;AT+CQCPREC=0,amr&amp;quot;);     // starts to record a sound clip&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='/');&lt;br /&gt;
    while(Serial.read()!='/');&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        name[x]=Serial.read();&lt;br /&gt;
        x++;&lt;br /&gt;
    }while(x &amp;lt; 19);&lt;br /&gt;
&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    Serial.println(name);      &lt;br /&gt;
    delay(10000);   &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CQCPPAUSE&amp;quot;);     // pauses record sound&lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
    delay(2000);   &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CQCPRESUME&amp;quot;);     // resumes record sound&lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
    delay(10000);&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CQCPSTOP&amp;quot;);     // stops to record a sound clip&lt;br /&gt;
    while(Serial.read()!='K');   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    //PLAY A SOUND CLIP&lt;br /&gt;
    Serial.println(&amp;quot;AT+FSCD=Audio&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CCMXPLAY=\&amp;quot;&amp;quot;);    //plays an audio file&lt;br /&gt;
    Serial.print(name);  &lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');   &lt;br /&gt;
    delay(7000);         &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCMXPAUSE&amp;quot;);     // pauses playing audio file&lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
    delay(2000);   &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCMXRESUME&amp;quot;);     // resumes playing audio file&lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
    delay(8000);&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCMXSTOP&amp;quot;);     // Stops playing audio file&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, you can use the 3G module like a mp3 player! First, you must save your music in mp3, amr or qcp format. You can use Audacity (linux) or Mobile Media Converter (Windows or Linux) to do this. Then, save the music in the Audio folder on microSD card. Now, put microSD card into the shield and enjoy the music!&lt;br /&gt;
&lt;br /&gt;
'''''NOTE''': You will need to '''update your firmware''' to play mp3. The update is available [https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/240150B15SIM5218E_HY.rar here]. Uncompress and run it in a PC with Windows (emulated Windows not supported).''&lt;br /&gt;
&lt;br /&gt;
A voice call can be recorded using these same commands too.&lt;br /&gt;
&lt;br /&gt;
=== Command summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command&lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CPTONE=**&lt;br /&gt;
| OK&lt;br /&gt;
| Plays a DTMF tone or complex tone on local voice channel device . ** is the number of the tone.&lt;br /&gt;
|-&lt;br /&gt;
| ATD*********;&lt;br /&gt;
|&lt;br /&gt;
| ********* is the number to call.&lt;br /&gt;
|-&lt;br /&gt;
| ATA&lt;br /&gt;
| OK&lt;br /&gt;
| Answer an incoming call.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHUP&lt;br /&gt;
| OK&lt;br /&gt;
| Cancel voice calls.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CNSM&lt;br /&gt;
| OK&lt;br /&gt;
| Enable/disable noise suppression.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CQCPREC=*,&amp;amp;&amp;amp;&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Starts recording sound clips . Answers with the path and the name of the clip. * is the path and &amp;amp;&amp;amp;&amp;amp; is the format.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CQCPPAUSE&lt;br /&gt;
| OK&lt;br /&gt;
| Pauses record sound.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CQCPRESUME&lt;br /&gt;
| OK&lt;br /&gt;
| Resumes record sound.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CQCPSTOP&lt;br /&gt;
| OK&lt;br /&gt;
| Stops record sound.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCMXPLAY=”*****”&lt;br /&gt;
| OK&lt;br /&gt;
| Plays an audio file . ***** is the name of the file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCMXPAUSE&lt;br /&gt;
| OK&lt;br /&gt;
| Pauses playing audio file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCMXRESUME&lt;br /&gt;
| OK&lt;br /&gt;
| Resumes playing audio file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCMXSTOP&lt;br /&gt;
| OK&lt;br /&gt;
| Stops playing audio file.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Camera ==&lt;br /&gt;
[[File:pindiagram.jpg]]&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Pin nº&lt;br /&gt;
! Name&lt;br /&gt;
! Pin nº&lt;br /&gt;
! Name&lt;br /&gt;
! Pin nº&lt;br /&gt;
! Name&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| NC&lt;br /&gt;
| 9&lt;br /&gt;
| HSYNC&lt;br /&gt;
| 17&lt;br /&gt;
| PCLK&lt;br /&gt;
|-&lt;br /&gt;
| 2 &lt;br /&gt;
| AGND&lt;br /&gt;
| 10 &lt;br /&gt;
| DVDD&lt;br /&gt;
| 18&lt;br /&gt;
| DATA6&lt;br /&gt;
|-&lt;br /&gt;
| 3 &lt;br /&gt;
| SDA&lt;br /&gt;
| 11&lt;br /&gt;
| DOVDD&lt;br /&gt;
| 19&lt;br /&gt;
| DATA2&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| AVDD&lt;br /&gt;
| 12&lt;br /&gt;
| DATA9&lt;br /&gt;
| 20&lt;br /&gt;
| DATA5&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| SCL&lt;br /&gt;
| 13&lt;br /&gt;
| MCLK&lt;br /&gt;
| 21&lt;br /&gt;
| DATA3&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| RESET&lt;br /&gt;
| 14&lt;br /&gt;
| DATA8&lt;br /&gt;
| 22&lt;br /&gt;
| DATA22&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| VSYNC&lt;br /&gt;
| 15&lt;br /&gt;
| AGND&lt;br /&gt;
| 23&lt;br /&gt;
| DATA1&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| PWDN&lt;br /&gt;
| 16&lt;br /&gt;
| DATA7&lt;br /&gt;
| 24&lt;br /&gt;
| DATA0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:cameraExample.jpg]]&lt;br /&gt;
&lt;br /&gt;
Mounting the camera&lt;br /&gt;
&lt;br /&gt;
'''Follow these simple steps to mount the camera into the 3G Arduino board.'''&lt;br /&gt;
&lt;br /&gt;
*The first step is to open the socket. To do this, pull carefully out the sides of the connector.&lt;br /&gt;
*Inserts the camera with metallic contacts facing up&lt;br /&gt;
*At the final step, push in the laterals of the connector&lt;br /&gt;
&lt;br /&gt;
=== Vedio Recording ===&lt;br /&gt;
To record video, and take images, you must start the camera in the first step. After you can configure some parameters like resolution, fps, rotation or zoom. The next code allows to record a video file in mp4 format. Remember, if you want to store the video file in a SD card, you must to use AT+FSLOCA command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char name[20];&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                //UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    }      &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMS&amp;quot;);     //starts the camera&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMSETD=320,240&amp;quot;);     //sets QVGA (320*240) resolution&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMSETF=2&amp;quot;);     //sets 15 frames per second&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    delay(1500);&lt;br /&gt;
    &lt;br /&gt;
    while(Serial.available()!=0){&lt;br /&gt;
        Serial.read();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMRS&amp;quot;);     //starts to record a video&lt;br /&gt;
    Serial.flush();                  //video is saved into C:/Video&lt;br /&gt;
    while(Serial.read()!='/');&lt;br /&gt;
    while(Serial.read()!='/');&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        name[x]=Serial.read();&lt;br /&gt;
        x++;&lt;br /&gt;
    }while(x &amp;lt; 19);&lt;br /&gt;
&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    Serial.println(name);      &lt;br /&gt;
    delay(10000);   &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMRP&amp;quot;);     // pauses record &lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
    delay(2000);   &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMRR&amp;quot;);     // resumes record &lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
    delay(10000);&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMRE&amp;quot;);     // stops to record&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAME&amp;quot;);     // stops the camera&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Taking Photo ===&lt;br /&gt;
Take photos is very easy, here is the example code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char name[20];&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    }   &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMS&amp;quot;);     //starts the camera&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMSETD=640,480&amp;quot;);     //sets VGA (640*480) resolution&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+FSLOCA=0&amp;quot;);     //stores the image file in the 3G module&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    delay(1500);&lt;br /&gt;
    while(Serial.available()!=0){&lt;br /&gt;
        Serial.read();&lt;br /&gt;
    }&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMTP&amp;quot;);     //takes a picture, but not saved it&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMEP&amp;quot;);     // saves the picture into C:/Picture    &lt;br /&gt;
    Serial.flush();     &lt;br /&gt;
    while(Serial.read()!='/');&lt;br /&gt;
    while(Serial.read()!='/');&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        name[x]=Serial.read();&lt;br /&gt;
        x++;&lt;br /&gt;
    }while(x &amp;lt; 19);&lt;br /&gt;
&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    Serial.println(name); &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAME&amp;quot;);     // stops the camera&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Video Call ===&lt;br /&gt;
&lt;br /&gt;
The SIM5218 allows video calls, but to carry them out correctly the operator and the network must be able to allow it. The example code is below. Cooking Hacks not ensure that the video call functions correctly.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char phone_number[]=&amp;quot;*********&amp;quot;;     // ********* is the number to call&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                //UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    }      &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMS&amp;quot;);     //starts the camera&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMSETD=320,240&amp;quot;);     //sets QVGA (320*240) resolution&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAMSETF=2&amp;quot;);     //sets 15 frames per seconds&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    delay(1500);&lt;br /&gt;
&lt;br /&gt;
    while(Serial.available()!=0){&lt;br /&gt;
        Serial.read();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+VPMAKE=&amp;quot;);     //inits a videocall&lt;br /&gt;
    Serial.println(phone_number);&lt;br /&gt;
    delay(30000);&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+VPEND&amp;quot;);     // ends the videocall&lt;br /&gt;
    while(Serial.read()!='K');     &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CCAME&amp;quot;);     // stops the camera&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Command Summary ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command&lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMS&lt;br /&gt;
| OK&lt;br /&gt;
| Starts camera.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAME&lt;br /&gt;
| OK&lt;br /&gt;
| Stops camera.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMSETD=xxx,yyy&lt;br /&gt;
| OK&lt;br /&gt;
| Sets dimension of camera. xxx is the width and yyy is the height.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMSETF=*&lt;br /&gt;
| OK&lt;br /&gt;
| Sets the frames per second. * is the frame rate option.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMRS&lt;br /&gt;
| OK&lt;br /&gt;
| Starts video recording . Also responds with the path and name of the file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMRP&lt;br /&gt;
| OK&lt;br /&gt;
| Pauses the record.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMRR&lt;br /&gt;
| OK&lt;br /&gt;
| Resumes video record.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMRE&lt;br /&gt;
| OK&lt;br /&gt;
| Stops video record.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMTP&lt;br /&gt;
| OK&lt;br /&gt;
| Takes a picture.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CCAMEP&lt;br /&gt;
| OK&lt;br /&gt;
| Saves a picture taken by last AT+CCAMTP. Also responds with the path and name of the file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+VPMAKE&lt;br /&gt;
| &lt;br /&gt;
| Makes a video call.&lt;br /&gt;
|-&lt;br /&gt;
| AT+VPEND&lt;br /&gt;
|&lt;br /&gt;
| Ends a video call.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== GPS ==&lt;br /&gt;
&lt;br /&gt;
SIM5218 supports both A-GPS and S-GPS and provides three operating modes: mobile-assisted mode, mobile-based mode and standalone mode. A-GPS is include mobile-assisted and mobile-based mode.&lt;br /&gt;
&lt;br /&gt;
In mobile-assisted mode, when a request for position location is issued, available network information is provided to the location server (e.g., Cell-ID) and assistance is requested from the location server. The location server sends the assistance information to the handset. The handset/mobile unit measures the GPS observables and provides the GPS measurements along with available network data (that is appropriate for the given air interface technology) to the location server. The location server then calculates the position location and returns results to the requesting entity.&lt;br /&gt;
&lt;br /&gt;
In mobile-based mode, the assistance data provided by the location server encompasses not only the information required to assist the handset in measuring the satellite signals, but also the information required to calculate the handset’s position. Therefore, rather than provide the GPS measurements and available network data back to the location server, the mobile calculates the location on the handset and passes the result to the requesting entity.&lt;br /&gt;
&lt;br /&gt;
In standalone (autonomous) mode, the handset demodulates the data directly from the GPS satellites. This mode has some reduced cold-start sensitivity, and a longer time to first fix as compared to the assisted modes. However, it requires no server interaction and works out of network coverage.&lt;br /&gt;
&lt;br /&gt;
This combination of GPS measurements and available network information provides: &lt;br /&gt;
*High-sensitivity solution that works in all terrains: indoor, outdoor, urban, and rural &lt;br /&gt;
*High availability that is enabled by using both satellite and network information &lt;br /&gt;
&lt;br /&gt;
Therefore, while network solutions typically perform poorly in rural areas and areas of poor cell geometry/density, and while unassisted, GPS-only solutions typically perform poorly indoors, the SIM5218 GPS solution provides optimal time to fix, accuracy, sensitivity, availability, and reduced network utilization in both of these environments, depending on the given condition.&lt;br /&gt;
&lt;br /&gt;
=== Stand-alone mode ===&lt;br /&gt;
In this mode, the GPS obtains position, altitude,... with only the signal of the satellites, making it the slowest of the three modes. If you use the AT+CGPSINFO command, the module bring directly latitud, logitude, date, UTC time, altitude and speed. Here is the example code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[255];&lt;br /&gt;
char latitude[11],longitude[12];&lt;br /&gt;
char date[6],UTC_time[8];&lt;br /&gt;
char speed_OG[6],altitude[6];&lt;br /&gt;
&lt;br /&gt;
int x,y;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGPS=1,1&amp;quot;);         // starts GPS session in stand-alone mode&lt;br /&gt;
    delay(100);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    delay(5000);&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGPSINFO&amp;quot;); // request GPS info&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        do{&lt;br /&gt;
            digitalWrite(led,HIGH);  &lt;br /&gt;
        }&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        digitalWrite(led,LOW);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    x=24;&lt;br /&gt;
    y=0;&lt;br /&gt;
    if(data[x]!=','){&lt;br /&gt;
        Serial.print(&amp;quot;Latitude: &amp;quot;);    //shows actual latitude&lt;br /&gt;
        do{&lt;br /&gt;
            latitude[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
        Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
        Serial.println(data[x]);    //north or south&lt;br /&gt;
&lt;br /&gt;
        x+=2;&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;Longitude: &amp;quot;);    //shows actual longitude&lt;br /&gt;
        do{&lt;br /&gt;
            longitude[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++; &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
        Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
        Serial.println(data[x]);    //west or east&lt;br /&gt;
&lt;br /&gt;
        x+=2;&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;Date: &amp;quot;);    //shows date&lt;br /&gt;
        do{&lt;br /&gt;
            date[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;\r\nUTC time: &amp;quot;);    //shows UTC time&lt;br /&gt;
        do{&lt;br /&gt;
            UTC_time[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;\r\nAltitude: &amp;quot;);    //shows altitude&lt;br /&gt;
        do{&lt;br /&gt;
            UTC_time[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        Serial.println(&amp;quot; m&amp;quot;);&lt;br /&gt;
        x++; &lt;br /&gt;
&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;Speed: &amp;quot;);    //shows speed&lt;br /&gt;
        do{&lt;br /&gt;
            speed_OG[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=0x0D);&lt;br /&gt;
        Serial.println(&amp;quot; knots&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    else{&lt;br /&gt;
        Serial.println(&amp;quot;GPS information not available, please wait...&amp;quot;);&lt;br /&gt;
    }   &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to get the NMEA sentences, you must to use the command AT+CGPSSWITCH=1 and configure the UART port at 57600 bauds. Supported NMEA sentences include GSV, GGA, RMC, GSA, and VTG.&lt;br /&gt;
&lt;br /&gt;
=== S-GPS Mode ===&lt;br /&gt;
For the S-GPS the module connects to a GPS server and the module calculates the position. Here is the example code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[255];&lt;br /&gt;
char latitude[11],longitude[12];&lt;br /&gt;
char date[6],UTC_time[8];&lt;br /&gt;
char speed_OG[6],altitude[6];&lt;br /&gt;
&lt;br /&gt;
int x,y;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
  Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!check_response(&amp;quot;OK&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGPSURL=\&amp;quot;supl.google.com:7276\&amp;quot;&amp;quot;);         // sets GPS server&lt;br /&gt;
    delay(100);   &lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGPSSSL=0&amp;quot;);         // without certificate&lt;br /&gt;
    delay(100);   &lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGPS=1,2&amp;quot;);         // starts GPS session in based mode&lt;br /&gt;
    delay(100);   &lt;br /&gt;
    while(Serial.read()!='K');        &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    delay(5000);&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGPSINFO&amp;quot;); // request GPS info&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    for (x=0;x&amp;lt; 255;x++){            &lt;br /&gt;
        data[x]='\0';                        &lt;br /&gt;
    } &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        do{&lt;br /&gt;
            digitalWrite(led,HIGH);  &lt;br /&gt;
        }&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        digitalWrite(led,LOW);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
    x=24;&lt;br /&gt;
    y=0;&lt;br /&gt;
    if(data[x]!=','){&lt;br /&gt;
        Serial.print(&amp;quot;Latitude: &amp;quot;);    //shows actual latitude&lt;br /&gt;
        do{&lt;br /&gt;
            latitude[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
            if(y==2){&lt;br /&gt;
                Serial.print(0xF8);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            if(y==4){&lt;br /&gt;
                Serial.print(&amp;quot;.&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
        Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
        Serial.println(data[x]);    //north or south&lt;br /&gt;
&lt;br /&gt;
        x+=2;&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;Longitude: &amp;quot;);    //shows actual longitude&lt;br /&gt;
        do{&lt;br /&gt;
            longitude[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
            if(y==3){&lt;br /&gt;
                Serial.print(0xF8);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            if(y==5){&lt;br /&gt;
                Serial.print(&amp;quot;.&amp;quot;);&lt;br /&gt;
            }        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
        Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
        Serial.println(data[x]);    //west or east&lt;br /&gt;
&lt;br /&gt;
        x+=2;&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;Date: &amp;quot;);    //shows date&lt;br /&gt;
        do{&lt;br /&gt;
            date[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;\r\nUTC time: &amp;quot;);    //shows UTC time&lt;br /&gt;
        do{&lt;br /&gt;
            UTC_time[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        x++;&lt;br /&gt;
&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;\r\nAltitude: &amp;quot;);    //shows altitude&lt;br /&gt;
        do{&lt;br /&gt;
            UTC_time[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=',');&lt;br /&gt;
        Serial.println(&amp;quot; m&amp;quot;);&lt;br /&gt;
        x++; &lt;br /&gt;
&lt;br /&gt;
        y=0;&lt;br /&gt;
        Serial.print(&amp;quot;Speed: &amp;quot;);    //shows speed&lt;br /&gt;
        do{&lt;br /&gt;
            speed_OG[y]=data[x];&lt;br /&gt;
            Serial.print(data[x]);&lt;br /&gt;
            y++;&lt;br /&gt;
            x++;        &lt;br /&gt;
        }&lt;br /&gt;
        while(data[x]!=0x0D);&lt;br /&gt;
        Serial.println(&amp;quot; knots&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    else{&lt;br /&gt;
        Serial.println(&amp;quot;GPS information not available, please wait...&amp;quot;);&lt;br /&gt;
    }   &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== A-GPS Mode ===&lt;br /&gt;
For the A-GPS the module connects to a GPS server for calculate the position. Here is the example code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! MS-assisted&lt;br /&gt;
! Server&lt;br /&gt;
! Module&lt;br /&gt;
|-&lt;br /&gt;
| Location server sends aiding data that is valid for the current fix&lt;br /&gt;
| Sending Data&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Module sends code phases&lt;br /&gt;
| &lt;br /&gt;
| Code phases&lt;br /&gt;
|-&lt;br /&gt;
| Server calculates position&lt;br /&gt;
| Calculate position&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! MS-based&lt;br /&gt;
! Server&lt;br /&gt;
! Module&lt;br /&gt;
|-&lt;br /&gt;
| Location server sends aiding data that is valid for the current fix&lt;br /&gt;
| Send aiding data&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Module calculates&lt;br /&gt;
| &lt;br /&gt;
| Calculate position&lt;br /&gt;
|-&lt;br /&gt;
! Stand alone&lt;br /&gt;
! Server&lt;br /&gt;
! Module&lt;br /&gt;
|-&lt;br /&gt;
| Module demodulates data form GPS satellite&lt;br /&gt;
| &lt;br /&gt;
|Demodulates GPS satellite data&lt;br /&gt;
|-&lt;br /&gt;
| Module calculates position&lt;br /&gt;
| &lt;br /&gt;
| Calculate position&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== GPS Units ===&lt;br /&gt;
The command AT+CGPSINFO returns the GPS info in a string:&lt;br /&gt;
&lt;br /&gt;
+CGPSINFO: [&amp;lt;latitude&amp;gt;],[&amp;lt;N/S&amp;gt;],[&amp;lt;longitude&amp;gt;],[&amp;lt;E/W&amp;gt;],[&amp;lt;date&amp;gt;],[&amp;lt;UTC_time&amp;gt;],[&amp;lt;altitude&amp;gt;],[&amp;lt;speedOG&amp;gt;],[&amp;lt;course&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Values&lt;br /&gt;
! Format&lt;br /&gt;
! Example&lt;br /&gt;
|-&lt;br /&gt;
| latitude&lt;br /&gt;
| ddmm.mmmmmm      &lt;br /&gt;
d: degree; m: minute&lt;br /&gt;
| 4140.831527&lt;br /&gt;
|-&lt;br /&gt;
| longitude&lt;br /&gt;
| dddmm.mmmmmm      &lt;br /&gt;
d: degree; m: minute&lt;br /&gt;
| 00053.173495&lt;br /&gt;
|-&lt;br /&gt;
| data&lt;br /&gt;
| ddmmyy    &lt;br /&gt;
d: day; m: month; y: year&lt;br /&gt;
| 020812&lt;br /&gt;
|-&lt;br /&gt;
| altitude&lt;br /&gt;
| meters&lt;br /&gt;
| 257.00&lt;br /&gt;
|-&lt;br /&gt;
| speedOG&lt;br /&gt;
| knots&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| course&lt;br /&gt;
| degrees&lt;br /&gt;
| 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If UE-assisted mode, when fixed will report indication:&lt;br /&gt;
&lt;br /&gt;
+CAGPSINFO:&amp;lt;latitude&amp;gt;,&amp;lt;longitude&amp;gt;,&amp;lt;altitude&amp;gt;,&amp;lt;date&amp;gt;,&amp;lt;UTC_time&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Values&lt;br /&gt;
! Format&lt;br /&gt;
! Example&lt;br /&gt;
|-&lt;br /&gt;
| latitude&lt;br /&gt;
| Unit is in 10^8 degree&lt;br /&gt;
| 4168050885&lt;br /&gt;
|-&lt;br /&gt;
| longitude&lt;br /&gt;
| Unit is in 10^8 degree&lt;br /&gt;
| 88618039&lt;br /&gt;
|-&lt;br /&gt;
| altitude&lt;br /&gt;
| meters&lt;br /&gt;
| 293&lt;br /&gt;
|-&lt;br /&gt;
| date&lt;br /&gt;
| ddmmyyyy      &lt;br /&gt;
d: day; m: month; y: year&lt;br /&gt;
| 28092012&lt;br /&gt;
|-&lt;br /&gt;
| UTC_time&lt;br /&gt;
| hhmmss.s      &lt;br /&gt;
h: hour; m: minute; s: seconds &lt;br /&gt;
| 081611.0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Command Summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command &lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGSOCKCONT=**,&amp;amp;&amp;amp;&amp;amp;&lt;br /&gt;
| OK&lt;br /&gt;
| ** is the protocol and &amp;amp;&amp;amp;&amp;amp; Access Point Name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGPS=*,&amp;amp;&lt;br /&gt;
| OK&lt;br /&gt;
| * sets on (1) or off (0) and &amp;amp; is the GPS mode.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGPSINFO&lt;br /&gt;
|&lt;br /&gt;
| Gets current position information.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGPSURL=”***”&lt;br /&gt;
| OK&lt;br /&gt;
| Sets AGPS default server URL . *** is the URL.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGPSSSL=*&lt;br /&gt;
| OK&lt;br /&gt;
| Select transport security, used certificate (*=1) or not (*=0).&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGPSSWITCH&lt;br /&gt;
| OK&lt;br /&gt;
| Choose the output port for NMEA sentence.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== SMS ==&lt;br /&gt;
=== Sending and Receiving SMS ===&lt;br /&gt;
The first code is used to send a SMS, the second one reads the SIM message memory and shows the last SMS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
 &lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int timesToSend = 1;        // Numbers of SMS to send&lt;br /&gt;
int count = 0;&lt;br /&gt;
&lt;br /&gt;
char phone_number[]=&amp;quot;*********&amp;quot;;     // ********* is the number to call&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CMGF=1&amp;quot;);         // sets the SMS mode to text&lt;br /&gt;
    delay(100);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    while (count &amp;lt; timesToSend){&lt;br /&gt;
        delay(1500);&lt;br /&gt;
        Serial.print(&amp;quot;AT+CMGS=\&amp;quot;&amp;quot;);   // send the SMS number&lt;br /&gt;
        Serial.print(phone_number);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
        delay(1500);      &lt;br /&gt;
        Serial.print(&amp;quot;Hola caracola...&amp;quot;);     // the SMS body&lt;br /&gt;
        delay(500);&lt;br /&gt;
        Serial.write(0x1A);       //sends ++&lt;br /&gt;
        Serial.write(0x0D);&lt;br /&gt;
        Serial.write(0x0A);&lt;br /&gt;
&lt;br /&gt;
        delay(5000);&lt;br /&gt;
&lt;br /&gt;
        count++;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
another code&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
*&lt;br /&gt;
 *  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
 *  it under the terms of the GNU General Public License as published by&lt;br /&gt;
 *  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
 *  (at your option) any later version.&lt;br /&gt;
 *&lt;br /&gt;
 *  This program is distributed in the hope that it will be useful,&lt;br /&gt;
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
 *  GNU General Public License for more details.&lt;br /&gt;
 *&lt;br /&gt;
 *  You should have received a copy of the GNU General Public License&lt;br /&gt;
 *  along with this program.  If not, see http://www.gnu.org/licenses/.&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
 *&lt;br /&gt;
 *  Version 0.1&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int timesToSend = 1;        // Numbers of SMS to send&lt;br /&gt;
int count = 0;&lt;br /&gt;
&lt;br /&gt;
int n_sms,x,sms_start;&lt;br /&gt;
char data[256];&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i = 0;i &amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CMGF=1&amp;quot;);         // sets the SMS mode to text&lt;br /&gt;
    delay(100);&lt;br /&gt;
    x = 0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;       &lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
    while(!((data[x-1] == 'K') &amp;amp;&amp;amp; (data[x-2] == 'O')));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    while (count &amp;lt; timesToSend){&lt;br /&gt;
        delay(1500);&lt;br /&gt;
&lt;br /&gt;
        while(Serial.available()!=0) Serial.read();&lt;br /&gt;
&lt;br /&gt;
        Serial.println(&amp;quot;AT+CPMS=\&amp;quot;SM\&amp;quot;,\&amp;quot;SM\&amp;quot;,\&amp;quot;SM\&amp;quot;&amp;quot;);    //selects SIM memory&lt;br /&gt;
        Serial.flush();&lt;br /&gt;
        for (x=0;x &amp;lt; 255;x++){            &lt;br /&gt;
            data[x]='\0';                        &lt;br /&gt;
        } &lt;br /&gt;
        x=0;&lt;br /&gt;
        do{&lt;br /&gt;
            while(Serial.available()==0);&lt;br /&gt;
            data[x]=Serial.read();  &lt;br /&gt;
            x++;       &lt;br /&gt;
&lt;br /&gt;
        }while(!((data[x-1] == 'K') &amp;amp;&amp;amp; (data[x-2] == 'O')));&lt;br /&gt;
&lt;br /&gt;
        x=0;&lt;br /&gt;
        do{&lt;br /&gt;
            x++;&lt;br /&gt;
        }while (data[x] != ' ');&lt;br /&gt;
&lt;br /&gt;
        x++;&lt;br /&gt;
        n_sms=0;&lt;br /&gt;
        do{&lt;br /&gt;
            n_sms*=10;&lt;br /&gt;
            n_sms=n_sms + (data[x]-0x30);&lt;br /&gt;
&lt;br /&gt;
            x++;&lt;br /&gt;
&lt;br /&gt;
        }while (data[x] != ',');&lt;br /&gt;
        &lt;br /&gt;
        Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
        Serial.print(n_sms,DEC);&lt;br /&gt;
&lt;br /&gt;
// Now it shows the total number of SMS and the last SMS&lt;br /&gt;
        Serial.println(&amp;quot;  SMS stored in SIM memory. Showing last SMS:&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        Serial.print(&amp;quot;AT+CMGR=&amp;quot;);    //Reads the last SMS &lt;br /&gt;
        Serial.println(n_sms-1,DEC);&lt;br /&gt;
        Serial.flush();&lt;br /&gt;
        for (x=0;x &amp;lt; 255;x++){            &lt;br /&gt;
            data[x]='\0';                        &lt;br /&gt;
        } &lt;br /&gt;
        x=0;&lt;br /&gt;
        do{&lt;br /&gt;
            while(Serial.available()==0);&lt;br /&gt;
            data[x]=Serial.read();  &lt;br /&gt;
            x++;           &lt;br /&gt;
            if((data[x-1] == 0x0D) &amp;amp;&amp;amp; (data[x-2] == '&amp;quot;')){&lt;br /&gt;
                x=0;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        while(!((data[x-1] == 'K') &amp;amp;&amp;amp; (data[x-2] == 'O')));&lt;br /&gt;
&lt;br /&gt;
        data[x-3]='\0';        //finish the string before the OK&lt;br /&gt;
&lt;br /&gt;
        Serial.println(data);    //shows the message&lt;br /&gt;
&lt;br /&gt;
        delay(5000);&lt;br /&gt;
&lt;br /&gt;
        count++;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Command Summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
! Command&lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CMGF=&lt;br /&gt;
| OK&lt;br /&gt;
| Specifies the input and output format of the short messages. 0 for PDU mode and 1 for text mode.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CMGS&lt;br /&gt;
|&lt;br /&gt;
| Sends a message.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CPMS=***&lt;br /&gt;
|&lt;br /&gt;
| Selects memory storages. *** is the memory type.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CMGR=*&lt;br /&gt;
|&lt;br /&gt;
| Reads a message. * is the number of the message.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== E-mails ==&lt;br /&gt;
=== Sending an E-mail ===&lt;br /&gt;
To send e-mail a SMTP server is used, so we need an e-mail account. The code example is the next:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
int x;&lt;br /&gt;
&lt;br /&gt;
//server and account data&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
//information about sender, direcctions and names&lt;br /&gt;
char sender_add[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char sender_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
char to_add[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char to_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
char cc_add[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char cc_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
char bcc_add[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char bcc_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
//&lt;br /&gt;
char subject[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char body[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
char response[128];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPSRV=\&amp;quot;&amp;quot;);    &lt;br /&gt;
    //configures the SIM5218 with server name and port&lt;br /&gt;
    Serial.print(server);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
    Serial.println(port);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPAUTH=1,\&amp;quot;&amp;quot;);    //configures the SIM5218 with user name and password&lt;br /&gt;
    Serial.print(user_name);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(password);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPFROM=\&amp;quot;&amp;quot;);    //sender adress and name&lt;br /&gt;
    Serial.print(sender_add);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(sender_name);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPRCPT=0,0,\&amp;quot;&amp;quot;);    //normal recipient address and name&lt;br /&gt;
    Serial.print(to_add);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(to_name);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    //If you don't need a carbon copy, delete this part&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPRCPT=1,0,\&amp;quot;&amp;quot;);    //carbon copy recipient address and name&lt;br /&gt;
    Serial.print(cc_add);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(cc_name);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    //If you don't need a blind carbon copy, delete this part&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPRCPT=2,0,\&amp;quot;&amp;quot;);    //blind carbon copy recipient address and name&lt;br /&gt;
    Serial.print(bcc_add);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(bcc_name);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPSUB=\&amp;quot;&amp;quot;);    //subjec of email&lt;br /&gt;
    Serial.print(subject);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+SMTPBODY=\&amp;quot;&amp;quot;);    //body of email&lt;br /&gt;
    Serial.print(body);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));    &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+SMTPSEND&amp;quot;);    //sends the email&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        response[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='K'&amp;amp;&amp;amp;response[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;Sending email...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        do{&lt;br /&gt;
            digitalWrite(led,HIGH);    &lt;br /&gt;
        }&lt;br /&gt;
        while(Serial.available()==0); &lt;br /&gt;
        digitalWrite(led,LOW);    &lt;br /&gt;
        response[x]=Serial.read();   &lt;br /&gt;
        x++;&lt;br /&gt;
    }&lt;br /&gt;
    while(!(response[x-1]=='S'&amp;amp;&amp;amp;response[x-2]=='S'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(response);&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Receiving an E-mail ===&lt;br /&gt;
For read an e-mail from a POP3 server we need an e-mail account. The code example is here:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
 &lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
int x;&lt;br /&gt;
&lt;br /&gt;
//server and account data&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
char path[50];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+POP3SRV=\&amp;quot;&amp;quot;);    &lt;br /&gt;
    //configures the SIM5218 with server name, user, password and port&lt;br /&gt;
    Serial.print(server);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(user_name);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(password);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
    Serial.println(port);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }&lt;br /&gt;
    while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+POP3IN&amp;quot;);    //logs into the server&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+POP3GET=1&amp;quot;);    //gets the first email&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        path[0]=Serial.read();&lt;br /&gt;
    }while(path[0]!='/'); &lt;br /&gt;
&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        path[0]=Serial.read();  &lt;br /&gt;
    }&lt;br /&gt;
    while(path[0]!='/');&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0); &lt;br /&gt;
        path[x]=Serial.read(); &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(path[x-1]!=' ');&lt;br /&gt;
&lt;br /&gt;
    x--;    //overwrite &amp;quot; &amp;quot; charracter&lt;br /&gt;
    x--;    //overwrite &amp;quot;,&amp;quot; charracter&lt;br /&gt;
&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0); &lt;br /&gt;
        path[x]=Serial.read(); &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(path[x-1]!=0x0D);&lt;br /&gt;
    path[x-1]='\0';&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+POP3OUT&amp;quot;);    //logs out the server&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+FSCD=C:/Email&amp;quot;);    //selects email directory as current directory&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+POP3READ=0,\&amp;quot;&amp;quot;);    //shows the email&lt;br /&gt;
    Serial.print(path);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[0]=Serial.read();         &lt;br /&gt;
    }while(data[0]!='D');&lt;br /&gt;
    &lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[0]=Serial.read();         &lt;br /&gt;
    }while(data[0]!='D');&lt;br /&gt;
    &lt;br /&gt;
    x=1;    &lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;   &lt;br /&gt;
        if(x==1020){&lt;br /&gt;
            Serial.print(data);&lt;br /&gt;
            x=0;&lt;br /&gt;
        }        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'&amp;amp;&amp;amp;data[x-3]==0x0A&amp;amp;&amp;amp;data[x-4]==0x0D));&lt;br /&gt;
&lt;br /&gt;
    data[x-2]='\0';&lt;br /&gt;
    Serial.println(data);&lt;br /&gt;
    &lt;br /&gt;
    while(1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Command Summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command &lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGSOCKCONT=**,&amp;amp;&amp;amp;&amp;amp;&lt;br /&gt;
| OK&lt;br /&gt;
| ** is the protocol and &amp;amp;&amp;amp;&amp;amp; Access Point Name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPSRV=”*****”,&amp;amp;&amp;amp;&amp;amp; &lt;br /&gt;
| OK&lt;br /&gt;
| Sets SMTP server address and server’s port . ***** is the sever address and &amp;amp;&amp;amp;&amp;amp; is the server's port.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPAUTH=1,”***”,”&amp;amp;&amp;amp;&amp;amp;”&lt;br /&gt;
| OK&lt;br /&gt;
| Controls SMTP authentication. *** is the user name and &amp;amp;&amp;amp;&amp;amp; is the password.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPFROM=”***”,”&amp;amp;&amp;amp;&amp;amp;”&lt;br /&gt;
| OK&lt;br /&gt;
| Sets sender’s address and nam e. *** is the sender's address and &amp;amp;&amp;amp;&amp;amp; is the sender's name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPRCPT=x,”***”,”&amp;amp;&amp;amp;&amp;amp;”&lt;br /&gt;
| OK&lt;br /&gt;
| Sets recipient address/name and kind .&lt;br /&gt;
x is the kind (TO/CC/BCC), *** is the recipient address and &amp;amp;&amp;amp;&amp;amp; is the recipient name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPSUB=”****”&lt;br /&gt;
| OK&lt;br /&gt;
| Sets the subject of e-mail . **** is the subject.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPBODY&lt;br /&gt;
|&lt;br /&gt;
| Sets e-mail body.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SMTPSEND&lt;br /&gt;
|&lt;br /&gt;
| Initiates TCP session with SMTP server and sends an e-mail&lt;br /&gt;
|-&lt;br /&gt;
| AT+POP3SRV=”**”,”&amp;amp;&amp;amp;”,”xx”,yy&lt;br /&gt;
| OK&lt;br /&gt;
| Sets all parameters to get an e-mail from POP3 . ** is the server address, &amp;amp;&amp;amp; is the user name,&lt;br /&gt;
xx is the password and yy the server port&lt;br /&gt;
|-&lt;br /&gt;
| AT+POP3IN&lt;br /&gt;
| OK&lt;br /&gt;
| Logs in POP3 server&lt;br /&gt;
|-&lt;br /&gt;
| AT+POP3GET=***&lt;br /&gt;
|&lt;br /&gt;
| Gets an e-mail from POP3 server , *** is the number of the e-mail.&lt;br /&gt;
|-&lt;br /&gt;
| AT+POP3OUT&lt;br /&gt;
| OK&lt;br /&gt;
| Logs out POP3 server&lt;br /&gt;
|-&lt;br /&gt;
| AT+POP3READ=”***”,”&amp;amp;&amp;amp;&amp;amp;”&lt;br /&gt;
| &lt;br /&gt;
| Reads an e-mail from file system . *** is the location and &amp;amp;&amp;amp;&amp;amp; is the name.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== SD and system memory ==&lt;br /&gt;
The file system is used to store files in a hierarchical (tree) structure. Local storage space is mapped to “C:”, and SD is mapped to “D:”. In both “C:” and “D:” directories, module creates four directories named “Picture”, “Audio”, “Video” and “VideoCall” automatically; “Picture” is used to store static image when taking picture by camera, “Audio” is used to store audio file, “Video” is used to store video file when recor ding by camera, and “VideoCall” is used to store media file which is recorded during a video call.&lt;br /&gt;
&lt;br /&gt;
The maximum size of the microSD card is 32GB. Here are some AT commands to manage the file system:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command &lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSCD=****&lt;br /&gt;
| OK&lt;br /&gt;
| Select a directory as current directory . **** is the directory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSMKDIR=****&lt;br /&gt;
| OK&lt;br /&gt;
| Create a new directory in current directory . **** is the name of the new directory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSRMDIR=****&lt;br /&gt;
| OK&lt;br /&gt;
| Delete existing directory in current directory . **** is the name of the directory to delete.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSLS&lt;br /&gt;
| &lt;br /&gt;
| Make a list with informations of directories and/or files in current directory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+DEL=****&lt;br /&gt;
| OK&lt;br /&gt;
| Delete a file in current directory. **** is the name of the file to delete.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSRENAME=****,&amp;amp;&amp;amp;&amp;amp;&lt;br /&gt;
| OK&lt;br /&gt;
| Rename a file in current directory. **** is the actual name and &amp;amp;&amp;amp;&amp;amp; is the new name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSATTRI=****&lt;br /&gt;
| &lt;br /&gt;
| Request the attributes of file which is existing in current directory. **** is the name of the file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSMEM&lt;br /&gt;
| &lt;br /&gt;
| Check the size of available memory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSFMT&lt;br /&gt;
| OK&lt;br /&gt;
| Format storage card which is plugged in.&lt;br /&gt;
|-&lt;br /&gt;
| AT+FSLOCA=&lt;br /&gt;
| OK&lt;br /&gt;
| Set the storage place , 0 for local and 1 for SD&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== FTP and FTPS ==&lt;br /&gt;
=== FTP ===&lt;br /&gt;
Creating a file into the FTP server, writing it and reading it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
*&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int x=0;&lt;br /&gt;
int file_size;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPSERV=\&amp;quot;&amp;quot;); //Sets the FTP server&lt;br /&gt;
  Serial.print(server);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPPORT=&amp;quot;);    //Sets FTP port&lt;br /&gt;
  Serial.println(port);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPUN=\&amp;quot;&amp;quot;); //Sets the user name&lt;br /&gt;
  Serial.print(user_name);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPPW=\&amp;quot;&amp;quot;); //Sets password&lt;br /&gt;
  Serial.print(password);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;);     &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPMODE=1&amp;quot;);    //Selects pasive mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPTYPE=I&amp;quot;);    //Selects Binary mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPPUT=\&amp;quot;/test.txt\&amp;quot;&amp;quot;);    //Creates a file and sends data (ASCII)&lt;br /&gt;
    Serial.flush(); &lt;br /&gt;
    while(Serial.read()]!='N');    //Waits 'N' from BEGIN&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;01234567890123456789&amp;quot;);    //Data for the file&lt;br /&gt;
    Serial.write(0x1A);    //EOL character&lt;br /&gt;
    Serial.write(0x0D);&lt;br /&gt;
    Serial.write(0x0A);&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read(); &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    delay(1000);&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPGET=\&amp;quot;/test.txt\&amp;quot;&amp;quot;);    //Reads the data from test file&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while((data[x-1]!=','));&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    &lt;br /&gt;
    while(Serial.peek()!=0x0A){&lt;br /&gt;
        file_size=(file_size*10)+(Serial.read()-0x30);&lt;br /&gt;
    }; &lt;br /&gt;
&lt;br /&gt;
    for(x=0;x&amp;lt; file_size;x++){&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    Serial.print(data);&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uploading a file from local storage or SD to FTP server.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[256];&lt;br /&gt;
int x=0;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPSERV=\&amp;quot;&amp;quot;); //Sets the FTP server&lt;br /&gt;
  Serial.print(server);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPPORT=&amp;quot;);    //Sets FTP port&lt;br /&gt;
  Serial.println(port);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPUN=\&amp;quot;&amp;quot;); //Sets the user name&lt;br /&gt;
  Serial.print(user_name);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPPW=\&amp;quot;&amp;quot;); //Sets password&lt;br /&gt;
  Serial.print(password);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;);     &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPMODE=1&amp;quot;);    //Selects pasive mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    //Selecciona el tipo ASCII&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPTYPE=I&amp;quot;);    //Selects Binary mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPPUTFILE=\&amp;quot;/testfile.txt\&amp;quot;,0&amp;quot;);    //Uploads a test file into FTP server.&lt;br /&gt;
    Serial.flush(); &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read(); &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Downloading a file from FTP server or SD to local storage.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int x=0;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);   &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPSERV=\&amp;quot;&amp;quot;); //Sets the FTP server&lt;br /&gt;
  Serial.print(server);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPPORT=&amp;quot;);    //Sets FTP port&lt;br /&gt;
  Serial.println(port);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPUN=\&amp;quot;&amp;quot;); //Sets the user name&lt;br /&gt;
  Serial.print(user_name);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;); &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPPW=\&amp;quot;&amp;quot;); //Sets password&lt;br /&gt;
  Serial.print(password);&lt;br /&gt;
  Serial.println(&amp;quot;\&amp;quot;&amp;quot;);     &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPMODE=1&amp;quot;);    //Selects pasive mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    //Selecciona el tipo ASCII&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPTYPE=I&amp;quot;);    //Selects Binary mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    //Envia data&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPGETFILE=\&amp;quot;/testfile.txt\&amp;quot;,0&amp;quot;);  //Downloads a test file from FTP server.&lt;br /&gt;
    Serial.flush(); &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read(); &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FTPS ===&lt;br /&gt;
Creating a file into the FTP server, writing it and reading it (likes FTP codes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
*&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int x=0;&lt;br /&gt;
unsigned int file_size=0;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for(int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSSTART&amp;quot;);      //Acquires FTPS protocol stack&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPSLOGIN=\&amp;quot;&amp;quot;);      //Logs into FTPS server&lt;br /&gt;
    Serial.print(server);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
    Serial.print(port);&lt;br /&gt;
    Serial.print(&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(user_name);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(password);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPMODE=1&amp;quot;);    //Selects pasive mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSTYPE=I&amp;quot;);    //Selects Binary mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
   //Envia data&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSPUT=\&amp;quot;/test_file.txt\&amp;quot;,13&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();&lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(data[x-1]!='&amp;gt;');&lt;br /&gt;
    &lt;br /&gt;
    Serial.write(&amp;quot;Test message!&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        digitalWrite(13, LOW);&lt;br /&gt;
        data[x]=Serial.read(); &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    delay(1000);&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSGET=\&amp;quot;/test.txt\&amp;quot;&amp;quot;);    //Reads the data from test file&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while((data[x-1]!=','));&lt;br /&gt;
&lt;br /&gt;
    x=0;&lt;br /&gt;
    &lt;br /&gt;
    while(Serial.peek()!=0x0A){&lt;br /&gt;
        file_size=(file_size*10)+(Serial.read()-0x30);&lt;br /&gt;
    }; &lt;br /&gt;
&lt;br /&gt;
    for(x=0;x&amp;lt; file_size;x++){&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    Serial.print(data);&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uploading a file from local storage or SD to FTP server &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[256];&lt;br /&gt;
int x=0;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // swithes the module ON&lt;br /&gt;
&lt;br /&gt;
    for(int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSSTART&amp;quot;);      //Acquires FTPS protocol stack&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPSLOGIN=\&amp;quot;&amp;quot;);      //Logs into FTPS server&lt;br /&gt;
    Serial.print(server);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
    Serial.print(port);&lt;br /&gt;
    Serial.print(&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(user_name);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(password);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPMODE=1&amp;quot;);    //Selects pasive mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSTYPE=I&amp;quot;);    //Selects Binary mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    //Envia data&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSPUTFILE=\&amp;quot;/testfile.txt\&amp;quot;,0&amp;quot;); //Uploads a test file from FTPS server.&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        digitalWrite(13, LOW);&lt;br /&gt;
        data[x]=Serial.read(); &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Downloading a file from FTP server or SD to local storage&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
char data[256];&lt;br /&gt;
int x=0;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char user_name[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char password[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for(int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSSTART&amp;quot;);      //Acquires FTPS protocol stack&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CFTPSLOGIN=\&amp;quot;&amp;quot;);      //Logs into FTPS server&lt;br /&gt;
    Serial.print(server);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
    Serial.print(port);&lt;br /&gt;
    Serial.print(&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(user_name);&lt;br /&gt;
    Serial.print(&amp;quot;\&amp;quot;,\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.print(password);&lt;br /&gt;
    Serial.println(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPMODE=1&amp;quot;);    //Selects pasive mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSTYPE=I&amp;quot;);    //Selects Binary mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    //Envia data&lt;br /&gt;
    Serial.println(&amp;quot;AT+CFTPSGETFILE=\&amp;quot;/testfile.txt\&amp;quot;,0&amp;quot;); //Downloads a test file from FTPS server.&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        digitalWrite(13, LOW);&lt;br /&gt;
        data[x]=Serial.read(); &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Command and Summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command&lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CGSOCKCONT=**,&amp;amp;&amp;amp;&amp;amp;&lt;br /&gt;
| OK&lt;br /&gt;
| ** is the protocol and &amp;amp;&amp;amp;&amp;amp; Access Point Name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSERV=”****”&lt;br /&gt;
| &lt;br /&gt;
| Sets FTP server domain name or IP address. **** is the domain name or the IP.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPPORT=***&lt;br /&gt;
| OK&lt;br /&gt;
| Sets FTP server port. *** is the port.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPUN=”***”&lt;br /&gt;
| OK&lt;br /&gt;
| Sets user name for FTP server access. *** is the user name.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPPW=”***”&lt;br /&gt;
| OK&lt;br /&gt;
| Sets password for FTP server access. *** is the password.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPMODE=&lt;br /&gt;
| OK&lt;br /&gt;
| Sets FTP mode. 1 for passive or 0 for proactive.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPTYPE=&lt;br /&gt;
| OK&lt;br /&gt;
| Sets the transfer type on FTP server . A for ASCII or I for binary.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPPUT=”***”,&amp;amp;&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Puts a file from FTP server to serial port . *** is the path with the name of the file and &amp;amp;&amp;amp; is the length.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPGET=”***”&lt;br /&gt;
|&lt;br /&gt;
| Gets a file from FTP server to serial port . *** is the path with the name of the file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPPUTFILE=”***”,&amp;amp;&lt;br /&gt;
|&lt;br /&gt;
| Uploads a file to FTP server from module . *** is the path and &amp;amp; is the storage directory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPGETFILE”=***”,&amp;amp;&lt;br /&gt;
|&lt;br /&gt;
| Downloads a file from FTP server to module . *** is the path with the name and &amp;amp; is the storage directory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSSTART&lt;br /&gt;
| OK&lt;br /&gt;
| Acquires FTPS protocol stack.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSLOGIN=”**”,&amp;amp;&amp;amp;&amp;amp;,”xxx”,”yyy&lt;br /&gt;
| OK&lt;br /&gt;
| Logs in FTPS server. *** is the host address, &amp;amp;&amp;amp;&amp;amp; is the port, xxx is the user name and yyy is the password.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSTYPE=&lt;br /&gt;
| OK&lt;br /&gt;
| Sets the transfer type on FTPS server . A for ASCII or I for binary.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSPUT=”***”,&amp;amp;&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Puts a file from FTPS server to serial port . *** is the path with the name of the file and &amp;amp;&amp;amp; is the length.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSGET=”***”&lt;br /&gt;
|&lt;br /&gt;
| Gets a file from FTPS server to serial port . *** is the path with the name of the file.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSPUTFILE=”***”,&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Uploads a file to FTPS server from module . *** is the path and &amp;amp; is the storage directory.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CFTPSGETFILE=”***”,&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Downloads a file from FTPS server to module . *** is the path with the name and &amp;amp; is the storage directory.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== TCP and UDP ==&lt;br /&gt;
=== UDP client ===&lt;br /&gt;
Sending data to a UDP server:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char name[20];&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+NETOPEN=\&amp;quot;UDP\&amp;quot;,&amp;quot;); //Opens the socket with the type of protocol and the port &lt;br /&gt;
  Serial.println(port);        &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='d'&amp;amp;&amp;amp;data[x-2]=='e'));        //waits for response &amp;quot;Network opened&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+UDPSEND=12,\&amp;quot;&amp;quot;); //Sends UDP data&lt;br /&gt;
  Serial.print(server);&lt;br /&gt;
  Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
  Serial.println(port);        &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='&amp;gt;');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;Test message&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+NETCLOSE&amp;quot;); //Opens the socket with the type of protocol and the port &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== TCP Client ===&lt;br /&gt;
Sending data to a TCP server:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char name[20];&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+NETOPEN=\&amp;quot;TCP\&amp;quot;,&amp;quot;);&lt;br /&gt;
    //Opens the socket with the type of protocol and the port &lt;br /&gt;
  Serial.println(port);        &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='d'&amp;amp;&amp;amp;data[x-2]=='e'));        //waits for response &amp;quot;Network opened&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    Serial.print(&amp;quot;AT+TCPCONNECT=\&amp;quot;&amp;quot;); //Connects with the server&lt;br /&gt;
  Serial.print(server);&lt;br /&gt;
  Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);    &lt;br /&gt;
  Serial.println(port);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+TCPWRITE=12&amp;quot;);        //Sends TCP data&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='&amp;gt;');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;Test message&amp;quot;); &lt;br /&gt;
    &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+NETCLOSE&amp;quot;); //Opens the socket with the type of protocol and the port &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Multiclient ===&lt;br /&gt;
SIM5218 allows to use ten connections simultaneously. Here is the example code with a UDP and TCP connections.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char UDP_server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char UDP_port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char TCP_server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char TCP_port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+NETOPEN=,,1&amp;quot;);        //Opens the socket in multiclient mode&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='d'&amp;amp;&amp;amp;data[x-2]=='e'));        //waits for response &amp;quot;Network opened&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CIPOPEN=0,\&amp;quot;UDP\&amp;quot;,\&amp;quot;&amp;quot;);  //Connects with the UDP server&lt;br /&gt;
  Serial.print(UDP_server);&lt;br /&gt;
  Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
  Serial.println(UDP_port);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CIPOPEN=1,\&amp;quot;TCP\&amp;quot;,\&amp;quot;&amp;quot;);  //Connects with the TCP server&lt;br /&gt;
  Serial.print(TCP_server);&lt;br /&gt;
  Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
  Serial.println(TCP_port);    &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CIPSEND=0,16&amp;quot;);    //Sends data to UDP server&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='&amp;gt;');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;UDP test message&amp;quot;); &lt;br /&gt;
    &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CIPSEND=1,16&amp;quot;);    //Sends data to TCP server&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='&amp;gt;');  &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;TCP test message&amp;quot;); &lt;br /&gt;
    &lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;                        &lt;br /&gt;
    }while(!(data[x-1]=='K'&amp;amp;&amp;amp;data[x-2]=='O'));&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CIPCLOSE=0&amp;quot;);    //Closes UDP connection&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CIPCLOSE=1&amp;quot;);    //Closes TCP connection&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+NETCLOSE&amp;quot;);        //Opens the socket with the type of protocol and the port &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K'); &lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== TCP Server ===&lt;br /&gt;
SIM5218 allows to create a TCP server with a maximum of ten TCP clients. In this example the server send a message every 5 seconds to all clients.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
 &lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char name[20];&lt;br /&gt;
&lt;br /&gt;
int clients=-2;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+NETOPEN=\&amp;quot;TCP\&amp;quot;,&amp;quot;);  &lt;br /&gt;
    //Opens the socket with the type of protocol and the port &lt;br /&gt;
    Serial.println(port);        &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='d'&amp;amp;&amp;amp;data[x-2]=='e'));        //waits for response &amp;quot;Network opened&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+SERVERSTART&amp;quot;); //Starts TCP server&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+LISTCLIENT&amp;quot;);  // List all of clients&lt;br /&gt;
  Serial.flush();&lt;br /&gt;
  clients=-2;&lt;br /&gt;
  do{&lt;br /&gt;
    if(Serial.read()==0x0D){&lt;br /&gt;
      clients++;&lt;br /&gt;
    }&lt;br /&gt;
  }while(Serial.peek()!='K'));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  for(int y=0;y&amp;lt; clients;y++){&lt;br /&gt;
    Serial.print(&amp;quot;AT+ACTCLIENT=&amp;quot;);    //activates the connection with the client  &lt;br /&gt;
    Serial.println(y);&lt;br /&gt;
    while(Serial.read()!='K'));&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+TCPWRITE=12&amp;quot;);        //Sends TCP data&lt;br /&gt;
      Serial.flush();&lt;br /&gt;
      while(Serial.read()!='&amp;gt;');  &lt;br /&gt;
&lt;br /&gt;
      Serial.println(&amp;quot;Test message&amp;quot;); &lt;br /&gt;
    &lt;br /&gt;
      x=0;&lt;br /&gt;
      do{&lt;br /&gt;
          while(Serial.available()==0);&lt;br /&gt;
          data[x]=Serial.read();  &lt;br /&gt;
          x++;                        &lt;br /&gt;
      }while(!(data[x-1]=='k'&amp;amp;&amp;amp;data[x-2]=='o'));    Waits for &amp;quot;send ok&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CLOSECLIENT=&amp;quot;); //desactivates the connection with the client  &lt;br /&gt;
    Serial.println(y);&lt;br /&gt;
    while(Serial.read()!='K'));&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  delay(5000);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Command and Summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command&lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+NETOPEN=”***”,&amp;amp;&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Opens a socket . *** is the socket type and &amp;amp;&amp;amp; is the port.&lt;br /&gt;
|-&lt;br /&gt;
| AT+NETCLOSE&lt;br /&gt;
| OK&lt;br /&gt;
| Closes socket.&lt;br /&gt;
|-&lt;br /&gt;
| AT+UPDSEND&lt;br /&gt;
| &lt;br /&gt;
| Sends UDP data.&lt;br /&gt;
|-&lt;br /&gt;
| | |&lt;br /&gt;
|-&lt;br /&gt;
| AT+TCPCONNECT=”***”,&amp;amp;&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Establishes TCP connection with TCP server. *** is the IP address and &amp;amp;&amp;amp; is the port.&lt;br /&gt;
|-&lt;br /&gt;
| AT+TCPWRITE&lt;br /&gt;
|&lt;br /&gt;
| Sends TCP data when the TCP connection is established.&lt;br /&gt;
|-&lt;br /&gt;
| AT+SERVERSTART&lt;br /&gt;
| OK&lt;br /&gt;
| Starts up TCP server.&lt;br /&gt;
|-&lt;br /&gt;
| AT+LISTCLIENT&lt;br /&gt;
|&lt;br /&gt;
| Lists all of clients’ information.&lt;br /&gt;
|-&lt;br /&gt;
| AT+ACTCLIENT=*&lt;br /&gt;
| OK&lt;br /&gt;
| Activates the specified client. * is the number of the client.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CLOSECLIENT=*&lt;br /&gt;
| OK&lt;br /&gt;
| Disconnects the specified client. * is the number of the client.&lt;br /&gt;
|-&lt;br /&gt;
| | | &lt;br /&gt;
|-&lt;br /&gt;
| AT+CIPOPEN=*,”&amp;amp;&amp;amp;”,”xx”,yy&lt;br /&gt;
| &lt;br /&gt;
| Establish a connection with TCP server or UDP server. * is the number of the connection, &lt;br /&gt;
&amp;amp;&amp;amp; is the type of transmision protocol, xx is the server IP and yy is the server port.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CIPSEND&lt;br /&gt;
| &lt;br /&gt;
| Sends some data to remote host in mult-client mode.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CIPCLOSE=*&lt;br /&gt;
| OK&lt;br /&gt;
| Closes a specified connection in multi-client mode. * is the number of the connection.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== HTTP and HTTPS ==&lt;br /&gt;
=== HTTP ===&lt;br /&gt;
SIM5218 can launch a HTTP operation like GET or POST. Here is an example with GET operation:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see ..&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int data_size&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.print(&amp;quot;AT+CHTTPACT=\&amp;quot;&amp;quot;); //Connects with the HTTP server&lt;br /&gt;
  Serial.print(server);&lt;br /&gt;
  Serial.print(&amp;quot;\&amp;quot;,&amp;quot;);&lt;br /&gt;
  Serial.println(port);        &lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    x=0;&lt;br /&gt;
    do{&lt;br /&gt;
        while(Serial.available()==0);&lt;br /&gt;
        data[x]=Serial.read();  &lt;br /&gt;
        x++;  &lt;br /&gt;
    }while(!(data[x-1]=='T'&amp;amp;&amp;amp;data[x-2]=='S'));        //waits for response &amp;quot;REQUEST&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;GET /index.html HTTP/1.1&amp;quot;);&lt;br /&gt;
  Serial.println(&amp;quot;Host: www.mywebsite.com&amp;quot;);&lt;br /&gt;
  Serial.println(&amp;quot;Content-Length: 0&amp;quot;);&lt;br /&gt;
  Serial.write(0x1A);       //sends ++&lt;br /&gt;
    Serial.write(0x0D);&lt;br /&gt;
    Serial.write(0x0A);&lt;br /&gt;
&lt;br /&gt;
  while(Serial.read()!='K');&lt;br /&gt;
  while(Serial.read()!=' ');&lt;br /&gt;
&lt;br /&gt;
  data_size=0;  &lt;br /&gt;
  do{&lt;br /&gt;
    data_size*=10;&lt;br /&gt;
    data_size=data_size+(Serial.read()-0x30);&lt;br /&gt;
  }while(Serial.peek()!=0x0D);&lt;br /&gt;
&lt;br /&gt;
  for(x=0;x&amp;lt; data_size;x++){&lt;br /&gt;
    data[x]=Serial.read();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  Serial.print(data);&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== HTTPS ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
*  This program is free software: you can redistribute it and/or modify&lt;br /&gt;
*  it under the terms of the GNU General Public License as published by&lt;br /&gt;
*  the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
*  (at your option) any later version.&lt;br /&gt;
*&lt;br /&gt;
*  This program is distributed in the hope that it will be useful,&lt;br /&gt;
*  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
*  GNU General Public License for more details.&lt;br /&gt;
*&lt;br /&gt;
*  You should have received a copy of the GNU General Public License&lt;br /&gt;
*  along with this program.  If not, see .&lt;br /&gt;
&lt;br /&gt;
*  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.&lt;br /&gt;
*  http://www.libelium.com&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*  Author: Alejandro Gállego&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
*  Version 0.1&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char data[1024];&lt;br /&gt;
int data_size&lt;br /&gt;
int led = 13;&lt;br /&gt;
int onModulePin = 2;        // the pin to switch on the module (without press on button) &lt;br /&gt;
&lt;br /&gt;
int x = 0;&lt;br /&gt;
&lt;br /&gt;
char server[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
char port[ ]=&amp;quot;&amp;quot;;&lt;br /&gt;
void switchModule(){&lt;br /&gt;
    digitalWrite(onModulePin,HIGH);&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    digitalWrite(onModulePin,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void setup(){&lt;br /&gt;
&lt;br /&gt;
    Serial.begin(115200);                // UART baud rate&lt;br /&gt;
    delay(2000);&lt;br /&gt;
    pinMode(led, OUTPUT);&lt;br /&gt;
    pinMode(onModulePin, OUTPUT);&lt;br /&gt;
    switchModule();                    // switches the module ON&lt;br /&gt;
&lt;br /&gt;
    for (int i=0;i&amp;lt; 5;i++){&lt;br /&gt;
        delay(5000);&lt;br /&gt;
    } &lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;AT+CGSOCKCONT=1,\&amp;quot;IP\&amp;quot;,\&amp;quot;myapn\&amp;quot;&amp;quot;);&lt;br /&gt;
    Serial.flush();&lt;br /&gt;
    while(Serial.read()!='K');  &lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Serial.println(&amp;quot;AT+CHTTPSSTART&amp;quot;); //Acquires HTTPS protocol stack       &lt;br /&gt;
    Serial.flush();    &lt;br /&gt;
  while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
  Serial.println(&amp;quot;AT+CHTTPSOPSE&amp;quot;);  //Opens a new HTTPS session   &lt;br /&gt;
    Serial.flush();    &lt;br /&gt;
  while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
  Serial.println(&amp;quot;AT+CHTTPSSEND=63&amp;quot;); //Sends HTTPS request   &lt;br /&gt;
    Serial.flush();    &lt;br /&gt;
  while(Serial.read()!='&amp;gt;');&lt;br /&gt;
    &lt;br /&gt;
    Serial.println(&amp;quot;GET /index.html HTTP/1.1&amp;quot;);&lt;br /&gt;
  Serial.println(&amp;quot;Host: www.mywebsite.com&amp;quot;);&lt;br /&gt;
  Serial.println(&amp;quot;Content-Length: 0&amp;quot;);&lt;br /&gt;
  while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
  Serial.println(&amp;quot;AT+CHTTPSRECV=1&amp;quot;);  //Receives HTTPS response&lt;br /&gt;
    Serial.flush();    &lt;br /&gt;
  while(Serial.read()!=',');&lt;br /&gt;
&lt;br /&gt;
  data_size=0;  &lt;br /&gt;
  do{&lt;br /&gt;
    data_size*=10;&lt;br /&gt;
    data_size=data_size+(Serial.read()-0x30);&lt;br /&gt;
  }while(Serial.peek()!=0x0D);&lt;br /&gt;
&lt;br /&gt;
  for(x=0;x&amp;lt; d ata_size;x++){&lt;br /&gt;
    data[x]=Serial.read();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  Serial.println(&amp;quot;AT+CHTTPSCLSE&amp;quot;);  //Closes a new HTTPS session   &lt;br /&gt;
    Serial.flush();    &lt;br /&gt;
  while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
  Serial.println(&amp;quot;AT+CHTTPSSTOP&amp;quot;);  //Releases HTTPS protocol stack&lt;br /&gt;
    Serial.flush();    &lt;br /&gt;
  while(Serial.read()!='K');&lt;br /&gt;
&lt;br /&gt;
  Serial.print(data);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    while(1);&lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Command and Summary ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command &lt;br /&gt;
! Response&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPACT=”***”,&amp;amp;&amp;amp;&lt;br /&gt;
| &lt;br /&gt;
| Launches a HTTP operation . *** is the server address and &amp;amp;&amp;amp; is the port.&lt;br /&gt;
|-&lt;br /&gt;
| | | |&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPSSTART&lt;br /&gt;
| OK&lt;br /&gt;
| Acquires HTTPS protocol stack.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPSSTOP&lt;br /&gt;
| OK&lt;br /&gt;
| Releases HTTPS protocol stack.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPSOPSE&lt;br /&gt;
| OK&lt;br /&gt;
| Opens a new HTTPS session.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPSCLSE&lt;br /&gt;
| OK&lt;br /&gt;
| Closes the opened HTTPS session.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPSSEND=*&lt;br /&gt;
| &lt;br /&gt;
| Sends HTTPS request. * is the length of the data in the sending buffer.&lt;br /&gt;
|-&lt;br /&gt;
| AT+CHTTPSRECV=*&lt;br /&gt;
| &lt;br /&gt;
| Receives HTTPS response after sending HTTPS request.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''AT Command Tester Application'''&lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/module-tester/ AT Command Tester] is a free online tool test [http://m2msupport.net/m2msupport/software-and-at-commands-for-m2m-modules/ AT Commands] and other modem functionalities of [http://m2msupport.net/m2msupport/category/devices/gprs-modem/ 2G modules] (GPRS/EDGE) , [http://m2msupport.net/m2msupport/category/devices/gprs-modem/ 3G Modules] (HSDPA/EVDO) and [http://m2msupport.net/m2msupport/search-page/?Max!Download!Speed=100%20Mbps 4G Modules] (LTE).AT Command Tester tool connects to the modem port of the device and can test various modem functions such as getting [http://m2msupport.net/m2msupport/at-commands-to-get-device-information/ device information], [http://m2msupport.net/m2msupport/data-call-at-commands-to-set-up-gprsedgeumtslte-data-call/ gprs data call], [http://m2msupport.net/m2msupport/voice-call-at-commands-to-set-up-voice-call/ voice call],[http://m2msupport.net/m2msupport/at-command-for-http-functions-for-remote-server-data-access/ http access], [http://m2msupport.net/m2msupport/signal-quality/ checking signal condition], [http://m2msupport.net/m2msupport/network-registration/ network registration], [http://m2msupport.net/m2msupport/sms-at-commands/ SMS functions], [http://m2msupport.net/m2msupport/sim-at-commands-for-sim-presense-and-status/ SIM access], [http://m2msupport.net/m2msupport/sim-phonebook-at-commands/ phonebook functions] etc.&lt;br /&gt;
&lt;br /&gt;
In the 'Port Configuration' section of the tool, users can search for available ports using the 'Find Ports' button. Then using the 'Connect' button, users can connect to the modem port of the device.&lt;br /&gt;
&lt;br /&gt;
In the 'Command Mode' tab of AT Command Tester, single AT commands can be sent. The drop down list provides AT command description and examples. Users can modify the default command settings.&lt;br /&gt;
&lt;br /&gt;
[[File:M2m img1.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Under the 'Script Mode' tab, multiple AT commands can be sent at a time. Users can add descriptive comments and save the script on their local machine. &lt;br /&gt;
&lt;br /&gt;
[[File:Script mode.PNG]]&lt;br /&gt;
&lt;br /&gt;
Data Call&lt;br /&gt;
&lt;br /&gt;
To make a data call with the modem, you need to connect to the APN of the carrier network. The carrier APN and other required information are stored in the SIM card and are referred as PDP contexts. Typically multiple PDP contexts are stored in the SIM for different call types. With the AT Command Tester you can edit/add/delete PDP contexts in a easy to use user interface. &lt;br /&gt;
&lt;br /&gt;
[[Image:Datacall.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;Typical call setup sequence,&lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgdcont-define-pdp-context/ AT+CGDCONT?] &lt;br /&gt;
&lt;br /&gt;
+CGDCONT: 1,&amp;quot;IP&amp;quot;,&amp;quot;epc.tmobile.com&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0&amp;lt;br&amp;gt;+CGDCONT: 2,&amp;quot;IP&amp;quot;,&amp;quot;test5&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0&amp;lt;br&amp;gt;+CGDCONT: 3,&amp;quot;IP&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;0.0.0.0&amp;quot;,0,0 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Checking registration status... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcreg-network-registration/ AT+CREG?] &lt;br /&gt;
&lt;br /&gt;
+CREG: 0,1 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;The device is registered in home network. &lt;br /&gt;
&lt;br /&gt;
Checking if device is already connected... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgact-pdp-context-activate-or-deactivate/ AT+CGACT?] &lt;br /&gt;
&lt;br /&gt;
+CGACT: 1,0&amp;lt;br&amp;gt;+CGACT: 2,0&amp;lt;br&amp;gt;+CGACT: 3,0 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;[http://m2msupport.net/m2msupport/atcmee-report-mobile-termination-error/ AT+CMEE=1] &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Attaching to network...&amp;lt;br&amp;gt;AT+CGATT=1 &lt;br /&gt;
&lt;br /&gt;
OK &lt;br /&gt;
&lt;br /&gt;
Connecting... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcgact-pdp-context-activate-or-deactivate/ AT+CGACT=1, 1] &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Connect Sucessful &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; '''SMS''' &lt;br /&gt;
&lt;br /&gt;
The SMS tab of the 'AT Command Tester' tool provides the interfaces to send SMS messages. You can also list/view/delete SMS messages stored on the SIM.&lt;br /&gt;
&lt;br /&gt;
[[Image:Sms.PNG]] &amp;lt;br&amp;gt; General sequence for sending SMS message, &lt;br /&gt;
&lt;br /&gt;
Checking registration status... &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcreg-network-registration/ AT+CREG?] &lt;br /&gt;
&lt;br /&gt;
+CREG: 0,1 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;The device is registered in home network. &lt;br /&gt;
&lt;br /&gt;
AT+CMGS=&amp;quot;858XXXXXXX&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&amp;amp;gt; Test Message with AT Command Tester� &lt;br /&gt;
&lt;br /&gt;
+CMGS: 19 &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;SMS Send successful &lt;br /&gt;
&lt;br /&gt;
'''Network Selection''' - This tab allows the user to manually select available networks. Modems are typically set for automatic network selection. 'Find Networks' button will command the modem to scan for available networks.&lt;br /&gt;
&lt;br /&gt;
[[Image:Network selection.PNG]] &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
AT+COPS command will initiate network scan in the modem, &lt;br /&gt;
&lt;br /&gt;
Finding Networks. Please wait.. &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcops-plmn-selection/ AT+COPS=?] &lt;br /&gt;
&lt;br /&gt;
+COPS: (2,&amp;quot;T-Mobile&amp;quot;,&amp;quot;T-Mobile&amp;quot;,&amp;quot;310260&amp;quot;),(1,&amp;quot;AT&amp;amp;amp;T&amp;quot;,&amp;quot;AT&amp;amp;amp;T&amp;quot;,&amp;quot;310410&amp;quot;),,(0,1,4),(0,1,2) &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;Networks found &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
'''Phonebook'''&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
With the 'Phone Book' tab, you can add/delete/read phone book entries stored on the SIM, &lt;br /&gt;
&lt;br /&gt;
[[Image:Phone book.PNG]] &lt;br /&gt;
&lt;br /&gt;
Getting phonebook entries.. &lt;br /&gt;
&lt;br /&gt;
[http://m2msupport.net/m2msupport/atcpbr-read-phonebook-entries/ AT+CPBR=1,99] &lt;br /&gt;
&lt;br /&gt;
+CPBR: 1,&amp;quot;*233&amp;quot;,129,&amp;quot;Refill Now&amp;quot; &lt;br /&gt;
&lt;br /&gt;
+CPBR: 2,&amp;quot;#999#&amp;quot;,255,&amp;quot;Check Balance&amp;quot; &lt;br /&gt;
&lt;br /&gt;
+CPBR: 3,&amp;quot;8878878878&amp;quot;,129,&amp;quot;Test&amp;quot; &lt;br /&gt;
&lt;br /&gt;
OK&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resource ==&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/3G_shield_schematic+(1).pdf 3G shield schematic]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/SIM5218_AT_command_manual+(1).pdf SIM5218 AT command manual]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/V-SIM5218E_HD_V1.04.pdf SIM5218 Hardware Design]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/WindowsDrivers_SIM5218_2.4.00.rar Drivers for Windows]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/3G+GPS+shield+for+Arduino.fzpz  Fritzing libraries]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/Shields/3G_GPS_shield/Jumpers+of+3G+Arduino+shield.pdf Jumpers of 3G Arduino shield]&lt;br /&gt;
*[http://www.cutedigi.com/blog/?p=74 CuteDigi 3G+GPS Shield Test Tutorial]&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=1.3Mp_LinkSprite_Long_Range_Weather_Proof_Infrared_JPEG&amp;diff=3440</id>
		<title>1.3Mp LinkSprite Long Range Weather Proof Infrared JPEG</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=1.3Mp_LinkSprite_Long_Range_Weather_Proof_Infrared_JPEG&amp;diff=3440"/>
		<updated>2013-07-25T06:54:07Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction  ==&lt;br /&gt;
The LinkSprite  long range all weather JPEG camera (LS_LR_AW_JPEG)  is compatible with  the LinkSprite  all weather JPEG camera (LS_AW_JPEG) .  While the typical rnage of the model LS_AW_JPEG is 10 meters, this model has typical range of 40 meters, up to 80 meters. &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
The LinkSprite all weather JPEG camera (LS_AW_JPEG and LS_LR_AW_JPEG are  widely applied in all kinds of embeded imaging systme.  Such as vehicle surveillance system, POS. machine, GSM module, videophone and so on.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
The CMOS camera,  built in snapshot, JPEG compression and serial interface communication module, can be attached to computer and any other embedded devices performing as a video camera or a JPEG compressed still camera. It will take a snapshot and then transmit JPEG data to host after receiving the snapshot command issured by host.  &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
This camera can have 0.3 mega, 1.3 mega, or 5 mega pixel.  The model number is LS_LR_AW_JPEG_03,   LS_LR_AW_JPEG_13,   LS_LR_AW_JPEG_50 respectively.  For the 0.3 meag pixel, the picture size is 160*120/320*240/640*480.  For the 1.3 mega pixel, the largest picture size is 1280*1024.  For the 5.0 mega pixel, the largest picture size is 2952*1944. &lt;br /&gt;
&lt;br /&gt;
[model:CAM_AW_JPEG_LR_1P3M]&lt;br /&gt;
&lt;br /&gt;
[[File:LRWPIR.jpg | 400px]]&lt;br /&gt;
&lt;br /&gt;
== Features  ==&lt;br /&gt;
*Power Supply: DC+5V core, 15~36V for infrared LEDs &lt;br /&gt;
*Focal Length: 6.0mm infrared &lt;br /&gt;
*Baud Rate: 2400-115200bps, default 115200bps. &lt;br /&gt;
*Serial Interface: RS232  ( RS485/TTL/SPI optional, please ask) &lt;br /&gt;
*If use RS485(bus interface), the host can connect up to 299 cameras with different camera ID no.. &lt;br /&gt;
*Built-in infrared light, it captures clear Black -White Image in night. The infrared lights are off when the camera is not taking snapshot, only auto-supplement light when the camera is capturing picture. Compare with the infrared lights that are alwyas keeping on in night, this infrared lights in *our camera have longer service life. &lt;br /&gt;
*Connector: DB9 RS232 &lt;br /&gt;
*Working Temperature: -20-85 Degree C &lt;br /&gt;
*Working Humidity: 20--80%RH &lt;br /&gt;
*Minimum lumen: 1 Lux &lt;br /&gt;
*Night Vision lumen: 6 Lux &lt;br /&gt;
*Night Vision Distance: 5--40M, can be longer  &lt;br /&gt;
*Angel of view: 45 degree  &lt;br /&gt;
*White Balance: Automatic &lt;br /&gt;
*Exposure: Automatic &lt;br /&gt;
*Auto Gain Control: Automatic &lt;br /&gt;
*Other: Anti-seismic, Anti-interference&lt;br /&gt;
&lt;br /&gt;
== Application Ideas  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cautions  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The warnings and wrong operations possible cause dangerous. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Schematic  ==&lt;br /&gt;
&lt;br /&gt;
== Specification  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Pin definition and Rating  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mechanic Dimensions  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Installation  ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Programming  ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FAQ  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please list your question here:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Support  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Resources  ==&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/waterproof_camera/CAM_AW_JPEG_LR_1P3M.pdf Specification]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/waterproof_camera/SDK_of_waterpf_camera.rar SDK souce files of LinkSprite All Weather JPEG Serial Camera]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/waterproof_camera/LS_AW_Camera.rar Evaluation Utility Software]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/waterproof_camera/Data+sheet+of+long+range+camera(A1.3).pdf User manual and protocol]&lt;br /&gt;
&lt;br /&gt;
== How to buy  ==&lt;br /&gt;
&lt;br /&gt;
Here to buy 1.3Mp LinkSprite Long Range Weather Proof Infrared JPEG [http://www.linkspritedirect.com/product_info.php?products_id=20 CAM_AW_JPEG_LR_1P3M] on LinkSprite [http://www.linkspritedirect.com/index.php Cart]&lt;br /&gt;
&lt;br /&gt;
== See Also  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other related products and resources.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Licensing  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This documentation is licensed under the Creative Commons [http://creativecommons.org/licenses/by-sa/3.0/ Attribution-ShareAlike License 3.0] Source code and libraries are licensed under [http://www.gnu.org/licenses/gpl.html GPL/LGPL], see source code files for details.&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=JPEG_2M_Pixel_Color_Camera_Serial_Interface(TTL_level)&amp;diff=3437</id>
		<title>JPEG 2M Pixel Color Camera Serial Interface(TTL level)</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=JPEG_2M_Pixel_Color_Camera_Serial_Interface(TTL_level)&amp;diff=3437"/>
		<updated>2013-07-16T09:55:28Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
LS-Y201-2MP is LinkSprite’s new generation high resolution serial port camera module. Its resolution is 2 million pixel. It can captures high resolution pictures using the serial port. LS-Y201-2MP is a modular design that outputs JPEG images through UART, and can be easily integrated into existing design.&lt;br /&gt;
&lt;br /&gt;
[[File:2M_JPEGC_CAMERA.jpg | 400px]]&lt;br /&gt;
&lt;br /&gt;
== Specification ==&lt;br /&gt;
*2 Million Pixels&lt;br /&gt;
*Support capture JPEG from serial port&lt;br /&gt;
*Default baud rate of serial port is 38400&lt;br /&gt;
*DC 3.3V or 5V power supply&lt;br /&gt;
*Size 32mm X 32mm&lt;br /&gt;
*Current consumption: 80-100mA&lt;br /&gt;
*The pin near C03 is AV output pin, which is an analog output pin.&lt;br /&gt;
&lt;br /&gt;
== Application Idea ==&lt;br /&gt;
*Different image capture systems&lt;br /&gt;
*Environmental monitoring&lt;br /&gt;
*Industry monitoring&lt;br /&gt;
*Medical equipment&lt;br /&gt;
*Video phone&lt;br /&gt;
*Security&lt;br /&gt;
*Vehicle based GPS&lt;br /&gt;
&lt;br /&gt;
== Usage  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Installation  ===&lt;br /&gt;
'''Evaluation Setup'''&lt;br /&gt;
&lt;br /&gt;
[[File:evasetup.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Programming  ===&lt;br /&gt;
[[File:evascreenshot.jpg]]&lt;br /&gt;
&lt;br /&gt;
*Step 1: Click Open COM&lt;br /&gt;
*Step 2: Click Single Shot.&lt;br /&gt;
&lt;br /&gt;
'''''Arduino sample code provided'''''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* Linksprite */&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;NewSoftSerial.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
byte incomingbyte;&lt;br /&gt;
NewSoftSerial mySerial(4,5);                     //Configure pin 4 and 5 as soft serial port&lt;br /&gt;
int a=0x0000,j=0,k=0,count=0;                    //Read Starting address       &lt;br /&gt;
uint8_t MH,ML;&lt;br /&gt;
boolean EndFlag=0;&lt;br /&gt;
                               &lt;br /&gt;
void SendResetCmd();&lt;br /&gt;
void SendTakePhotoCmd();&lt;br /&gt;
void SendReadDataCmd();&lt;br /&gt;
void StopTakePhotoCmd();&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{ &lt;br /&gt;
  Serial.begin(19200);&lt;br /&gt;
  mySerial.begin(38400);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() &lt;br /&gt;
{&lt;br /&gt;
     SendResetCmd();&lt;br /&gt;
     delay(4000);                               //After reset, wait 2-3 second to send take picture command&lt;br /&gt;
      &lt;br /&gt;
      SendTakePhotoCmd();&lt;br /&gt;
&lt;br /&gt;
     while(mySerial.available()&amp;gt;0)&lt;br /&gt;
      {&lt;br /&gt;
        incomingbyte=mySerial.read();&lt;br /&gt;
&lt;br /&gt;
      }   &lt;br /&gt;
      byte a[32];&lt;br /&gt;
      &lt;br /&gt;
      while(!EndFlag)&lt;br /&gt;
      {  &lt;br /&gt;
         j=0;&lt;br /&gt;
         k=0;&lt;br /&gt;
         count=0;&lt;br /&gt;
         SendReadDataCmd();&lt;br /&gt;
&lt;br /&gt;
         delay(25);&lt;br /&gt;
          while(mySerial.available()&amp;gt;0)&lt;br /&gt;
          {&lt;br /&gt;
               incomingbyte=mySerial.read();&lt;br /&gt;
               k++;&lt;br /&gt;
               if((k&amp;gt;5)&amp;amp;&amp;amp;(j&amp;lt;32)&amp;amp;&amp;amp;(!EndFlag))&lt;br /&gt;
               {&lt;br /&gt;
               a[j]=incomingbyte;&lt;br /&gt;
               if((a[j-1]==0xFF)&amp;amp;&amp;amp;(a[j]==0xD9))      //Check if the picture is over&lt;br /&gt;
               EndFlag=1;                           &lt;br /&gt;
               j++;&lt;br /&gt;
	       count++;&lt;br /&gt;
               }&lt;br /&gt;
          }&lt;br /&gt;
         &lt;br /&gt;
          for(j=0;j&amp;lt;count;j++)&lt;br /&gt;
          {   if(a[j]&amp;lt;0x10)&lt;br /&gt;
              Serial.print(&amp;quot;0&amp;quot;);&lt;br /&gt;
              Serial.print(a[j],HEX);&lt;br /&gt;
              Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
          }                                       //Send jpeg picture over the serial port&lt;br /&gt;
          Serial.println();&lt;br /&gt;
      }      &lt;br /&gt;
     while(1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//Send Reset command&lt;br /&gt;
void SendResetCmd()&lt;br /&gt;
{&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x26, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//Send take picture command&lt;br /&gt;
void SendTakePhotoCmd()&lt;br /&gt;
{&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x36, BYTE);&lt;br /&gt;
      mySerial.print(0x01, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);  &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//Read data&lt;br /&gt;
void SendReadDataCmd()&lt;br /&gt;
{&lt;br /&gt;
      MH=a/0x100;&lt;br /&gt;
      ML=a%0x100;&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x32, BYTE);&lt;br /&gt;
      mySerial.print(0x0c, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE); &lt;br /&gt;
      mySerial.print(0x0a, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(MH, BYTE);&lt;br /&gt;
      mySerial.print(ML, BYTE);   &lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x20, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);  &lt;br /&gt;
      mySerial.print(0x0a, BYTE);&lt;br /&gt;
      a+=0x20;                            //address increases 32，set according to buffer size&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void StopTakePhotoCmd()&lt;br /&gt;
{&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x36, BYTE);&lt;br /&gt;
      mySerial.print(0x01, BYTE);&lt;br /&gt;
      mySerial.print(0x03, BYTE);        &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Support  ==&lt;br /&gt;
&lt;br /&gt;
If you have questions or other better design ideas, you can go to our [http://www.linksprite.com/forum/index.php forum] to discuss or creat a ticket for your issue at [http://www.linksprite.com/support/ linksprite support].&lt;br /&gt;
&lt;br /&gt;
== Resources  ==&lt;br /&gt;
*[http://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LinkSprite+JPEG+Color+Camera+User+Manual++V1.2.pdf User Manual]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LSY201evaluationsoftware.exe Evaluation Software]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LSY201.rar Linksprite Open Source Code for X86]&lt;br /&gt;
*[http://www.fezzer.com/project/220/linksprite-camera-library/ .Net micro framework source code]&lt;br /&gt;
*[https://github.com/nosebleed/jpeg-ttl-cam Github]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/JPEG_UART_camera_tutorial.pdf Tutorial at Linksprite]&lt;br /&gt;
&lt;br /&gt;
== How to buy  ==&lt;br /&gt;
&lt;br /&gt;
Here to buy on LinkSprite [http://www.linkspritedirect.com/index.php Cart]&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=JPEG_2M_Pixel_Color_Camera_Serial_Interface(TTL_level)&amp;diff=3436</id>
		<title>JPEG 2M Pixel Color Camera Serial Interface(TTL level)</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=JPEG_2M_Pixel_Color_Camera_Serial_Interface(TTL_level)&amp;diff=3436"/>
		<updated>2013-07-16T09:54:59Z</updated>

		<summary type="html">&lt;p&gt;Leona: /* Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
LS-Y201-2MP is LinkSprite’s new generation high resolution serial port camera module. Its resolution is 2 million pixel. It can captures high resolution pictures using the serial port. LS-Y201-2MP is a modular design that outputs JPEG images through UART, and can be easily integrated into existing design.&lt;br /&gt;
&lt;br /&gt;
[[File:2M_JPEGC_CAMERA.jpg | 400px]]&lt;br /&gt;
&lt;br /&gt;
== Specification ==&lt;br /&gt;
*2 Million Pixels&lt;br /&gt;
*Support capture JPEG from serial port&lt;br /&gt;
*Default baud rate of serial port is 38400&lt;br /&gt;
*DC 3.3V or 5V power supply&lt;br /&gt;
*Size 32mm X 32mm&lt;br /&gt;
*Current consumption: 80-100mA&lt;br /&gt;
*The pin near C03 is AV output pin, which is an analog output pin.&lt;br /&gt;
&lt;br /&gt;
== Application Idea ==&lt;br /&gt;
*Different image capture systems&lt;br /&gt;
*Environmental monitoring&lt;br /&gt;
*Industry monitoring&lt;br /&gt;
*Medical equipment&lt;br /&gt;
*Video phone&lt;br /&gt;
*Security&lt;br /&gt;
*Vehicle based GPS&lt;br /&gt;
&lt;br /&gt;
== Usage  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Installation  ===&lt;br /&gt;
'''Evaluation Setup'''&lt;br /&gt;
&lt;br /&gt;
[[File:evasetup.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Programming  ===&lt;br /&gt;
[[File:evascreenshot.jpg]]&lt;br /&gt;
&lt;br /&gt;
*Step 1: Click Open COM&lt;br /&gt;
*Step 2: Click Single Shot.&lt;br /&gt;
&lt;br /&gt;
'''''Arduino sample code provided'''''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* Linksprite */&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;NewSoftSerial.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
byte incomingbyte;&lt;br /&gt;
NewSoftSerial mySerial(4,5);                     //Configure pin 4 and 5 as soft serial port&lt;br /&gt;
int a=0x0000,j=0,k=0,count=0;                    //Read Starting address       &lt;br /&gt;
uint8_t MH,ML;&lt;br /&gt;
boolean EndFlag=0;&lt;br /&gt;
                               &lt;br /&gt;
void SendResetCmd();&lt;br /&gt;
void SendTakePhotoCmd();&lt;br /&gt;
void SendReadDataCmd();&lt;br /&gt;
void StopTakePhotoCmd();&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{ &lt;br /&gt;
  Serial.begin(19200);&lt;br /&gt;
  mySerial.begin(38400);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() &lt;br /&gt;
{&lt;br /&gt;
     SendResetCmd();&lt;br /&gt;
     delay(4000);                               //After reset, wait 2-3 second to send take picture command&lt;br /&gt;
      &lt;br /&gt;
      SendTakePhotoCmd();&lt;br /&gt;
&lt;br /&gt;
     while(mySerial.available()&amp;gt;0)&lt;br /&gt;
      {&lt;br /&gt;
        incomingbyte=mySerial.read();&lt;br /&gt;
&lt;br /&gt;
      }   &lt;br /&gt;
      byte a[32];&lt;br /&gt;
      &lt;br /&gt;
      while(!EndFlag)&lt;br /&gt;
      {  &lt;br /&gt;
         j=0;&lt;br /&gt;
         k=0;&lt;br /&gt;
         count=0;&lt;br /&gt;
         SendReadDataCmd();&lt;br /&gt;
&lt;br /&gt;
         delay(25);&lt;br /&gt;
          while(mySerial.available()&amp;gt;0)&lt;br /&gt;
          {&lt;br /&gt;
               incomingbyte=mySerial.read();&lt;br /&gt;
               k++;&lt;br /&gt;
               if((k&amp;gt;5)&amp;amp;&amp;amp;(j&amp;lt;32)&amp;amp;&amp;amp;(!EndFlag))&lt;br /&gt;
               {&lt;br /&gt;
               a[j]=incomingbyte;&lt;br /&gt;
               if((a[j-1]==0xFF)&amp;amp;&amp;amp;(a[j]==0xD9))      //Check if the picture is over&lt;br /&gt;
               EndFlag=1;                           &lt;br /&gt;
               j++;&lt;br /&gt;
	       count++;&lt;br /&gt;
               }&lt;br /&gt;
          }&lt;br /&gt;
         &lt;br /&gt;
          for(j=0;j&amp;lt;count;j++)&lt;br /&gt;
          {   if(a[j]&amp;lt;0x10)&lt;br /&gt;
              Serial.print(&amp;quot;0&amp;quot;);&lt;br /&gt;
              Serial.print(a[j],HEX);&lt;br /&gt;
              Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
          }                                       //Send jpeg picture over the serial port&lt;br /&gt;
          Serial.println();&lt;br /&gt;
      }      &lt;br /&gt;
     while(1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//Send Reset command&lt;br /&gt;
void SendResetCmd()&lt;br /&gt;
{&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x26, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//Send take picture command&lt;br /&gt;
void SendTakePhotoCmd()&lt;br /&gt;
{&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x36, BYTE);&lt;br /&gt;
      mySerial.print(0x01, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);  &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//Read data&lt;br /&gt;
void SendReadDataCmd()&lt;br /&gt;
{&lt;br /&gt;
      MH=a/0x100;&lt;br /&gt;
      ML=a%0x100;&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x32, BYTE);&lt;br /&gt;
      mySerial.print(0x0c, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE); &lt;br /&gt;
      mySerial.print(0x0a, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(MH, BYTE);&lt;br /&gt;
      mySerial.print(ML, BYTE);   &lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x20, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);  &lt;br /&gt;
      mySerial.print(0x0a, BYTE);&lt;br /&gt;
      a+=0x20;                            //address increases 32，set according to buffer size&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void StopTakePhotoCmd()&lt;br /&gt;
{&lt;br /&gt;
      mySerial.print(0x56, BYTE);&lt;br /&gt;
      mySerial.print(0x00, BYTE);&lt;br /&gt;
      mySerial.print(0x36, BYTE);&lt;br /&gt;
      mySerial.print(0x01, BYTE);&lt;br /&gt;
      mySerial.print(0x03, BYTE);        &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Support  ==&lt;br /&gt;
&lt;br /&gt;
If you have questions or other better design ideas, you can go to our [http://www.linksprite.com/forum/index.php forum] to discuss or creat a ticket for your issue at [http://www.linksprite.com/support/ linksprite support].&lt;br /&gt;
&lt;br /&gt;
== Resources  ==&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LSY201evaluationsoftware.exe Evaluation Software]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LSY201.rar Linksprite Open Source Code for X86]&lt;br /&gt;
*[http://www.fezzer.com/project/220/linksprite-camera-library/ .Net micro framework source code]&lt;br /&gt;
*[https://github.com/nosebleed/jpeg-ttl-cam Github]&lt;br /&gt;
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/JPEG_UART_camera_tutorial.pdf Tutorial at Linksprite]&lt;br /&gt;
*[http://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LinkSprite+JPEG+Color+Camera+User+Manual++V1.2.pdf User Manual]&lt;br /&gt;
&lt;br /&gt;
== How to buy  ==&lt;br /&gt;
&lt;br /&gt;
Here to buy on LinkSprite [http://www.linkspritedirect.com/index.php Cart]&lt;/div&gt;</summary>
		<author><name>Leona</name></author>
		
	</entry>
</feed>