Archive for the ‘GSM’ Category

How to sync real-time clock with network-time on Telit modules

June 30, 2009

You can configure the Telit GM cellular modem to set its internal real-time clock to the network time and have this value automatically updated each time the module is powered on. Here are the AT commands that you need to issue (I’ve omitted the AT response codes):

AT#SELINT=2
AT#NITZ=7,0 // sync network time to internal clock
AT&P0 // profile to be loaded on startup
AT&W0 // store the complete profile
AT#SHDN // this will turn off the modem
// now power on the modem
AT+CCLK? // get current time
// time response is +CCLK: "09/06/29,15:25:32-28"
// time format is yy/MM/dd,hh:mm:ss±zz

The command AT#NITZ=7,0 on your specific modem may not work, check the range of valid inputs for this command using AT#NITZ=?. If you’ve an old module from sparkfun.com then AT#NITZ=? may return #NITZ:(0-1),(0-7). More recent firmwares return #NITZ:(0-7)(0,1). If you’ve an older firmware, then you should set the AT#NITZ=1,0. The difference is that with newer firmware, you will also get the time-zone zz, not so with the older firmware. If you set AT#NITZ=7,1, then when the module gets the network time it is supposed to be echoed as an unsolicited message on the serial port. This didn’t work in my tests. Just as well. In this case, I rather not deal with unsolicited messages for network time, since I can use the real-time clock to get the time when I want to (getting unsolicited messages for AT+CREG is valuable, however).

What do I mean by older firmware? The GM862 module that I bought from sparkfun.com has this firmware:

AT+CGMR
PS:5.02.203/AL:6.04.204-GM862 QUAD

The module that I purchased from SemiConductorStore has this firmware:

AT+CGMR
07.03.600

SERVINFO, AT&T

May 22, 2009

In US, AT&T operates on two frequencies 850MHz and 1900 MHZ. With the Telit GM862 module, the 850MHz frequency has current consumption peaks of 2 Amps and on the 1900 MHz network, current peaks of 1 Amps. The T-mobile network operates on 1900 MHz. You can use the AT SERVINFO command to find out which network (850MHz or 1900 MHz) are you on. If the channel number is between 128 to 251, then you’re on the 850 MHz network and for 512 to 810 channel numbers, you’re on the 1900 MHz network.

Telit GM862 power consumption on GSM 850 & 900

April 7, 2009

The GSM frequencies for the AT&T network in USA are 850 MHz and 900 MHz. The power consumption of the Telit GM862 is determined by the strength of the signal of the closest cellular tower. If you’re in the he 850 MHz region, then you must prepare for peaks of 2A; the 900 MHz region are more efficient and only peaks of 1A need be anticipated. The peak current typically happens during network initialization, i.e., when you turn the module on and it attempts to register on the AT&T network. You can use various AT commands such as AT#MONI and AT+CSQ to find out which frequency region you fall under.

During normal operation in well served cellular regions, the peak current consumption seems to be a lot more reasonable (but still quite high) — around 150mA.

Powering GM862 from a battery

February 24, 2009

 

Gm862 battery circuit

Gm862 battery circuit

To run the Telit’s GM862 cellular module/modem from a battery you must read the Telit documentation very carefully. It states that “A Bypass low ESR capacitor of adequate capacity must be provided in order to cut the current absorption peaks, a 100μF tantalum capacitor is usually suited.”

 

Well I read this point about a low ESR capacitor in the Telit’s hardware guide and didn’t think much about it. I used a 100μF capacitor, but it was not tantalum nor was it low ESR, and guess what it didn’t work. First I thought that it was my battery, a 19AH 3.6V Lithium Ion battery from Jameco. But after reading this very informative forum entry, I learned that the capacitor was the problem.

The only adequate capacitor that I had was a 1F (yes a monster 1F) capacitor from Sparkfun. I used this capcitor and after giving a few minutes for the capacitor to charge, the circuit worked and GM862 was able to register with the network.

