Page 3
Index 4.12. Setting Information returned when receiving an SMS ..................... 21 4.13. Setting Mode for SMS ................................21 4.14. Sending SMS .................................... 22 4.15. Getting the number of SMS stored in SIM card ......................22 4.16. Deleting SMS .................................... 22 5.
Page 4
Index 7.3.4. Downloading files to Waspmote ..........................38 7.3.5. Downloading files to 3G/GPRS module ......................39 7.3.6. Log out the FTPS server ............................39 8. SMTP and POP3 related functions....................40 8.1. Sending email with SMTP ..............................40 8.1.1. Setting the SMTP server ............................40 8.1.2.
Page 5
Index 11.6. Working in multi client mode............................. 56 11.6.1. Enable the multi client mode ..........................57 11.6.2. Creating sockets ...............................57 11.6.3. Sending and receiving data ..........................57 11.6.4. Closing the socket ..............................58 11.7. Working in TCP server mode .............................. 58 11.7.1. Creating the server ..............................58 11.7.2.
SMTP and POP3 clients implemented internally. Coinciding with the release of the 3G/GPRS module and in order to take part of all the the capabilities Libelium launched the Video Camera Sensor board, which allows to each of the nodes of the sensor network to take photos (640x480), record videos (320x240) and upload them in real time to the Cloud.
General Considerations 1.3. Hardware GSM / GPRS / 3G module Figure: 3G/GPRS board Model: SIM5218E (SIMCom) Tri-Band UMTS 2100/1900/900MHz Quad-Band GSM/EDGE, 850/900/1800/1900 MHz HSDPA up to 7.2Mbps HSUPA up to 5.76Mbps TX Power: - UMTS 900/1900/2100 0,25W - GSM 850MHz/900MHz 2W - DCS1800MHz/PCS1900MHz 1W Sensitivity: -106dBm Antenna connector: UFL...
Page 9
FTP and FTPS Service (downloading and uploading files) • Sending/receiving email (SMTP and POP3) • OTA feature can be performed now by Waspmote’s 3G/GPRS module. Refer to the Over the Air Programming Guide for more information: http://www.libelium.com/development/waspmote/documentation/over-the-air-programming-guide-otap/ Figure: 3G/GPRS board in Waspmote Figure: 3G/GPRS board top v4.9...
General Considerations Figure: 3G/GPRS board bottom 1.4. Waspmote Libraries 1.4.1. Waspmote 3G Files Wasp3G.h ; Wasp3G.cpp 1.4.2. Constructor In order to start using Waspmote 3G library, an object from class ‘Wasp3G’ must be created. This object, called ‘_3G’ , is created inside Waspmote 3G library and it is public to all libraries.
General Considerations 1.4.4. Library fuses The library for this module is divided in 9 sections and other section with functions and constants that always are active. Each section is activated/deactivated by a fuse. This fuses are located in Wasp3G.h. By default this fuses have a ‘1’ allowing to use the functions.
Initialization 2. Initialization 2.1. Initializing the 3G/GPRS module The 3G/GPRS module is connected to a multiplexer, since it is connected to the same microcontroller UART. To start using the 3G/GPRS module, this multiplexer must be switched on and choose the correct combination for the 3G to be selected. This selection is (1,1).
‘0’ if not connected According to Libelium experience, 60 seconds is the recommended timeout for connecting the 3G/GPRS network. The timeout may vary depending on the network range and quality of service. If the user detects this timeout does not allow his 3G/GPRS to connect, he can experiment with higher values.
Initialization 2.7. Setting operator parameters When the 3G module uses some services like IP connections (TCP/UDP), HTTP services, SMTP/POP3 or FTP transfers, it’s mandatory to configure operator parameters like APN, login and password. There are two ways to configure these settings. The first one is to use the definitions into the file Wasp3G.h. #define _3G_APN “apn”...
SIM related functions 3. SIM related functions Some functions have been developed to configure some settings related with GSM, specifically with managing calls and SMS. 3.1. Setting the PIN It sets the PIN to the SIM card. Example of use: // Sets PIN=1234 to the SIM: _3G.setPIN(“1234”);...
SIM related functions 3.4. Getting IMEI It gets the IMEI from the SIM card and it stores the IMEI into variable. buffer_3G Example of use: _3G.getIMEI(); This function returns: • ‘1’ on success • ‘0’ if error -16- v4.9...
GSM related functions 4. GSM related functions The fuse is used to activate or deactivate the functions of this section. If you use a function of this section the fuse GSM_FUSE must be at ‘1’ . 4.1. Setting information returned when receiving a call This function configures the information returned by the module when a call is received.
GSM related functions This function returns: • ‘1’ on success • ‘0’ if error • ‘-2’ if no carrier 4.4. Hanging up calls It hangs up all the active calls. Example of use: // Hangs all the active calls up: _3G.hangUp();...
GSM related functions 4.7. Gets the phone activity status This function gets the phone activity status. Example of use: uint8_t status=0; // Stores in ‘status’ the state of the phone: status=_3G.getPhoneActStatus(); This function returns: • ‘0’ for error • ‘1’= Ready •...
GSM related functions 4.10. Generating DTMF tones This function generate a DTMF tone according the code listed below: • ‘0’ - Stop the sound tone • ‘1’ - DTMF tone for 1 key, duration 100ms • ‘2’ - DTMF tone for 2 key, duration 100ms •...
GSM related functions 4.11. Ringer level This function controls the ringer level of the loudspeaker for incoming call alert. Allowed values: ‘0’ for mute and ‘1’ to ‘5’ for volume level. Example of use: // Answers an incomming call: _3G.ringerLevel(4); This function returns: •...
GSM related functions 4.14. Sending SMS It sends an SMS to the specified number. Note: the maximum length is 160 Bytes (160 characters). Example of use: // Sends this text in a SMS to the desired number _3G.sendSMS(“Hello World!”,“6********”); This function returns: •...
File system related functions 5. File system related functions 5.1. Description The file system is used to store files in a hierarchical (tree) structure, and there are some definitions and conventions to use the Module. Local storage space is mapped to “C:”, and storage space of present storage card is mapped to “D:”. In both “C:” and “D:” directories, module creates four directories named “Picture”, “Audio”, “Video”...
File system related functions 5.4. Getting file size It gets the size of a file given as a parameter in the current directory. Example of use: int32_t sizeFile; // gets the size of “file.txt” sizeFile= _3G.getFileSize(“file.txt”); This function returns: • The size of the file •...
File system related functions 5.7. List subdirectories/files in current directory stores in a list of the files and/or subdirectories in the current directory. The function needs ls(type_of_ls) buffer_3G a number as input parameter that indicates the kind of the list to do. ‘0’ for list the directories and the files, ‘1’ for list only subdirectories and ‘2’...
Camera related functions 6. Camera related functions Waspmote 3G/GPRS module is capable to take pictures and videos and store in the memory of the module or in its external microSD card. To use camera functions the Videocamera Sensor Board is required. This board, the 3G/GPRS Board, allows to Waspmote take pictures in jpg format with a resolution up to VGA quality (640 x 480) and record video in mp4 format with a resolution up to QVGA quality (320 x 240).
Camera related functions 6.3. Stopping the camera When do not use the camera, the function stops and turns off the camera reducing the power consumption. stopCamera() Example of use: // Stops the camera: _3G.stopCamera(); This function returns: • ‘1’ on success •...
Camera related functions 6.4.2. Brightness The camera have seven levels of brightness, from 0 to 6 (0 is the lowest, 6 is the highest). Example of use: // Sets highest brightness _3G.cameraBrightness(6); This function returns: • ‘1’ on success • ‘0’...
Camera related functions 6.4.4. FPS For record a video 3 different FPS can be selected. The parameters are ‘0’ for 7.5 FPS, ‘1’ for 10 FPS and ‘2’ for 15 FPS Example of use: // Selects 15 fps _3G.cameraFPS(2); This function returns: •...
Camera related functions 6.5. Taking pictures The function takes a picture and stores it in the folder “Picture”. To select if store in the module memory or the takePicture() external microSD card use the function selectStorage() Example of use: // Takes a picture: _3G.takePicture ();...
Camera related functions The functions return: pauseVideo() resumeVideo() stopVideo() • ‘1’ on success • ‘0’ if error • ‘-2’ if camera not started • ‘-3’ if camera is in invalid state 6.7. Making videocalls It makes a videocall to the given telephone number. To do this you can use the function makeVideoCall(phone_number, .
Camera related functions 6.8. Setting the video quality The video quality can be selected with the function . The parameter VideoCallQuality(VideoQuality) VideoQuality be between 5 for 5 for high quality image or 15 for high motion profile. Note: This function can be used only when videocall is in idle state, and the setting is available until power off. Example of use: // Sets high quality image: _3G.VideoCallQuality(5);...
• Broken clients compatibility: No From Libelium, we recommend the use of this server hosting provider to obtain good results to upload and download files, but we can’t guarantee the perfect performance of the FTP server. Also, Libelium has tested with Guebs hosting (www.guebs.com) with good results.
FTP and FTPS 6 - Modify folder permissions: sudo chown -R user1 /home/ftp sudo chmod -R 755 /home/ftp 7 - Add the new user to the pure-ftpd database: sudo pure-pw useradd username -u ftpuser -g ftpgroup -d /home/ftp Set the user password when it request. 8 - Update the pure-ftpd database: sudo pure-pw mkdb 9 - When the users are include in the ftp, start the server:...
FTP and FTPS 7.2.2. Uploading files from Waspmote To upload a file from Waspmote’s SD card you can use the function uploadData(SD_origin, FTP_destination) are strings that contains the complete path with the file name. The strings must be start with origin FTP_destination the character ‘/’...
FTP and FTPS 7.2.4. Downloading files to Waspmote To download a file to Waspmote’s SD card you can use the function downloadData(FTP_origin, SD_destination, max_ are strings that contains the complete path with the file name. The strings must be time) FTP_origin SD_desitanion start with the character ‘/’...
FTP and FTPS 7.3. FTPS related functions Note: the 3G/GPRS module doesn’t support FTPS server with certificate authentication. An explicit FTPS server without certificate authentication must be used with these functions. 7.3.1. Log into FTPS server Before to upload or download files from a FTPS server, you need to log into the FTPS server. The parameters needed to log into the server in order are: server address (can be an IP address or a domain name), port, user name and password.
FTP and FTPS 7.3.3. Uploading files from 3G/GPRS module To upload a file from the SD card of the 3G/GPRS module you can use the function uploadFileSecure(3G_folder, FTPS_ is a number that indicates the folder that contains the file to upload. Allowed values for destination_path) 3G_folder 3G_folder...
FTP and FTPS 7.3.5. Downloading files to 3G/GPRS module To download a file to the SD card of the 3G/GPRS module you can use the function downloadFileSecure(FTPS_path, is a number that indicates the destiny folder to the SD_destination_folder, max_time) SD_destination_folder downloaded file.
SMTP and POP3 related functions 8. SMTP and POP3 related functions Note: to use these features the email servers must work without SSL function. 8.1. Sending email with SMTP 8.1.1. Setting the SMTP server This function set SMTP server address and server’s port number. SMTP client will initiate TCP session with the specified server to send an e-mail.
SMTP and POP3 related functions 8.1.4. Setting the subject and the body These functions sets the subject of the email and the body. After an e-mail is sent successfully, the subject and the body will be cleared, if unsuccessfully, they won’t be cleared. Subject and email body are printable ASCII text up to 512 characters each one. If the process of sending an e-mail is ongoing, these functions will return ‘0’...
SMTP and POP3 related functions 8.2. Receiving emails with POP3 8.2.1. Setting the POP3 server parameters This function sets the parameters for the POP3 server. Example of use: // Configures the SMTP server: setPOP3server(“pop.server.com”, 110, “username”, ”password”); This function returns: •...
SMTP and POP3 related functions 8.2.4. Getting an email This function gets the e-mail specified in index and stores it in the location selected with . After retrieving selectStorage() an e-mail successfully, POP3 client will create a directory and save the email’s header and body into file system as file “EmailYYMMDDHHMMSSXYZ.TXT”, and save each attachment as a file under the same directory.
HTTP is a great protocol because it is a standard, simple and light way to send information to web servers. Libelium has created a little web service in order to allow GPRS, WiFi or 3G modules users to test the HTTP mode. This web service is a little code, written in PHP, which is continuously listening to the HTTP port (port number 80) of our test server “pruebas.libelium.com”.
Remember this PHP code is really simple and is offered with the only purpose of testing, without any warranty. The source code is available here: downloads.libelium.com/waspmote-html-get-post-php-parser-tester.zip The user may find it interesting to copy this code and make it run on his own server (physical or virtual). If the user wants to go further, he can complete the code.
‘-16’ if error opening a HTTP session with CME_error code available Reading an URL using GET and POST methods example: http://www.libelium.com/development/waspmote/examples/3g-15-getting-url/ 9.3. Sending a frame to Meshlium The function sendHTTPframe( url, port, data, length, method) has been developed to send a frame from Waspmote to Meshlium.
• ‘-19’ if data field not found Sending a frame to Meshlium using GET and POST methods example: http://www.libelium.com/development/waspmote/examples/3g-15b-sending-a-frame-to-meshlium/ 9.4. HTTPS connections Hypertext Transfer Protocol Secure (HTTPS) is a combination of the Hypertext Transfer Protocol (HTTP) with SSL/TLS protocol to provide encrypted communication and secure identification of a network web server.
HTTP and HTTPS • Support Mutual authentication • Support SSL re-handshake • Support DES, 3DES, AES, RC2, and ARCFOUR (compatible with RC4) algorithms. • Support resumed handshake. • Support user interaction in certificate processing. 9.4.1. HTTPS function The function is used to launch a HTTPS operation like GET or POST. readURL(url, port, procedure) It accesses to the specified URL and stores the info read in the variable.
10. GPS Waspmote 3G board incorporates a GPS receiver capable to work in stand alone mode, MS-based mode and MS-assisted mode. 10.1. Differences between GPS modes MS-assisted Server Module Location server sends aiding data that is Send aiding data valid for the current fix Module sends code phases Code phases Server calculates position...
10.3. Starting GPS There are four functions to start the GPS. For no parameters are required and start the startGPScold() startGPShot() GPS in cold mode and hot mode respectively. Example of use: // Cold start GPS: _3G.startGPScold(); // Hot start GPS: _3G.startGPShot();...
To get the GPS data in stand alone and MS-based mode use the function . The GPS data from MS_assisted mode getGPSinfo() are stored in buffer_3G Example of use: // Gets GPS data and shows it: _3G.getGPSinfo(); USB.println(_3G.buffer_3G); These functions returns: •...
Page 52
In MS-assited mode the data stored in has this format: buffer_3G <longitude>, <latitude>, <altitude>, <date>, <time> Variable Format Example latitude Unit is in 10^8 degree 4168050885 longitude Unit is in 10^8 degree -88618039 altitude meters date ddmmyyyy 28092012 d: day; m: month; y: year UTC_time hhmmss.s 081611.0...
TCP and UDP connections 11. TCP and UDP connections Waspmote 3G/GPRS module allows 3 different working modes for TCP and UDP connections. The first one is the single client mode. In this mode, only can connect with a TCP or UDP server. The second one is the multi client mode, with the capacity to work with 10 connections simultaneously.
11.3. Query a IP address from a domain name This function obtains the IP address from a given domain name. The IP address is stored in buffer_3G Example of use: // Query the IP address from a domain name _3G.QueryIPfromDomain(“www.libelium.com”); This function returns: • ‘1’ on success •...
TCP and UDP connections 11.4. Query a domain name from a IP address This function obtains the IP address from a given domain name. The IP address is stored in buffer_3G Example of use: // Query the domain from the give IP _3G.QueryIPfromDomain(“80.58.0.33”);...
TCP and UDP connections 11.5.2. Sending and receiving data is the function for send data to an opened socket. For send data to a TCP socket you only needs the string of data sendData() to send. For send data to a UDP socket, you need the string of data to send, the IP address and the port. Example of use: // Sending data to a TCP socket: _3G.sendData(“TCP test string”);...
TCP and UDP connections 11.6.1. Enable the multi client mode The function with the parameter must be used to enable the multi client mode. createSocket() MULTI_CONNECTION Example of use: // Enables the multi client mode: _3G.createSocket(MULTI_CONNECTION); This function returns: • ‘1’...
TCP and UDP connections This function returns: • ‘1’ on success • ‘0’ if error • ‘-2’ if error with IP error code available For receive data Waspmote must execute the function . This function executes the proper functions manageIncomingData() and returns a number with the type of data.
TCP and UDP connections 11.7.2. Listing the clients The function creates in a list of the clients connected to the TCP server. Each line shows: the listClients() buffer_3G number of the client, the IP address of the client and the port of the client. Example of use: // Lists the clients: _3G.listClients();...
TCP and UDP connections For receive data Waspmote must execute the function . This function executes the proper functions manageIncomingData() and returns a number with the type of data. For IP data this function returns ‘3’ . The IP address of the sender is stored in IP_dir and the data in .
Miscellaneous functions 12. Miscellaneous functions 12.1. Managing incoming data It waits for incoming calls, SMSs or TCP/UDP data up to 20 seconds. It executes the function if a call is received, readCall() if an SMS is received and readSMS() readIPData() Example of use: // Stores in answer the kind of data received answer = _3G.manageIncomingData();...
Miscellaneous functions This function returns: • ‘1’ on success • ‘0’ if error • ‘-1’ if timeout • ‘-2’ if error restoring the baudrate (data are valid) Information is stored in with this format: buffer_3G [SCELL],ARFCN:9,MCC:214,MNC:07,LAC:5002,ID:2432,BSIC:63,RXLev:-95dbm,C1:8,C2:8,TA:0,TXPWR:0 [NCell1],ARFCN:60,MCC:214,MNC:07,LAC:5002,ID:4433,BSIC:37,RXLev:-97dbm,C1:5,C2:5 • [SCELL]: indicate serving cell •...
Miscellaneous functions • ARFCN: assigned radio channel • BSIC: base station identification code • HSN: hopping sequence number • MAIO: mobile allocation index offset • TN: timeslot number • HF: hopping flag • TSC: training sequence code • TCH: channel type 12.5.
Miscellaneous functions 12.7. Scanning the network band channels This function scans the network band channels and stores in the data from the channels. You must to specify a start buffer_3G channel and an end channel. The parameter selects if the output will be a verbose output (0) or only numeric data (1). mode Example of use: // Scans channels from 23 to 33 with verbose output:...
Miscellaneous functions • <list of arfcns> : list arfcns BCCH allocation, and the total number is <num_arfcn> • <num_channel> : number of valid channels • <list of channels> : list channels, and the total number is <num_channels> • <arfcn_index> : the index of arfcn, and the minimum value is zero 12.8.
Miscellaneous functions 12.9. Show network system mode This function shows network system mode. Example of use: // Shows network mode: USB.println(_3G.showsNetworkMode(), DEC); This function returns: • ‘1’ for no service • ‘2’ for GSM • ‘3’ for GPRS • ‘4’ for EGPRS (EDGE) •...
Miscellaneous functions 12.13. Choosing the storage location This function selects the location (local storage or SD card storage) of store the data captured by the 3G/GPRS module as pictures, video or emails. The values for input parameter can be: ‘0’ for local storage and ‘1’ for SD card storage. Example of use: // Selects microSD card to store data: _3G.selectStorage(1);...
Miscellaneous functions 12.16. Choosing audio output This functions selects the output for the audio. Allowed values are ‘0’ for speaker and ‘1’ for loudspeaker. Example of use: // Selects the loudspeaker for audio: _3G.selectAudioOutput(1); This function returns: • ‘1’ on success •...
Miscellaneous functions 12.19. Getting module information The function get the model of the module and saves it in . The function get the whoamI() buffer_GPRS firmware_version() firmware of the module and saves it in buffer_GPRS These functions return ‘1’ on success, ‘0’ if error. Example of use: USB.print(F(“WhoamI: “));...
Geolocation tracker application example 13. Geolocation tracker application example The 3G+GPS module allows the developer to send the GPS location and sensor data to the cloud, via 3G or GPRS. This chapter shows how to track a Waspmote with the 3G+GPS module and see in the web with Google Maps API. The example for Waspmote and the PHP script for the server are shown as help or inspiration for the developer.
API changelog 14. API changelog Keep track of the software changes on this link: www.libelium.com/development/waspmote/documentation/changelog/#3G -74- v4.9...
Documentation changelog 15. Documentation changelog From v4.8 to v4.9 • Reference to the new GPRS+GPS module version (chipset SIM908) From v4.7 to v4.8: • Link to the new online API changelog From v4.6 to v4.7: • Added new chapter “Geolocation tracker application example” •...
Apendix A. CME error codes Apendix A. CME error codes CME error code Description CME error code Description phone failure Location area not allowed no connection to phone Roaming not allowed in this location area phone adaptor link reserved service option not supported operation not allowed requested service option not subscribed operation not supported...
Need help?
Do you have a question about the Waspmote 3G Plus GPS and is the answer not in the manual?
Questions and answers