Professional Documents
Culture Documents
Index
Document version: v0.4 - 09/2012
Libelium Comunicaciones Distribuidas S.L.
INDEX
1. General Considerations ....................................................................................................................... 4
1.1. Differences between GPRS and GPRS PRO libraries for Waspmote ......................................................................4
1.2. Hardware..........................................................................................................................................................................................4
1.3. Waspmote Libraries .....................................................................................................................................................................5
1.3.1. Waspmote GPRS_Pro Files .......................................................................................................................................5
1.3.2. Constructor .....................................................................................................................................................................5
1.3.3. Flag ....................................................................................................................................................................................6
1.3.4. Working Modes .............................................................................................................................................................6
2. Initialization ......................................................................................................................................... 7
2.1. Initializing the GPRS_Pro module ..........................................................................................................................................7
2.2. Setting the GPRS_Pro Power Mode .......................................................................................................................................7
2.3. Closing the GPRS_Pro module ................................................................................................................................................7
2.4. Switching GPRS_Pro off .............................................................................................................................................................7
2.5. Checking the GSM connection ...............................................................................................................................................8
4. Call functions...................................................................................................................................... 10
4.1. Setting Information returned when receiving a call..................................................................................................... 10
4.2. Making Calls ................................................................................................................................................................................ 10
4.3. Making Missed Calls ................................................................................................................................................................. 10
4.4. Hanging up calls ........................................................................................................................................................................ 10
v0.4
Index
8. General functions............................................................................................................................... 19
8.1. Managing incoming data........................................................................................................................................................ 19
8.2. Sending any AT command ..................................................................................................................................................... 19
8.3. Setting volume and mode for monitor speaker............................................................................................................. 19
8.4. Setting CLI presentation in incoming calls....................................................................................................................... 20
8.5. Setting CLI presentation in outcoming calls.................................................................................................................... 20
8.6. Gets the phone activity status............................................................................................................................................... 20
8.7. Setting loudspeaker level....................................................................................................................................................... 20
8.8. Setting call alert mode and level.......................................................................................................................................... 20
8.9. Mute................................................................................................................................................................................................ 21
8.10. Getting current operator...................................................................................................................................................... 21
8.11. Getting available operators................................................................................................................................................. 21
8.12. Setting preferred operator................................................................................................................................................... 21
8.13. Getting cell information........................................................................................................................................................ 22
-3-
v0.4
General Considerations
1. General Considerations
1.1. Differences betweenGPRS andGPRS PRO libraries for Waspmote
GPRS libraries were developed to control the Hilo module (from Sagem). The GPRS_Pro libraries had been developed to control
the new GPRS board which integrates the SIM900 module (from SIMCom). GPRS_Pro performs the same actions that GPRS
module (some functions had been enhanced) and new functions has been added such as multiconnection for TCP/IP and UDP/
IP clients, audio control or operator selection.
Regarding power consumption it has been reduced from 56A to 30A in power down mode (GPRS_OFF power mode).
The SIM900 module improves TCP/IP and UDP/IP connections adding new features such as TCP/IP server and multiconnection
mode that allows up to 8 TCP/UDP clients or up to 7 TCP/UDP clients and 1 TCP/IP server. Extra functions such as autosending
timer, add IP headers, setting DNS servers,... have been added.
Also uploading and downloading functions have been upgraded to allow to select the origin and destiny folder into the SD card
and FTP server.
New functions allow to manage speaker level, Calling Line Identification (CLI) , mute, call alert. Also GSM/GPRS operator
connection can be managed with functions such as get current operator, set preferred operator list, get cell information.
If you acquired the old GPRS module (HiLo - Sagem) and need to access to the user guide, you can download it here:
http://www.libelium.com/documentation/waspmote/waspmote-gprs-programming_guide.pdf
1.2. Hardware
v0.4
General Considerations
Actions:
Making/Receiving calls.
Sending/Receiving SMS.
TCP/IP server.
HTTP Service.
1.3.2. Constructor
In order to start using Waspmote GPRS_Pro library, an object from class WaspGPRS_Pro must be created. This object, called
GPRS_Pro, is created inside Waspmote GPRS_Pro library and it is public to all libraries. It is used throughout the guide to show
how the Waspmote GPRS_Pro library works.
When creating this constructor, some variables are defined with a value by default, that can be modified later. These variables are:
baudRate : specifies the baudrate used to communicate with the module (57600 by default).
uart : specifies the UART used to communicate with the module (UART1 by default).
pwrMode : specifies the power mode (ON by default).
-5-
v0.4
General Considerations
1.3.3. Flag
A flag to indicate if there have been any problem during execution of a function has been created. This flag shows the error
occurred when using GPRS_Pro module. Possible values are:
0: GPRS_PRO_ON. Module is powered on. Starts with the last power mode stored in the module(full functionality by default).
1: GPRS_PRO_FULL. Module is set in full functionality (power consumption around 10-40mA).
2: GPRS_PRO_RF_OFF. Module deactivates RF circuits (power consumption around 10-40mA).
3: GPRS_PRO_MIN. Module is set on minimum functionality (power consumption around 10-40mA).
4: GPRS_PRO_SLEEP. Module enters in sleep mode when there is no data on serial port. From time to time, it communicates
with carrier to maintain the connection (power consumption 1-2mA ).
5: GPRS_PRO_OFF. Module is powered off.
Minimum functionality mode and RF disabled functionality mode cannot be switched to each other. When the module
communicates with carrier, current peaks between 1-14A are produced.
-6-
v0.4
Initialization
2. Initialization
2.1. Initializing the GPRS_Pro module
The GPRS_Pro module is connected to a multiplexer, since it is connected to the same microcontroller UART. To start using the
GPRS_Pro module, this multiplexer must be switched on and choose the correct combination for the GPRS_Pro to be selected.
This selection is (Figure1).
To open the UART and set the multiplexer to the correct combination, a function has been developed. This function powers on
(GPRS_Pro.setMode(GPRS_PRO_ON)) the module too.
Example of use
{
GPRS_Pro.ON(); // opens UART and sets multiplexer
}
Related variables
GPRS_Pro.pwrMode
-7-
v0.4
Initialization
-8-
v0.4
-9-
v0.4
Call functions
4. Call functions
4.1. Setting Information returned when receiving a call
This function configure the information returned by the module when a call is received. It is useful to generate interruptions or
to store data from the incoming call .
They modify flag if expected answer is not received after sending a command to GPRS_Pro module.
They return 1 on success, 0 if error and -1 if no memory.
Example of use
{
GPRS_Pro.setInfoIncomingCall();
}
-10-
v0.4
-11-
v0.4
-12-
v0.4
-13-
v0.4
-14-
v0.4
-15-
v0.4
-16-
v0.4
-17-
v0.4
-18-
v0.4
General functions
8. General functions
8.1. Managing incoming data
It waits for incoming calls, sms or TCP/UDP data up to 20 seconds. When a call or sms is received, this function stores in tlfIN
variable the telephone number which sent the sms or made the call, in sms variable the text of the SMS received and in sms_
index the last sms received index.
It executes the function readCall if a call is received, readSMS if a SMS is received and readIPData.
Returns 1 for call, 2 for SMS, 3 for IP data and 0 for error or not data.
Note 1: the phone number has a maximum length of 15 characters, including country code.
Note 2: the sms text has a maximum size of 100 characters.
Note 3: the TCP/UDP data string has a maximum size of 150 characters.
Example of use
{
GPRS_Pro.manageIncomingData(); // Manages incoming data
}
Related variables
-19-
v0.4
General functions
-20-
v0.4
General functions
8.9. Mute
This function enables or disables mute during a call.
It returns 1 on success, 0 if error and -1 if no memory.
Example of use
{
GPRS_Pro.setMute(ENABLE);
}
Related variables
operators_list
struct that stores the format and the name of the operators.
-21-
v0.4
General functions
-22-
v0.4
void setup()
{
// Checks if we come from a normal reset or an hibernate reset
PWR.ifHibernate();
delay(3000);
RTC.ON();
RTC.clearAlarmFlag();
RTC.OFF();
// setup for GPRS_Pro serial port
GPRS_Pro.ON();
USB.println(GPRS_Pro module ready...);
// waiting while GPRS_Pro connects to the network
while(!GPRS_Pro.check());
USB.println(GPRS_Pro connected to the network);
// configure SMS and Incoming Calls
if(GPRS_Pro.setInfoIncomingCall()) USB.println(Info Incoming Call OK);
if(GPRS_Pro.setInfoIncomingSMS()) USB.println(Info Incoming SMS OK);
if(GPRS_Pro.setTextModeSMS()) USB.println(Text Mode SMS OK);
}
void loop()
{
// If Hibernate has been captured, execute the associated function
if( intFlag & HIB_INT )
{
Utils.blinkLEDs(1000);
Utils.blinkLEDs(1000);
intFlag &= ~(HIB_INT);
}
// Set Waspmote to Hibernate, waking up after 10 seconds
PWR.hibernate(00:00:00:10,RTC_OFFSET,RTC_ALM1_MODE2);
}
-23-
v0.4
-24-
v0.4