Well I thought it worked with the 1F capacitor, but the reason was that GM862 was connected via the USB in addition to the battery, and after it registered with the network, I disconnected from the USB and it was able to continue with the operation using the battery. But I’m unable to start GM862 with the battery.

I’ve ordered a low ESR 100 mF Tantalum (with a 600 m Ohm ESR) from digikey – $7 each. I suspect that with this capacitor, I’ll be able to start the module with the battery.

I wish the Telit site and documentation included more information on how to connect a micro-controller to the modem and the list of alternative parts to use. I’ve not been able to find any of the transistor, voltage level translators, etc. that Telit recommends on Jameco, DigiKey or Sparkfun. More detailed information on how to use the Telit modems is badly needed.

The problem that I was having was the battery and its inability to maintain the minimum voltage (3.4V) at 150mA current peaks that GM862 required during network registration. I connected two 3.6 V batteries in parallel and that fixed the problem – lowered the internal resistance of the batteries and allowed the batteries to maintain a higher than the minimum 3.4V voltage.

GPRS AT Commands for the AT&T Network

February 1, 2009

Here is a note on how to do HTTP communication with Telit GM862 on the AT&T network using the module’s Easy GPRS AT commands (full AT commands reference) . To use the network you’ll a data plan and then you can use the need a userid and password, it appears that the same userid and password is used by anyone that has a data plan and wishes to connect to the AT&T network. I tried just leaving the userid/password blank, but that didn’t work. Here is the sequence of AT commands that you can use to HTTP GET a web page via the AT&T network. Note: All lines that start with AT are commands, and the following lines are the responses to these commands.

AT+CGDCONT=1,"IP","WAP.CINGULAR"
OK
AT#USERID="WAP@CINGULARGPRS.COM"
OK
AT#PASSW="CINGULAR1"
OK
AT#GPRS=0
OK
AT#GPRS=1
+IP: 10.110.125.164

OK
AT#SKTD=0,80,"www.bluehost.com"
CONNECT
GET / HTTP/1.0^m^jHost: http://www.bluehost.com^m^j

If  you are typing this into a terminal application,  you need to enter (control-m aka carriage-return)(control-j aka linefeed) instead of ^m^j. In a program you replace ^m^j with \r\n (\r is carriage-return which is ascii 13, and \n is line-feed which is ascii 10. In the terminal you must enter control-m followed by control-j.

In the sequence above, I explicitly deactivate the GPRS context and then reactivate it. I found that during testing, you may need to reset the module, terminate your screen application, etc., and in these cases, you may not be able to activate the GPRS context unless you deactivate it first. Oddly enough, sometimes after a complete restart the above sequence will fail at the AT#GPRS=1 command. If this happens, then I’ve found that issuing the following two commands and trying again will work: AT#MONI and AT+CMGF=1, not sure why that is the case yet.

I’ve also found that some web sites, e.g., http://www.google.com don’t seem to allow telnet-like connections, i.e., they immediately close a connection. So if the web site that you try to connect to results with No CARRIER line before you have had the chance to enter the HTTP GET request, then try another site.

 

Here is an example of POST issued in the Terminal.

AT#SKTD=0,80,"yourserver.com"
CONNECT
POST /cgi-bin/aqua.cgi HTTP/1.1^m^j
Content-Type: application/x-www-form-urlencoded^m^j
Content-Length: 28^m^j
Host: yourserver.com^m^j
^m^j
p1=Aqua+AQ&p2=AquaAqua+Rules^z

Here are a few additional AT&T commands that I found useful:

AT+CCLK? reads the current data and time. This is not the network time, simply the time since powered up the module.

AT#QDNS="www.google.com" executes a DNS query and returns the ip address of the host name.

AT#GPRS=1 activates the GPRS context, on success this returns the IP address of the GM862 on the AT&T network. Activating a context implies getting an IP address from the network and this will be maintained throughout the session.

AT#GPRS=0 deactivates the GPRS context. Deactivating the context implies freeing the network resources previously allocated to the device.

AT#SKTD This is the socket dial command which is request to make a TCP/UDP connection with an internet host. Once the connection has been established, the module responds with the code CONNECT. From this moment on, all the data coming in the serial port is sent to the internet host and all the data received from the host is serialized and flushed to the Terminal Equipment.

AT+CMEE=0 or 1 or 2 0 means disable error reports; 1 means enable error reports in numeric format; 2 means enable error reports in verbose format.

How to control GM862 from Arduino

December 20, 2008

Arduino to GM862 pin connection

Arduino to GM862 pin connection

It took some effort to figure out how to connect the GM862 GSM module to a UART (in my case the Arduino USB evaluation board, so I decided to document the steps here.

I also have the GM862 USB Evaluation board, if you plan to use this board and control the GM862 from Arduino, e.g., to programmatically send an SMS message, then you need to be careful how you power the GM862 USB board. If you power it via a battery or external power source (but not USB), then you’re fine. Otherwise, you must remove the jumper that disconnects the TX and RX pins from the GM862 USB FT232. To remove this jumper, you must remove the solder that is on the pins marked TX-I and RX-O. This Sparkfun.com board is not designed to accept a two pin header and a plastic jumper to allow you to easily switch between USB control and external control. So to get going, don’t use the GM862 USB to power the GM862, whilst it is being externally controlled through your Arduino board.

For a minimum implementation, only the TXD and RXD lines needs to be connected, the other signals of the GM862 modem serial port (DCD/pin 36, DTR/pin 43, DSR/pin 33, RTS/pin 45, CTS/pin 29, and RI/pin 30) can be left open provided a software flow control is implemented (which is what we are trying to do).

You’ll need to disconnect the RX pin 0 on the Arduino board each time you upload your program. If you don’t, upload will fail with the “avrdude: stk500_recv(): programmer is not responding” error message. After you’ve uploaded the program you can reconnect pin 0. Pin 1 can remain connected at all times, so there is no need to disconnect pin 1.

It helps to have a LED attached to the status indicator LED (pin 39 of GM862), but this is optional and not required for you to control the GM862 from Arduino. Pin 39 is an Open Collector output where we can directly connect a LED to show network and call status information (fast blink means net search, not registered or turning off, slow blink means registered full service, always on means a call is active). I connected a LED with a pull-up resistor.

After connecting the Arduino RX pin (pin 0) to GM862 RX-O pin (pin 37), Arduino TX pin (pin 1) to GM862 TX-I pin (pin 20), and Arduino Ground to GM862 Ground, you are ready to take control of GM862 right from Arduino (click on the thumbnail for detailed schematics). To test this set up, send a SMS message. Here is the code to do just that:

#include <SoftwareSerial.h>

int rxPin = 0;
int txPin = 1;

// set up a new serial port
SoftwareSerial serial=SoftwareSerial(rxPin,txPin);

void setup()  {
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);

  // set the data rate for the SoftwareSerial port
  serial.begin(9600);

  // Set SMS to text mode. Note it is critical 
  // to use \r\n to end each line
  // The delays are also critical, without them, 
  // you may lose some of the
  // characters of your message

  serial.print("AT+CMGF=1\r\n");
  delay(300);
  serial.print("AT+CMGS=");
  delay(300);
  // Replace with a valid phone number
  serial.print("+14081234567\r\n");
  delay(300);
  serial.print("Hello from Arduino.");
  delay(300);

  // End the SMS with a control-z
  serial.print(0x1A,BYTE);
}

void loop() {
}

Here is a function that takes a char array and use that as the content of the SMS. Not sure if a delay after each print statement is really needed or not.


#define PHONE_NUMBER  "+14081234567\r\n" 
#define PRINTDELAY 500

void sendSms(char msg[]) {
  modem.print("AT+CMGF=1\r\n");
  delay(PRINTDELAY);
  modem.print("AT+CMGS=");
  modem.print(PHONE_NUMBER);
  delay(PRINTDELAY);
  modem.print(msg);
  delay(PRINTDELAY);
  modem.print(",");
  delay(PRINTDELAY);
  modem.print(millis());
  delay(PRINTDELAY);
  // End the SMS with a control-z
  modem.print(0x1A,BYTE);
  delay(PRINTDELAY);
}

 

Select the correct GSM band – AT#BND

December 14, 2008

I just got my second Telit GSM862 Quad module and I could not get it to work. I could use various AT commands to find out various configurations of the system, but I could not send an SMS message or make a call. Well after going though the entire AT command manual and comparing the configuration of my first module versus the second module, I found out that the reason my new module was not working was that it was factory set to use band 0 (900MHz + DCS 1800MHz) instead of band 1 (900MHz + PCS 1900MHz), after setting the module to use band 1 — AT#BND=1 — the module starting working fine. Clearly, band 1 is the correct setting for US.

But why didn’t the module automatically pick the correct band? After all there is the AT#AUTOBND=1 command that is suppose to pick the correct band. The factory default is to disable automatic band selection. I suspect that the automatic selection consume more power and that is the reason why it is by default turned off.

Basic AT Commands for SMS

December 14, 2008

The list of AT commands is long, but there is basic set that I’m finding that I need to constantly refer to for testing, so here they are for ease of reference:

 

AT COMMAND
AT Echo OK means that you can connect to the device.

 

MODEL & CONFIGURATIONS
AT+CGMI Read manufacturer information
AT+CGMM Read model information
AT+CGMR Read software version
AT+CGSN Read serial number
AT&V Display base configuration
AT&V2 Display last connection statistics
AT#MONI Display neighboring cell information

BASIC SMS COMMANDS
AT+CMGF=1 Set SMS message format to text
AT+CMGS=“+14081234567″<CR>Hello, World.<Ctrl+z> Send SMS message
AT+CMGL=? List all messages. Depending on the CMGF settings (text or PDU), the argument to this command is a number from 0 to 4 or an enum. The ? parameter will inform you which one you’ll need to pass. Make it easier on yourself and set CMGF to text.
AT+CMGD=? Delete messages from memory.

DIAL A NUMBER
ATD +14081234567; Dial the given number. “;” is essential since it means make a voice call.

How to send a SMS message from Mac with Screen

December 2, 2008

I just received my GMS 862 Evaluation Board and here is how I managed to send my first SMS message (by reading this article and some trial and error):

  • Install the Virtual Com Port Driver (if you’ve already not done that) to be able to use USB to communicate with the board.
  • Connect the board to the USB port on your Mac. The red light on the board will light up indicating that it is getting power.
  • On the Mac, start the Terminal application
  • Find out the “name” for the serial port: issue the command ls /dev/tty.* 
  • The name will be something like /dev/tty.usbseria;-A80081n2
  • Start a serial session by using the screen application: issue the command screen /dev/tty.usbseria;-A80081n2 115200. To end the screen session enter control-a \
  • Start the GSM module (this is critical, if you don’t start it up then anything you type on the screen session simply wont show up and the AT commands will, of course, wont be sent to the GSM module. You can start up the module, by pressing and holding the little start button on the evaluation board for at least 1 second.
  • Issue the following 3 AT commands:


AT+CMGF=1
OK
AT+CMGW="+14081234567"
> HELLO WORLD!
+CMGW: 1

OK
AT+CMSS=1
+CMSS: 3

OK

The command AT+CMGF=1 will format SMS as a TEXT message.

The command AT+CMGW provides the phone number you wish to send the SMS message to. When you hit enter, the GSM module responds with >. Now you can enter your text message and you terminate it with control-z. The message is read into memory and the module replies with the message index.

The command AT+CMSS=1 sends the SMS message with the specified index.

Here is an excellent introduction to the SMS AT commands.


Follow

Get every new post delivered to your Inbox.